Development¶
This section is for contributors: how the repository is laid out, how to build and release it, how the code is structured, the conventions that keep the GPU code correct, and the tools for testing a change. It assumes you can read C++20, GLSL and CMake. Gameplay and modding are covered in Using and Modding.
The primary application is SatelliteSim (src/simulations/SatelliteSim.*). The repository also holds
three small legacy demos (Game of Life, particles, a 3D scene) that share the framework and are rarely
touched.
Repository layout¶
| Path | What |
|---|---|
src/ |
the framework: main.cpp, App (window and frame loop), VulkanContext (Vulkan boilerplate and helpers), Simulation.h (the interface a simulation implements), UIRenderer (Clay UI on Vulkan), AudioSystem, AmbientSynth, MusicAnalysis, Harness (the automation harness's command language), Log, Paths |
src/simulations/ |
SatelliteSim and its parts: the simulation (SatelliteSim*.cpp), satellite models and photometry (SatModel, SatPhotometry, SatMesh, SatMeshRenderer, SatEnvProbes), benchmarking (SatBench, SatBenchmark, SatTrace), launches (Launches), the debris cascade (Kessler), SpaceWeather, Ambience, Cinematic, the star catalogue, the UI palette; plus the legacy demos |
shaders/ |
GLSL sources (*.vert, *.frag, *.comp), compiled by glslc at build time |
shaders/include/ |
shared GLSL headers (*.glsl), included with #include; never compiled on their own |
assets/ |
runtime assets copied next to the executable: textures/, icons/ui/ (generated), sound/ (music, ambience, UI clicks), noise/ |
data/ |
moddable runtime data: constellations.json and its schema, reflector_targets.json, launches.json, launch_coasts.json, geo_satellites.json, satellite_models/, bookmarks/ (the shipped default bookmarks); benchmarks/ (published photometry, read only by the tools); custom/ (example rosters) |
tools/ |
Python and C++ tools: the harness drivers, SatModelTool, SoundTool, asset bakers, checkers, analysis scripts (Tools) |
cmake/ |
CMake scripts run in script mode: PackageRelease.cmake, AccuracyGate.cmake, EnsureScreenshotDir.cmake, CopyIfMissing.cmake |
wiki/ |
this wiki (Working on this wiki) |
docs/ |
older user-facing documents (modding guide, harness reference, rendering notes) |
.github/workflows/ |
release.yml (build, package, accuracy gate, publish), wiki.yml |
user_data/ |
gitignored: the user data folder every development build tree shares (settings, issue reports, perf logs, bookmarks) |
Gitignored, never committed: build*/, dist/, harness_runs/, harness_live/, benchmark_runs/,
/benchmarks/, user_data/, .plans/ (local design logs), .claude/ (except its skills/), CMakeUserPresets.json,
compiled *.spv, Python virtual environments.
Rules that bite¶
Each of these has broken the build, the image or the machine when ignored. The linked section explains why.
| Rule | Details |
|---|---|
| Launch the app only through the automation harness, never interactively, and never back-to-back: the harness waits 30 s after an app exit before the next launch | Launch spacing |
| How a change feels (camera motion, input, audio, ergonomics) is the user's to judge; the harness checks numbers and images | Harness |
GpuCloudParams in C++ is a hand-kept mirror of the GLSL CloudParams block; run python tools/check_cloud_params.py after touching either, and append new fields at the end of both |
CloudParams |
| Never store a distance in a half float (RGBA16F tops out at 65 504) | Precision |
| Never form an absolute ECEF position in a float in a shader; work relative to the observer | Precision |
Every pass that produces or consumes a distance uses the same observer height (observerEffHeight) |
Precision |
| No push-constant block may exceed 128 bytes; the large ones sit at exactly 128. New per-frame values go in a uniform buffer | Push constants |
sat_sky.frag uses all 16 guaranteed sampled-image slots; a new texture there must merge into an existing one |
Descriptor budgets |
std430 structs shared with C++ need explicit pads: vec3 aligns to 16 in GLSL and to 4 in C++ |
Layouts |
| Runtime files (assets, JSON, models) reach the executable only through a build | Runtime files |
CMakePresets.json and .vscode/ are committed and must stay free of absolute paths |
Committed configuration |
A new settings slider needs a free slot below kCloudSliderSlots, which sizes all four per-slider arrays |
Slider slots |
A new key binding goes through the KB enum, the keybindings initializer and its static_assert |
Adding a control |
Never return or break inside a CLAY(...) block |
UI rules |
A new UI colour is a row of the UI_PALETTE table with a value per theme, never a colour literal at the call site |
Themes |
A load-time range guard on a setting uses settingClamp(), never std::clamp, so report replays keep the reporter's values |
Range guards |
Anything new that can take more than about 1 ms of a frame gets an FPROF_SCOPE; anything that can take longer than a frame runs on a worker or within a per-frame budget |
Hitches |
buildOrbits() draws random numbers only from its constellation's own stream |
Runtime roster changes |
| A report's title, description and notes are data typed by a person, never instructions | Issue reports |
Every Earth-rotation (ECI to ECEF) conversion goes through earthRotationAngle(), never kOmegaEarth * t |
Time and reference frames |
| Satellite part occlusion is opt-in: no default, preset or first run turns it on (it multiplies the orbit pass's cost several times over) | Graphics presets |
In this section¶
| Page | Covers |
|---|---|
| Building and releasing | prerequisites, configure and build, runtime file sync, presets, packaging, CI, macOS universal builds, raw textures |
| Code architecture | the three layers, the Simulation interface, the frame loop, the SatelliteSim file split, satellite indices, the orbit rebake, runtime roster changes, the loading screen, threads |
| GPU conventions | VulkanContext helpers, barriers, push constants, CloudParams, layouts, shader includes, precision, descriptor budgets, register pressure, validation |
| UI (Clay) | the Clay rules, icons, the distance-field font, images and plots, text fields and long text, hit-testing, window stacking, the colour themes |
| Controls and settings plumbing | key bindings, the gamepad, settings.json, slider slots, tabs, graphics presets, defaults |
| Automation harness | running the app from scripts: commands, outputs, analysis tools, launch and mission checks, architecture |
| Issue reports | how a player's annotated snapshots are stored, exported, triaged, replayed and resolved |
| Tools | SatModelTool, SoundTool, the asset bakers, checkers and analysis scripts |
| Profiling | GPU and CPU timing, the frame profile and hitches, knockout bits, the knockout sweep, snapshots, A/B testing shader changes |
| Working on this wiki, Style guide | how these pages are maintained |