about feedback archives submissions

//loonygames://issue 2.8://Anatomy of a Video Game://1, 2, 3, 4, 5, 6, 7, 8
switch to printer-friendly version

What's new today:

The archives have been cleaned up, dead links fixed, and the printable versions restored! Also, don't miss the new comments on the main page!

Livin' With The Sims
theAntiELVIS explores the wild and wacky world that is Will Wright's The Sims, asking the inevitable quesiton, "is The Sims the first step toward a virtual life where everyone is Swedish?"

Pixel Obscura
Josh Vasquez on Omikron: The Nomad Soul.

Real Life
Check out our newest comic strip, Real Life! Updated daily!

User Friendly
Updated daily!

Random Feature:

Search the Archives!

Anatomy of a Video Game

Vol. 2, Issue 8
January 10, 2000 


One of the most crucial parts of most games is the part that actually does the hard work of drawing what you want to see. In this module goes some of the most time critical code - the 3D matrix math. All of today’s 3D games, we have lots of 3Dgeometry going on. In lots of ways, this particular module will set the frame rate of your game, since both the quality of the code, and the amount of triangles you try and pass through it will affect the amount of time you spend in this part of your code. Optimization usually starts in this module, and ends in this module too, since changes here can make the most difference. When it comes to actually drawing data on the screen, almost no one actually uses software to render anymore (ie programming the CPU to draw individual pixels). When you consider the resolutions that most of today’s games run at, and the amount of overdraw that goes on, its just not feasible to expect the CPU to be able to do it fast enough. And when you start adding semi transparency for individual pixels into the mix, it gets very slow very fast. Most PC games today are using 3d accelerator cards to do the rendering for us. We hand it the triangles we want to render, hand it the textures we want to use, turn on the features we want, like fogging, or tri-linear interpolation, and it handles the actual drawing for us. Now I'm going to get a little technical here for a second, if you’re not a techy, just tune out for a second J. Since there are multitudes of different video cards out there, with all different abilities, a universal method of drawing to them is required. Now, we, as game developers, don’t want to spend the time writing drivers for each and every card, so we use an off the shelf API (API stands for Application Programmer Interface). This is just a standardized way we can ‘talk’ to the graphics cards. Almost all card manufacturers supply one of two graphic API drivers. Direct3D, developed by Microsoft - which is very complete, but incredibly hard to use, or OpenGL, developed 20 years ago and now maintained by Silicon Graphics. We use the OpenGL standard, simply because that’s what id uses, and since we use their engines, well...

Here you can see the relationship from the top-level code right down to the pixel pipeline on the graphics card itself.

For consoles and Arcade machines, the rendering technology is somewhat different. Firstly, you always know what kind of display systems you have at your disposal; they don’t change from machine to machine. This means that once you’ve written a renderer, you don’t need to change it from game to game. Plus, you almost always get much closer to the metal. For instance, in all the Mortal Kombat games, the programmers talk to the graphics chip directly; setting registers and so on without any kind of API layer. It’s harder to keep track of what’s going on, but it does generally result in a faster graphics pipeline, plus a much greater understanding of exactly what the hardware is doing.


Unless you are doing a purely one on one game - i.e. one person against another, you are going to need some form of Artificial Intelligence code in the game, in order for the player to have something to play against. In Tetris, this would take the form of deciding which block to send down next, something relatively easy with a decent random number generator. In Solider of Fortune for instance, this expands a little into pathway tracking, enemy tracking, decision making, (deciding whether to run away, shoot at the player, follow someone, or whatever). The system has to take into account the local environment, so the bad guy doesn’t fall down a hole, or try and run through a wall. Convincing AI can make a huge difference to a good game playing experience. One of the biggest problems is making the AI not too smart. Since the world you are playing in is generated within the game, it means that the bad guy AI has access to all information regarding this world, and your actions in it. This can mean that the bad guy is aware of everything, and when he shoots at you, he will never miss. Bit of a boring game that. So we have to tone it down a bit to make it more fun. Another thing we have to do is include lots of different animations for the bad guys, since he more they are visually capable of doing, the less predictable they are. If all the guy can do is run, shoot and die, then he’s only got that range of operations. However, if he can walk, crawl, duck, roll, and jump, then he has a far greater range, and is less predictable. Another thing to take into account is the visual and aural acuity of the bad guy. Let me explain that with graphics.


Next >>

about feedback archives submissions

Credits: Illustration © 2000 Durrenberger David (dines). This article is © 2000 Jake Simpson. All other content is © 2000 loonyboi productions. Unauthorized reproduction is prohibited. So don't do it, or we'll dissect you.