26 October 2009
Oiling the cogs
Oh! The sparkles! Geometry Wars has some crazy stuff going on.
People with slower computers are the ones who make the developers work harder. Every time you throw in fancy glowing stars with psychosis inducing flashes, smarter AI, and multi-channel whizzbang (tm) sounds you eat away at the available processing power of the computer. The more effects (not just visual stuff, a whole gamut of background processes) you use, the less free time the system has to run other parts of the program (or other programs that you may have open at the same time).
Eventually (depending on how much money you sunk into beast/pipsqueak of a computer), it starts to get a bit much for the ol' gal and the frame rate drops, sounds become unsynched, and the whole experience tends to come apart.
To fix this, game developers can set up different levels of detail that you can choose to suit your machine's capabilities. This can remove some of the very expensive (cpu/graphics card-wise) elements present in the game. Maybe you can disable the really intense physics calculations so that instead of ejected bullet shells spinning across the screen, careening into walls and each other, they just limply fall to the floor. Removing effects from the player isn't the greatest approach as most players like to have as much visual eye-candy as possible along with intelligent AI and reverbing audio. What needs to happen (and should at least have already happened to some degree) is code optimisation. Optmizing the code behind the effects or hides the effects away when they are unneccessary leads to a smoother experience. Code will generally need some level of optimisation (if it hasn't been worked out beforehand), but to really make it fly, developers have to do really smart optimisation.
Here's a quick sample of how optimising would work: if you have 300 enemies on a level, and only 15 of them are aware of the player, then the AI can run on only those 15 enemies and semi-simulate (or not) the rest of the enemies. This drastically cuts down on the processing time required while still allowing a vast number of enemies in a particular level. Many different types of optimisations are needed depending on the situation (some of them are as simple as "if the player isn't looking at this, don't draw it" whereas others can be insanely complex to work out and program). This allows developers to add extra bits and bobs into the game for the high-end folk and still keep the game running at a playable speed on lower settings for the lower spectrum of computer power.
Developers have to calculate complex algorithms just so you can splash around in water with fresnel shading. Or have sparks fly as you smash your vehicle over a ramp. Or enemies that don't hide behind the nearest explosive barrel. And so they downgrade other parts of the game to make certain parts of it shine. If they're really good, they can hide the downgrading, or even get it to the point where nothing needs to be downgraded. Here's hoping I can at least pretend to do something similar.