Changing renderstate efficiency?

I am building a 2d tile based game for my first game and I was wondering if there would be any problems with how I am thinking of handling the tiles.



I was thinking of changing each tile's renderstate to a different texture whenever the map needs updating.  If I only had 100 tiles on the screen I would only ever need 100 tiles.  I would just change the tile to its appropriate texture whenever I did something which changed the map on the screen.



The other way I thought of doing it would be storing all of my tiles to be displayed in a data structure, but still only render the 100 tiles on the screen.



The first idea sounds better to me unless changing the renderstate to a different texture takes too much work.

unless changing the texture involves resizing, i dont think changing the texture would be a problem.



just change the texture in the same texturestate and make sure u exported ur textures as binary first.

I was thinking about creating a texture state for each tile type and switching texture states so that I would only have to load the textures once.

Using the same TextureState for the same textures is a good idea because it should give you a nice FPS boost.



I'm sure what the performance impact is of 100 objects having their updateRenderState method called is (might be less heavy than it sounds). If that IS the problem, I'd say report back and we'll see how we could work around that…

I'm doing a tile-based game with board sizes up to 100x100 (give or take) and found that using geometry instancing in combination with a texture atlas works pretty well.



Check out the GeometryInstance test(s) and I can probably provide a working sample if need be.