Collision checks performance issues

Discussion and feedback on Construct 2

Post » Wed Nov 05, 2014 11:27 am

Hello fellas,

the game I develop right now has about 300 sprites, which act like physical particles. Some of the game play mechanics is based on collision checks between sprites. This particles form clusters, where they kind of touching each other and that's a lot of collision checks, which are redundant and decrease perfomance. I need to check for collision when to particles with different attributes collide, but as long as I do > Sprite on collision with another Sprite - the engine checks for all the collisions even if I specify conditions.

The question is - is it possible to "filter" collision checks with conditions?
B
45
S
11
G
4
Posts: 517
Reputation: 7,398

Post » Wed Nov 05, 2014 11:42 am

Yes, place conditions above the collision check to filter down the objects to only those meeting the condition, and then collision checks will only work with those instances.
Scirra Founder
B
402
S
238
G
89
Posts: 24,630
Reputation: 196,027

Post » Wed Nov 05, 2014 12:41 pm

@Ashley
Hmm, it is only possible to place conditions above "Is Overlaping", which I tried and it does not work for objects from the same family. Example: family consisting of one sprite but with instances with different local variables (name)

SpriteFamily.name != Sprite.name
SpriteFamily Is Overlaping Sprite

Does not register any collisions.
B
45
S
11
G
4
Posts: 517
Reputation: 7,398


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests