Tile Map
Despite the game having poor graphics, I was still having major frame rate issues when the player zoomed out to view the whole map. And each additional feature was making the situation worse. (Surprise, surprise - making over 360x180=64,800 draw calls every frame was slow.)
The solution in SFML (Simple Fast Media Library, the library I'm using) is to make a TileMap. Create a single texture that has all the images your map is going to use. Then instruct the TileMap of which image from the TileMap texture are to be added on the larger game world and where. Have the video card handle all the rendering in one draw call from the TileMap as opposed to 64,800 individual draw calls. (It was actually far more calls than that...)
The result is an order of magnitude increase in performance. Previously when zoomed out frame rates were low single digits. Now I'm reliably getting upper 30s. Performance is still lower than it should be, but there is much room for improvement to pull that up to 60.
The drawing overhaul is not complete. Fog of war and terrain borders aren't even implemented yet, but the new drawing is such a major improvement that it's on the short list to be finished.
Respawning
Previously once a monster was killed, its equipment could be picked up by the player but future versions of that monster wold not have the equipment. For example, only the first instance of the rat killed had a rat hide. The load code has been reworked such that monsters that have been recreated regain their default equipment. This same rat has now been killed twice, leaving behind 2 rat hides.
Lots of other small changes have been made this past month: fixes to networking code, cleanup of items, and the start of a more user friendly store.
The goal for next month is to complete the new drawing routines and the store revamp.
No comments:
Post a Comment