Collision Checks Increase on Middle of the Layout [HELP]

Discussion and feedback on Construct 2

Post » Fri Jan 13, 2017 3:50 am

Hello,
In my game, when the character is on the left or right of the layout, the collision checks are low (~20/tick)
But when the character is on the middle of the layout, suddenly the collision checks became ~50-80/tick
I tried disabling the of the code on my event sheet 1 by 1 until all of them are disabled, and the collision checks still spikes when on the middle of the layout


Here's the simplified version of the problem (in this case, the collision checks only change from ~3/tick to ~7/tick)

https://imgur.com/a/kbfek
Last edited by hsetiawan on Fri Jan 13, 2017 4:09 am, edited 3 times in total.
B
41
S
21
G
27
Posts: 39
Reputation: 17,252

Post » Fri Jan 13, 2017 3:54 am

My guess is there's less collision checks because half of the collision box is not on the screen?

My other guess is that this isn't causing you any problems.. am I right? If not, why worry about it?
Last edited by spacedoubt on Fri Jan 13, 2017 4:00 am, edited 2 times in total.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Fri Jan 13, 2017 3:58 am

spacedoubt wrote:My guess is there's less collision checks because half of the collision box is not on the screen?

My other guess is that this isn't causing you any problems.. am I right? If not, why worry about it?


Well, in the middle there should be less collision checks than the left / right side of the layout

I worried because this game is for mobile and in 1 level there will be a lot of collision checks, and i'm trying to reduce it right from the start
B
41
S
21
G
27
Posts: 39
Reputation: 17,252

Post » Fri Jan 13, 2017 4:03 am

Well, I'd start with the manual:

Collision checks/sec (e.g. 1144 (~22 / tick)): how many times in the last second the engine had to test for a collision between two objects. Collision checks are invoked by the On collision or Is overlapping sprite conditions, and many behaviors perform additional collision checks automatically. In brackets, the average checks per tick is also shown. For example if there were 600 collision checks in the last second and the framerate is 60 FPS, the estimated checks per tick will be 10. This tells you on average there were about ten collision checks per frame, although the actual value will often vary frame-by-frame.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Fri Jan 13, 2017 4:06 am

spacedoubt wrote:Well, I'd start with the manual:

Collision checks/sec (e.g. 1144 (~22 / tick)): how many times in the last second the engine had to test for a collision between two objects. Collision checks are invoked by the On collision or Is overlapping sprite conditions, and many behaviors perform additional collision checks automatically. In brackets, the average checks per tick is also shown. For example if there were 600 collision checks in the last second and the framerate is 60 FPS, the estimated checks per tick will be 10. This tells you on average there were about ten collision checks per frame, although the actual value will often vary frame-by-frame.


I see
Thank you so much for the detailed explanations
and also, you're right, the middle of the layout has more instances of solid objects.
In this types of game (platformer), which is better:
1) put the solid behavior on the tilemap directly
2) put the solid behavior on other object (sprite or tiled background)
B
41
S
21
G
27
Posts: 39
Reputation: 17,252

Post » Fri Jan 13, 2017 4:09 am

I'm not sure it makes a whole lot of difference (I might be wrong). I suppose the less solid objects you have to use, the better.

These are good reads if you haven't read them already:

https://www.scirra.com/blog/83/optimisation-dont-waste-your-time

https://www.scirra.com/manual/134/performance-tips


EDIT: Also, I think if you'll search the forums you can find some threads discussing reasonable ranges of collision checks..
Last edited by spacedoubt on Fri Jan 13, 2017 4:12 am, edited 2 times in total.
B
86
S
43
G
71
Posts: 601
Reputation: 43,619

Post » Fri Jan 13, 2017 4:11 am

spacedoubt wrote:I'm not sure it makes a whole lot of difference (I might be wrong). I suppose the less solid objects you have to use, the better.

These are good reads if you haven't read them already:

https://www.scirra.com/blog/83/optimisation-dont-waste-your-time

https://www.scirra.com/manual/134/performance-tips


Okay, Thank You so much for the help ! :D :D
B
41
S
21
G
27
Posts: 39
Reputation: 17,252


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 17 guests