Number of collision checks

Discussion and feedback on Construct 2

Post » Fri Dec 19, 2014 1:06 am

My game contains ~150 objects per level (let's say: 15-20 moving enemies, some boxes and lots of coins) and tilemap. Debug mode shows between 3000-8000 collisions per second, but some times even 12000 (even on static screen). Is it normal? If not - can I improve it somehow?

I already disabled collisions for all background objects.

[My viewport is 1280x720, cell count i.e. 372, layouts are 40.000 - 100.000 width and 6000 height and I scale them to 0.3)]
B
18
S
7
G
1
Posts: 783
Reputation: 4,247

Post » Fri Dec 19, 2014 2:12 am

that's pretty good
B
42
S
17
G
2
Posts: 850
Reputation: 6,209

Post » Fri Dec 19, 2014 2:25 am

What only matters is how your game performs on hardware that you are targeting. You can't observe the number of collision checks outside of the debug environment (which distorts the CPU loading) so you can add a HUD text object to display the fraction of time the CPU is required to perform your game's tasks - the larger the fraction and the closer you are to 1, the closer you are to max-ing out the browser. The debug Profile is an awesome tool to use as well (as long as you use event sheet groups) so you can see if there are any groups that use up a disproportionate fraction of processor time.
A big fan of JavaScript.
B
74
S
20
G
71
Posts: 2,230
Reputation: 44,892

Post » Fri Dec 19, 2014 5:25 am

@Collodium I would like to run smooth game on dual core CPUs (like 14.000 in Antutu) however my last phone is broken, so I can test only on new one (26.000). It's going smooth but my friend has some older tablet, and he can see jittering. I'm using CocoonJS (I tried one time Chromium from CocoonJS, but it just gave me white screen).

or maybe I should ask @Ashley - what exactly means "collisions"? Does 1 object generate 1 collision check?
B
18
S
7
G
1
Posts: 783
Reputation: 4,247

Post » Fri Dec 19, 2014 9:25 am

Actually, that's a pretty good reading. Even at the high end (12,000), that's only 200 checks per tick. If you are only incurring around 2*objectcount number of checks, you are doing something right.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Fri Dec 19, 2014 12:14 pm

szymek wrote:@Collodium I would like to run smooth game on dual core CPUs (like 14.000 in Antutu) however my last phone is broken, so I can test only on new one (26.000). It's going smooth but my friend has some older tablet, and he can see jittering. I'm using CocoonJS (I tried one time Chromium from CocoonJS, but it just gave me white screen).

or maybe I should ask @Ashley - what exactly means "collisions"? Does 1 object generate 1 collision check?



As far as I can tell, a collision test between object A and object B will create A.count*B.Count collision checks, minus the ignored instances via collisions cells or filtering.Behaviors benefits too of the collisions cells which will really help.

a collision check in C2 terms is not yet checking the collisions polygons overlapping, but the bounding boxes (aka the smallest non rotated rectangle that fits the object inside), if those are overllaping, the polycheck (aka collision polygon check) will be tested, this one is far slower so keep an eye on it.

Some behavior combinations (solid, platform, jump thru, LoS, bullet with the bounce off solid) will increase the number of collision checks, but keep in mind that they can benefit from the collision cells, which means they will ignore too far off objects (under some circumstances that you must follow, aka not using different parralax rates for collisions).

while it is true that keeping the number of collisions checks low is nice, testing on the device you are targetting (or ask someone to do so) will be decisive, as there is never a "universally recognized" number of collisions checks to not go over, each device being different.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123


Return to Construct 2 General

Who is online

Users browsing this forum: technofou and 13 guests