Collision- Each tile vs. One sprite covering tiles

Discussion and feedback on Construct 2

Post » Fri Apr 12, 2013 9:56 pm

Hi!
I have had this question in my mind for ages. I thought I'd finally ask about it :P
Say you have a platformer with a lot of tiles scattered throughout the stage.
What would be more efficient-
Making the tiles a "Solid"
OR
Disabling the collision for the tiles and having a long stretched out invisible sprite that is a solid that goes over the tiles.

I don't know why, but I feel that there may be a performance hit from allowing every single tile to have collision, but lessening the collision detection by having a few sprites that are stretched across the tiles to detect, just sounds more efficient in my view.

Thanks!
B
45
S
19
G
10
Posts: 562
Reputation: 9,543

Post » Fri Apr 12, 2013 10:00 pm

Because the collision detection is polygon-based, one large object check requires the same processing power as a smaller version of that same object. Having one large object to check is definitely more efficient than having lots of small objects.Arima2013-04-12 22:01:51
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Fri Apr 12, 2013 11:26 pm

Ah that's excellent :D I've already been designing my layouts this way so that's a relief. Thanks for the info!
B
45
S
19
G
10
Posts: 562
Reputation: 9,543

Post » Sat Apr 13, 2013 3:29 am

@Arima, that's not entirely true.

@Jase00, if you go, use tiled background and set it to be invisible (not transparent, invisible).

[tube]http://www.youtube.com/watch?v=pJFQftlOdH0[/tube]

I had a big headache after doing a big mask with many polygons, because the engine check the collision on a runtime, and when it get low fps, the problems start to happen with complex polygon areas.

Long, long time ago I reported this bug, and it was solved, but @Ashley told me to avoid using big collision masks.


http://www.scirra.com/FORUM/collision-polygons-and-detection-issues_topic54181.html?KW=collision_issue%2EpngTELLES08082013-04-13 17:54:34
ImageImageImageImageImageImage
B
93
S
20
G
14
Posts: 1,218
Reputation: 19,500

Post » Sat Apr 13, 2013 4:31 am

I was referring to having a larger version of an object with the same number of points in the collision mask. Sorry if that wasn't clear enough. Having more points, as you point out, will be more work than an object with less points as there are more polygons to check, but two objects of different size with equal collision masks should require the same amount of processing power to check.Arima2013-04-13 04:37:08
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sat Apr 13, 2013 5:36 pm

How do you turn of collision checking for non physics sprites? I can't seem to find anything about anything outside of Physics objects.

thanks
Image
B
57
S
14
G
6
Posts: 493
Reputation: 11,253

Post » Sat Apr 13, 2013 5:46 pm

@NotionGames there's an action called 'set collisions enabled' for any Sprite.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat Apr 13, 2013 5:54 pm

@Sqiddster Thank you sir!
Image
B
57
S
14
G
6
Posts: 493
Reputation: 11,253

Post » Sat Apr 13, 2013 5:57 pm

@NotionGames No problem! If you ever need a beta tester, just let me know
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sun Apr 14, 2013 5:54 am

@NotionGames @sqiddster
There's also a sprite property that you can change at edit time, at the bottom where you can also set the initial frame and initial visibility, in case you want it to start off with no collision detection.TL222013-04-14 05:54:55
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 14 guests