Live data from Hacker News

Dev Diary: John Carmack on RAGE for iOS

bethblog.com

21–30 of 39 posts

Re: Dev Diary: John Carmack on RAGE for iOS

#21

John Carmack has always been my mancrush since the Quake days.

Youngster! I've had mine ever since Wolf3D was released. His plan file updates held the same place HN does now: I checked for updates constantly.

    finger johnc@idsoftware.com
    [idsoftware.com]
    finger: connect: Connection refused
sigh...

Re: Dev Diary: John Carmack on RAGE for iOS

#22

John Carmack has always been my mancrush since the Quake days.

I consider myself sharp, but not smart. So I'm often humbled when I read stuff on Hacker News, but I am always completely dumbfounded when I read any of the technical pieces by John Carmack. I read 90% of that article and I comprehended about 20% of it.

I toil with silly web development side projects for months on end that evolve into nothing and he's coding complete games, single-handedly (though admittedly using some existing codebases and content) in a couple of months.

That guy is wicked smart.

Re: Dev Diary: John Carmack on RAGE for iOS

#24
post #19
post #11

Earlier quoted context omitted.

Some more Carmack tweets on C++ IMO, good C++ code is better than good C code, but bad C++ can be much, much worse than bad C code. 10:17 AM Oct 6th I wish C++ had a "functional" qualifier to enforce no global references or side effects. 11:16 PM Sep 21st Reading More Effective C++. I have grown to appreciate at least some uses of most C++ features, but I still don't buy in on exceptions. 10:26 PM Aug 13th

I'm no C++ fan (anymore), either, but I don't understand Carmack's taking exception with exceptions. If the alternative is guarding every function call with an if statement to check for error codes, I'll take exceptions almost every time. (Many game programmers I know think that checking for errors is usually bad game programming style, period, but I'm assuming Carmack isn't one of those people.) Exceptions do have p…

Throwing an exception is a misnomer. An exception doesn't necessarily mean that an error happened. It means, "please unwind the call stack". Unwinding the call stack in a game is a no-no.

Games, especially the simulation, must be deterministic. An exception would most likely destroy determinism.

The simulation/AI is a big, hairy, ugly set of if/else and switch statements anyway. Adding extra error checking is not an extra burden.

The visualization sends asynchronous commands from the CPU to the GPU. The error condition won't be known right away. Querying the GPU will cause a flush of your command stream and ruin performance.

Dynamic memory allocation is reduced to a minimum during a frame so you don't get out of memory errors. Strings are allocated in a pool. Network sockets, file handles, and other performance intensive resources are not created mid-frame.

Exceptions are not a win for games. It is usually best to run the entire frame and then check for errors all at once at the end.

Re: Dev Diary: John Carmack on RAGE for iOS

#25
post #19
post #11

Earlier quoted context omitted.

Some more Carmack tweets on C++ IMO, good C++ code is better than good C code, but bad C++ can be much, much worse than bad C code. 10:17 AM Oct 6th I wish C++ had a "functional" qualifier to enforce no global references or side effects. 11:16 PM Sep 21st Reading More Effective C++. I have grown to appreciate at least some uses of most C++ features, but I still don't buy in on exceptions. 10:26 PM Aug 13th

I'm no C++ fan (anymore), either, but I don't understand Carmack's taking exception with exceptions. If the alternative is guarding every function call with an if statement to check for error codes, I'll take exceptions almost every time. (Many game programmers I know think that checking for errors is usually bad game programming style, period, but I'm assuming Carmack isn't one of those people.) Exceptions do have p…

You're making two mistakes: One about how exceptions work, and another by not considering our constraints.

Exceptions don't just add an overhead when they're thrown, they add overhead for every function call. How else would the exception-handling runtime know to unwind the stack to the correct addresses? It is this performance degradation that we avoid. Why? For the PC, it doesn't really matter. The XBox360 doesn't handle the performance hit very well. The compilers for the Nintendo DS (edit: and the Wii) don't even support exceptions, and the PSP is so crazily architectured that things like floating point numbers or exceptions can cause a framerate to drop from 300 to 12. I've not worked on the PS3. You must understand that these consoles and handhelds are designed very differently from PCs, and are never as powerful.

We do check for errors, we just stay away from exceptions. And dynamic casting, when we can (the DS does a freaking string compare against the vtable!).

Re: Dev Diary: John Carmack on RAGE for iOS

#26
post #9
post #3

