Live data from Hacker News

Doom3 is the proof that “keep it simple” works

gamedev.net

61–70 of 111 posts

Re: Doom3 is the proof that “keep it simple” works

#61
post #35

No one have issues with source code files 5100 lines long? https://github.com/dhewm/dhewm3/blob/master/neo/game/ai/AI.c...

You make it sound like it is a single 5100 line long method. It seems actually very well organised in that file. If you're using any kind of IDE then this wouldn't bug you as you can just jump to the point in the file you need.

And if you're not using a fancy IDE, jumping around in one file can be much easier than jumping around a dozen files.

Re: Doom3 is the proof that “keep it simple” works

#63
Lots of structs is how http://handmadehero.org is being built.

"As we can observe many structs are defined, for example more than 40% of DoomDLL types are structs. They are systematically used to define the data model. This practice is adopted by many projects, this approach has a big drawback in case of multithreaded applications. Indeed, structs with public fields are not immutable."

Re: Doom3 is the proof that “keep it simple” works

#65

Earlier quoted context omitted.

Not a definitive list, but these are good: The C++ Programming Language, 4th edition Bjarne Stroustrup The C++ Standard Library, 2nd Edition Nicolai M. Josuttis Effective C++, More Effective C++, Effective Modern C++ Scott Meyers http://en.cppreference.com

I would also add Effective STL too. A Tour of C++ by B. Stroustrup is a good start point for a beginner too

Well, don't forget about exceptions, unless you decide to ban them like many people do. So add:

Exceptional C++ by Herb Sutter

More Exceptional C++ by Herb Sutter

Exceptional C++ Style by Herb Sutter

And Templates:

C++ Templates: The Complete Guide by Josuttis & Vandevoorde

And of course you need some background in generic & metaprogramming, so add:

Modern C++ Design by Alexandrescu

Advanced C++ Metaprogramming by Gennaro

So you're looking at over ten books. What does this say about C++? Can you think of another language that has a ten book prerequisite?

Re: Doom3 is the proof that “keep it simple” works

#66

Earlier quoted context omitted.

What's wrong with this?

Over 150 lines of code in a simple method? C-style declaration of all the variables in the beginning? (Yes, I know what Carmack said about how he written the project; this explains it, but doesn't make it good C++ code.) Unclear flow with just one comment, which doesn't really explain anything?

It's a "simple method", but it's responsible for a bunch of initialization, so yeah, it's kind of expected to be long.

Notice, though, that each section is pretty straightforward in what it does...basically forEach's.

You could make the argument for greater polymorphism in types, or something like a visitor pattern over collections or something, but honestly this is readable and maintainable code.

More comments at the function declaration would've been nice, but the implementation is pretty straightforward.

Re: Doom3 is the proof that “keep it simple” works

#67
post #55
post #39

Earlier quoted context omitted.

append ?ts=4 to the URL to change GitHubs default 8 character tab to 4 characters wide.

Is that really a GitHub thing? When I view diffs in the command line with Git, it always shows tabs as 8 spaces too.

8 spaces tends to be the de facto standard tab width. But because tab is it's own ASCII character (0x09), much like how space (0x20) and the lower case letter 'a' (0x61) are, it means it's up to whatever text processors used (eg diff, vim, GitHub web application, etc) to interpret a tab character by whatever width they choose. Which is why tab spaces are a per-application setting, eg:

    diff --tabsize=4 ...
    vim "+set tabstop=4" ...
    http://github.com/.../file?ts=4

Re: Doom3 is the proof that “keep it simple” works

#68
post #3

If you read this article and agreed with it, you should definitely read this next: http://lesswrong.com/lw/dr/generalizing_from_one_example/

Depends on how you interpret the "argument." If the argument is "all software projects can/should 'keep it simple'" then yes, it's clearly a logical fallacy.

But if the argument is "'keep it simple' works for some software projects," one example proves the point. This seems the more generous interpretation.

Re: Doom3 is the proof that “keep it simple” works

#69
post #59
post #26

https://github.com/dhewm/dhewm3/blob/master/neo/game/Target.... This is the "nicest looking code [you] have ever seen" ?

Any critiques in specific?

   if ( ent->GetRenderEntity()->gui[ j ] && 
   ent->spawnArgs.FindKey( j == 0 ? "gui_demonic" : va( 
   "gui_demonic%d", j+1 ) ) ) { ent->GetRenderEntity()->gui[ 
   j ] = uiManager->FindGui( ent->spawnArgs.GetString( j == 0 
   ? "gui_demonic" : va( "gui_demonic%d", j+1 ) ), true );
Really?

Re: Doom3 is the proof that “keep it simple” works

#70
post #59

Earlier quoted context omitted.

Any critiques in specific?

if ( ent->GetRenderEntity()->gui[ j ] && ent->spawnArgs.FindKey( j == 0 ? "gui_demonic" : va( "gui_demonic%d", j+1 ) ) ) { ent->GetRenderEntity()->gui[ j ] = uiManager->FindGui( ent->spawnArgs.GetString( j == 0 ? "gui_demonic" : va( "gui_demonic%d", j+1 ) ), true ); Really?

Fair enough.
Post reply on HN