[SOLVED] Crash on destroying bodies

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

Re: [SOLVED] Crash on destroying bodies

Postby Julio Jerez » Wed Nov 27, 2019 11:25 am

also if I launch the demo and I do no see anythong, there a list of messages liek this

    [Newton] Body outside world destroyed: 1B728FE0 - location 113.47669, -84.45722, -0.02262
    [Newton] Body outside world destroyed: 1C445540 - location 111.32338, -81.28863, -0.02350
    [Newton] Body outside world destroyed: 1C445540 - location 107.83714, -75.61535, -0.02350
    [Newton] Body outside world destroyed: 1C448720 - location 107.83714, -75.61535, -0.02350
    [Newton] Body outside world destroyed: 1C448720 - location 107.83714, -75.61535, -0.02350
    [Newton] Body outside world destroyed: 1C448720 - location 107.83714, -75.61535, -0.02350

are these game erro message for bodes that are falling thought the floor?
if that is the case that may be easier to debug, anyway I am late now I continue tomorrow
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [SOLVED] Crash on destroying bodies

Postby JernejL » Wed Nov 27, 2019 11:33 am

Those messages about body leaving world are because actors are falling thru ground - they are all a result of ground collisions failing (not the other way round)

Game has only one newton world so that is not a factor.

I could not get dgIntersections.h line 137 assert to repeat but am running a continous test so i could get a proper stack trace.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [SOLVED] Crash on destroying bodies

Postby Julio Jerez » Wed Nov 27, 2019 12:11 pm

Ah ok that makes simpler to debug.

I thing we leave early from work, if so I will debug it.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [SOLVED] Crash on destroying bodies

Postby JernejL » Wed Nov 27, 2019 12:23 pm

The message is once the actors falloutaide bounds tho, which is around 0.0 z not inmediately afzer going thru ground
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [SOLVED] Crash on destroying bodies

Postby JernejL » Wed Nov 27, 2019 12:37 pm

If you want, i can add a screen display with newtonbody pointers on each shape, so you can set breakpoints and inspect specific body of interest?
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [SOLVED] Crash on destroying bodies

Postby Julio Jerez » Wed Nov 27, 2019 12:54 pm

Not the pointer, the unique id.

I do not remember the name of the function now, but every body has a unique I'd that can be collected from the app.
I used this for debug.

If you add a trace line that prints the player unique I'd that will help a great deal.
If you run the SDK and you pick a body from the screen, you will see it trace the body of, it is a huge time saver when debugging.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [SOLVED] Crash on destroying bodies

Postby JernejL » Wed Nov 27, 2019 2:40 pm

I've added display of the value that is returned NewtonCreateDynamicBody and it's userdata - if this helps:

Image

Updated:
https://gtamp.com/tdc/tdc_demo_error.7z
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [SOLVED] Crash on destroying bodies

Postby Julio Jerez » Wed Nov 27, 2019 2:50 pm

no, no, use function to trace the body user unique ID NewtonBodyGetID(m_targetPicked);

if I can determine the use ID of the player, then I can debug that body history.
Pointer are hard because if I run again the point is different.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [SOLVED] Crash on destroying bodies

Postby JernejL » Wed Nov 27, 2019 3:12 pm

Ok, i added body ID now aswell, it now shows all 3 values. body ID is written in decimal (not hex)

Image

link to changes: https://gtamp.com/tdc/tdc_demo_error.7z

Edit: seems like body id is predictable, the first body for player seems to be always 50.

But when player dies, the body is removed and re-created and has a different value next time.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [SOLVED] Crash on destroying bodies

Postby Julio Jerez » Wed Nov 27, 2019 4:23 pm

JernejL wrote:Edit: seems like body id is predictable, the first body for player seems to be always 50.

nice, that make it much easier, yes after player dies Ii will get a new ID, but that that does not matter. once we fix the bug is not longer a problem.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [SOLVED] Crash on destroying bodies

Postby JernejL » Thu Nov 28, 2019 6:18 am

Ok, after running for a while i got this newton crash - this is debug newton build, maybe this is relevant?

