Skip to content

Getting Started

Cursor Agent edited this page Nov 29, 2026 · 4 revisions

Getting Started

From a clean machine to the editor. The same steps, with the commands CI checks, are chapter 1 of the user guide. The short version on the project site is fanalor.dev/Fanalor-Engine/guide.html.

Requirements

Tool Version
Rust 1.97 or newer, stable, via rustup
Windows MSVC Build Tools
Linux cc, Vulkan drivers, and the packages below
macOS Rust is enough. The renderer uses Metal.

On Debian or Ubuntu the audio layer links ALSA and the gamepad layer links udev, both found through pkg-config:

sudo apt-get install -y libasound2-dev libudev-dev pkg-config

Check the toolchain:

rustc --version   # 1.97 or newer
cargo --version

Clone and run the editor

git clone https://github.com/Fanalor-Labs/Fanalor-Engine.git
cd Fanalor-Engine
cargo run -p fanalor-editor

The first build compiles the workspace and takes a few minutes. Later builds are incremental. The editor opens on a small demo scene: hierarchy on the left, inspector on the right, the scene in the middle, the asset browser along the bottom. What each control does is Editor.

Run a scene with no editor in the binary:

cargo run -p fanalor-player -- assets/scenes/sandbox.ron
cargo run -p fanalor-player -- assets/scenes/lights.ron
fanalor-player [--asset-root DIR] [--title TEXT] [--size WxH] <SCENE>

With no active Camera in the scene, the player keeps the default framing and says so in the log.

Commands

cargo run -p fanalor-editor
cargo run -p fanalor-player -- assets/scenes/sandbox.ron
cargo xtask dist
cargo xtask dist --manifest platformer.build.ron
cargo xtask new-game my-game
cargo xtask dist --web
cargo xtask guide
cargo xtask pack-atlas <folder>
cargo xtask bench
cargo run -p fanalor-platformer
cargo run -p breakout
cargo run -p dodge
cargo run -p arena
cargo run -p arena -- --host
cargo run -p arena -- --join udp://127.0.0.1:7777
cargo run -p arena --bin arena-server -- --asset-root games/arena/assets
cargo run -p fanalor-server -- scenes/sandbox.ron
cargo run -p fanalor-mcp -- --project .
cargo run -p fanalor-editor -- --bridge
cargo build --workspace
cargo test --workspace
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --all
Command What it does
cargo xtask dist Packages the root build.ron into dist/<name>/
cargo xtask dist --manifest <file> Packages that build instead
cargo xtask dist --web The same build as a static folder for the browser. See Export
cargo xtask new-game <name> A game crate under games/. See Building Games
cargo xtask guide Runs the guide's checked shell blocks, as CI does
cargo xtask pack-atlas <folder> Packs PNGs into one sheet plus an .atlas.ron (--trim, --out)
cargo xtask bench Times the hot paths in release. --compare FILE fails on a regression
cargo run -p fanalor-server -- <scene> Serves a scene headless (UDP 7777, WebSocket 7778). --help lists the flags

A game the editor will play has to be built with the editor, by the same compiler:

cargo build -p fanalor-editor -p fanalor-platformer
cargo run -p fanalor-editor -- --game platformer.build.ron scenes/platformer.ron

Web toolchain

Needed only for Export. Once per machine:

rustup target add wasm32-unknown-unknown
cargo install wasm-bindgen-cli --version 0.2.126 --locked

The CLI version must equal the wasm-bindgen crate in Cargo.lock. cargo xtask dist --web checks and names the version to install when they differ. 0.2.126 is the version locked on current main; trust the lockfile if it has moved.

Layout

Fanalor-Engine/
├── Cargo.toml          virtual manifest: workspace members and shared versions
├── build.ron           the build `cargo xtask dist` packages by default
├── assets/             shaders, textures, scenes, prefabs
├── crates/             the engine. See Architecture
├── games/              platformer, breakout, dodge, arena
└── docs/
    ├── ARCHITECTURE.md
    ├── CONVENTIONS.md
    ├── WEB.md
    ├── MCP.md
    └── guide/          the user guide

The workspace root is a virtual manifest. It has no src/. cargo build and cargo test at the root cover every member.

Environment variables

Variable Who reads it Effect
FANALOR_ASSET_ROOT fanalor-assets Asset root, taken as given. Overrides the usual search.
FANALOR_SAVE_DIR fanalor-core Saves directory. Overrides the per-platform folder. A relative path is ignored.
FANALOR_KEEP_SCRATCH tests Any value keeps a failed test's scratch folder. Folders younger than a minute are never swept.
FANALOR_BLESS scene text-render tests Any value writes the reference PNGs instead of comparing.
RUST_LOG the log crate Per-module filter. Example: RUST_LOG=fanalor_render=debug. See Logging.
WGPU_BACKEND wgpu Force a backend: vulkan, dx12, metal, or gl.

Asset paths are not resolved against the process working directory first. The order is FANALOR_ASSET_ROOT, then a walk upward from the Cargo manifest directory or the executable looking for an assets folder (at most six levels), then the working directory as a last resort. On the web there is no environment: assets come from the pack. See Export.

Saves go to the platform's per-user application folder (roaming AppData, Application Support, or the XDG data home), unless FANALOR_SAVE_DIR is an absolute path. In the browser they go to localStorage for that site.

An AI client

fanalor-mcp speaks MCP over stdio: scenes, assets, a headless run with a screenshot, build and test. With the editor started as cargo run -p fanalor-editor -- --bridge, the editor_* tools drive that editor. Details are in docs/MCP.md.

cargo run -p fanalor-mcp -- --project . [--assets assets] [--editor-port 47810]

Next

  • Editor — the window you just opened.
  • Building Games — a crate of your own.
  • docs/guide — ten chapters, from this install through physics, UI, audio, export, networking, animation, and big worlds.

Clone this wiki locally