"the exceptional beauty of doom 3's source code"

Info on Quake 3 and VOGON servers - live status of all Q3 servers

"the exceptional beauty of doom 3's source code"

Postby AG » Tue Jan 15, 2013 20:11 UTC

http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code

John Carmack wrote:Thanks!

A few comments:

In some ways, I still think the Quake 3 code is cleaner, as a final evolution of my C style, rather than the first iteration of my C++ style, but it may be more of a factor of the smaller total line count, or the fact that I haven’t really looked at it in a decade. I do think "good C++" is better than "good C" from a readability standpoint, all other things being equal.

I sort of meandered into C++ with Doom 3 – I was an experienced C programmer with OOP background from NeXT’s Objective-C, so I just started writing C++ without any proper study of usage and idiom. In retrospect, I very much wish I had read Effective C++ and some other material. A couple of the other programmers had prior C++ experience, but they mostly followed the stylistic choices I set.

I mistrusted templates for many years, and still use them with restraint, but I eventually decided I liked strong typing more than I disliked weird code in headers. The debate on STL is still ongoing here at Id, and gets a little spirited. Back when Doom 3 was started, using STL was almost certainly not a good call, but reasonable arguments can be made for it today, even in games.

I am a full const nazi nowadays, and I chide any programmer that doesn’t const every variable and parameter that can be.

The major evolution that is still going on for me is towards a more functional programming style, which involves unlearning a lot of old habits, and backing away from some OOP directions.
User avatar
AG
Q3 Admin
 
Posts: 2365
Joined: Mon Apr 14, 2008 18:25 UTC
Location: Texas
Favorite map: q3dm17
Server: INSTAKILL
Website: http://vogonhq.com

Re: "the exceptional beauty of doom 3's source code"

Postby craij » Wed Jan 30, 2013 21:33 UTC

Not sure why you would ever move away from OOP once you've started. Sharing objects simply makes sense across the board. This means Doom 3 is going to way more extensible than Q3. Read: more variations of the game. But, hey, compared to him, I'm a snotty-nosed little tike so he's probably right.

Cool article, thanks for sharing.
craij
 
Posts: 467
Joined: Wed Nov 04, 2009 17:41 UTC
Server: FFA


Return to Quake 3

Who is online

Users browsing this forum: CommonCrawl [Bot] and 1 guest