Odin + Raylib Template#
A minimal starter for Odin + Raylib games with a basic window, hot reloading, and release builds.
This template is intentionally light on game opinions. Put your game state and logic in src/game; the src/lib packages provide the launcher and hot-reload infrastructure.
Requirements#
Raylib is provided by Odin's vendor:raylib package.
Commands#
just check # check all packages
just build # build the hot-reload game library
just build-loader # build the hot-reload loader executable
just run # build and run the hot-reload loader in the foreground
just reload # rebuild the game library for a running loader
just dev # run loader in the background and rebuild on src/game changes; requires watchexec or fswatch
just release # build an optimized non-hot-reload executable
just clean # remove build artifacts
Layout#
assets/ Game assets
docs/ Template docs
src/game/ Your game package
src/lib/hot_reload/ Hot-reload loader executable
src/lib/release/ Release executable entry point
src/lib/platform/ Small platform constants/helpers
Hot reload#
The game package exports a small game_* API used by both the hot-reload loader and release executable.
Persistent state should live in Game_Memory or be reachable from it. During hot reload, the loader keeps the existing Game_Memory pointer when size_of(Game_Memory) is unchanged. If the memory layout size changes, the loader restarts the game memory.
Runtime controls:
F5: force hot reloadF6: restart game memoryEsc: quit
Platform notes#
The Odin code uses compile-time when ODIN_OS == ... checks for platform-specific constants such as dynamic library extensions. The build is set up for macOS and Linux, with Windows extension support included but not yet validated in this repository.