Dev Log: Declarative, Data-Bound UIBuilder System Online
Date: May 26, 2025
Tags: #ui #framework #nextsteps
Something major clicked into place this week — and it happened fast.
What began as a push to build a clean Orbit Editor UI quickly evolved into the birth of a fully modular, declarative, and data-bound UI system for Colonies: Genesis of E.D.E.N.. It wasn’t just a UI utility — it became a core framework that unlocks dynamic, context-aware simulation control at runtime.
In a incredibly efficient session, we stood up a reusable, extendable system that:
- Constructs UI panels in code via builder-style composition.
- Automatically syncs with live simulation data.
- Scales across domains, from orbits to overlays to capabilities.
This is a massive architectural win.
The System: UIBuilder Architecture
At the heart of this new UI system is the builder pattern, modeled as a composable hierarchy:
- UIBuilderPanel: top-level container
- UIBuilderSection: logical grouping blocks
- UIBuilderField
: reusable typed inputs
Each field is declared in a chainable syntax that mirrors the structure of the UI:
panel.AddSection(“Orbit”)
.AddField(new UIBuilderFloatField(“Eccentricity”).Bind(…))
.AddField(new UIBuilderDropdownField(“Parent Body”).WithOptions(…));
No prefabs. No drag-and-drop. Just declarative logic with visual results.
Built-In Data Binding: The Secret Weapon
What truly sets this apart is native data binding — baked in from the start.
Every field supports:
- A Bind() method accepting:
- A getter (e.g., () => orbit.Eccentricity)
- A setter (e.g., val => orbit.Eccentricity = val)
- Two-way sync between the simulation and the UI
- Optional polling to reflect external changes (e.g., orbit altered by script or simulation logic)
This means:
- When you drag a slider or change a dropdown, the simulation updates in real time.
- When the simulation changes values (e.g. during ticking), the UI reflects those changes without manual wiring.
This isn’t just convenient — it’s the foundation of responsive simulation tooling. Debugging, tweaking, and controlling complex systems becomes fluid.
First Use Case: Orbit Editor Panel
The initial implementation lives in the new OrbitEditorPanel, and already features:
- Fields for semimajor axis, eccentricity, inclination, and orbital alignment
- Automatic synchronization with orbital parameters
- Live updates and visual reflection via bound renderers
This alone unlocks direct in-game tuning of orbital mechanics — and is already being extended.
Planned Field Types and Layout Features
The roadmap is expansive and exciting. Upcoming fields include:
- Dropdowns for selecting simulation definitions
- Sliders for precision tuning with constraints and ticks
- Vector3 inputs for axis control, wind direction, local gravity
- Gradients for custom overlays and field visualization
- Composite fields for bundled input groups (e.g., orbital angles)
- Toggles for capability switches, debug flags, etc.
Layout improvements:
- Collapsible sections
- Auto-grids and flexible alignment
- Label/diagnostic outputs
- Manual refresh buttons or “apply” modes
Forward Vision: Capability-Driven Toolchains
With this framework in place, we now have the power to build dynamic toolbars, context-sensitive commands, and AI-generated interfaces — all backed by the simulation’s capability system.
Imagine:
- A colonist selects a facility — and the toolbar updates to show actions they’re capable of taking.
- A spacecraft is selected — and orbit adjustment panels appear with only valid controls.
- A player unlocks a new tech — and new control interfaces emerge automatically.
That’s where we’re heading. Capability-driven UI generation is now in scope — and this system is how we’ll get there.
Why This Matters
UI work is often treated as a bolt-on. Here, it’s part of the simulation architecture itself. The declarative approach, combined with live binding and a modular layout model, means:
- Fewer bugs
- Less duplication
- More power
- Faster iteration
And — perhaps most importantly — this system makes it possible for simulation, AI, player, and modder to share the same interface logic. That’s not just efficient — it’s transformational.
This content is restricted to site members. If you are an existing user, please log in. New users may register below.