DEV Community

Eric Ahnell
Eric Ahnell

Posted on

Game Object Variance: Single and Multiple

I am working on updating my 2nd of 30 games: Mazer5D. I have decided to use image templates for various game objects, using two different systems: avatars, due to their 6 degrees of variability, using one, while objects use another scheme supporting only 1 degree. Objects that have 2 degrees of variability are stored as 2 images and assembled at runtime. I'm primarily supporting color variability, but the engine can also rotate images 90/180/270 degrees if needed. Doing so means I only need 260 raw input images, instead of >1000 for all the possible permutations. There is a performance penalty for doing this, but I mitigate it by precomposing all the common variants and caching them at startup.

Top comments (0)