Skip to content

Use Jolt Physics by default in newly created projects (and progressively set it as the default later on) #12289

@Calinou

Description

@Calinou

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

With Jolt Physics added in Godot 4.4, 3D physics have greatly improved in performance and stability. However, this is not the default, so new users won't get to see these improvements right away.

Additionally, to reduce maintenance overhead, we will want to progressively make Jolt the primary option for 3D physics in Godot. This way, we can focus on making its integration as robust as possible.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

This is how I envision the migration going:

  • In 4.5: Make Jolt the default in new projects by writing project.godot with the 3D physics engine setting set to Jolt Physics.

  • In 4.6: If Jolt is in a state where we can presume it's unlikely to break existing projects, make Jolt the default 3D physics engine, i.e. DEFAULT points to Jolt Physics instead of GodotPhysics3D. Projects that have explicitly specified GodotPhysics3D in the project settings will keep using it, but other projects will switch to Jolt upon upgrading.

  • In 4.7: If we are even more certain that exististing projects won't break, remove GodotPhysics3D to reduce binary size. It can be reimplemented as an extension if a project still needs to rely on its specific behavior for any reason.

    • Removing GodotPhysics3D should not break GDExtension compatibility, as the exposed API does not change in any way. (We will have to keep properties that are specific to GodotPhysics3D though, as extensions may use them.)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

For the first part of this proposal

To make Jolt the default in new projects, we should make the project manager write a project.godot file that sets the 3D physics engine setting to Jolt, similar to what's described in #4834. This should also be done for projects created from the command line by creating an empty project.godot file and pointing the Godot editor to it. (I'll write a dedicated proposal for this later on.)

For the second part of this proposal

To make Jolt the default 3D physics engine, remove this line:

https://github.com/godotengine/godot/blob/9f03bbf9086a1164490cd7cb4e8dd056bf57eac2/modules/godot_physics_3d/register_types.cpp#L54

Then add a similar line here: https://github.com/godotengine/godot/blob/9f03bbf9086a1164490cd7cb4e8dd056bf57eac2/modules/jolt_physics/register_types.cpp#L57

If Jolt is disabled at compile-time, this may require adjustments to keep GodotPhysics3D as the default using #ifdef.

For the third part of this proposal

Remove modules/godot_physics_3d from the Godot source repository, and optionally port it as a GDExtension if needed. It is possible to convert a module to GDExtension with relative ease, and it should remain 100% compatible when doing so. In fact, it's even possible to make a module optionally buildable as a GDExtension (and vice versa), similar to TextServerAdvanced in the Godot source repository.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

This is about improving the new project experience.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions