godot-goose

Docs

Setup

Add Goose to an existing project

Run the setup command from the folder containing project.godot. It adds the build configuration and enables Goose Build while keeping existing scenes, other settings, and Goose source files. Add a GooseGame node to a scene and run it.

Set up directly with CMake

Use Goose v2026.4, official single-precision Godot 4.7.2, and CMake 3.22 or newer. Put both executables on PATH or pass their paths with GOOSE_EXECUTABLE and GODOT_EXECUTABLE.

cmake -DPROJECT_DIR=../my-game -P tools/setup.cmake

Godot 4.7 is the minimum. CI uses 4.7.2 and also runs the Linux integration project on 4.7 and 4.8 RC1.

Usage

Handle a scene event

Register the starter’s GooseGame as a Label with READY_MASK. When Godot sends READY, this handler sets the text.

game.goose
export fn goose_project_event(class_id: i64, id: u64, event: i64, delta: f64, method: i64) {
    guard event == godot::READY else { return; }
    let message = "Hello from Goose!";
    guard godot::set_property(id, "text", godot::box(message)) else { return; }
    print(message);
}

Integrate a custom build

Import godot from your Godot Goose checkout in the Goose entry point. Copy the registration and event callbacks from Mover. Include the project helper in CMake and list files to stage.

CMakeLists.txt
cmake_minimum_required(VERSION 3.22)
project(my_game LANGUAGES C)
include(path/to/godot-goose/cmake/GooseGodot.cmake)
goose_godot_add_project(my_game game.goose "project.godot;main.tscn")

To build directly into an existing Godot project, pass an empty resource list and PROJECT_DIR. The extension goes under addons/my_game/. A staged build supports HOT_RELOAD and generated desktop export presets.

Rebuild and debug

With Goose Build enabled, Run Project compiles updated game code. Reopen the editor to refresh the loaded extension’s classes and compiled script metadata. For staged Arena builds, run cmake --build build --target arena_check for JSON diagnostics.

Use HOT_RELOAD for native classes in staged builds. Load a new revision with GDExtensionManager.reload_extension. Godot restores saved properties and Goose starts with fresh runtime state.

Pass -DGOOSE_DEBUG=ON when setting up a native-only project to enable runtime checks and debugger support. Attached Goose scripts already support the debugger. Use debug_break to pause from a callback or debug_point to pause at an enabled breakpoint.

Testing

Run the integration suite

Run the project suite from the checkout. It covers callbacks, properties, signals, engine calls, resource ownership, attachable scripts, and editor reload.

mise run test

Install the matching Godot templates and pass --exports to include desktop export tests.

Architecture

How a scene calls Goose

Register classes and callback masks in goose_project_register. The C adapter connects the Godot GDExtension ABI to the Goose event handler.

A Goose node becomes ready
  1. RegistrationSubscribes the class to READY
  2. GodotSends the ready callback
  3. GDExtension adapterPasses the object ID and event
  4. Goose handlerUpdates the scene with godot:: calls

Use one Goose entry point per extension. Callbacks run on the scene thread. Node handles store IDs and resolve them before use. Retain engine values that must outlive a callback, then release them with their owner.

Bindings, methods, and signals

Goose contains the public API, conversions, and the generator for the typed engine wrappers. The native C adapter supplies Godot callbacks and manages value lifetimes.

Use typed wrappers for common Godot methods or godot::call for other engine instance methods. Declare Inspector fields with define_property or pass a struct of typed defaults to define_properties. Use define_resource_property for typed resource references. define_method and define_signal accept up to eight typed arguments.

InstanceStates<T> stores Goose state by Godot instance ID. Initialize the entry on the first ENTER_TREE, use with_state to update it, and subscribe to INSTANCE_FREED_MASK to release retained variants and remove the entry when the object is destroyed. The mover keeps its state when it leaves and re-enters the scene tree.

Exports

Export for desktop

Build a staged example and use its generated Desktop preset with the matching Godot export templates. The macOS preset packages the arm64 binding with Godot’s universal export template.

Export for Android or iOS

For Android, install the NDK and Ninja and pass -DANDROID_NDK=/path/to/ndk to setup. The build adds arm64-v8a and x86-64 libraries. Configure the SDK, JDK, and matching templates in Godot.

For iOS, install Xcode and Ninja on macOS and pass -DGOOSE_IOS=ON to setup. Configure your team and bundle identifier in the iOS preset, then export the Xcode project. Rebuild after changing Goose code.

Full mobile setup. Web export requires a WebAssembly-compatible Goose runtime.

Examples

Build the examples

From the checkout, build the staged Godot projects with the pinned toolchain. Edit the source projects under examples/ and rebuild to stage changes.

Terminal
mise exec -- cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
mise exec -- cmake --build build --config Release --target mover arena pong tetris mario zelda

Use Godot in the launch commands on macOS. Press R to restart Pong, Tetris, Mario, or Zelda.

Mover

Two native Goose nodes expose independent speed values and an advanced signal. Edit speed in the Inspector.

mise exec -- godot --path build/mover
Two colored Goose nodes running on a dark stage.

Source

Arena

Press Space to launch a projectile. A Goose script moves it, a timer removes it, and a signal updates the shot counter. Edit launch_settings.tres to adjust projectile lifetime.

mise exec -- godot --path build/arena
Goose Arena immediately after a projectile launch.

Source

Pong

Play a first-to-seven match. Press 2 for local two-player mode. Move the first paddle with the arrows and the second with W and S. Serve with Space.

mise exec -- godot --path build/pong
Pong in local two-player mode with two paddles and a scoreboard.

Source

Tetris

Use the arrows to move and rotate a piece, Space to drop, and C to hold or swap it. The landing guide shows where it will settle.

mise exec -- godot --path build/tetris
The eight-column Tetris board with the next and held pieces.

Source

Mario

Run with the left and right arrows. Tap Space for a short jump or hold it for a higher jump. Light the three lanterns to open the gate.

mise exec -- godot --path build/mario
The platformer courier bouncing above a platform after stomping a patrol.

Source

Zelda

Use the arrows to move, Space to interact, and X for a directional strike. Power the three beacons to open the exit.

mise exec -- godot --path build/zelda
A directional strike against a patrol in the top-down maze.

Source