Haven't had a chance to look through the code, but these are the two common performance killers for tile maps:
- Are you using an Image.draw call per tile? If so, try using Image.startUse/drawEmbedded/endUse instead. Performance should improve a lot. Image.draw exists as a convenience which does (more or less) the following:
To improve performance, I'd suggest using startUse/drawEmbedded/endUse as much as possible. It works on an a single texture
(i.e. the backing OpenGL texture); so even if you're using multiple sub-images, scaled copies, etc. you will still be able to draw them all in the same "batch." In theory, your entire game could be rendered in the same startUse/endUse as long as it's all contained on the same sprite sheet. So your tile renderer might look more like this:
for (.. rows ..)
for (.. columns ..)
grassSprite.drawEmbedded( ... );
Just a note; if you want to render a different texture, or change the blend mode, or change the transform (translate/scale/etc), or what have you, you'll need to first "flush" it by calling endUse(), then change the state, then start again with startUse(). [/li]
- Are your game tiles contained in a sprite sheet? If not, this can be another source of performance loss.
If you fix those you should be able to render thousands of tiles per frame with no performance loss!
More info here:http://slick.cokeandcode.com/wiki/doku.php?id=performance_memory_tips