Building from source
Requirements
Build and run
git clone https://github.com/LibreTerrain/LibreTerrain.git
cd LibreTerrain
cargo build # builds the Rust terrain engine and the Godot extension
godot --path app # runs the appgodot is whatever you called the Godot executable. You can also open app/project.godot in the Godot editor and press Play. After changing Rust code, run cargo build again and restart the app.
Tests
cargo test --workspace
godot --headless --path app --script res://tests/smoke_test.gd
godot --path app --script res://tests/ui_test.gd # needs a display (or xvfb-run) and a GPUcargo test checks every node for determinism across thread counts, resolution independence (513² against 2,049²) and unchanged output and settings (tests/golden/), and that projects saved by 2026.1 still open unchanged (tests/format/).
To look at a node without the app, render it to a shaded PNG:
cargo run --release -p terrain-nodes --example render -- terrain.mountain mountain.pngPackaging
Packaged builds use Godot's export templates, which must match the Godot version pinned in .godot-version exactly.
scripts/fetch-godot.sh --templates # Linux: downloads that Godot and its export templates
GODOT=.godot-cache/4.7.2/godot scripts/package.shscripts/package.sh builds the release library, exports the app and zips it into build/. On Windows, use scripts\package.ps1. scripts/installers.sh turns exported apps into the Windows installer, .deb, .rpm and AppImage, and scripts/installers.sh flatpak builds the Flatpak.
Project layout
The Rust workspace is layered, each crate depending only on those above it:
| Crate | Contents |
|---|---|
terrain-field | Foundations: grids, point sets, world units, grid operations, seeds and noise |
terrain-sim | Simulations: erosion, hydrology, coast, snow and ecosystems |
terrain-core | The engine: node graph, evaluator, caching and tiling, custom nodes, project files, export, GPU device |
terrain-nodes | The node library: schemas and thin wrappers around the simulations |
terrain-godot | The GDExtension the Godot editor uses |
Simulations know nothing about nodes: each is a function of grids and a settings struct, so it can be tested and benchmarked on its own.
