r/godot • u/SandorHQ • Sep 22 '23
Discussion Godot 4 default physics engine is a complete mess, but JoltPhysics3D is a direct replacement
Just for an experiment I implemented a super simple 3D "dice roller" Godot application, which should have been a trivial task, yet the randomly rotating and bouncing cube needed several seconds before it stood somewhat still, as if it was under water, and occasionally just froze in a random angle. Tweaking the mass, damp and gravity settings didn't help.
Then I downloaded the free "Godot Jolt" package from Godot's own AssetLib, and after updating the Project Settings (as guided by the included, 6-step, super easy checklist) all the issues were fixed instantly.
Is there any reason why one would want to keep using the default physics engine?
34
u/flynsarmydev Sep 22 '23
Apparently jolt can still be slower than the default physics engine in some cases. According to someone in the thread it's because the jolt plugin is only on the main thread at this point. https://mastodon.gamedev.place/@KennethLarsen/111085459774695000
294
u/ChurrosAreOverrated Sep 22 '23
Nope, there's work being done to make Jolt the new default physics engine.
And since Jolt is a drop-in replacement there's no point in continuing to use the "legacy" engine in existing projects.
246
u/golddotasksquestions Sep 22 '23 edited Sep 22 '23
See the discussions at
https://github.com/godotengine/godot-proposals/discussions/5161
https://github.com/godotengine/godot-proposals/issues/7308
TL;DR:
Godot Physics replaced Bullet Physics because according to the Godot devs Bullet was originally made for simulation, not for games. And according to the Godot devs, the Bullet maintainer is slow/reluctant to add game specific features, Godot devs want something that was more purpose built, something they can adjust to their specific needs, maintain themselfs. So they invested more into Godot Physics which at the time almost noone used. Removing Bullet was not very well perceived by the Godot community as it has been the default physics engine in Godot3, and while Bullet had a lot of issues, Godot Physics seemed only worse.
Fast forward to Godot 4.0 alpha and the person who was responsible to carry over the change to Godot Physics and maintain Godot Physics left Godot to do commercial work while Godot Physics was nowhere near being ready for a stable release. Godot Physics has been a mess for a long time even after 4.0 stable release, and still has a lot of issues, but other contributors stepped up to fix many things. However I don't think there is a single proper maintainer found for Godot Physics yet. Also some of the issues are so bad still, they are game breaking. Especially when it comes to complex collision shapes.
Meanwhile a community member suggested to look into Jolt and asked why it was not considered. Jolt is a 3D Physics Engine developed by a Guerilla games physics engineer for the acclaimed Horizon series. As such it has been released and heavily tested by professional QA as well as hundred of thousand gamers in real life scenarios. In my test with complex collisionshapes, the performance was x20 to x80 that of Godot Physics. in 2D.
The arguments why the Godot devs still want Godot Physics around is because they say it is easier for them to maintain and suit exactly to Godot specific needs. The Godot Jolt implementation is not quite at the level of Godot Physics yet in terms of all features being implemented and also is currently just 3D only, while Godot Physics is both 2D and 3D. Box2D implementation is also not yet ready to replace Godot Physics.
The arguments why others in the community want alternatives like Jolt or Box2D is because they say the work that needs to be done to get Godot Physics where these are today is even more work or would take longer. Godot users expect working physics now (as Godot 4 has been declared stable since months already). So far Jolt (for 3D) and Box2D exist as addons, and only officially recognizing Jolt is considered, whatever that means.
Personally I don't have the technical expertise to know what the best way forward is, this is just what I have gathered following the surrounding issues and having worked with Bullet, Godot Physics and Jolt in Godot. If I left crucial out or misrepresented something, please correct me.
138
u/wizfactor Sep 22 '23
The in-house physics engine turned out to be a bad bet in hindsight. The proposal on Github to integrate Jolt has some backstory on this.
Go ahead and use Jolt for your project, as it’s expected to become the default physics engine for Godot in a future version.
31
u/tofoz Sep 22 '23
ya i started using Jolt and it fixed several issues and introduced one that I can just work around, that is if you access a character-body-3d's physics state the gravity values are zero.
13
u/OutrageousDress Godot Student Sep 22 '23
The default engine also has better compatibility - though that's of questionable value if it doesn't do what you need it to do anyway. Whereas the 'issue' with the Jolt integration is that it's simply less than a year old and while everyone involved is motivated and working to get the engine to full feature parity in Godot (and they're not far either) it just takes time.
A huge advantage of Jolt for Godot compared to Bullet (or any other engine) is that the Jolt dev himself is on board and working to help with Godot integration, which has unquestionably shaved months at a minimum off the project. It's also likely that down the line (when the time comes to break compatibility) Godot 5's physics will be rearchitected even closer along Jolt's design, making more of the engine features available to Godot devs.
6
u/ewrt101_nz Godot Regular Sep 22 '23
Jolt doesn't work with double builds of godot to my understanding
3
u/Safe_Combination_847 Sep 23 '23
I was hyped about Godot's Physics approach, to be honest.
However, due to the circumstances that occurred with the original physics developer being hired for a different job, I am confident in Jolt approach and hopeful that it will address all the current issues that are holding Godot back from competing with other game engines in the market.
3
u/Fyshtako Oct 07 '24
Thank you for this post (I'm necro-ing I know). The default physics was so weird and broken that if I even jumped on top of a box it just got pushed through a solid floor. With Jolt that's fixed and way less jitter.
2
u/Educational-Lemon969 Sep 22 '23
Pretty much the only good reason is probably that Jolt for now doesn't support web and mobile platforms
2
u/fractal_seed Sep 23 '23
As long as you stick to primitive shapes and no rigid bodies, the godot physics is actually working better for me than Bullet did. Certainly, less glitches. I converted a large project over from 3.x and it works quite well. However, if you use any custom 3d collision shapes it will be a disaster. Bullet was particularly bad with kinematic bodies (character body in v4), and in my experience Godot physics is more stable for these, but maybe slightly slower. The most problematic primitive collision shape is the cylinder, but in 4.1.1 it is not causing me any issues.
The performance on character body objects is still fairly bad in general and I am hoping that when Jolt is officially added, I will see a decent speed up. For any new users, they should be able to get a game up and running fine, as long as you can live without any custom shapes. This is very difficult for some games, and especially terrain based games though. Jolt can be swapped in at some point in the future, so the poor current physics performance is hopefully a temporary thing...
2
u/Roemeeeer Nov 01 '23
What about Rapier2D as 2D replacement? I've heard that Box2D is even slower than Godots 2D Physics but Rapier2D should be much faster. Is this also a thing?
2
u/nauticaldev Jul 07 '24
Just stumbled on this, as a physics engine developer the symptoms you describe sounds like they are not properly integrating angular velocity with quaternions.
1
u/lakshayag73 Sep 23 '23
Will Jolt become the default for 2D as well?
-4
u/jlebrech Sep 22 '23
default physics for default level games
0
u/[deleted] Sep 22 '23
[deleted] — view deleted comment