| Zombie simulator: preparing sprites |
|
| Friday, 08 January 2010 15:57 |
|
I spent some more time consolidating the state of the engine by merging the roof and wall mesh buffers. I've also added in the ability to select individual wall segments using the mouse, giving me a handy readout on the console showing how many vertices and triangles there are in each piece of wall. I even found time to reduce the number of vertices in the wall and roof models by about 25%. Every little bit helps. Moving on, you might recall that a few days ago I mentioned that I did some work on the sprite generator. Initially it simply rendered a sprite from all sides then pumped out a single PNG file per sprite. I spent some time today refactoring the code so that all sprites of the same size (to the nearest power of two) would be merged into a single image, finally writing an XML file that specifies the location and source for all the sprites, so the engine can work out where everything is. The reason for doing this is that I'm going to be rendering the sprites on a simple rectangle composed of two triangles, which means that they'll need to be loaded as textures, and switching textures is a costly exercise for a GPU, so the last thing I want to do is have loads of small sprite textures constantly being switched in and out. Anyhow, I've done a quick test to see how big the human model should be scaled to make it look like it belongs in the world.
Now that there's a correctly scaled human character in the world, I can see that the buildings will need some work (the walls are too thick for a start), the pavement needs a texture and the road looks too new... time for that later. Next step, now that some test sprites are generated, is to load them and get the world populated with a random smattering of this little guy. blog comments powered by Disqus |

