How do I…?
Task-first recipes. Each is a problem, the code, and the gotcha that will bite you.
Where a page is derived from the game's own implementations rather than from a working sample, it says so in a Note — those are the ones to verify against your game version before building on them.
Adding content
| Task | Recipe |
|---|---|
| Add a new machine | Add a building |
| Add a new platform or island | Add an island or platform |
| Put it on the toolbar so it can be selected | Add to the toolbar |
| Make it unlockable through research | Add a research unlock |
| Give it a name that is not a translation key | Add translations |
Load a .fbx model, an icon, or an asset bundle |
Load models and icons |
| Give it sound | Add sounds |
| Make it scale with the player's research | Speed upgrades and buffs |
| Show what it would produce during placement | Placement previews |
| Add behaviour spanning many entities | Add a simulation system |
| Change the rules of the game | Custom scenarios |
New content needs all four of definition, toolbar entry, research unlock, and translations. Miss the unlock and the toolbar entry stays hidden; miss the translation and the player sees a raw key. Add a building is the spine — start there and follow the links.
Reading a running game
| Task | Recipe |
|---|---|
| Run something once a save is actually open | Run code when a game loads |
| Do work every frame without tanking the framerate | Run code when a game loads |
| Find every building of a given type | Find buildings |
| Find the building at a tile | Find buildings |
| Find what the player has selected | React to the player's selection |
| Tell whether a machine is running, starved, or backed up | Read machine state |
| Measure a machine's real throughput | Read machine state |
| Gate a feature on the player's progress | Read research progress |
| Get production rates over time | Read production statistics |
| Measure what a belt or machine is actually moving | Measure throughput |
| Tell a bottleneck from a starved machine | Measure throughput |
| Total up what a platform ships | Measure throughput |
| Know which shape will arrive somewhere, before it does | Read shape predictions |
| Tell whether a region of factory is simple enough to reason about | Read shape predictions |
| Work out what crosses the boundary of a set of platforms | Ports and Notches |
| Measure a factory's ceiling rather than its current rate | Run a detached simulation |
Game systems
| Task | Recipe |
|---|---|
| Read or transform a shape | Work with shapes |
| Read tank levels and pipe networks | Work with fluids |
| Read a wire, or react to a signal | Work with signals and wires |
| Read where trains are and what they carry | Work with trains |
| Read or add to the blueprint library | Work with blueprints |
| Read what is inside a blueprint, or expand one myself | Work with blueprints |
Showing things to the player
| Task | Recipe |
|---|---|
| Add a button to the bottom-right visualization bar | Add a visualization toggle |
| Draw a coloured marker over a building or platform | Draw in the world |
| Draw text in the world without a font | Rendering |
| Stop an overlay showing through the platform above it | Rendering |
| Draw only when zoomed out to the platform view | Draw in the world |
| Show a message, or open the research/statistics screen | Notifications and HUD screens |
| Add a section to the selected building's panel | Building side panel |
| Add a section to the selected platform's panel | Platform side panel |
| Show a live rate in a panel | Platform side panel |
Tooling and shipping
| Task | Recipe |
|---|---|
| Toggle my feature with a key | Bind a key |
| Add a dev console command | Add a console command |
| Store my own data in the player's save | Store data in the save |
| Work out why nothing is happening | Debug a mod |
| Get my mod to players | Publish to the Steam Workshop |
Working out the rest yourself
When there is no recipe, the fastest route is to find where the game does the same thing and copy it — see Exploring the Assemblies. The reference pages explain the types those answers are made of.
Two shortcuts worth internalising:
F1→debug.export-game-dataanswers most "what is this thing called?" questions — definition ids, milestone ids, scenario data.grepthe decompiled tree for a method name to find every vanilla caller, which shows you the intended usage far faster than reading signatures.