dagon icon indicating copy to clipboard operation
dagon copied to clipboard

Developer experience of using newton-dynamics

Open 0xEAB opened this issue 3 years ago • 2 comments

  • newton-dynamics lacks easily accessible (and comprehensible) build instructions. If I searched long enough, I’d probably find something, but I decided to go with a simple cmake . and hope… Well, apparently this includes building some demo project(s), and because I couldn't find out how to set cmake "variables" (or whatever they are called) within a minute, I decided to patch the CMakeList.txt to generates demos projects" OFF
  • BindBC cannot find libnewton.so which is per default installed to /usr/local/lib/libnewton.so (via make install on Debian GNU/Linux) So I symlinked all of those newton/libd libraries from /usr/local/lib to /usr/lib
  • Missing Symbol NewtonUserJointSetRowSpringDamperAcceleration sorry, I don’t know how to debug this (in a reasonable way), so I commented it out in ~/.dub/packages/dagon-0.13.0/dagon/thirdparty/bindbc-newton-0.2.0/src/bindbc/newton/funcs.d
  • Running an application (the vehicle demo in my case) still doesn’t work :(
    * thread #1, name = 'demo', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
        frame #0: 0x00007ffff79bc76c libdgPhysics.so`dgWorldPluginList::LoadLinuxPlugins(char const*) + 92
    libdgPhysics.so`dgWorldPluginList::LoadLinuxPlugins:
    ->  0x7ffff79bc76c <+92>: rep    cmpsb	%es:(%rdi), (%rsi)
        0x7ffff79bc76e <+94>: seta   %al
        0x7ffff79bc771 <+97>: sbbb   $0x0, %al
        0x7ffff79bc773 <+99>: testb  %al, %al
    (lldb) bt
    * thread #1, name = 'demo', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
    * frame #0: 0x00007ffff79bc76c libdgPhysics.so`dgWorldPluginList::LoadLinuxPlugins(char const*) + 92
        frame #1: 0x00005555555f780b demo`void dagon.ext.newton.world.NewtonPhysicsWorld.loadPlugins(immutable(char)[])(this=0x0000555555e28fd8, dir=(length = 2, ptr = u8"./")) at world.d:162:9
        frame #2: 0x00005555555c3d21 demo`void main.TestScene.afterLoad()(this=0x00005555570526b8) at main.d:111:9
        frame #3: 0x00005555556a4938 demo`void dagon.resource.scene.Scene.update(dagon.core.time.Time)(this=0x00005555570526b8, t=(delta = 0.016666666666666666, elapsed = 5.0890000000000057)) at scene.d:253:17
        frame #4: 0x0000555555666069 demo`void dagon.game.game.Game.onUpdate(dagon.core.time.Time)(this=0x0000555555841a98, t=(delta = 0.016666666666666666, elapsed = 5.0890000000000057)) at game.d:119:13
        frame #5: 0x00005555555f89e1 demo`void dagon.core.application.Application.onAnimationFrame(dagon.core.time.Time)(this=0x0000555555841a98, t=(delta = 0.016666666666666666, elapsed = 5.0890000000000057)) at application.d:298:9
        frame #6: 0x0000555555663e67 demo`void dagon.core.time.Cadencer.update(dagon.core.time.Time)(this=0x0000555555ad3408, t=(delta = 0.017000000000000001, elapsed = 5.0890000000000057)) at time.d:64:13
        frame #7: 0x00005555555f8bea demo`void dagon.core.application.Application.run()(this=0x0000555555841a98) at application.d:321:13
        frame #8: 0x00005555555c75bc demo`_Dmain(args=string[] @ 0x00007fffffffde60) at main.d:388:5
        frame #9: 0x000055555572440c demo`void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).runAll() + 76
        frame #10: 0x0000555555724306 demo`_d_run_main2 + 406
        frame #11: 0x000055555572415e demo`_d_run_main + 158
        frame #12: 0x00005555555c7f52 demo`main(argc=1, argv=0x00007fffffffe0f8) at entrypoint.d:42:17
        frame #13: 0x00007ffff7c81d0a libc.so.6`__libc_start_main + 234
        frame #14: 0x00005555555bdb7a demo`_start + 42
    

0xEAB avatar Aug 20 '22 17:08 0xEAB

Apart from this I’ve had a great experience and pretty much fun using Dagon. Everything else worked out of the box so far.

Kudos for how easy it is to build beautiful looking scenes (by simply following your tutorials and experimenting with a few things).

0xEAB avatar Aug 20 '22 17:08 0xEAB

Unfortunately I can't test under linux, but it must be something related to Newton compute plugins. To use NewtonPhysicsWorld.loadPlugins there must be at least one compatible plugin in the specified directory. Under Windows they are dgNewtonAvx.dll, dgNewtonAvx2.dll, dgNewtonSse4.2.dll, and the engine automatically selects the best compatible one.

If plugins are not used, world.loadPlugins should not be called.

gecko0307 avatar Aug 22 '22 11:08 gecko0307

I've tested under linux with recently compiled libnewton, and it worked for me. Also dagon:newton now provides a local prebuilt library when building the project, and it is loaded if libnewton is not installed system-wide. Still no luck with plugins though. I'll add a notice about that to the README.

gecko0307 avatar Jan 24 '24 20:01 gecko0307