Code: Select all
First-chance exception at 0x79B0BBCB (newton.dll) in TDC.exe: 0xC00002B5:  Multiple floating point traps (parameters: 0x00000000, 0x00009D33).
Unhandled exception at 0x79B0BBCB (newton.dll) in TDC.exe: 0xC00002B5:  Multiple floating point traps (parameters: 0x00000000, 0x00009D33).


Code: Select all
>   newton.dll!dgVector::Floor() Line 279   C++
    newton.dll!dgBroadPhaseNode::SetAABB(minBox={...}, maxBox={...}) Line 96   C++
    newton.dll!dgBroadPhase::UpdateBody(body=0x24ea2260, threadIndex=0) Line 740   C++
    newton.dll!dgBody::UpdateCollisionMatrix(timestep=0.0166666675, threadIndex=0) Line 262   C++
    newton.dll!dgWorldDynamicUpdate::IntegrateVelocity(cluster=0x18dcaa68, accelTolerance=0.500000000, timestep=0.0166666675, threadID=0) Line 628   C++
    newton.dll!dgWorldDynamicUpdate::ResolveClusterForces(cluster=0x18dcaa68, threadID=0, timestep=0.0166666675) Line 677   C++
    newton.dll!dgWorldDynamicUpdate::CalculateClusterReactionForcesKernel(context=0x17b5fd9c, worldContext=0x18d80f40, threadID=0) Line 458   C++
    newton.dll!dgThreadHive::dgWorkerThread::RunNextJobInQueue(threadId=0) Line 224   C++
    newton.dll!dgThreadHive::dgWorkerThread::ConcurrentWork(threadId=0) Line 243   C++
    newton.dll!dgThreadHive::dgWorkerThread::Execute(threadId=0) Line 260   C++
    newton.dll!dgThread::dgThreadSystemCallback(threadData=0x18e1bcc4) Line 201   C++
    newton.dll!std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *>::_Do_call<,0>(_Myfargs={...}, __formal={...}) Line 1149   C++
    newton.dll!std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *>::operator()<>() Line 1138   C++
    newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Run(_Ln=0x01f4e774) Line 196   C++
    newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Go() Line 187   C++
    newton.dll!_Call_func(_Data=0x01f4e774) Line 28   C++
    newton.dll!_callthreadstartex() Line 376   C
    newton.dll!_threadstartex(ptd=0x18e231f8) Line 359   C
    kernel32.dll!@BaseThreadInitThunk@12()   Unknown
    ntdll.dll!__RtlUserThreadStart()   Unknown
    ntdll.dll!__RtlUserThreadStart@8()   Unknown



Locals:

Code: Select all
+      this   0x21d5f5d0 {m_f=0x21d5f5d0 {956.016846, -660.131042, -2.14749901e+009, 0.000000000} m_i=0x21d5f5d0 {...} ...}   const dgVector *
+      truncated   {m_f=0x21d5f480 {-107374176., -107374176., -107374176., -107374176.} m_i=0x21d5f480 {-858993460, -858993460, ...} ...}   dgVector
+      ret   {m_f=0x21d5f430 {-107374176., -107374176., -107374176., -107374176.} m_i=0x21d5f430 {-858993460, -858993460, ...} ...}   dgVector



Edit: this crash happens regularly, i had it happen again - call stack looks same:

