by

Introducing Stagemaster

(
May
04
)

In order to take a small break from thinking about economics, while still doing something useful for it, I decided to work on engine code for creating user interfaces.

Although the prototypes thus far already contained a pretty flexible and nice system for complicated mouse interactions with objects in the 3D game world (creating, selecting, modifiying roads and lanes with drag and drop), keyboard interaction was pretty rough and 2D user interfaces (buttons, texts, info windows, menus, ...) were pretty much nonexistent.

Both Herbstein and kingoflolz, two of my most avid contributors, already went great lengths towards better keyboard interaction (such as rebindable key bindings) and their ideas were a direct inspiration to what I ended up implementing.

Regarding the 2D user interface part, I originally planned to write a UI library from the ground up, just like I did for interaction with the 3D world. But then, in the spirit of keeping things simple, I decided that I don't really need to revolutionize good ol' button-clicking and text-showing and instead opted to use an existing 2D user interface library.

I decided to use "dear imgui", a library that's really popular with game developers and already contains a huge catalogue of useful controls like sliders, scrollable windows, ... pretty much whatever you will ever need. People create all kinds of simple and complex UIs with it.

Even though using "dear imgui" would save me a lot of work, integrating it still brought some challenges:

But the biggest challenge was probably:

So I unified all of that and called it Stagemaster, which is now the one and only part of the engine to:

Here is the first screenshot of Stagemaster in action:

As you can see, it shows the debug info we all know and love, as well as a fully-functional control settings menu for camera control and plan editing!

The best thing is that with this set up, it is now really easy for me to add all kinds of UI.

This will not only mean that I will finally put a stronger focus on that in the upcoming prototypes, but also that I will be able to write some really nice inspection and debug UI to look at individual households and companies while developing the economy simulation.

What else I did in the past couple days:

As always, let me know what you think!

Discussion on /r/Citybound
Support Citybound