I had been harboring some suspicions that our big codebases might benefit from the application of some more of the various “modern” C++ design patterns, despite seeing other large game codebases suffer under them. I have since recanted that suspicion. Quoted for truth. I learned C++ during the Meyers/Sutter era. Then Andrei Alexandrescu came along and I had Boost libraries sprinkled all over my code. My beard is grow…

My C++ also tends to be simple. I also have never had a need for any formal "design patterns", as every time I've encountered a problem for which it turns out there is named pattern in the books, a few moments thought about the problem has always led me to discover the solution myself. Now, it could be that this means I'm some kind of programming genius. I wish that were true, but alas I think it is not so much a ref…

"Design Patterns" exists to give a common vocabulary to the things we do with code and discuss the proper application of the techniques.

Re: Dev Diary: John Carmack on RAGE for iOS

#27
post #4
post #2

Provide Date of Birth to Continue This site requires cookies. Please enable cookies and try visiting this site again. is this a joke?

You can thank ESRB for that.

Speaking of ESRB ratings, how is this going to get on the iOs devices? Aren't the app store rules against the following:

"This is the perfect setup for a quintessential first person shooter game play experience — you pick your targets, aim your shots, time your reloads, dodge the bad guys, and try and make it through to the end of the level with a better score than last time. Beyond basic survival, there are pickups, head shots, and hit streak multipliers to add more options to the gameplay, and there is a broad range of skill levels available from keep-hitting-fire-and-you-should-make-it to almost-impossible." -JC

(off to go look...)

Sure enough, part 15 should prevent this app from ever getting to the public (see http://photos.appleinsider.com/App%20Store%20Review%20Guidel... ). I doubt Apple has the eggs to tell Carmack no. Time to see if Jobs' moral views outweigh his greed. (edit: BTW, I think his greed will win)

Re: Dev Diary: John Carmack on RAGE for iOS

#28
post #19

Earlier quoted context omitted.

I'm no C++ fan (anymore), either, but I don't understand Carmack's taking exception with exceptions. If the alternative is guarding every function call with an if statement to check for error codes, I'll take exceptions almost every time. (Many game programmers I know think that checking for errors is usually bad game programming style, period, but I'm assuming Carmack isn't one of those people.) Exceptions do have p…

You're making two mistakes: One about how exceptions work, and another by not considering our constraints. Exceptions don't just add an overhead when they're thrown, they add overhead for every function call. How else would the exception-handling runtime know to unwind the stack to the correct addresses? It is this performance degradation that we avoid. Why? For the PC, it doesn't really matter. The XBox360 doesn't h…

> Exceptions don't just add an overhead when they're thrown, they add overhead for every function call. How else would the exception-handling runtime know to unwind the stack to the correct addresses?

With unwind descriptors/exception handling tables, which can be stored in a read-only segment of the executable and don't need to be paged in until an exception occurs. They have no runtime performance cost until an exception is thrown.

Unwind tables are the default exception model on most modern gcc C++ targets. They're also the default exception model in Visual C++ x64, at least.

c.f.:

http://stackoverflow.com/questions/318383/exception-handling...

http://msdn.microsoft.com/en-us/library/1eyas8tf(VS.80).aspx

Re: Dev Diary: John Carmack on RAGE for iOS

#29
post #24
post #19

Earlier quoted context omitted.

I'm no C++ fan (anymore), either, but I don't understand Carmack's taking exception with exceptions. If the alternative is guarding every function call with an if statement to check for error codes, I'll take exceptions almost every time. (Many game programmers I know think that checking for errors is usually bad game programming style, period, but I'm assuming Carmack isn't one of those people.) Exceptions do have p…

Throwing an exception is a misnomer. An exception doesn't necessarily mean that an error happened. It means, "please unwind the call stack". Unwinding the call stack in a game is a no-no. Games, especially the simulation, must be deterministic. An exception would most likely destroy determinism. The simulation/AI is a big, hairy, ugly set of if/else and switch statements anyway. Adding extra error checking is not an…

> Unwinding the call stack in a game is a no-no.

For the most part, I agree, which is why I said they're probably only appropriate in games when used judiciously, e.g., for fatal errors.

Re: Dev Diary: John Carmack on RAGE for iOS

#30

John Carmack has always been my mancrush since the Quake days.

I consider myself sharp, but not smart. So I'm often humbled when I read stuff on Hacker News, but I am always completely dumbfounded when I read any of the technical pieces by John Carmack. I read 90% of that article and I comprehended about 20% of it. I toil with silly web development side projects for months on end that evolve into nothing and he's coding complete games, single-handedly (though admittedly using so…

...and, just as important, has done his "10,000 hours" and then some, on the practice of game engine development.
Post reply on HN