Doom 3 source released
github.com
github.com
$ sudo perl cloc-1.55.pl --unicode doom3.gpl/
2014 text files.
1907 unique files.
476 files ignored.
http://cloc.sourceforge.net v 1.55 T=40.0 s (36.6 files/s, 22123.3 lines/s)
-------------------------------------------------------------------------------
Language files blank comment code
-------------------------------------------------------------------------------
C++ 517 87051 113094 366423
C/C++ Header 615 29640 26891 110991
C 170 11407 15566 53520
Bourne Shell 36 4529 5476 33717
m4 10 1079 232 9025
HTML 55 391 76 4142
Objective C++ 6 709 654 2605
Perl 10 523 411 2380
yacc 1 95 97 912
Python 10 108 182 895
Objective C 1 145 20 768
make 22 160 253 579
DOS Batch 5 0 0 61
Teamcenter def 4 3 0 51
Lisp 1 5 20 25
awk 1 2 1 17
-------------------------------------------------------------------------------
SUM: 1464 135847 162973 586111
-------------------------------------------------------------------------------Question 2: Why does Doom 3 involve 33,717 lines of bash? That's a lot of bash. I realise it's used heavily for build scripts, but thirty three thousand lines seems excessive.
$ wc -l neo/curl/configure
31052 neo/curl/configureHmmm, because of a really bad habit I need to break. ;)
Wow. For six years I've been doing "UP + CTRL^A + sudo + SPACE" instead. This is much better.
I use Ctrl-P Ctrl-A sudo <space> which is exactly the same number of keystrokes as "sudo !!" and a much more general solution in my opinion.
Edit: OK. I just googled and it indeed is Carmack's reverse.
Check out draw_common.cpp [2] - the patent work-around is contained in the RB_T_Shadow method:
// patent-free work around
if ( !external ) {
// "preload" the stencil buffer with the number of volumes
// that get clipped by the near or far clip plane
qglStencilOp( GL_KEEP, tr.stencilDecr, tr.stencilDecr );
GL_Cull( CT_FRONT_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
qglStencilOp( GL_KEEP, tr.stencilIncr, tr.stencilIncr );
GL_Cull( CT_BACK_SIDED );
RB_DrawShadowElementsWithCounters( tri, numIndexes );
}
[1] See my previous comment for more info: http://news.ycombinator.com/item?id=2945889[2] https://github.com/TTimo/doom3.gpl/blob/master/neo/renderer/...
That makes very little sense to do - every single project? Don't you think someone would have released a library to implement the "new and improved allocator" if everyone needs to use it?
There have been several successful efforts at writing better performing general-purpose allocators:
* TCMalloc (http://goog-perftools.sourceforge.net/doc/tcmalloc.html)
* jemalloc (http://www.canonware.com/jemalloc/)
There's a great Facebook Engineering blog post about jemalloc which describes why a fast allocator is needed & why the standard malloc is not always sufficient:
https://www.facebook.com/notes/facebook-engineering/scalable...Moderate usage of STL can do nasty, nasty things to memory performance. In one case a game I worked on ran at 5-10fps and a simple, fast change to DLMalloc instantly took perf to 60fps.
We used TCMalloc at Opera Community[0], and they still might be using it there for all I know ... it greatly improved performance on our MySQL servers!
[0]: http://my.opera.com/
https://github.com/TTimo/doom3.gpl/blob/master/neo/idlib/Hea...
Surprisingly there's not a lot of platform-specific cruft in that code. The Xbox version of Doom3 must have been a separate code branch.
The Zone Memory Allocator(common.c: Z_Malloc, Z_Free,
Z_TagMalloc , Z_FreeTags) is still here in Quake2 but
it is pretty much useless:
Tagging is never used and allocation/deallocation is
build on top of malloc and free (I have no idea why id
software decided to trust the C Standard Library at this
point).
The overflow detector (using the Z_MAGIC contant) is
never used either.
So, unless I totally misunderstand things, it is half C stdlib, half Hunk allocator?From the header comments:
/* ===============================================================================
Memory Management
This is a replacement for the compiler heap code (i.e. "C" malloc() and free() calls). On average 2.5-3.0 times faster than MSVC malloc()/free(). Worst case performance is 1.65 times faster and best case > 70 times.
=============================================================================== */
Also, and this is subjective I suppose, I don't remember Doom 3 doing anything that 'felt' or looked better than even what the contemporaneous engines did (such as the version of Havok used in Half-Life 2).
So I guess, there probably aren't valuable additions, but I imagine there is much to tinker with.
From looking at the game code, I see odd things like rolling barrels animating their rotation as though the physics engine itself doesn't handle rolling contact.
Barring running the code... I prefer to start with a quick scan through the foundation code. What does the math library look like? How about the file and network I/O? Next, locate the top-level main loop, then the top-level Update Everything/Render Everything functions. At that point, you'll understand the general theme of the code and you'll have spotted lots of interesting avenues to explore.
EXTRACT_ALL
(these are the steps that worked for me)
Open doom.sln Go to View -> Property Manager Expand Debug | Win32 Right click "Microsoft.Cpp.Win32.user" and choose Properties Select VC++ Directories
You need to add the following directories C:\Program Files (x86)\Microsoft DirectX SDK June 2010\Include C:\Program Files (x86)\Microsoft DirectX SDK June 2010\Lib\x86
Do the same for Release | Win32.
Doom3 should now compile. Note that 2 projects might fail and 1 could be skipped.
You should find Doom3.exe under doom3.gpl\build\Win32\Release From your Doom3 installation copy the "base" folder, if you have the expansion copy that too.
Doom3 should now launch.
If you have any more problems, feel free to ask!
DOOM 1.3.1.1304-debug linux-x86 Nov 24 2011 00:27:04
found interface lo - loopback
found interface eth0 - 10.0.0.19/255.255.255.0
------ Initializing File System ------
Current search path:
/home/xx/.doom3/base
/home/xx/doom3.gpl/neo/base
game DLL: 0x0 in pak: 0x0
Addon pk4s:
file system initialized.
--------------------------------------
----- Initializing Decls -----
------------------------------
------- Initializing renderSystem --------
idRenderSystem::Shutdown()
Sys_Error: _default material not foundEDIT: Doom 1 source code seems dirty when compared to Doom 3.
This does not all hold for Doom3 as it was also an engine sold to other companies for other games.
Which is to say, code cleanliness is very much not the norm anywhere. And if anything the game industry seems to be a good 10-20 years behind the rest of the software industry in terms of hewing to good practices (clean code, automated tests, etc.)
Has anyone had success building this on a 64 bit machine?
Is my only option to set up a virtual machine with a 32 bit distro?
I tried to use a very unofficial Ubuntu utility called getlibs (http://frozenfox.freehostia.com/cappy) but that didn't really help, the library search path was wrong and the correct libs were not found.
/media/d2/sw/doom3.gpl/neo$ git diff
diff --git a/neo/sys/scons/SConscript.curl b/neo/sys/scons/SConscript.curl
index 4d889b9..7271dfc 100644
--- a/neo/sys/scons/SConscript.curl
+++ b/neo/sys/scons/SConscript.curl
@@ -14,7 +14,7 @@ class idBuildCurl( scons_utils.idSetupBase ):
def Compile( self, target = None, source = None, env = None ):
self.TrySimpleCommand( 'cd curl ; make clean' )
- cmd = 'cd curl ; CC=\'' + env['CC'] + '\' ./configure --enable-shared=no --enable-static=yes --enable-http --enable-ftp --disable-gopher --enable-file --disable-lda
+ cmd = 'cd curl ; CC=\'' + env['CC'] + '\' CFLAGS=\'-m32\' ./configure --enable-shared=no --enable-static=yes --enable-http --enable-ftp --disable-gopher -- enable-fi
if ( self.debug ):
cmd += '--enable-debug'
else:
@@ -37,5 +37,5 @@ else:
g_env.Command( target_name, None, Action( build.Compile ) )
-curl_libs = [ target_name, '/usr/lib/libz.a' ]
+curl_libs = [ target_name, '/usr/lib32/libz.a' ]
Return( 'curl_libs' )
Linked for me on Ubuntu 11.04 64-bit.I probably would have figured it out by myself, I solve this kinds of things for living. But I was trying to quickly build this before going to work and ran out of time.
http://forums.gamershell.com/showthread.php?407-About-Doom-3...
and just browse around locally in your favourite editor.
git clone https://github.com/TTimo/doom3.gpl DOOM 1.3.1.1304-debug linux-x86 Nov 24 2011 00:27:04
found interface lo - loopback
found interface eth0 - 10.0.0.19/255.255.255.0
------ Initializing File System ------
Current search path:
/home/xx/.doom3/base
/home/xx/doom3.gpl/neo/base
game DLL: 0x0 in pak: 0x0
Addon pk4s:
file system initialized.
--------------------------------------
----- Initializing Decls -----
------------------------------
------- Initializing renderSystem --------
idRenderSystem::Shutdown()
Sys_Error: _default material not foundWhether that is failure to check for a dependency, failure to document a dependency or failure to clearly specify which specific version of a dependency is required. And the pain of autotools is a completely separate chapter in describing how "my" environment can differ from "theirs."
All of that just goes to show that state management is _the_ hardest part of software.
or zlib-dev if your distribution separates out development packages
Can anyone here confirm/deny that?
You should be able to play a total conversion that does not rely on the original game’s assets, however.
Now what is the matter with default.cfg and what about "Unknown command 'vid_restart'"? I am not familiar with the structure of idgames.
------ Initializing File System ------
Current search path:
C:\Program Files (x86)\DOOM 3\base/base
game DLL: 0x0 in pak: 0x0
Addon pk4s:
file system initialized.
--------------------------------------
Unknown command 'vid_restart'
idRenderSystem::Shutdown()
Shutting down OpenGL subsystem
...shutting down QGL
Couldn't load default.cfgNOTE: For those primed to accuse me of hating: this is as much a compliment to certain hackers and their fixated attitude towards porting iD code dumps, as it is a snide reference to textmate2's status as vaporware.