Code: Select all
>   newton.dll!dgVector::Floor() Line 279   C++
    newton.dll!dgBroadPhaseNode::SetAABB(minBox={...}, maxBox={...}) Line 96   C++
    newton.dll!dgBroadPhase::UpdateBody(body=0x1839ce60, threadIndex=2) Line 740   C++
    newton.dll!dgBody::UpdateCollisionMatrix(timestep=0.0166666675, threadIndex=2) Line 262   C++
    newton.dll!dgWorldDynamicUpdate::IntegrateVelocity(cluster=0x18a3a99c, accelTolerance=0.500000000, timestep=0.0166666675, threadID=2) Line 628   C++
    newton.dll!dgWorldDynamicUpdate::ResolveClusterForces(cluster=0x18a3a99c, threadID=2, timestep=0.0166666675) Line 677   C++
    newton.dll!dgWorldDynamicUpdate::CalculateClusterReactionForcesKernel(context=0x179afd9c, worldContext=0x189f0d00, threadID=2) Line 458   C++
    newton.dll!dgThreadHive::dgWorkerThread::RunNextJobInQueue(threadId=2) Line 224   C++
    newton.dll!dgThreadHive::dgWorkerThread::ConcurrentWork(threadId=2) Line 243   C++
    newton.dll!dgThreadHive::dgWorkerThread::Execute(threadId=2) Line 260   C++
    newton.dll!dgThread::dgThreadSystemCallback(threadData=0x18a8db94) Line 201   C++
    newton.dll!std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *>::_Do_call<,0>(_Myfargs={...}, __formal={...}) Line 1149   C++
    newton.dll!std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *>::operator()<>() Line 1138   C++
    newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Run(_Ln=0x01f4e774) Line 196   C++
    newton.dll!std::_LaunchPad<std::_Bind<1,void *,void * (__cdecl*const)(void *),dgThread *> >::_Go() Line 187   C++
    newton.dll!_Call_func(_Data=0x01f4e774) Line 28   C++
    newton.dll!_callthreadstartex() Line 376   C
    newton.dll!_threadstartex(ptd=0x18a9e128) Line 359   C
    kernel32.dll!@BaseThreadInitThunk@12()   Unknown
    ntdll.dll!__RtlUserThreadStart()   Unknown
    ntdll.dll!__RtlUserThreadStart@8()   Unknown

Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [SOLVED] Crash on destroying bodies

Postby Julio Jerez » Fri Nov 29, 2019 2:51 pm

I think I found the bug, it was a mesh convex optimization I made when making the vehicle.

I believe it is fixed now, I do not see the message body leaved world delete anymore.

I did not know your objects were so small. They are tiny, the player is 0.15 of a unit, when I saw it, I though it was another bug but is was not. Small size objects is the Kryptonite of many popular physics engines. I am surprise it works so well for you.

Anyway please try again and tell me if you get more bug after this fix, I think those you found were a consequence of the body missing the polygon collision.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: [SOLVED] Crash on destroying bodies

Postby JernejL » Fri Nov 29, 2019 3:48 pm

Amazing - yes, the bug is now fixed!

I did not know there could be a issue with that body size - i actually have even smaller objects and they work well ( traffic cones are smaller ) - So i never had a scaling problem - they all worked really well until this one glitch, and this is also now fixed :)

Would you suggest or recommend that i scale up my world?

I will still check if dgVector::Floor() Line 279 assert still happens and report on that.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

Re: [SOLVED] Crash on destroying bodies

Postby Julio Jerez » Fri Nov 29, 2019 4:11 pm

JernejL wrote:I did not know there could be a issue with that body size -...
Would you suggest or recommend that i scale up my world?

ahh but that has been, and still is, the huge problem of all game physics engines for may reasons, beleive me.
In newton the collision is not a problem but the dynamics could be if a body moves fast enough that it can travel more than half the smallest collision shape thickness in a time step. but for that we have continue collision to the rescue.
My suggestion is that for your players and vehicles which seem fine you do not need to do anythong extra, but the very small objects, you could try setting CCD option on, see how that works.
CCD is cost effective, it only kicks in when a body speed is fast enough in the direction of the collsion that can tunnel thought, otherwise it is not any extra cost.
Julio Jerez
Moderator
Moderator
 
Posts: 12249
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Crash on destroying bodies

Postby JernejL » Sat Nov 30, 2019 8:20 am

I already turn on ccd on cars that have sufficient velocity, would there be benifit if i scale up world? I plan to have scale up to 1000 x 1000 units max, each box in my game is 1x1 unit in size.
Help improving the Newton Game Dynamics WIKI
User avatar
JernejL
 
Posts: 1578
Joined: Mon Dec 06, 2004 2:00 pm
Location: Slovenia

PreviousNext

Return to Bugs and Fixes

Who is online

Users browsing this forum: No registered users and 7 guests

cron