Sprites or Tilemap?(Question about optimisation)

Discussion and feedback on Construct 2

Post » Sun Jul 02, 2017 2:34 pm

I'm in a middle of developing my game, which is grid based and I just realised that I could replace almost all my objects with tiles from tilemap. The thing is most of my environment is supposed to have animations. I'm planning to do it by switching tiles on demand or, in some cases, constantly. I have a guess that if I use tile positions to calculate movements for my characters it wll cost less and I will be able to have a lot more action going on without unnecessery collision detection. I don't have a lot of time to experiment and make my own tests, so my question is: is it worth trying to build a game that will mostly have tilemaps and use sprites only for characters and players? Can I win a lot of performance by redesigning my project to be that way? I saw some plugins utilising tilemaps and people seem to be very pleased with their performance. So are tilemaps generally faster then sprites, even if I try to make all my scene animated with them?
B
32
S
5
G
3
Posts: 32
Reputation: 4,471

Post » Sun Jul 02, 2017 7:52 pm

Whenever you change a tile, I think the whole tileset has to rebuild its collision polygons. So it might end up being much slower if you are animating the tileset.
Also, when you use a tileset, it increases the number of draw calls. When it draws the tileset, it has to change draw calls per tile type. So a tilemap with a lot of variety will take longer to process/draw. Also if you use multiple tilemaps it will add more draw calls.

Tilemaps are better suited for simple repetitive tiles that don't need to change. It sounds like sprites would be your better choice.
It'd be nice if tilemaps were more optimized and had more features, etc..
B
45
S
21
G
65
Posts: 1,115
Reputation: 38,221

Post » Mon Jul 03, 2017 10:40 am

Thanks, that clarifies a lot. But does it mean that the more tile types there are in a tilemap, the more drawcalls it would produce? I thought the whole puprose of tilemap is to do the opposite
B
32
S
5
G
3
Posts: 32
Reputation: 4,471

Post » Mon Jul 03, 2017 6:45 pm

I thought so too, but construct runs through each tile, left to right then top to bottom. Whenever the tile changes as it cycles through them, it has to do another drawcall.
So if you have two types of tiles and just keep alternating them like a checkerboard, it would create a new drawcall for each tile in the map!
And if you use multiple tilesets that are layered, you get even more drawcalls.
Animating them will slow it down even more. I've animated them in the past.

I wish scirra would optimize the tilemaps more and add more options/features for them.
B
45
S
21
G
65
Posts: 1,115
Reputation: 38,221

Post » Mon Jul 03, 2017 7:15 pm

Oh wow. Good thing I asked before redoing my project. Again thanks for info. I guess I'm just gonna stick with my current method
B
32
S
5
G
3
Posts: 32
Reputation: 4,471


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests