Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / AGK Box2D crash (explode!)

Author
Message
ale870
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location:
Posted: 31st May 2012 11:33 Edited at: 31st May 2012 11:35
Hello,

i know that physics engines are "bad beasts", but I need to solve this problem.
I successfully created a vehicle (multi-tires!) but, sometimes, based on some parameters (joints distance, motor force or speed, etc...) the game crash. The problem is I cannot find any way to trap this exception.
I used many programming languages and I usually use assertions and exceptions to manage unpredictable problems (lazy problems, since my game hangs).

The players will be able to fine-tune the vehicle, so that fine-tuning may crash the game.
How can I avoid that?

Thank you for your help!

EDIT: Sorry I forgot to say I'm working in BASIC (tier 1)

--Alessandro
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 31st May 2012 13:40
Sounds like it's a bug that needs fixing but in the meantime you need to experiment some more and find out what you adjust to cause the crash. If you find you are using very high values for forces it might be worth experimenting with the "setPhysicsScale" command (put it near the start of your code before any other physics commands).

In my experience crashes / bugs in Box2D are generally caused by multiple dynamic objects being squashed up against static / kinematic objects, multiple joints which conflict with each other, joints with limits. Maybe one or two other possible causes...

ale870
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location:
Posted: 31st May 2012 13:57
Thank you for your suggestions. I will try with physicsScale.
In the meantime I got some benefits applying SetSpritePhysicsIsBullet in order to enable continuous collision detection.

The problem seems related to:
objects mass
motor speed and force
joints distance at startup (game crash when starts in certain conditions).

I red in the web that it may happen (physics engines, even in 3d environments, sometimes are "crazy" due to math precision, objects speed, etc...) but the problem in AppGameKit is the game hangs, and there is no way to detect/prevent that.

It seems something like a "system exception" where AppGameKit has no control.

Damn.

--Alessandro
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 31st May 2012 14:10
Some things that might help:
-Make sure wheels don't overlap
-Make sure mass / forces / motor values are set by you or within certain values

You have to play with any physics system to get it right that's true

ale870
17
Years of Service
User Offline
Joined: 17th Jan 2007
Location:
Posted: 31st May 2012 15:45
SetPhysicsScale has no impact on bug.
It seems infact a bug problem related to internal physics calculations.

For example, in my last case, I solved the crash by decreasing the object mass from 50 to 30.

--Alessandro

Login to post a reply

Server time is: 2024-05-03 01:03:39
Your offset time is: 2024-05-03 01:03:39