Less collisions worse performance?!?

Get help using Construct 2

Post » Sat Feb 18, 2017 9:59 pm

So im making my platformer and first level is almost complete.
Enemies use platform behavior and i see that i have over 3000 collision checks per tick. Game plays smooth 60fps on pc but choppy on mobile.
I set enemy platform behavior disabled, gravity to zero, collisions disabled and then with event ->when enemy is on screen->enable platform and collisions.
Great! Collision checks per tick dropped to 30!

The weird thing is that performance took a huge hit! 15fps (with 3% CPU usage) on pc and didnt even check it on mobile.
Why did that happened?
B
26
S
6
G
2
Posts: 85
Reputation: 2,638

Post » Sat Feb 18, 2017 10:03 pm

event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
Image ImageImage
B
172
S
50
G
182
Posts: 8,432
Reputation: 115,083

Post » Sat Feb 18, 2017 10:15 pm

newt wrote:event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions
event ->when enemy is on screen->enable platform and collisions


Enemy->is on screen->Enemy->Set Collisions enabled
.......................................Enemy->Set Platform enabled
B
26
S
6
G
2
Posts: 85
Reputation: 2,638

Post » Sat Feb 18, 2017 10:25 pm

Every tick
Image ImageImage
B
172
S
50
G
182
Posts: 8,432
Reputation: 115,083

Post » Sun Feb 19, 2017 12:08 am

newt wrote:Every tick


And thats worse than checking 3000 collisions every tick?
B
26
S
6
G
2
Posts: 85
Reputation: 2,638

Post » Sun Feb 19, 2017 12:27 am

Well I don't see where you set the collisions to stop when it's not on screen so it's going to be even worse at some point.
Anyway, I have no idea how many objects you have on screen at any point in time so yeah that could slow it down a lot.

Then you may have some other events that cause some issues because you have set collisions and platform behavior off.

The ideal method would be to turn collisions on when you get to a certain zone once, and turn it off when you leave that zone to go to another.
Image ImageImage
B
172
S
50
G
182
Posts: 8,432
Reputation: 115,083

Post » Sun Feb 19, 2017 12:47 am

newt wrote:Well I don't see where you set the collisions to stop when it's not on screen so it's going to be even worse at some point.
Anyway, I have no idea how many objects you have on screen at any point in time so yeah that could slow it down a lot.

Then you may have some other events that cause some issues because you have set collisions and platform behavior off.

The ideal method would be to turn collisions on when you get to a certain zone once, and turn it off when you leave that zone to go to another.


Well, i feel stupid but this never hapened to me before. Ive restarted my pc and everything works fine now. Collision checks from 3000/tick are now 30/tick and performance is 60 fps on pc. Also smooth gameplay on my Galaxy S4 but about 15-18fps on a dualcore $50 tablet (as expected)

PS Thank you very much for your replys. Ill keep in mind the zones method though.. :)
B
26
S
6
G
2
Posts: 85
Reputation: 2,638


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests