I want to study the Doom 3 code and I would like some help. How can I start reading it? Should i find a main() function and go on from there?
Any other tips that may help me?
Thank you for your time
Jump to content
Posted 16 January 2013 - 01:26 PM
Pick a subsystem you're interested in and dive in. You may want to try to get a broad-strokes overview of the high-level setup, which is presumably why you would start with main, but since other folks have already done the work of that and written about it, I'd say the best approach is to just read their analysis for that info, and dig into specific sub-systems for details that you're interested in.
I'd also caution against putting the Doom 3 code on any sort of pedestal. Its a great resource to have the source of a commercial game as renowned as Doom 3, but there's a lot of other great open-source code too. There was a recent opinion article on the "beauty" of the Doom 3 source code, but exercise caution and judgment, as it was just that--an opinion of one person, who, in the very same article, says that he considers himself "not a coder", although he has published a game himself. Having read that article myself yesterday, much of what he considers "beautiful" are things that myself and others would consider ugly. If you're looking to the code as a model for you to mimic, you could do worse, but you could also do better. Don't assume the code or design is great just because it's Doom, or just because its Carmack.
Posted 16 January 2013 - 05:12 PM
Posted 16 January 2013 - 08:45 PM
There was a recent opinion article on the "beauty" of the Doom 3 source code, but exercise caution and judgment, as it was just that--an opinion of one person, who, in the very same article, says that he considers himself "not a coder", although he has published a game himself.
I think he's just being humble, as in that same opinion piece he showed quite a bit of knowledge of C++, the STL and code readability in general.
Anyway in answer to the original post, Doom3 is a MASSIVE codebase, by a team of programmers conforming to a set of standards in terms of code layout and practices. If you have little experience in 3d game programming maybe looking at the original Doom source code would be good, despite in being in C and hard to understand at times refactoring the code into an object oriented style of your choice (either using inheritance or a flat component based hierarchy) would be a good learning exercise albeit a long one.