Just discovered TileMap. Should I reimplement my code?

I just discovered TileMap today. Sounds interesting, but I don’t know how better it is compared to what I already implemented.

What I’m doing is bascially create a BitmapData and copyPixel tiles from spritesheet. It eats a lot of RAM, but at the end of the day, it’s only single (albeit huge) BitmapData.

Does TileMap do it differently? Is it going to be a huge improvement? Right now, my code is doing what I want at a reasonable speed, so I really have no point changing if it’s not better.

It depends, do you copy once? Copy repeatedly?

The concept is that Tilemap will use (on software) blitting, so the equivalent of copyPixels when rendering, but will use batch rendering when hardware is available, so your spritesheet is loaded as a single texture, and each tile is rendered from a rectangle within the texture. On hardware, this can have a huge savings.

1 Like

@Knight52
You should really have a look on it.
Even more if you already use of kind of sheets.
It won’t take long to adapt and compare.
In my case, my copyPixel approachs was hand made, not optimized at all. I admit…
But the first attempts with TileMap were just so… have a look on it !
The incredible FPS boost has raised my whole graphics goals.