Double Precision Worlds #113
-
|
My game will support 64bit floats for world positions as I want to create planet sized environments. I'm wondering if newton has support for this or do I need to make my own partitioning system so that collisions always use 32bit floats and have bodies removed if they get too far away? |
Beta Was this translation helpful? Give feedback.
Replies: 20 comments 12 replies
-
|
yes the engine support double. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
I do not get any crashes in double precision in any of the demos. Also, the code you are showing is guaranteed to produce a memory leak or a crash. For example: ndShapeInstance takes ownership of the ndShape pointer. So my guess is that the crash happens because when Collider goes out of scope, it attempts to delete a reference-counted shape. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
there is no ndMemory::CheckMemory() in current sdk. edit: now the check is also call form the free list The error you are getting is not form the allocation, that error have before. you need to sync to get that. |
Beta Was this translation helpful? Give feedback.
-
|
Synced and rebuilt my project. Error shows an issue in ndMemory.cpp.
|
Beta Was this translation helpful? Give feedback.
-
|
on check memory on each allocation is actually too slow and does even detect when the bug happens.. top find out when that happen, I made the memory integrity check available to the application. you can change it to this and set a break point. at the begining. this way you can narrow down to what function is causing the memory overrun. You have to sync to get that change. |
Beta Was this translation helpful? Give feedback.
-
|
actually, the stack show that this happen early. place the line below in few places in the function CreateBody() |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
put the check before and after new and see if it gets the error. my guess is that the source is and you code do not have the same compile options. try to place more line, until you get the line that override the memory. I just try in the stuff I am working now. an that works in float32 and float64. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
I just try to build the sdk and demo in 32 bit, and it works fine. Is your engine open source? or something I can download and test?
ahh yes, that sound like a good idea. |
Beta Was this translation helpful? Give feedback.
-
|
Okay, try this project if you can and let me know what you think. It's very minimal and I'm not sure if I should set up newton better to show the bug better - but it crashes when using d_ndNewton_d.lib and not using f_ndNewton_d.lib For both lib files I turn ":option("NEWTON_BUILD_SHARED_LIBS" "build shared library" OFF)" to OFF For d_ndNewton_d.lib I turn "option("NEWTON_DOUBLE_PRECISION" "generate double precision" ON)" to ON Those are the only things I change when building newton. |
Beta Was this translation helpful? Give feedback.
-
|
ok I build it and I get the crash. edit: |
Beta Was this translation helpful? Give feedback.
-
|
alright. there are few problems. and they are my fault. That define has no effect when building with avx2 since floats are aligned to 32 bytes. I am guessing this is probably a cause of all those problems that you are getting that seems so weird. the other point is that I see you are copying the code to a folder and making a build. you can open cmake and in the option, you select and installation folder. after you set all the other options that you want. You create the solution. this will copied the entire source code to a flat directory that you can use either use as source or lib. to using, it you only need to include one header I used that method and uploaded you test. please sync, build and see if that works for you now. |
Beta Was this translation helpful? Give feedback.
-
|
Okay thanks.
Yes that is much easier! 😄 EDIT - Got it too build. I'll test with my engine now. |
Beta Was this translation helpful? Give feedback.
-
|
With this setup ofbx is interfering greatly with my game engine. All of ofbx's structs have the same names as my own. Is there a using namespace ofbx somewhere? I'd need to comment that out so I can compile. |
Beta Was this translation helpful? Give feedback.
-
|
Works in my game engine now. Thanks for your help on this one Julio. 😃 |
Beta Was this translation helpful? Give feedback.
-
|
ahh yes, the openfbx, tinyxml, and vhacd are copy as part of the source because they are use by the ndMesh to import external file. what is the other crash? |
Beta Was this translation helpful? Give feedback.
-
|
I’ve updated the namespace from ofbx to ndOfbx. OpenFBX is such an impressive little library, it’s hard to believe how good it is for its size. Back in 2009, I bought 3ds Max 2010 and included the FBX libraries in my project. I guess that’s one of the reasons people have reverse-engineered the format, So it was a great find coming across this tiny library. Anyway, if you sync and re-import, everything should work without any modifications.
It is fine for now, but I am working on the serialization, so that file will be important to run the demos. ndMesh will be a way for end users to shared and debug issues. |
Beta Was this translation helpful? Give feedback.











yes the engine support double.
has you ever build the engine using cmake?
all those options are there.