Re: Big tables and performance with love.graphics.draw.
Posted: Thu Apr 23, 2015 7:45 pm
I've worked on a very similar problem for my roguelike. I initially had a number of very small maps, where inefficiency wasn't really a problem. Then I generated a world map (768x768 tiles), each tile with several layers (eg. a river running on top of plains). This bogged the game down to an unplayable state. The solution was pretty much the same as what the others suggested - I created a camera-type object which only draws what is on the screen.
An additional optimization was to only create the tile-objects as they were revealed by the camera / player moving around. This reduced the initial loading time from 7 seconds to 0.3 seconds. It also has the added effect of allowing me to track what the player has actually seen, which I use to create the minimap.
I've written in more detail about it here:
http://www.killvore.net/blog/blog/2014/ ... ng-the-map
http://www.killvore.net/blog/2014/8/10/ ... -the-table
An additional optimization was to only create the tile-objects as they were revealed by the camera / player moving around. This reduced the initial loading time from 7 seconds to 0.3 seconds. It also has the added effect of allowing me to track what the player has actually seen, which I use to create the minimap.
I've written in more detail about it here:
http://www.killvore.net/blog/blog/2014/ ... ng-the-map
http://www.killvore.net/blog/2014/8/10/ ... -the-table