Godot Export Pipeline
The @world-forge/export-godot package converts a WorldProject into a structured content pack with .tscn scene generation for Godot 4.
Pipeline Overview
Section titled “Pipeline Overview”- Validate —
validateProject()runs structural checks. Invalid projects fail with detailed error context. - Convert zones —
Zone[]becomes Godot spatial resources with 2D coordinate transform (grid → Godot 2D). - Convert content — entities, items, connections, dialogues, loot tables, spawn markers, and transitions.
- Convert tiles + interiors —
TileLayer[]→TileMapLayer+TileSet(bakedtile_map_datafor image tilesets), non-walkable cells → wallStaticBody2Dcollision, and props → aNode2Dcontainer. - Convert town — markets + crafting stations, and buildings / hubs / strongholds (
convert-economy,convert-structures). - Convert world modeling — vertical strata + links (
convert-strata), typed hazards (convert-hazards), and zone entry gates (convert-gates). - Build scene —
buildWorldScene()generates a single playable.tscnfrom all of the above. - Build asset bindings — sprites, portraits, and backgrounds mapped to Godot resource paths.
- Fidelity report — structured tracking of lossless, approximated, and dropped data.
Output
Section titled “Output”The export produces a GodotContentPack containing:
- Per-zone resources with spatial data
- Entity manifest with placement coordinates
- Navigation links between zones
- Transition nodes for scene changes
- Loot tables and spawn markers
- Dialogue resources
- District groupings with faction/economy data
- Asset binding manifest
- A world
.tscnscene (optional, controlled by export options)
Playable Scene Structure
Section titled “Playable Scene Structure”buildWorldScene() emits a single .tscn that opens navigable in the Godot 4
editor — not a metadata graph. The root Node2D (y-sort enabled) contains:
- A framed
Camera2Dso the scene is visible the moment it opens. - Per zone: a
Node2Dwith aStaticBody2Dcollision hull, aNavigationRegion2Dnavmesh,y_sort_enabled, and az_indexderived from its stratum band (+ elevation). TileMapLayernodes per tile layer (image tilesets baketile_map_datacells; color-only layers carry aTileSetscaffold + metadata), each with per-cell wallStaticBody2Dcollision for non-walkable tiles.- A
Propscontainer (Node2Dplacements). - Town:
Markets/CraftingStationscontainers, plusBuildings(StaticBody2Dfootprints with aCollisionShape2D),Hubs, andStrongholds. Strata+StratumLinkscontainers (metadata; zones carrystratum_idand az_indexband so surface layers sort over the cellar).Hazards— oneArea2Dper (zone, hazard) with an inlineCollisionShape2Dregion; the hazard’s effects ride as metadata, read onbody_entered.- Gated zones carry
entry_gate/entry_gate_mode/entry_gate_reasonmetadata for the runtime to evaluate against party state on entry.
Every node is a textureless, self-contained engine primitive — the export loads
clean in real Godot 4.7 headless (the dogfood smoke asserts 36 facts about the
generated scene, from zone collision to the cellar’s underground z_index band).
Programmatic Usage
Section titled “Programmatic Usage”import { exportToGodot } from '@world-forge/export-godot';
const result = exportToGodot(project);
// result.pack — full GodotContentPack// result.scenes — .tscn scene text per zone// result.fidelity — structured fidelity reportEditor Export Options
Section titled “Editor Export Options”When exporting from the editor’s Export modal, the Godot 4 target options panel provides:
| Option | Default | Effect |
|---|---|---|
| Entity scene prefix | res://entities/ | Resource path prefix for entity scenes |
| Transition scene prefix | res://transitions/ | Resource path prefix for transition scenes |
| Include world .tscn | ✓ enabled | Whether to generate the top-level world scene |
| Asset binding mode | manifest | How assets are referenced: manifest (centralized) or manual (inline paths) |
These settings are embedded in the exported bundle’s exportSettings field for downstream tooling to consume.
Coordinate Transform
Section titled “Coordinate Transform”World Forge grid coordinates are converted to Godot 2D coordinates:
- Grid position → Godot
Vector2in pixels - Zone dimensions map to scene node bounds
- Entity placements become positioned child nodes
Fidelity Reporting
Section titled “Fidelity Reporting”Every export produces a structured fidelity report tracking what was preserved, approximated, or dropped:
- Lossless — zones, entities, items, connections, dialogues, spawn points, tile cells (image tilesets), wall collision
- Approximated — town economy + structures, vertical strata, hazards, and entry gates (emitted as nodes + metadata the runtime drives); parallax (no
ParallaxBackgroundnode emitted yet); position-default fallbacks - Dropped — references with no matching definition (e.g. a zone hazardRef with no
HazardDefinition), reported with the offending id
Fidelity is grouped by domain (zones, tiles, props, economy,
structures, navigation, …) so you can see exactly what each subsystem
contributed.
Format Version
Section titled “Format Version”GODOT_PACK_FORMAT_VERSION — currently 1.0.0.