Collision check question.

Get help using Construct 2

Post » Thu Apr 24, 2014 12:47 am

I just implemented this form of distance-based collision enabling/disabling. It's drastically reduced my collision checks from a max of 200 down to like a max of 10. However the debugger claims far higher CPU % utilization. Exporting to the phone now to check whether this change increases performance due to collision checks reduced, or slaughters performance due to higher CPU utilization.

Edit: Yeah this destroys performance on mobile due to the higher CPU usage all the "For Each" loops cause. Collisions/tick average was about 4 compared to ~80+ though lol.
B
5
S
1
Posts: 16
Reputation: 416

Post » Sun Apr 27, 2014 2:31 am

I did the same thing to my mobile game, but in my case there was a performance boost of about 20%. (went from 2000 checks to 0-40)

I suppose it has to do with the processor on the device, I test on a Galaxy S3.

I'd love to hear an expert's opinion on this.
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Sun Apr 27, 2014 5:37 pm

Yup same here, a clear performance improvement. But i guess this depends on the number of objects you have for which you have to enable/disable collision.
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Sun Apr 27, 2014 6:00 pm

But, after further testing this, I found that there is a limit to what can you do until it starts getting slow again.

If set every object in mi game to "collisions disabled" and make the game check distance for them in order to enable their collision when is going to be needed, the game actually gets slower. But if i only do it for the couple of objects that do the most interactions, the game performs better than without the distance enabling. And not even by much. but it clearly gets smoother. The rest of the objects interact so little with other things that they are better left by default.
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Sun Apr 27, 2014 6:07 pm

I guess that's cause of the higher cpu usage ionC2 mentioned. So we can conclude that there will only be a noticeable performance improvement if we enable/disable collision only with objects that interact most frequently.
B
16
S
4
Posts: 138
Reputation: 1,454

Post » Thu Jun 05, 2014 5:22 am

Definite & noticable boost (about 8-9 -> 12) to performance switching all my "On Collisions" to "Is Overlapping" ... thank you for this.
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Post » Thu Jun 05, 2014 5:36 am

An additional 3 FPS gained when disabling collisions for all planets further than 1000 pixels from player X,Y...

Thank you guys for this. game now running at 15~20 FPS in the iPad simulator haha. :)
Made Cosmochoria - www.cosmochoria.com
Currently working on Slayaway Camp - www.slayawaycamp.com
B
27
S
8
G
3
Posts: 384
Reputation: 5,020

Previous

Return to How do I....?

Who is online

Users browsing this forum: ksiads, marc254, marcinkowski, mtnboy22, Rable and 6 guests