Collision- Each tile vs. One sprite covering tiles

  • 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!

  • 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.

  • Ah that's excellent :D I've already been designing my layouts this way so that's a relief. Thanks for the info!

  • 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.

    <img src="https://dl.dropboxusercontent.com/u/47035927/temp/collision_issue.png" border="0" />

    scirra.com/FORUM/collision-polygons-and-detection-issues_topic54181.html

  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • NotionGames there's an action called 'set collisions enabled' for any Sprite.

  • sqiddster Thank you sir!

  • NotionGames No problem! If you ever need a beta tester, just let me know <img src="smileys/smiley2.gif" border="0" align="middle" />

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)