Page 1 of 1

Doom 3 Source Code is Free

Posted: Wed Nov 23, 2011 5:23 pm
by draconic74
http://www.pcgamer.com/2011/11/23/doom- ... ee-to-all/
https://github.com/TTimo/doom3.gpl

Well, if this isn't something to learn from then I don't know what is. It's the Doom 3 source code, now released for free. And even better, it has an Xcode project file, so it's not limited to Windows. Linux works too. (Make sure to read the README for info on this)

In fact, I just opened it and hit compile. Aside from a few thousand warnings of deprecated stuff, it went just fine. Thats pretty damn awesome. I'll be completely honest, I have no idea what I'm doing or what to even do with it, this sort of stuff is far above my head right now, but it's at least interesting to scroll through the code (decently commented, too) and just look at it.

So for anyone who knows what they are doing, have fun. To everyone else, I dunno... Look at the pretty text! :o

Re: Doom 3 Source Code is Free

Posted: Wed Nov 23, 2011 5:42 pm
by Fonzeh
Im guessing it's written in C++?

Re: Doom 3 Source Code is Free

Posted: Wed Nov 23, 2011 7:19 pm
by draconic74
Should have mentioned that, but yes.

Have a snippet of Model.cpp, IN YO FACE

Code: Select all

/*
================
idRenderModelStatic::MakeDefaultModel
================
*/
void idRenderModelStatic::MakeDefaultModel() {

	defaulted = true;

	// throw out any surfaces we already have
	PurgeModel();

	// create one new surface
	modelSurface_t	surf;

	srfTriangles_t *tri = R_AllocStaticTriSurf();

	surf.shader = tr.defaultMaterial;
	surf.geometry = tri;

	R_AllocStaticTriSurfVerts( tri, 24 );
	R_AllocStaticTriSurfIndexes( tri, 36 );

	AddCubeFace( tri, idVec3(-1, 1, 1), idVec3(1, 1, 1), idVec3(1, -1, 1), idVec3(-1, -1, 1) );
	AddCubeFace( tri, idVec3(-1, 1, -1), idVec3(-1, -1, -1), idVec3(1, -1, -1), idVec3(1, 1, -1) );

	AddCubeFace( tri, idVec3(1, -1, 1), idVec3(1, 1, 1), idVec3(1, 1, -1), idVec3(1, -1, -1) );
	AddCubeFace( tri, idVec3(-1, -1, 1), idVec3(-1, -1, -1), idVec3(-1, 1, -1), idVec3(-1, 1, 1) );

	AddCubeFace( tri, idVec3(-1, -1, 1), idVec3(1, -1, 1), idVec3(1, -1, -1), idVec3(-1, -1, -1) );
	AddCubeFace( tri, idVec3(-1, 1, 1), idVec3(-1, 1, -1), idVec3(1, 1, -1), idVec3(1, 1, 1) );

	tri->generateNormals = true;

	AddSurface( surf );
	FinishSurfaces();
}
Isn't AddCubeFace OpenGL? Sounds familiar.

Re: Doom 3 Source Code is Free

Posted: Wed Nov 23, 2011 9:25 pm
by nil
No, it's most likely a function or method in the Doom 3 source code that modifies the tri data.

Nice to see the source code is now open, although I do not own the game.

Re: Doom 3 Source Code is Free

Posted: Thu Nov 24, 2011 6:00 am
by draconic74
Well hello there.

Code: Select all

/*
================
AddCubeFace
================
*/
static void AddCubeFace( srfTriangles_t *tri, idVec3 v1, idVec3 v2, idVec3 v3, idVec3 v4 ) {

	BLAH BLAH BLAH - A bunch of  " tri->verts[tri->numVerts+0] "
	Like 20 of em, with different suffixes and numbers. 

}
So if I understand correctly, you should be able to compile this code and use the game's original data to play the actual thing? Again, this is pretty much way above my head. It does generate a Doom3.app though. And the console goes all the way to getting a config file error, which seems to be a common error in games using id Tech engines. So basically, you need that file before it starts checking for anything else.

Re: Doom 3 Source Code is Free

Posted: Thu Nov 24, 2011 11:13 am
by nil
draconic74 wrote:So if I understand correctly, you should be able to compile this code and use the game's original data to play the actual thing?
Yeah.

I think I remember being able to compile the Quake 3 source code and run the app without supplying any game content, though. I'm not sure about the config file and how Doom 3 works. Maybe you could just grab the Doom 3 demo (that exists, right?), and get the data you need from there.

Re: Doom 3 Source Code is Free

Posted: Thu Nov 24, 2011 1:03 pm
by draconic74
That would be worth a shot. Unless it's like Halo/Halo Demo and the mapfile has oddities.

Also, Doom 3 is on sale on Steam right now... Hm... Windows only though -_-

Re: Doom 3 Source Code is Free

Posted: Thu Nov 24, 2011 4:49 pm
by Fonzeh
maybe now that halo has been remade, they will release the source code?

Yeah i know... Imagine the shit we could do....

Re: Doom 3 Source Code is Free

Posted: Fri Nov 25, 2011 5:16 pm
by draconic74
Don't really think I would change anything... I suppose the source code allows for some awesome tweaks, but to be honest Halo just plays fine as it is. I guess if you could improve rendering and whatnot to make it run a bit better, then shove in proper support for 10.6 and 10.7.


Though I doubt they will release it. For one thing, the Halo engine as far as I know is exclusive to the Halo franshice and Stubbs the Zombie (made by a split-off group of the Bungie team). I don't think anyone has used it aside from them. It's not like id Tech, Unreal, or Source, these ones are widespread.

Re: Doom 3 Source Code is Free

Posted: Mon Nov 28, 2011 5:41 am
by Dirk Gently
Halo's code is still owned by microsoft and will not be released.

-- Source: Roger Wolfson, bungie employee

Re: Doom 3 Source Code is Free

Posted: Mon Nov 28, 2011 11:56 am
by draconic74
Dirk Gently wrote:Halo's code is still owned by microsoft and will not be released.

-- Source: Roger Wolfson, bungie employee
Not even surprised in the slightest, really...

Re: Doom 3 Source Code is Free

Posted: Tue Nov 29, 2011 8:45 pm
by Fonzeh
same