Hacker News new | comments | show | ask | jobs | submit login
Quake 2 Source Code Review (fabiensanglard.net)
347 points by DanielRibeiro 2220 days ago | hide | past | web | 19 comments | favorite

I really respect Carmack, he is one of the few programmers I'd describe as an industry trend setter. I've worked on many games in my career, and seen a lot of engines. When you read through the Q2 and perhaps a better example is the Q3 engine source, you sit there and think, hang on .. where's the rest of the code? He takes a complex problem and reduces it to a set of simple components, and reuses those components. This is incredibly hard to do.

What the article doesn't impress upon people is the effect Carmacks code has on the industry. The shaders in Quake 3 were a huge thing, now seems so obvious. I have no evidence for this, however I wouldn't be surprised if Q3 shaders are the reason we have vertex/pixel shaders in hardware today.

"I have no idea why id software decided to trust the C Standard Library at this point"

This quote reminds me why I liked watching Notch's video for Ludum Dare. We not only get to see the final result, but the way it got to be that way, and some of his thoughts on it as well.

I noticed this comment in the "notes.html":

  // Set the floating point precision ...
  // Question: Why do that for every frames ? Probably because precision is altered during the loop execution.
  // Answer: The is no other call to this function. It appears that floating point precision remains the same during program execution.
I seem to vaguely recall reading something about some versions of Windows not preserving the FPU state across task switches. Could it be that this call to configure the FPU for every frame is a workaround for that?


Search for _controlfp.. seems some MS API calls could change it.

I've also experienced Windows / DirectX API's use MMX, hence the floating point code I was using (x87 FPU) required a femms instruction before it to change back from MMX state.

This just goes to show that if you need a particular state on a processor (CPU, FPU, GFX, etc) you need to set it explicitly before use.

Maybe it's because the calls to functions in DLLs could, in theory, change it?

You may mix up with linux (which does not save the FPU state: that's why you can't use most floating point operations in the kernel).

3D graphics is something I've always wanted to look into more once I have a lot of time on my hands. Watching a good deal of Notch's ludum dare already whetted my appetite. And now just glancing over this article makes my finger tips itch, I'd like to take a week off and start diving into it. It's just great. I love the extra work Fabien put in to link to many external books and articles.

This is so bookmarked!

WebGL makes it really easy for anyone to start now: http://learningwebgl.com/blog/?page_id=1217?

You can also see the framework Three.Js[1], which Mr. Doob used/created on his Google Colabs[2]

[1] https://github.com/mrdoob/three.js

[2] http://www.ro.me/tech/

I said something very similar to that for many years.

I finally just jumped into 2D games recently and found it surprisingly easy. Once I'm comfortable with 2D, I'm moving on to 3D as well.

I'd suggest you just jump in as well. Don't worry about taking a week off or whatever. Just use some of your free time at night and get started.

Free time at night? What are you talking about? ;-)

Dammit... first the workings of Thief and now this!

I have work to do!

I've missed the submission about Thief. Do you have a link?


Edit: changed direct link to YC link.

HN search (see the very bottom of most pages) works surprisingly well: http://www.hnsearch.com/search#request/all&q=Thief

Excellent. I had a lot of fun recently looking at ioquake3 code and picking up a thing or two.

On a totally different note, my wrists hurt just looking at that picture of Carmack in front of his Intergraph monitor. Lower your keyboard, man!

D: At first, I thought you were telling us you were getting a bit too excited about John Carmack and his monitor.

"Since I was running Windows on a Mac with Parallels it was uneasy to hit "printscreen" while the game was running. I hardcoded the '*' from the keypad to produce the same"

Umm.. educational, sure, but can't you just: alias +shift "bind 8 screenshot"; alias -shift "bind 8 whatever_was_bound_to_8"; bind shift +shift;

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact