Skip to content

Building from source ​

Requirements ​

  • Rust 1.94 or newer (stable)
  • Godot 4.6 or newer (the standard build, not .NET)

Build and run ​

sh
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 app

godot 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 ​

sh
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 GPU

cargo 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:

sh
cargo run --release -p terrain-nodes --example render -- terrain.mountain mountain.png

Packaging ​

Packaged builds use Godot's export templates, which must match the Godot version pinned in .godot-version exactly.

sh
scripts/fetch-godot.sh --templates             # Linux: downloads that Godot and its export templates
GODOT=.godot-cache/4.7.2/godot scripts/package.sh

scripts/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:

CrateContents
terrain-fieldFoundations: grids, point sets, world units, grid operations, seeds and noise
terrain-simSimulations: erosion, hydrology, coast, snow and ecosystems
terrain-coreThe engine: node graph, evaluator, caching and tiling, custom nodes, project files, export, GPU device
terrain-nodesThe node library: schemas and thin wrappers around the simulations
terrain-godotThe 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.

Code dual-licensed MIT / Apache-2.0. "LibreTerrain" and its logo belong to EllisonDigital.