How the `World` is rendered?

Hello everyone!

I’m new to Thrive codebase, and I’m having hard time understanding how the World is rendered.

So far, I have figured out the followings:
(Correction is always welcome if I’m wrong here.)

  • the CreatureStageBase (parent of MicrobeStage) object has WorldSimulation (parent of MicrobeWorldSimulation) object.
  • WorldSimulation object has World data implemented by DefaultEcs library.
  • When a /Stage/ is created and attached to the Godot node tree, World is instantiated on _Ready() callback.
  • When _Process() is called by the Godot engine to update the scene, the /Stage/ passes down the update to the WorldSimulation and updates the World data through OnProcessFixedWithThreads() or OnProcessFixedWithoutThreads().

The question is “where is the Godot scene update?”. All the code I see here is working on the data itself, and not handling the rendering part.

This might have been my silly oversight though. Thanks in advance.

7 Likes

I don’t have the Thrive code open as I’m taking a break from Thrive development. But from my memory, here’s how it goes:

  • The simulation is given a root Node3D that is the root of the dynamic content of the game scene
  • The simulation forwards that node reference to all relevant systems that need it
  • The graphics related systems directly create and update the graphics nodes for entities they process. You can look in systems like “microbe visuals system” and also “predefined visual loader” and maybe there was a visual attaching system as well, but as I don’t have the code open I can’t look up the exact names.

So the answer to your question is that there is no Godot scene update as such, each system that needs to deal with graphics does it when it runs and directly updates Godot scene nodes.

4 Likes

Ah! spacialInstance was a Node3D that can be updated!

Thank you for such a quick and helpful answer. :slight_smile:

5 Likes