As some of you may know I'm making a game called
World Off Road that uses DarkPhysics as the main basis for all the ingame events.
The game basically operates by giving the player a box and attaching 4 capsules to it with revolute joints as wheels. The player can drive this box around and another one with 4 similar wheels and 4 similar joints is created for splitscreen multiplayer.
So far I've had no major problems using DarkPhysics; each time the game is started and a car and map are chosen, the game sets up all the physics correctly. Then when it's time to stop driving, the user presses escape and the application closes.
The game is nearing release and it's now time to start thinking about adding in proper menu control and all that so I started implementing the cleanup code to remove all the currently in use ingame entities and reset all the variables so the game can be restated with a different car on a different map.
This is all working correctly as far as I'm aware and I've done this many times on other projects so I have no reason to doubt that part of the code.
However, as soon as I try anything like
phy end,
phy clear,
phy delete rigid body, some strange things start happening.
This is regardless of whether I have
phy start at the start of the application and no
phy end - or if I call a
phy start and
phy end each time a map is loaded and unloaded, respectively.
The strange thing that happens under these new circumstances (clearing up the game world) is that every so often it will just crash and offer up the old send error report/don't send error report window. This gives me absolutely nothing to go on.
The other strange aspect of that is that if you recreate exactly what caused the error last time, it may not do it again, or it may do it again. - It's like the bug has a mind of its own and just pops up every so often to annoy me.
So there it is. I have a bug, which I can't recreate, can't debug and don't know anything about and can't seem to solve.
I've tried using phy update and phy clear before after in between and in other funny places for things like loading and unloading the game scenes but all that achieved was it telling me some object was illegal on the command phy update and in a different instance I got that it was object 9 on phy update. (Object 9 is 1 of a handful of rigid bodies being used ingame and is not the first to be removed or added to the game (it's usually second).)
So yeah, I'm stumped... and I can't find anything pointing me in the right direction, someone help please.
WOR can't be completed if I can't fix this, it's pretty much integral to the design that the user can go back to the main menu and choose another race.