KK Physics and Jolt JNI

Jolt JNI isn’t quite production-ready. As often happens, I discovered rough spots and gaps while writing tutorials. However, a v0.9.9 has been released, and I estimate v1.0.0 is less than a month away.

KK Physics remains a long way from being production-ready. It’s still a prototype, and I may abandon it entirely. If I do, I’ll probably launch a less-ambitious project to simplify using Jolt JNI with JMonkeyEngine. (JME projects can already use Jolt JNI directly; it’s just a tad inconvenient.)

Up till now, I haven’t had any difficulty getting 3rd-party libraries added to the JMonkeyEngine SDK. However, I’m not directly involved in the SDK, and I can’t predict its releases.

5 Likes

SDK uses Minie now and there are no plans to change that. But in your application you can use whatever library you please.

2 Likes

Thanks !!
Just make some tutorials so, it will be easy to use for people like me. its ok if you are completely stop working on KK physics.
No problem !!

1 Like

The Jolt-JNI tutorial is about 50% done, with pages on rigid and soft bodies, constraints, characters, and vehicles, but nothing yet on collision queries or ragdolls or performance tuning. I plan to continue improving the tutorial, but not very intensely.

I’ve begun pointing links at the tutorial website instead of the GitHub project.

Writing sample apps for the tutorial has boosted my confidence in the library. I’ve frozen the API and released a production version: v1.0.0.

9 Likes

Nice. Thanks for your efforts !!

1 Like

With Jolt JNI v1.0 in the jar, I’ve been thinking more about integrating Jolt Physics into JMonkeyEngine.

First, I’m having second thoughts about the name “KK Physics”. It’s short, creative, and easy to remember. However, “jme3-jolt” would be more self-explanatory.

More importantly, a lot of code needs to be written to make Jolt JNI convenient for use in “real games” as opposed to sample apps, performance tests, and demos:

  • Integrate physics into game assets at runtime. This implies:
    • standard scene-graph controls to associate spatials with physics objects such as bodies, characters, vehicles, and ragdolls
    • debug visualization. For this, I envision an AppState with access to both the PhysicsSystem and also any ragdolls and bodyless virtual characters.
  • Integrate physics into game assets prior to runtime. This implies:
    • generating shape settings, rag-doll settings, and/or soft-body settings from scene-graph subtrees
    • The physics scene-graph controls should implement both Savable and JmeClonable. This implies the settings objects should also implement those interfaces.

Serialization is tricky to do correctly, that is to say, with portability between platforms and to future software releases. For instance, Bullet implements serialization at the native level, but Minie doesn’t use Bullet serialization except in one case, where it has caused a lot of trouble.

If I can rely on Jolt Physics to serialize settings objects, that will make JME integration a lot easier.

11 Likes

I learned that Jolt has 2 serialization systems: one for uncooked data (ObjectStream) and one for cooked.

JoltPhysics/Docs/Architecture.md at master · jrouwe/JoltPhysics · GitHub

I’ve begun experimenting with the ObjectStream system. Serializing a rigid body, at least, seems to be straightforward.

Neither system handles physics characters, so I’ve opened an issue for that:

7 Likes

Thank you so much for your work! :partying_face:

3 Likes

You understand that this is completely unrelated to anything in this thread, right?

2 Likes

oh sorry. I posted it here.

ICYMI - discussion of the planned jme3-jolt library has begun: Jme3-jolt physics project

The Jolt-JNI API wasn’t as stable as I hoped it would be. Five days after I released Jolt JNI v1.0.0, the author of Jolt Physics made a minor breaking change to the Jolt Physics API, requiring a corresponding change to the Jolt-JNI API.

The Jolt JNI v2.0.0 release failed due to a process issue: I misunderstood how the new “Portal OSSRH Staging API” works for releases staged from CI hosts. That’s good news, actually, because it should save me from making the same mistake on the JMonkeyEngine project!

Jolt JNI v2.0.1 was released today. Release notes here: Release 2.0.1 · stephengold/jolt-jni · GitHub

I ran a quick performance test using TestManyBoxes, and the result was acceptable.

EDIT: Something went wrong with the v2.0.1 release, and MacOSX_ARM64 artifacts were not published. I am investigating.
EDIT^2: The missing artifacts have now been published. Sorry for the confusion and delay.

7 Likes

Thank You @sgold for your efforts. May God help you and with your efforts you will achieve what JME community needs. Thanks Again !!

2 Likes

It’s been exactly a year since I wrote, “I regard KK Physics as potentially a 3-year project.” That prediction still seems accurate.

My plan to promote Jolt JNI at the LWJGL Discord server is on hold since I discovered how attached the LWJGL community is to PhysX. Before I can articulate the advantages of Jolt over PhysX, I need to learn more about the latter!

My current focus:

  1. designing and prototyping the jme3-jolt library
  2. improving the Jolt-JNI documentation and sample code

In the latter area, I recently developed a Jolt-JNI clone of @skidrunner 's “Rolling the Monkey” game: sport-jolt/java-apps/src/main/java/com/github/stephengold/sportjolt/javaapp/demo/MarbleGame.java at master · stephengold/sport-jolt · GitHub

I consider it worth playing once or twice.

7 Likes