comparing distance vs collision detection

Discussion and feedback on Construct 2

Post » Tue May 05, 2015 4:26 pm

Is it possible that comparing the distance between objects would be faster then comparing collisions/overlapping objects? I guess this would create a purely radial "collision" but if it could increase performance...
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Tue May 05, 2015 4:57 pm

no, collision detection is optimized.. it wouldn't be any good if doing your own collision testing was better/faster.

better to have less points in your collision poly

also put collision triggers in groups that can be deactivated when you know for sure those objects are not to be tested for collisions.
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

Post » Tue May 05, 2015 10:56 pm

powerwaffle wrote:Is it possible that comparing the distance between objects would be faster then comparing collisions/overlapping objects? I guess this would create a purely radial "collision" but if it could increase performance...

If you do it correct it will increase performance a great deal using distance rather than pure collision. Like if you use a distance check to turn off collision of objects that are more than X distance from what needs to be checked. There have been a lot of discussion about this topic and some say it doesn't work. But personally from my own tests and experience, I would still use "Is overlapping" and distance checks, and as much as possible avoid "On collision" if I want the best performance. But again that's just my experience and not going to get into a discussion regarding this topic again, so its just my advice :D
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Wed May 06, 2015 1:00 am

You do not need to optimize your collision checks that way - Render Cells ensure that such actions are superfluous. On Collision demands more of the engine than Is Overlapping checks, but Is Overlapping will give True if one instance is overlapping and will not trigger again if a second occurs while the first is still true (in case you use Trigger Once, it will only trigger for the first Is Overlapping), so use it wisely to give best performance but understand its limitations. Read through this thread for a complete discussion on testing for collisions.
I only occasionally visit - I'm learning C# for Unity, but c2 is still a respectable game engine imo....
B
73
S
19
G
66
Posts: 2,198
Reputation: 42,193

Post » Wed May 06, 2015 1:58 am

Colludium wrote:but Is Overlapping will give True if one instance is overlapping and will not trigger again if a second occurs while the first is still true


oh cool, I wasn't aware of this... I only use isOverlapping for laser beams...good to know, thanks!
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

Post » Wed May 06, 2015 2:07 am

While I got you guys here. My game has been crashing since I put ads in. I've exported with coocon.js to android. How can I check the log to see where the crash is happening? And if it's in the cocoon launcher, that kind of defeats the purpose because the test ads work fine.
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Wed May 06, 2015 2:09 am

I don't think cocoon.js is still supported... I don't use it myself.. but you may want to look into it..
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

Post » Wed May 06, 2015 5:42 am

I just find cocoon performs so much better then webview. And it's not all blurry either. Maybe the new construct release is just not getting along with cocoon anymore? Blah. The only problem i've encountered is this with the ads. When I tested with XDK I was getting all sorts of weird stuff happening. Plus it ran pretty bad... and looked blurry. It's frustrating. Been working a while on my game and it's like a download thats stuck at 99% lol
B
13
S
4
Posts: 61
Reputation: 1,028

Post » Wed May 06, 2015 8:41 am

Every single collision check first verify if the bounding boxes are overlapping before doing the actual check, so I am unsure the result will work out that much with distance, even though a pick nearest before a collision seems to perform better (when it can be used).
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093


Return to Construct 2 General

Who is online

Users browsing this forum: kanjmarrie and 5 guests