Gamestate and World simulation in Godot (part 4) - connecting dots


Let's see how's Mars doing today! Open the planetary view, and check your bases general status, hmm, everything seems to be fine, but let's open the details of this base...

Some of the work this week was to connect the backend (the data structures) with UI, in particular the bases, that now are a children of the terrain tile entity.

This implied building a couple (for now) UI components that directly look into the global data (the persistent world), and visualize it's related elements, let's look at the base manager, this one will visualize all bases scattered around the planet giving you a quick glance at it's status (a few status bars that will give you the main stats: energy, oxygen, food, water, maybe some other more).

How data is managed

I've decided to go this way with data: there is a derived class that will be in charge of each data type, with all the methods I need for that particular data type, for example a method to create the dictionary with the specific fields of that entity type, and another when intialized to retrieve it from the global data structure.

bases data structure

As you can see, the code is pretty simple for now

Visualizing data

In case of the bases, I already have some basic feature, even if I had time only to build a simple UI that lists the bases with it's name and some random generated stats. Each element is a button, for now it doesn't work but by pressing it you'll be able to see, on the right panel, it's buildings, their activity and status, also a few buttons below to give simple commands or to just go to your base and give it a closer look.

As everything is passed by reference, the data modified is immediately reflected in the UI.


I will continue implementing more data structures:

  • Orbit entity: one for each orbit (it could be like a few low orbit, and progressively up to geostationary, or even large elliptical ones).
  • Orbital platform: it can be a single component, like a small satellite probe, or even a large space base
  • Orbital component: it can be any object that can exist in space (a cargo container, a landing capsule, solar panels, propulsion modules, etc)

Once I have then I'll continue with it's integration in the game (show them in the menu as well as visually in the 3D world).

This is for now the last post about the data structures work I'm doing. From this post on I'll probably send updates less often (1 every 10 to 15 days), as I need to work for some customers so that I can get the money for a living...

Leave a comment

Log in with itch.io to leave a comment.