I need code to dissasemble.

Jones
Unregistered
 
Post: #1
I'm currently on a hunt for graphics code. I wish to devour all I encounter! Bwahahahaha. (Except for sdl... it gives me stomach cramps.)

Anyway, I/m intrested in going through the source of other peoples games to get a better idea of efficient programming/faster graphics rendering.

Does anybody know of games written in C (preferably with OpenGL) that I could poke through?

Simple things would be best, as I'm not sure I'm capable of deciphering super-large fps games yet. Rolleyes

Thanks!
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #2
Have a look at OMG entry N0x35C497E
http://www.fax.xmgfree.com

Theres a couple of graphics optimisations there, like the GUI is hard coded for example.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Jones
Unregistered
 
Post: #3
Thanks.

Actually, it doesn't have to be an optimization, any code I can look at/learn from. Ranging from source code for full built games to empty game engines.
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #4
I think ive recommended it to you before but Nehe.gamedev.net is about as good as you will find for C/C++ OpenGL code. It goes from simple programs up to pretty advanced topics. After that pick up a copy of the Red Book.

And I really enjoyed Brian Greenstones new book on mac game programming.

Kyle Richter
DragonForged.com
Twitter: @kylerichter
Quote this message in a reply
Jones
Unregistered
 
Post: #5
I have the Red Book, actually, and I'm slowly working my way through it.

I also have brian greenstones book, but I've been warned away from using it.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #6
Quote:Ranging from source code for full built games to empty game engines.
Its the source code of a fully built game engine with levels and resources as well.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Jones
Unregistered
 
Post: #7
unknown Wrote:Its the source code of a fully built game engine with levels and resources as well.

I know.

And wow, that game you sent me the link to does the graphics in a very original style.
Quote this message in a reply
Moderator
Posts: 1,560
Joined: 2003.10
Post: #8
The source code for my games can be found on my website:

http://www.sacredsoftware.net/

It probably ranges from decent to completely unreadable, so beware. Infiltration is probably a reasonably good place to start; Water Tower 3D might be a bit more complex than what you're looking for, and Bees and QnDMaze are perhaps too simple.
Quote this message in a reply
Jones
Unregistered
 
Post: #9
Actually, I QnDMAze seems awfully complicated, but that's probably because I don't know a scrap of cocoa. Smile

EDIT : How hard are game engines like "Crystal" to learn and use?
Quote this message in a reply
Member
Posts: 41
Joined: 2006.01
Post: #10
While we're at it, here's these. They seem to function but they're hacker-ish.

Which leads me to a question: how come my inline assembler stopped working when I put SDL in? It compiles but produces nonsense results. I can't seem to get asm_blocks to function either.

float ReciprocalSquareRoot(float x)
{
float approx = __frsqrte(x);
return approx * (1.5 - approx * approx * 0.5 * x);
}

// E5 means correct to 5 digits
float SquareRootE5(float x)
{
float result, result2;

if(x == 0.0) return 0.0;

result = __fres(__frsqrte(x));

result2 = result * result;
result += (x - result2) * __frsqrte(result2) * 0.5;

result2 = result * result;
result += (x - result2) * __frsqrte(result2) * 0.5;
}


float vtan(float x, float y)
{
float d = ReciprocalSquareRoot(x * x + y * y);

if(y >= 0.0)
{
if(x >= 0.0)
{
if(x > y) return fasin(y * d);
else return facos(x * d);
}
else
{
if(y > -x) return piOver2 + fasin(-x * d);
else return Pi - fasin(y * d);
}
}
else
{
if(x < 0.0)
{
if(-x > -y) return Pi + fasin(-y * d);
else return oneAndHalfPi - fasin(-x * d);
}
else
{
if(-y > x) return oneAndHalfPi + fasin(x * d);
else return twoPi - fasin(-y * d);
}
}
}

// about 2.3 times faster than 1.0 / a (G3), correct to a few parts in 10^7
float ReciprocalE6(float a)
{
float result;

result = __fres(a);
result += result - result * result * a;
return result;
}

// this is 0.58% accurate from 0°..45° (don't use negative angles)
// the worst case absolute error is about 0.0009
inline float fasin(float x)
{
return x * (1.0089 + 0.2914 * x * x * x);
}


inline float facos(float x)
{
return piOver2 - x * (1.0089 + 0.2914 * x * x * x);
}


// produces incorrect results with SDL
float __fres(float x)
{
// this is just unreal, xcode's inline assembly sucks big ones
asm("fres %1,%0" : "=f" (x) : "f" (x));
return x;
}


// produces incorrect results with SDL
float __frsqrte(float x)
{
asm("frsqrte %1,%0" : "=f" (x) : "f" (x));
return x;
}
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #11
#include <ppc_intrinsics.h> to get official apple-supported equivalents to your __fres and __frsqrte functions, amongst others.

'course, in the brave new world of Intel, they perhaps don't hold as much pull Wink
Quote this message in a reply
Member
Posts: 41
Joined: 2006.01
Post: #12
omg it worked. This is better than sex.

I just sifted through the documentation for that and I still can't find it.

TY!
Quote this message in a reply
Post Reply