Questions about tilemap's collision ...

Discussion and feedback on Construct 2

Post » Wed Aug 13, 2014 10:02 pm

I'm using the following tilemap to create my collisions for my layout/level:
Image

I've already read this, but I still have some questions... Which of the following methods is the best to use for detecting tilemap's collision (in term of optimisation/draw calls):
Image
Image
Image
Image

Also, does it help to use only 1 tile and rotate it (instead of 4) ? ... That would reduce my tilemap from 25 tiles to 7 tiles.
B
49
S
15
G
6
Posts: 531
Reputation: 7,189

Post » Thu Aug 14, 2014 7:59 am

Identical tiles within the same rectangle are only drawn in one call (as long as the tilemap is setted for that, which is by default), I am not sure about collisions, but I would think than less collision points and less tilemap with collision enabled would be better (enough to make a big difference that justify doing it? Not sure.).

I personnaly remember doing once in a bubble bobble type of clone (never really gone too far yet into it) having different tilemaps (one graphical only with collisions off and one that used collisions but set to invisible), that would let you have a collision different than the graphics if you want it that way.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Thu Aug 14, 2014 12:23 pm

Your proposed alternatives will probably not show up any significant performance difference. The way to check it is to see if you can measure any performance difference; if you can't, it doesn't matter.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Thu Aug 14, 2014 5:20 pm

Aphrodite wrote:Identical tiles within the same rectangle are only drawn in one call (as long as the tilemap is setted for that, which is by default).

So you are saying that if I use only one tile and rotate it, there would be only 1 draw call for it (instead of 4 draw calls for 4 tiles). Also, are draw calls used when the tilemap is invisible ?

Aphrodite wrote:I personnaly remember doing once in a bubble bobble type of clone (never really gone too far yet into it) having different tilemaps (one graphical only with collisions off and one that used collisions but set to invisible), that would let you have a collision different than the graphics if you want it that way.

That is what I am doing now since is a RPG map (like Pokemon/Zelda).

Ashley wrote:Your proposed alternatives will probably not show up any significant performance difference. The way to check it is to see if you can measure any performance difference; if you can't, it doesn't matter.

So the performance increase would be minimal to none ... I've thought that, but wanted to make sure. My maps will be from 2000x2000px to 3500x3500px with tiles of 72x72px.
B
49
S
15
G
6
Posts: 531
Reputation: 7,189

Post » Thu Aug 14, 2014 7:22 pm

The tilemap object internally breaks up tiles in to cells a bit like the collision cells optimisation, so it works on screen-sized chunks at a time instead of the whole thing. So the size of the tilemap should not affect performance.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Thu Aug 14, 2014 8:49 pm

So you are saying that if I use only one tile and rotate it, there would be only 1 draw call for it (instead of 4 draw calls for 4 tiles). Also, are draw calls used when the tilemap is invisible ?

Rotated tiles are considered as different tile for rendering I think

And the draw on screen is skipped for invisible objecs, so the draw calls should not be a problem
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Fri Aug 15, 2014 8:47 am

Ashley wrote:The tilemap object internally breaks up tiles in to cells a bit like the collision cells optimisation, so it works on screen-sized chunks at a time instead of the whole thing. So the size of the tilemap should not affect performance.

I understand, so the collisions in tilemap are calculated differently. That was the reason I asked about the examples in the first post (I've thought that less collisions points would be better)

Also, using:
Image or Image
Would not have any difference except a few less Kb in file size.

Thanks, I know about "Optimisation: don't waste your time", but I wanted to make sure I use the tilemaps correctly :mrgreen:
B
49
S
15
G
6
Posts: 531
Reputation: 7,189

Post » Fri Aug 15, 2014 12:38 pm

Rotated tiles count as different tiles for rendering. But there's really not much point asking - unless draw calls show up high in the profiler then it's a waste of time worrying about it.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests