[quote:479cjqvv]Wait, what? I'm 99% sure 'on collision' and 'is overlapping' are exactly the same performance-wise.
nimos100
where did you get this info?
I cant explain exactly how they work as I simply don't know. But its based on pure testing. You can actually check it with that program I linked earlier. If you just add that event, and disable the other.
Here are some data from my tests:
(The collision group is a functionality I added, trying to optimize collision checking, if you wonder what it is, its not an event or action you find in C2)
Using overlapping (With the Collision group disabled)
Number of objects: 2490
FPS: 8-9
Collision checks per sec: 18000-21000
Using On collision event (With the Collision group disabled)
Number of objects: 2512
FPS: 2-3
Collision checks per sec: 1013025+
Using overlapping (With the Collision group Enabled)
Number of objects: 2501
FPS: 29-30
Collision checks per sec: 12000-15000
Using On collision event (With the Collision group enabled)
Number of objects: 2464
FPS: 3-4
Collision checks per sec: 2048000-3100000
These are my tests that I just did, as it removes overlapping objects before checking collisions, there is a slight difference in amount of objects. But nothing that will change the results in any significant way.
But if you look at the collision per secs, which is from the debugger, it goes nuts on the On collision event, even when you remove the squares that are overlapping. So something is clearly not the same but there aint really a lot you can do with the "On collision" event as its part of C2 and cant be modified.
[quote:479cjqvv]Obviously doing a simple distance check is less expensive than a collision check, but you lose polygon data.
My program only uses small squares so whether the tests would differ if it was random shapes I don't know or whether it would have an impact on the polygon collision mesh accuracy when doing collision checking. However I do actually think that the result would be pretty much the same as them being simple squares, but I haven't tested it.