09-08-2009, 05:00 AM
Personally, I feel that the graphic drawing is already optimized, and doing this, although it could be a good idea on let's say indoor maps where there are lots of empty tiles, on most maps it is useless and will just lower your FPS. You have to remember that basically your game needs 32 FPS to look smooth, so if you get 900 instead of 850, it really won't make a big difference.
The problem with this code is that there is potential for artifacts. Say for example a player walks near the empty tile and his name goes over it, there will be artifacts on that tile.
If you REALLY want to optimize so badly, the best way would be to draw the entire map once and then only redraw the tiles that need to be drawn (for example where the sprite has been, etc.) You could potentially make a tile attribute No Redraw or something, for lets say a tile that you know the player will never get to but you can still see. This could be useful in situations like, for example, you are in a town and you can see the other side of the town wall, but you can't access it. That could be one approach.
The problem with this code is that there is potential for artifacts. Say for example a player walks near the empty tile and his name goes over it, there will be artifacts on that tile.
If you REALLY want to optimize so badly, the best way would be to draw the entire map once and then only redraw the tiles that need to be drawn (for example where the sprite has been, etc.) You could potentially make a tile attribute No Redraw or something, for lets say a tile that you know the player will never get to but you can still see. This could be useful in situations like, for example, you are in a town and you can see the other side of the town wall, but you can't access it. That could be one approach.