Collision Checks

  • Is there a trick to reducing the number of collision checks that occur per second? I'm currently getting over 1600 in my current project and it seems to be affecting performance a bit. As I delete objects it gets smoother so I'm thinking I have to reduce the number of collision checks I am getting.

    -Mike

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You could try "Every x seconds" as a top tier, and your collision event as a sub. Might even use a dt multiplier in the x for a variable timer.

  • i find this a clear way to reduce per tick checks, system compare tickcount%2 = 0 (check every 2 ticks, will reduce collisionchecks by half !)

    you can go higher, but you need to make sure your object collision still get registered (depends on speed and size of your objects)

    i actually would advise everyone to do this, as a per tick collision check is way to much

  • It makes no sense to use dt in 'Every X seconds', it's already measuring in seconds!

    The simple answer is to make fewer collision checks. Only collision check objects which really need it, and try to only check every few ticks if possible. Alternatively try to spread your objects out over a larger area and collision cells will reduce the collision checks for you.

    BTW if that's 1600 a second, that's almost nothing to worry about at all. A single collision check is near-instant, and 30 a tick or so will have probably zero impact on performance (not counting poly checks).

  • "Dt multiplier" as in 10 * dt

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