Godot with Godex - reeseschultz/godex GitHub Wiki

Godex is a module that allow to create games using ECS in Godot. However, it’s an expansion of the Godot engine which mean you can still use Godot as usual.

The idea is to create the gameplay mechanics using Godex, but still use Godot to perform one time operations:

  • Load a new level.
  • Compose and handle the UI.
  • Manage the animations.
  • etc... Of course, the more Godex expands the more things you can handle with ECS and so benefit from it; for now the combination of Godot and Godex gives a big set of features that otherwise is not yet available on other engines. See bevy for example, it doesn’t have an editor while Godex has it: so we can already focus on things that matter more.

Setup Godex to work with Godot.

The aim of Godex is to give a really deep and good ECS support, without any compromise; but still give to the developers the choice to use Godot workflow, as usual (or with more control).

To achieve this, some parts of the engine were moved to a System:

  • CallPhysicsProcess is a System that calls the function _physics_process. Add it if you need that _physics_process is called in your game.
  • StepPhysicsServer3D is a System that process the PhysicsServer. Add it if you need the physics in your game.
  • PhysicsSystemDispatcher is a DispatcherSystem. It's a special system that contains a sub pipeline and dispatches it with a fixed delta.

To make sure that Godot works like usual you have to follow these steps:

  1. In your main pipeline: add the system PhysicsSystemDispatcher (this system has the ability to dispatch the specified sub pipeline with a fixed time step), set the name of the sub Pipeline Physics; we will create it in the step 2. Screenshot from 2021-01-17 11-17-11
  2. Create a new pipeline and call it Physics, so it matches the name specified on the PhysicsSystemDispatcher. The systems in this pipeline are processed with a fixed time, so depending on the physics frame settings these systems may be dispatched more times per frame. Screenshot from 2021-01-17 17-47-23
  3. On the Physics pipeline add the system CallPhysicsProcess and StepPhysicsServer Screenshot from 2021-01-17 17-52-14

At this point the pipeline is set up to process Godot as usual: so _physics_process and the PhysicsServer are called with a fixed delta, as we would expect, and everything is ready to be used.

Of course, if you need that a System run with a fixed delta put it in the Physics pipeline otherwise in the main pipeline. The System order matters so a System that is registered before is also executed before.

💡 Now the physics is fully controlled by the systems, so at editor time and without touching a single line of code, it's possible to fully customize the engine process.

  • If your game needs to process the physics with dynamic delta you can just define the above Systems on the main pipeline.
  • If your game doesn’t need the PhysicsServer, just by not defining StepPhysicsServer it won’t be processed.

So, cutting short, you can customize the processing depending on the game needs.

You can download the example project here: HelloWorld2ECS.zip