How a Molten game is put together
Molten gives every job in a game its own name, its own file type and one rule for how it connects to the others. There is no general-purpose "scene" that nests into everything.
| Concept | What it is | Where it lives | Example |
|---|---|---|---|
| Asset | A raw file: mesh, texture, sound, shader, font. No behavior | assets/** |
models/cube.gltf |
| Component | A named bundle of data | components/*.cast (or built in) |
Health, Transform |
| Object type | A kind of thing: components, values, parts | objects/*.object |
Player, Crate |
| Object | One instance of an object type in the world | runtime only, reached by Handle<T> |
the crate by the door |
| Level | A place: lighting, placed objects, spawn points | levels/<name>/ |
levels/yard/ |
| Screen | What the game is doing now; owns UI, picks the level | screens/*.screen |
MainMenu, Playing |
| UI | Widgets with flexbox/grid layout and CSS-like styles | ui/*.ui + .style |
the HUD |
| Behavior | Code that runs every tick on objects with certain components | behaviors/*.cast |
health regen |
The project layout
mygame/
game.toml project settings and the first screen
screens/ main_menu.screen playing.screen pause.screen
levels/ farmhouse/ (farmhouse.level + chunks/) town/
objects/ player.object zombie.object shotgun.object
ui/ hud.ui hud.style hud.cast
components/ health.cast movement.cast
behaviors/ movement.cast health.cast zombie_ai.cast
native/ optional hand-written C
assets/ models/ textures/ sounds/ shaders/
The folder names for components/, behaviors/ and ui/ are a convention: the compiler
reads every .cast file in the game folder except under native/, assets/ and folders
starting with .. The concept folders (screens/, levels/, objects/) and game.toml
are fixed.
How the pieces connect
Every connection is a name written in text. Nothing is dragged into anything else.
game.tomlnames the first screen, sayMainMenu. Its.screenfile loads no level and showsui/menu.- The menu's Play button calls a Cast function that runs
switchScreen("Playing"). playing.screennames the levelfarmhouse. Switching to it loadslevels/farmhouse/, which places objects by type name (Barn,Zombie).- Some Cast code spawns the
Playerat the level's spawn point. - Behaviors run every tick on every object that has the components they ask for, including the player.
Rules worth knowing early
- Parts are the only nesting. An object type can have parts (a camera on the player, wheels on a car). A part is attached to its owner and is destroyed with it.
- Levels never contain screens, UI or players. Players are spawned.
- Exactly one level is loaded at a time (or none).
- Screens are a stack.
pushScreenputs a pause menu on top;popScreenreturns to the screen below untouched. - State lives in engine memory, in components and arenas. Your code can be swapped at any frame without losing anything. See Live reload.
- Gameplay refers to objects by handle, never by pointer. A handle to a destroyed
object resolves to
null.
Compared with scenes and prefabs in other engines
If you know Unity, Godot or Unreal, this table maps the ideas:
| Molten | Unity | Godot | Unreal |
|---|---|---|---|
Object type (.object) |
Prefab | A scene used as a reusable node | Blueprint class |
| Object | GameObject instance | Node instance | Actor |
| Component (data) | MonoBehaviour fields / ECS component | Node properties | Actor component properties |
| Behavior (code over components) | MonoBehaviour Update / ECS system |
_process script |
Tick function |
| Part | Child GameObject in a prefab | Child node | Child actor component |
| Level + chunks | Scene | Main scene | Level / World Partition cells |
| Screen | A scene for menus, or a UI state machine | A scene switched with change_scene |
Game mode / UMG widget flow |
UI (.ui + .style) |
UI Toolkit (UXML + USS) | Control nodes + themes | UMG |
Handle<T> |
Object reference (null-checked) | WeakRef |
TWeakObjectPtr |
The main difference: in Molten these are different kinds of file, each with its own schema, instead of one kind of scene that can be all of them. A level can't accidentally contain a menu, and a screen can't contain placed objects.