Live data from Hacker News

Dev Diary: John Carmack on RAGE for iOS

bethblog.com

11–20 of 39 posts

Re: Dev Diary: John Carmack on RAGE for iOS

#11
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…

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

Re: Dev Diary: John Carmack on RAGE for iOS

#12
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…

I found this part of his article to be interesting. I'm working through a CS degree and learning C++ for the first time after cutting my teeth on Python and C#. What exactly does he mean by "(restrained) C++"? He mentions a contract studio using the STL and boost. We are using the STL in our data structures class...does John Carmack eschew the STL and roll his own data structures?

Kids these days with their allocations and virtual memory. shakes fist

You don't need std::vector if you don't need dynamic memory allocations. Game programming and systems programming is a whole lot different than web or desktop development.

For games, you create a memory budget up front. You decide how much memory sound, textures, models, AI will consume up front and then statically allocate that memory up front. http://gamesfromwithin.com/start-pre-allocating-and-stop-wor...

You can statically allocate at the start of a game, level, and frame.

From the original article: OpenAL appears to have a limit of 1024 sound buffers, which we bumped into. We could dynamically create and destroy the static buffer mappings without too much trouble, but that is a reasonable number for us to stay under.

It also sounds like Carmack is loading an entire level as a memory mapped file and then doing reads into specific indexes within the file.

Take a look at the source code that id has open sourced. That's the best way to get a feel how this style of development works. I believe RtCW is their last release. ftp://ftp.idsoftware.com/idstuff/source/ http://github.com/monoid/rtcw-rebirth

Re: Dev Diary: John Carmack on RAGE for iOS

#13
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…

I found this part of his article to be interesting. I'm working through a CS degree and learning C++ for the first time after cutting my teeth on Python and C#. What exactly does he mean by "(restrained) C++"? He mentions a contract studio using the STL and boost. We are using the STL in our data structures class...does John Carmack eschew the STL and roll his own data structures?

Google gives a good take on restrained C++: http://google-styleguide.googlecode.com/svn/trunk/cppguide.x...

Re: Dev Diary: John Carmack on RAGE for iOS

#14
post #12

Earlier quoted context omitted.

I found this part of his article to be interesting. I'm working through a CS degree and learning C++ for the first time after cutting my teeth on Python and C#. What exactly does he mean by "(restrained) C++"? He mentions a contract studio using the STL and boost. We are using the STL in our data structures class...does John Carmack eschew the STL and roll his own data structures?

Kids these days with their allocations and virtual memory. shakes fist You don't need std::vector if you don't need dynamic memory allocations. Game programming and systems programming is a whole lot different than web or desktop development. For games, you create a memory budget up front. You decide how much memory sound, textures, models, AI will consume up front and then statically allocate that memory up front. h…

Actually, I'm 38...bit of a late starter :) Thanks for the reply and link. Modeling and simulation is my area of interest (I work in civil and environmental engineering), so it will be interesting to see what patterns will work best.

Re: Dev Diary: John Carmack on RAGE for iOS

#15
post #13

Earlier quoted context omitted.

I found this part of his article to be interesting. I'm working through a CS degree and learning C++ for the first time after cutting my teeth on Python and C#. What exactly does he mean by "(restrained) C++"? He mentions a contract studio using the STL and boost. We are using the STL in our data structures class...does John Carmack eschew the STL and roll his own data structures?

Google gives a good take on restrained C++: http://google-styleguide.googlecode.com/svn/trunk/cppguide.x...

Nice, I read this a long time ago before learning C++. It's interesting (and reassuring) that some of the stuff we are learning is considered bad practice by Google.

Re: Dev Diary: John Carmack on RAGE for iOS

#17
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…

I'm on the same arc (especially the template Kool-Aid phase), except perhaps further along: now I forgo C++ entirely and write plain C because it's so much easier to wrap from higher-level languages.

I do miss smart pointers, but on the other hand, dealing with malloc and friends keeps me honest about what really needs to be written in C.

Re: Dev Diary: John Carmack on RAGE for iOS

#18

Earlier quoted context omitted.

I found this part of his article to be interesting. I'm working through a CS degree and learning C++ for the first time after cutting my teeth on Python and C#. What exactly does he mean by "(restrained) C++"? He mentions a contract studio using the STL and boost. We are using the STL in our data structures class...does John Carmack eschew the STL and roll his own data structures?

In his own words: http://twitter.com/#!/ID_AA_Carmack/status/21119808432 I consider myself a decent programmer but I have more trouble reading template heavy C++ than I do haskell code. To me, restrained C++ means keeping the unreadable bits outside the code base and isolated in their own library, like Boost :)

One problem with C++ templates is that they're infectious. You're right that the Boost source code is quite unreadable compared to vanilla C++, but even using Boost types and algorithms in your own code often makes it impenetrable, too.

Re: Dev Diary: John Carmack on RAGE for iOS

#19
post #11
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…

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 possibly deleterious effects on performance, but then, you can just be judicious about where you use them. Exceptions are at least appropriate for catastrophic failures like, "Oops, the game just crashed," or, "Your network connection died." Thinking about manually unwinding out of a game-over failure like that makes me grimace.

Sigh, game programmers. :)

Post reply on HN