| A collection of articles on key topics in computer game programming. Highlights include coverage of artificial intelligence, geometry management, audio programming, and other topics. The CD-ROM contains code and demos for the text. System requires a C and C++ x86 assembler, Open GL, and Direct3D. DLC: Computer games--Programming.
Well-written C++ games are often more maintainable and reusable than their plain C counterparts are—but is it worth it? Can complex C++ programs hope to match traditional C programs in speed?
With a good compiler and thorough knowledge of the language, it is indeed possible to create efficient games in C++. This gem describes techniques you can use to speed up games in particular. It assumes that you're already convinced of the benefits of using C++, and that you're familiar with the general principles of optimization (see Further Investigations for these).
One general principle that merits repeating is the absolute importance of profiling. In the absence of profiling, programmers tend to make two types of mistakes. First, they optimize the wrong code. The great majority of a program is not performance critical, so any time spent speeding it up is wasted. Intuition about which code is performance critical is untrustworthy—only by direct measurement can you be sure. Second, programmers sometimes make "optimizations" that actually slow down the code. This is particularly a problem in C++, where a deceptively simple line can actually generate a significant amount of machine code. Examine your compiler's output, and profile often.
About the Author DeLoura is the editor-in-chief of Game Developer magazine and the former software engineering lead at Nintendo of America, Inc. He has also worked independently as a game developer and has written for a number of industry publications. |