0 Favourites

Collisions and Performance Discussion

  • I am an indie developer and was wondering about some collision related questions to improve performance,

    First : Every object has a collision property to disable or enable, so will it effect performance if i set collisions disabled for irrelevant objects in the layout?

    Second : Every object has a collision mask made of a certain number of points and when we increase those points construct2 warns us to not use more than 8 points in collision mask or it will reduce performance !

    So should we reduce the mask points to one for irrelevant objects? (as it is not possible to remove collision mask )

    Please reply

    Thanks!

  • if you don't have an event that checks the collision, then you don't need to worry about it. There are no collision checks that are performed.

    say you have 100 balls floating in/out of your layout. and everytime your player hits them, they pop. you have to have a statement that says if Player On Collision with Ball. This creates lots of collision checks.

    However, if you for some reason, set all the Ball's collision properties to disabled, then that trigger will not happen and not checks are done. Or more constructively, if you set just the balls that are off screen to disabled then you are eliminating unneeded checks i.e. since your player is always in the center of the screen it will never collide with something off screen.

    If you have a sprite that is background art and never needs any collision check. You don't need to turn off collisions because you don't have any events for it.

  • jobel

    Thanks, you just saved my time which i may have spent in disabling collisions for objects in background!

    Also, is touching an object event also checks for collisions?

    if yes then where does it leave us with the disabling/enabling collision of objects scenario?

  • I don;t know for sure, but it seems if you use the Touch input type and specify an object it would do a collision check, because it's looking at the collision box in order to know if it interacts with the object.

    again the simple optimization is

    IF sprite is NOT on screen then disable collisions

    else

    enable collisions.

    but you'd have to have A LOT of objects to make this worth doing. What is your object count?

  • I would recommend not disabling collision checks for off screen objects since Construct already does this for you.

    Here is the Blog post about it.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks UberLou for info!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
331 35,573
Lordshiva1948's avatar
Lordshiva1948
Unread hot topic
151 16,272
Tom's avatar
Tom Construct Team Founder
Unread hot topic
157 12,693
megatronx's avatar
megatronx