---
title: "onegame cookbook"
url: https://recursiveai.org/onegame/cookbook/
description: "Short recipes for common onegame tasks, each with complete code you can copy."
version: "1.2.0"
---

# onegame cookbook

Short recipes for common onegame tasks, each with complete code you can copy.

## Recipes

- [Automated game testing with scenarios](https://recursiveai.org/onegame/cookbook/automated-game-testing/index.md): Write game tests as YAML scenarios that click, press keys, send commands and step frames, then check state, UI, sounds and pictures, and run them headless…
- [Record and replay a game](https://recursiveai.org/onegame/cookbook/record-and-replay/index.md): Record a run of a C# game to a file, replay it later and check every tick’s state hash, and find the first tick where a code change makes the game behave…
- [Screenshot tests for a game](https://recursiveai.org/onegame/cookbook/screenshot-tests/index.md): Capture frames of a C# game headless, compare them with reference images at a tolerance in a scenario, update the references when a change is intended…
- [Deterministic simulation in C#](https://recursiveai.org/onegame/cookbook/deterministic-simulation/index.md): Keep a game’s simulation deterministic with fixed-point numbers and named random streams, and let the analyzers turn floats, clocks, System.Random and…
- [Test a game from C#](https://recursiveai.org/onegame/cookbook/csharp-game-tests/index.md): Write xUnit tests for a C# game with onegame’s test API: drive a headless game by id and command, run scenario files, and prove determinism with RunTwice…
- [Start tests from fixtures and snapshots](https://recursiveai.org/onegame/cookbook/fixtures-and-snapshots/index.md): Give tests a ready-made world with named fixtures, save a running game as a snapshot, and start a scenario from either, instead of playing up to the…
- [Client/server sync with a dedicated server](https://recursiveai.org/onegame/cookbook/client-server-sync/index.md): Make a C# game with a dedicated server, export the server as a NativeAOT program, run it with two clients over UDP and WebSocket on a simulated network…
- [Client-side prediction](https://recursiveai.org/onegame/cookbook/client-side-prediction/index.md): Show a player’s command on their own screen at once while the server decides, with predicted commands, a predicted world beside the replica, and rollback…
- [Drive a running game over MCP](https://recursiveai.org/onegame/cookbook/live-control-mcp/index.md): Control a running Debug build of a C# game from an MCP client or a script: read state, click by id, step time, send commands, load fixtures and capture…
- [Draw sprites, shapes and text with Draw2D](https://recursiveai.org/onegame/cookbook/draw-sprites-2d/index.md): Draw a C# game’s entities in 2D from view code with onegame’s Draw2D: an animated sprite sheet loaded from a PNG, rectangles, lines, circles and text, a…
- [Input actions for keyboard, gamepad and tests](https://recursiveai.org/onegame/cookbook/input-actions/index.md): Declare a C# game’s input as named actions with default bindings for the keyboard and a gamepad, read them in view code, test them with scenario steps for…
- [Build a game screen with the UI kit](https://recursiveai.org/onegame/cookbook/game-ui-screen/index.md): Build a C# game screen from the onegame component kit: a table of items bound to synced state, a primary button, a confirm dialog, a theme with your own…
- [Controller and keyboard navigation](https://recursiveai.org/onegame/cookbook/controller-navigation/index.md): Make a game screen playable with a gamepad and a keyboard: a default focus, d-pad movement, confirm and back, focus that stays inside a dialog, and…
- [Check UI contrast](https://recursiveai.org/onegame/cookbook/ui-contrast/index.md): Check a game UI theme against WCAG 2.x AA contrast from the command line or a test, read which token pairs fail, and pick an accent that passes.
- [Export for Linux, Windows and macOS](https://recursiveai.org/onegame/cookbook/export-desktop/index.md): Package a C# game for Linux, Windows and macOS with onegame export: NativeAOT where the host allows it, a folder and an archive per target, and a JSON…
- [Ship a game for Steam and the Steam Deck](https://recursiveai.org/onegame/cookbook/steam-and-steam-deck/index.md): Export a C# game for Steam on Linux and Windows with the Steamworks library beside it, and build a Linux program that starts on the Steam Deck’s runtime.
- [Export for the web, Android and iOS](https://recursiveai.org/onegame/cookbook/export-web-android-ios/index.md): What the web, Android and iOS exports need at onegame 1.2.0: an engine checkout for all three, plus the Android SDK or a Mac with Xcode, and what each…
