Live data from Hacker News

Doom 3 Source code review

fabiensanglard.net

51–60 of 64 posts

Re: Doom 3 Source code review

#51
post #47

Earlier quoted context omitted.

Attention readers: For some reason I cannot comprehend people use the internet in 2012 with javascript and cookies disabled and then whine when some things don't work.

FYI, some people use NoScript to pick and choose which JavaScript they allow to run.

[deleted]

Re: Doom 3 Source code review

#52
post #5

>In some part of the code (see dmap page) there are actually more comments than statements. >Dmap source code is very well commented, just look at the amount of green: There is more comments than code ! You know, in my experience that's not a good thing. I work on similar, heavily-commented code and find it extremely painful. At some point it becomes a burden to see the code behind the comments. (And just so no one m…

Though I no longer have the link handy, one of my favourite examples of this was of an OAuth2 'library' for PHP. You couldn't make out the code for the endless comments. Javadoc style comments and annotations; actual comments ... there was paragraph upon paragraph of comment for individual class properties, that you could reasonably infer from their name if it was done well.

It got to the point where the comments were so lengthy and prosaic, you were deterred from reading them just by their very existence.

Re: Doom 3 Source code review

#53
I get the feeling the reviewer kind of looks up to John Carmack a little bit.

I think it must be a little bit hard to be John Carmack. He probably has a hard time getting balanced feedback on his stuff.

Re: Doom 3 Source code review

#54
post #5

>In some part of the code (see dmap page) there are actually more comments than statements. >Dmap source code is very well commented, just look at the amount of green: There is more comments than code ! You know, in my experience that's not a good thing. I work on similar, heavily-commented code and find it extremely painful. At some point it becomes a burden to see the code behind the comments. (And just so no one m…

// While i goes from 0 to 50.

// --------------------------

for ( int i = 0; i Well, doStuff() only happens while i goes from 0 to 49, so maybe this comment reveals a bug.

Re: Doom 3 Source code review

#55
post #4

> the variables highlights and the "Command-Click" to reach a definition make the experience superior to Visual Studio. Seriously ? There may be reasons to think Visual Studio is an inferior product, these are not among them.

He mentioned just for code browsing so don't panic. Nobody in their right mind would think XCode compares to Visual Studio. I mean it's 2012 and there is still no refactoring support.

> I mean it's 2012 and there is still no refactoring support.

This is a complete lie.

Re: Doom 3 Source code review

#56
post #47
post #6

Attention readers: For some reason i cannot comprehend the pages use javascript to load some images. There are no noscript elements notifying you about this. So enable javascript to read through this.

Attention readers: For some reason I cannot comprehend people use the internet in 2012 with javascript and cookies disabled and then whine when some things don't work.

Poor[1] Javascript can hamper accessibility. Some people need to get the content in a way they can access. Sometimes those people will need to turn off bits of javascript to allow their assistive tech browser to find the content, or to allow their hardware to find the links for clicking, or to keep the user experience similar to what their used to, or etc etc.

Computers in 2012 are less powerful than a few years ago - many (most?) people will be using tablets or smart phones and thus using ARM processors with low clock speeds. Internet connection is also problematic. People may be using nice fibre-optic broadband with low contention. Or they may be stuck on dial up. Or in a country like Australia with very expensive connections. Or on mobile connections with poor bandwidth and high charges.

[1] I'm not saying this website's javascript is poor.

Re: Doom 3 Source code review

#57
We only just found out last year why it was problematic – on windows, OpenGL can only safely draw to a window that was created by the same thread. We created the window on the launch thread, but then did all the rendering on a separate render thread

I actually thought this was well known and documented as I've known it for years. Guess not :)

AFAIK you can use OpenGL in other threads, but you must lock the context to the current thread, which I believe means you're still only rendering from one thread at a time and possibly this is OpenGL 3+ ???

In my own multithreaded OpenGL code, my main thread always became the render thread after starting up the other subsystems. Well, render thread and input gathering thread (as that often needs to be done in the main thread too - at least in SDL).

Re: Doom 3 Source code review

#58

We only just found out last year why it was problematic – on windows, OpenGL can only safely draw to a window that was created by the same thread. We created the window on the launch thread, but then did all the rendering on a separate render thread I actually thought this was well known and documented as I've known it for years. Guess not :) AFAIK you can use OpenGL in other threads, but you must lock the context to…

It may be not so much "well-known" as universally observed without thinking about it. I made the same mistake id did, using SDL in fact, spawning a separate thread for SDL calls. I beat my head against it for much longer than necessary and finally ended up in the SDL irc channel, where someone firmly informed me to stop making calls from multiple threads. When I told them I was making all SDL calls from my rendering thread, including SDL_Init, as advised by the documentation, their response was basically that nobody else had ever had this crazy idea before, every game does rendering and UI interaction from the main thread (never mind that I wasn't writing a game and had no user interaction,) and I shouldn't go around trying weird complex stuff until I learned the basics.

They didn't argue that the restriction was obvious or well-known, only that it didn't need to be documented because good programmers never thought of violating it. (I feel more than a little vindicated with Carmack in my corner :-) ) Strangely enough, they also implied that it might be fixed in the future, and now the SDL docs imply that what I did would work [1], though I wouldn't bet on it because they have a FAQ item that seems to say otherwise [2].

It's something for people to keep in mind when they're writing documentation: document the limitations of your software even if you can't imagine why someone would violate them. People coming from a different background, such as a non-game programmer picking up a game library for some simple animation, might approach your software with different assumptions.

[1] http://www.libsdl.org/cgi/docwiki.cgi/Multi-threaded_Program... [2] http://wiki.libsdl.org/moin.cgi/FAQDevelopment

Re: Doom 3 Source code review

#59
post #45
post #35

Earlier quoted context omitted.

Scroll the page to the bottom, scroll it back up, then go do your other things.

Of course you have to know to do this.

I figured it out after about 15 seconds from seeing one of the images load on-demand. Which is the time any self-respecting computer programmer should take.
Post reply on HN