Freespace 3 Fan game

Programming, for all ages and all languages.
Tux

Freespace 3 Fan game

Post by Tux »

I was interested in seeing who would help me work on a fan version of Freespace 3. It is in OpenGL so you are prepared :)

I already started it though.
AGI1122

Re:Freespace 3 Fan game

Post by AGI1122 »

You should probably include more info, such as what you need(I.E. programmer, graphics, sound). As well as info on the project. Nobody wants to join a project that they don't know what is.

So please put some more info.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Freespace 3 Fan game

Post by df »

i'm playing descent freespace 2 right now. (the space opera, not the indoor lots of tunnels fps).
-- Stu --
Tux

Re:Freespace 3 Fan game

Post by Tux »

You are right.
Here are the specialists I am looking for:
Programmers who are good and know OpenGL in and out. The biggest must for programmers is summerization. e.g.

//Bad programmer
int flipbool(int someval) {
if(someval==1) //Try not to leave brackets. It is allowed
return 0; //but makes the source hard to read
else
return 1;
}

//Good programmer
bool FlipBool(bool var1) //At least use a naming standard
{
return 1-var1; //Saves cpu time and is easier to read
}

The code right now is a mutated version of the Stonehenge Engine. I removed all the functions, and just kept the writeString and writeChar functions. The object structures are the same without the script parts. Actually, I rewrote the engine's variable structures. But it came out to be identical because the Engine's code inspired me to organize the stuff in the same way.

The graphics and models:
Most of it will be ported from the Freespace 2 version.
The GUI will be changed a little. I will e-mail the code to anybody that wants it.

The game texture format is ".raw". The game model format is on the brink of confusion. I am planning to make a .asc type model format, but hex numbers. e.g.
0025.0000 = 0x00190000
You can't see the difference there, but by using hex, the models can be bigger. ABOUT 55536 UNITS BIGGER!
Also, the model can be scaled even more by the model header data. That's 55536*255 FYI.

I am going to start work on a dev list which will contain what the full functioning version of the game should do.

The more, the better.
sonneveld

Re:Freespace 3 Fan game

Post by sonneveld »

I would do neither. A boolean value in C is 0 for false and any other number for true. probably slightly different for c++

so I would do

#define FlipBool(__somevar) (!(__somevar))

if you absolutely had to do it that way.

- Nick
Tim

Re:Freespace 3 Fan game

Post by Tim »

Tux wrote://Good programmer
bool FlipBool(bool var1) //At least use a naming standard
{
return 1-var1; //Saves cpu time and is easier to read
}
That's pretty horrible.

Saves CPU time: What CPU? What benchmark?
Easier to read: Is it? What's wrong with the ! operator? At least the first example is explicit in what it does; the second is more of a fudge.

These two functions aren't even equivalent. true is any non-zero value; false is zero. The second function is broken in C for any value other than zero or one (AFAIK bool in C++ is restricted to 0 and 1).

Personally I would go for the function function, modified slightly (even though this is a pointless example):

Code: Select all

int flipbool(int someval)
{
    if (someval != 0)
        return 0;
    else
        return 1;
}
BTW: you spelled summarisation incorrectly. Even assuming the correct spelling, that sentence doesn't make a lot of sense to me.
Tux

Re:Freespace 3 Fan game

Post by Tux »

It's true, everyone's a critic.
If I can ask nicely, may only people that want to work on the game post? Thanks for the pointers though.
distantvoices
Member
Member
Posts: 1600
Joined: Wed Oct 18, 2006 11:59 am
Location: Vienna/Austria
Contact:

Re:Freespace 3 Fan game

Post by distantvoices »

This is how it works gosh. Be glad the guys reply honestly. they could also say it's ok, and afterwards think "shall he do what he want, I don't mind". It is what I consider respect.

And it is as Tim says: the function which explicitly tests the variable for true or false in an if-clause is easier to read and you know upon reading it what it does. This can't be said of your proposal of "good programming style" which I consider to be merely a fuzzy hardly readable thing. Yes, you can obfuscate things in c. You can even do arithmetic opertions in conditions. But it is not professional to keep with an obfuscating style.

btw, in all my time at the programming courses and in business life I 've never been trained on shortening coding. I've been trained on structured, well readable coding style.

stay safe
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
Tux

Re:Freespace 3 Fan game

Post by Tux »

I have been busy finding out a formula. If it works out, the game will be more faster then the sin/cos rotation games. Most of them use vectors these days.

About the code shortening, no one teaches you. Just take a look at the Q2 source; it's a jungle in there!
Anyway, bye bye.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Freespace 3 Fan game

Post by df »

sin/cos is too slow. in all my demos i used tables for them. much quicker. less precise but LUT are much much faster than calling sin/cos themselves...
-- Stu --
Tim

Re:Freespace 3 Fan game

Post by Tim »

The old knowledge that a lookup table was always better is less solid with current CPUs. A LUT is only faster if you can fit it all in L1 cache; a cache miss can take far longer than the FSIN/FCOS instruction itself.
Tux

Re:Freespace 3 Fan game

Post by Tux »

Rapid table:

Instead of creating a table, I calculate values right away. It's still better then sin/cos. But my cur rotations function has some bugs and only uses y rotation and applies it to z and x. It would be helpful if someone can help me outhere. Thanks.

   //Test
   if(keys.key[VK_UP]==1)
   {
if((-view.rot.y/DEGTORAD)<=90)
{
view.pos.z+=((90-((view.rot.y/DEGTORAD)-0))*ROT);
view.pos.x+=(((view.rot.y/DEGTORAD)-0)*ROT);
}
else if((-view.rot.y/DEGTORAD)<=180)
{
view.pos.z+=((90-((view.rot.y/DEGTORAD)-90))*ROT);
view.pos.x+=(((view.rot.y/DEGTORAD)-90)*ROT);
}
else if((-view.rot.y/DEGTORAD)<=270)
{
view.pos.z+=((90-((view.rot.y/DEGTORAD)-180))*ROT);
view.pos.x+=(((view.rot.y/DEGTORAD)-180)*ROT);
}
else if((-view.rot.y/DEGTORAD)<=360)
{
view.pos.z+=((90-((view.rot.y/DEGTORAD)-270))*ROT);
view.pos.x+=(((view.rot.y/DEGTORAD)-270)*ROT);
}
   }
Tim

Re:Freespace 3 Fan game

Post by Tim »

How does this work? What does ROT do?

You're not going to get true rotation without using some form of sin/cos, whether real functions, approximations, or lookup tables.
Tux

Re:Freespace 3 Fan game

Post by Tux »

It is quite smooth, but has some formula defects. When the rotation is more then 360 because I have no code to reset it to 0, it becomes glitchy. That may be fixed easily.

Also: view is a struct
rot is the vertex structure
y is a float

So it is the y rotation of the viewport.
Tux

Re:Freespace 3 Fan game

Post by Tux »

I forgot to add that so far there is one problem. I draw a square in the front, when I get about 6 units to it, the aquare disappears. So to say, it doesn't draw stuff 6 units in front of me. (6 units is 6.00f) Because of this, I have trouble testing the rotation formula.
Post Reply