Game Development Reference
In-Depth Information
'
'
and game objects won
t need that kind of density; they
ll usually use different textures
in layers to create interesting effects.
A single object, such as a wall, might have a 16-bit 512 × 512 texture on it taking
1MB of memory, but add to that a couple of 128 × 128 decals and a 128 × 128
normal map and you start eating up some memory. This one object with these
three textures will take almost 2MB of texture memory. Your game might have a
few hundred objects of various detail, eating your memory faster than you expect.
The Nintendo Wii only has 64MB in the first place, which means you have to budget
your textures more than almost any other game asset.
Even the best video cards don
t perform well when you have to swap textures in and
out of video memory. If your game is expected to run well on a 512MB video card,
you
'
'
d better be careful and take that into account when building levels. A few hun-
dred objects and 10 unique characters will chew up that 512MB in a real hurry, and
you
t be able to ask your
customers to simply buy new video cards, unless of course you are Valve and are
publishing the latest Half-Life.
Finally, most textures need some additional storage for their mip-maps. A textured
object with a mip-map will look good no matter how far away the viewer is from
the textured object. If you
'
ll have to scramble to fix the problem. Believe me, you won
'
'
ve ever seen a really cheap 3D game where the object tex-
tures flashed or scintillated all the time, it ' s because the game didn ' t use mip-mapped
textures. A mip-map precalculates the image of a texture at different distances. For
example, a 128 × 128 texture that is fully mip-mapped has a 64 × 64, 32 × 32, 16 ×
16, 8 × 8, 4 × 4, 2 × 2, and 1 × 1 version of itself. The renderer will choose one or
even blend more than one of these mip-maps to render the final pixels on the poly-
gon. This creates a smooth textured effect, no matter how the viewpoint is moving.
A full mip-map for a texture takes 33 percent more space than the texture does by
itself. So don
'
t forget to save that texture space for your mip-maps. One interesting
bit
games almost always pregenerate their mip-maps and store them in the resource
file rather than generating them on the fly. There are two reasons for this. First, a
good mip-map takes a long time to generate, and the second reason is that even a
crappy mip-map takes longer to generate on the fly than it takes to load from disc.
Improving loading speed can be a much bigger problem than media storage.
Sound and Music Data
Sound formats in digital audio are commonly stored in either mono or stereo, sam-
pled at different frequencies, and accurate to either 8 or 16 bits per sample. The effect
of mono or stereo on the resulting playback and storage size is obvious. Stereo sound
 
 
Search WWH ::




Custom Search