# NSGo Game > A pure-Go 2D and 3D game layer for NSGo apps: fixed-step loop, sprites, glTF rendering, visual scene editor and plain-text YAML across six platforms. NSGo Game ships both stable and experimental packages (see API Stability). Read the packages' source, `go list -m -f '{{.Dir}}' github.com/nsgo-dev/game`, before relying on a signature. Each page below is a page of the site; http://nsgo.games/llms-full.txt holds their Markdown in full. ## Guides - [Overview](http://nsgo.games/docs/): For download size, loading groups and web caching, see Small downloads and fast starts. - [Getting Started](http://nsgo.games/docs/getting-started/): Create an NSGo game, run it on desktop, web, iOS and Android, draw an animated sprite on a fixed-step loop, handle touch and mouse input, and play sound. - [Troubleshooting](http://nsgo.games/docs/troubleshooting/): Use this page when setup, build or first-run output stops before the game starts. Run go tool nsgo doctor first, then compare the exact message with the entries below. File-format failures are covered by Errors. - [Teaching and game jams](http://nsgo.games/docs/teaching-and-jams/): A class or a jam needs a path that works on a prepared machine and ends with a playable web build. Pin the Go and NSGo versions used by the templates, keep each student's project in its own directory, and run the same go tool nsgo commands locally and in CI. - [Templates](http://nsgo.games/docs/templates/): A new project starts from a template: a small, complete game that builds, runs and passes its tests before you change a line. game new writes one into a new directory, and NSGo's nsgo init -template writes the same files from the template's Go module. For a class or jam, see the Teaching and game jams checklist. When growing a template into a shippable game, follow the Accessibility Guide to wire gameui.SettingsMenu, a11y.Assist, captions, and effects end to end (shipping a ready Accessibility settings screen in every template is tracked in #1783). See Testing games for the test layers used by the templates. - [Genres](http://nsgo.games/docs/genres/): Start with the template closest to the game you want, then combine the packages named below. The templates are complete, tested projects. The examples show the same systems in a running game. A genre with no template is a contribution opportunity rather than a promise of a built-in kit. - [The puzzle2d template](http://nsgo.games/docs/template-puzzle2d/): A spark slides until a wall stops it and lights every lamp it passes; lighting all of a level's lamps within its moves wins the level, and a slide into a void or running out of moves loses it. Because the HUD, board and bottom bar stack vertically, the root scope requests portrait orientation on phones (cx.RequestOrientation(core.OrientationPortrait)). The template shows how a puzzle game grows: the rules in board.go, where each move is an undo.History move that undoes and redoes exactly; the levels in levels.yaml, a versioned YAML file with unknown fields refused and a canonical form, which levels.go reads and writes; the input map in game.yaml, bound into input.Actions with swipes from input.GestureRecognizer; moves animated with tween on a fixed-step game.Loop; and the stars of each level kept with save. To change the game, add or edit levels in levels.yaml, whose tests check that every level can be won in its par; run go tool game playtest to verify solvability, difficulty order, unintended shortcuts and moves over par through playtest.yaml and playtest_test.go; rebind the controls in game.yaml; add a tile in board.go and draw it in draw.go. The template's README lists the controls, the level format and every file. - [The rhythm template](http://nsgo.games/docs/template-rhythm/): Notes fall down four lanes to the beat of a song, and the player hits each lane as its note reaches the line; hits build a combo and fill the energy bar, misses drain it, and the chart is cleared by reaching the song's end with energy left and failed by running out. Because the four falling lanes and stacked menus are tall, the root scope requests portrait orientation on phones (cx.RequestOrientation(core.OrientationPortrait)). The template shows how a rhythm game grows: the song list, the judgement windows and the energy rules in songs.yaml, a versioned YAML file with unknown fields refused and a canonical form, which songs.go reads and writes, with each song's tempo in a rhythm beat map beside it; the rules in run.go, a Run that judges hits by track position and knows no clock, so its tests drive it exactly; the music played through an audio.Player and followed by a rhythm.Clock, with the template unwrapping the position a looping track shorter than the song reports (unwrapLoop) before passing it to rhythm.Clock.Sync; hits judged by when the key or the finger went down rather than by the game step that reads them; latency calibration on rhythm.CalibrationScreen, through the same input as the charts, kept per device by rhythm.OffsetStore; the input map in game.yaml, bound into input.Actions with each lane's column bound to touches and the mouse; and the best clear of each chart kept with save. To change the game, chart a new song in songs.yaml with its beat map and music under songs/, whose tests check the file is canonical and every chart fair; tune the windows and the energy there too; rebind the controls in game.yaml; and change how the playfield looks in draw.go. The template's README lists the controls, the songs format and every file. - [The shmup2d template](http://nsgo.games/docs/template-shmup2d/): shmup2d is one stage of a vertical shooter on a 270×480 portrait playfield. Enemy waves fly in on dive, weave, cross and hover paths and fire bullets patterns; destroying a whole wave drops a power, bomb or life item; a boss with three phases ends the stage. Defeating the boss is the win, losing the last life the loss. It plays with the keys or WASD, a controller's stick, D-pad and buttons, and by dragging with a finger or the mouse, with a bomb button on touch screens. - [The visualnovel template](http://nsgo.games/docs/template-visualnovel/): Lantern Crossing: a cartographer has to get her map across a foggy river before dawn, and the ferryman decides how far to trust her. Two choices earn or lose his trust and the third, at a fork in the river, reaches the harbor or the fog, so the story has a good ending and a lost one. - [The platformer2d template](http://nsgo.games/docs/template-platformer2d/): platformer2d is a small side-scrolling platformer: a lantern bearer runs and jumps through the three rooms of Lantern Hills, collects sparks, lights a lamp that becomes the respawn point and reaches the beacon to win. Spikes and pits cost a life, and losing the last one loses the run. It is built on platformer, physics, tilemap, rooms, input, sprite and screen, and its art is drawn by code. - [The rpg2d template](http://nsgo.games/docs/template-rpg2d/): rpg2d is a small top-down RPG called Hollowbrook: a town and the meadow beyond its gate, three people to talk to, a pack of items and equipment, one quest, turn-based battles and three save slots. It is one of the templates, and the starting point for a game of that kind. - [The roguelike2d template](http://nsgo.games/docs/template-roguelike2d/): roguelike2d is a small turn-based roguelike: a delver descends the five floors of the Glimmerdeep, fights the monsters that live there, gathers weapons, armor, draughts, tonics and shards, and lifts the Heart Ember from the last floor, where the Vault Warden stands on it. Every floor is generated from the run's seed, and death is permanent: the run's save is deleted the moment the run ends, and a summary and the records of every run are kept. It is built on procgen, entities, loot, stats, ability, save, random, input and screen, and its art is drawn by code. - [Tower defense template](http://nsgo.games/docs/template-towerdefense2d/): The towerdefense2d template is Bramble Gate, a small 2D tower defense game: enemies walk a road from a spawn to a gate, and the player builds towers on the grass beside it, upgrades them with the money the enemies drop and calls each wave when ready. Stopping all five waves wins; letting ten lives' worth of enemies through the gate loses. It plays with a keyboard, a gamepad or touches on desktop, mobile and the web, and all of its art is drawn in code. - [The fighting game template](http://nsgo.games/docs/template-fighting2d/): fighting2d is a one-on-one 2D fighting game to start a fighter from: two original characters, special moves from motion inputs, cancels and combos, guarding high and low, best-of-three rounds on a timer, a CPU opponent, and a second player on the same keyboard, on a second game controller or on one touch screen. It is built mainly on fighting, which recognizes the inputs, and framedata, which resolves the hits, with input, sound, screen and the placeholder pack's sounds. - [The cards2d template](http://nsgo.games/docs/template-cards2d/): cards2d is Suit Ladders, a single-player card game of an original design. Each suit has a ladder that climbs from 1 to 9. The player holds a hand of five cards, draws from a draw pile, climbs a ladder with a card that is the next rank there and throws the others on a discard pile, which can be turned over into a new draw pile twice a game. The game is won when every ladder reaches 9 and lost when the draw pile is empty, cannot be dealt again, and no card in the hand fits a ladder. - [The coop2d template](http://nsgo.games/docs/template-coop2d/): coop2d holds the authoritative rules of a 2D co-op room for one to four players: room codes and invite links, a fixed tick, leaving and rejoining within a grace period, a teammate reviving a downed player, and a solo respawn when no teammate is standing. Create a project from it with: - [The idle template](http://nsgo.games/docs/template-idle/): idle is Hearthkeeper, a small idle game: a fire to keep alive, generators and upgrades bought with the embers it makes, progress while the game is closed, a prestige reset and a goal that wins. Create a project from it with: - [The rts2d template](http://nsgo.games/docs/template-rts2d/): rts2d is a 2D real-time strategy skirmish, Shardfront: two bases on one map, crystals to mine, barracks to build, three unit types, fog of war, box selection, control groups and a computer opponent. The side whose headquarters falls first loses; both falling in the same step is a draw. It is small enough to read in an afternoon and laid out the way a strategy game grows: the rules, the map and the opponent's priorities are YAML data files, the simulation knows nothing of views or input, and the player and the opponent give their orders through the same functions. - [Action Adventure Template](http://nsgo.games/docs/template-action3d/): action3d is a third-person 3D action adventure: a knight crosses a walled courtyard, fights the guards, jumps onto a ledge for the key, and the key opens the gate to the shrine. Reaching the shrine wins the run; losing all health loses it. Create a project from it with: - [The fps3d template](http://nsgo.games/docs/template-fps3d/): fps3d is a first-person shooter arena, Relay Yard: the player holds a walled yard against three waves of drones and wardens with a hitscan rifle and a projectile launcher, picking up health and ammo between fights. Clearing the last wave wins; reaching 0 health loses. It is the template to start from for a 3D shooter, and a working example of the 3D packages together: physics3d, render3d, ai and input. - [Racing 3D Template](http://nsgo.games/docs/template-racing3d/): The racing3d template is a small 3D racing game: two laps of a closed circuit against two computer-driven rivals, from the back of the grid, with a countdown, checkpoints, a ghost of your best lap and a results screen. It plays with a keyboard, a gamepad or touch, on the desktop, phones and the web. - [Project File](http://nsgo.games/docs/project/): github.com/nsgo-dev/game/pkg/project reads, checks, writes and applies game.yaml, the one file at a game's root that holds its settings: its name, id and version, its window and virtual resolution, its input map, its audio buses, the scenes and resources it loads at startup, its export presets per platform, the editor plugins it turns on, its asset pipeline and the library packs installed into it. The game reads it at startup, the game project command checks and applies it, game release reads its export presets, game assets builds its asset targets, and the editor opens, edits and saves it. - [File Formats](http://nsgo.games/docs/formats/): Every file a game made with these packages reads or writes, with the names its files go by, the version it declares, the Go functions that read and write it, the guide that describes its fields and an example, so a person or an AI can edit one without reading the code. - [Schemas for YAML files](http://nsgo.games/docs/schemas/): Every file a game's author writes is YAML text, and each format has a JSON Schema so editors and AI tools can complete keys, show each field's description on hover and flag mistakes while the file is being written, before the game loads it. - [Editor & Scene Format](http://nsgo.games/docs/editor/): This document records the scope decision for NSGo's game editor (#159) and specifies the version 1 YAML scene format (#160) implemented in github.com/nsgo-dev/game/pkg/sceneformat. - [Playground](http://nsgo.games/docs/playground/): The playground starts each built example in an iframe. Its reload contract is deterministic: the first Run uses run 1, Restart increments the run key so the iframe is recreated, and a source-file fragment such as #game.go selects that tab. The page keeps the fragment in a shareable URL without changing browser history. Editing an example still happens through the local go tool nsgo dev -target web workflow described below. - [Core packages](http://nsgo.games/docs/packages/): This page summarizes the core packages and how their parts behave, from package doc comments. The API reference covers every package, and API Stability maps every package to its guide. Every file format the packages read and write is in File Formats. - [API Stability](http://nsgo.games/docs/stability/): Every package of the module is either stable or experimental. The status says how a package may change from one release to the next, how its changes are announced, and how long an app has to move off what it deprecates. - [File loading errors](http://nsgo.games/docs/errors/): Every loader and validator in this module returns the same error type when a file cannot be used: *loaderr.Error from github.com/nsgo-dev/game/pkg/loaderr. It names the file, the line and column, the field, what was wrong, what was expected and how to fix it, so a person, or an agent reading a test or build log, can open the file at that line and correct it without reading the loader's source. - [Platform support](http://nsgo.games/docs/platforms/): NSGo Game targets six primary build targets (macOS, Windows, Linux, iOS, Android, and Web) and also compiles with NSGo's four experimental targets (HarmonyOS, tvOS, watchOS, and mini programs), though feature availability and CI test coverage differ by target. Every cell below is verified against NSGo v0.3.4 and this repository's build tags and workflows, with links to the upstream issue tracking each gap. - [Building and Shipping](http://nsgo.games/docs/shipping/): For a first-load plan that connects resources, loading progress, web caching and size budgets, see Small downloads and fast starts. - [Shipping on Steam](http://nsgo.games/docs/steam/): Configure Steamworks app and depot IDs, bundle the Steamworks redistributable through nsgo-natives.yaml, build desktop depots with go tool game release -channel steam, upload builds via SteamPipe to a staging branch, map NSGo's save directories to Steam Auto-Cloud, and verify your game against Steam Deck and Steam review requirements. - [Releasing in Mainland China](http://nsgo.games/docs/shipping-china/): Prepare a game built with NSGo Game for players in mainland China: plan regulatory registrations in order, implement first-launch privacy consent and required disclosures, handle Android devices without Google Play Services, and track HarmonyOS and mini program preview status. - [Accessibility Guide](http://nsgo.games/docs/accessibility-guide/): This guide maps the Game Accessibility Guidelines (GAG) and Xbox Accessibility Guidelines (XAG) to NSGo Game packages, shows how to wire player preferences end to end, provides a pre-release checklist, and maps Apple's App Store Accessibility Nutrition Labels to what the engine lets you claim truthfully. - [Command Line](http://nsgo.games/docs/cli/): game is the game layer's command-line tool: one command whose subcommands pack sprite atlases, convert audio, generate asset manifests, encode textures, open the scene editor, build release packages, show its build version, play input recordings headless, check benchmarks against a stored baseline, check a built package against its size budget, create projects, check, format and apply a project's game.yaml, run the game with asset hot reload, check a game's scenes, maps and atlases, build all of a game's assets from game.yaml, rebuilding only what changed, write new components, systems, scenes and prefabs into a project, move files while keeping the references to them working, keep the project index of stable file IDs, render pixelfx effects to sprite sheets and write shell completion scripts. They share how they are called: flags before arguments, -in for what a command reads and -out for what it writes, and the same help. - [Command Reference](http://nsgo.games/docs/cli-reference/): Every subcommand of go tool game (or go run github.com/nsgo-dev/game/cmd/game@latest outside a project), with its usage line and flags, generated from the commands' definitions so it always matches game help. Command Line shows how to add the command as a tool, what each subcommand is for and how to set up shell completion. - [Asset and Plugin Library](http://nsgo.games/docs/library/): github.com/nsgo-dev/game/pkg/tooling/library finds shared asset packs, editor plugin packs and templates in a library and installs them into a game project. A library is a text index anyone can add a pack to with a pull request; installing a pack writes its files into the project and records them, and the references they add, in game.yaml. go tool game library runs it from the command line and the scene editor's library panel runs it from the editor. - [Plugins](http://nsgo.games/docs/plugins/): A Go plugin is a Go module that extends a game's runtime, the scene editor, or the game CLI. Because iOS and web targets link all native code at compile time, Go plugins are ordinary Go packages wired into the game project through go.mod rather than dynamically loaded shared libraries. - [Placeholder Assets](http://nsgo.games/docs/placeholder/): game/placeholder is a small asset pack to prototype with: sprite sheets, a tileset with a Tiled tileset and a sample level, a pixel font, sound effects and a music loop, and three glTF models, each image and sound with its import settings sidecar. Every file is an original work drawn, synthesized or modeled in Go for this repository, and all of them are dedicated to the public domain under CC0 1.0: a game may use, change and ship them, commercially or not, without asking and without giving credit. - [Agent Skill](http://nsgo.games/docs/agent-skill/): The repository publishes an Agent Skill at skills/nsgo-game so coding agents know how to scaffold, build, test, inspect and drive NSGo games using the go tool game CLI, plain-text YAML formats and the game/mcp tool suite. - [Agent evaluation catalog](http://nsgo.games/docs/agent-eval/): tools/agenteval grades coding agents on versioned task YAML files under tools/agenteval/tasks/; its README describes the modes, the rubric and how to run it. - [Package Size Budgets](http://nsgo.games/docs/package-size-budgets/): game size, built on the tooling/sizecheck package, measures and enforces package size budgets for WebAssembly (.wasm), Android App Bundles (.aab), Android APKs (.apk), and iOS App Store Packages (.ipa) using Go's standard library (archive/zip), with no external tools or SDK dependencies. - [GC and Frame Allocations](http://nsgo.games/docs/gc-and-allocations/): A 60 fps frame budget is 16.67 ms (8.33 ms at 120 fps). Go's garbage collector runs concurrently with low stop-the-world (STW) pauses, but steady per-frame heap allocations trigger frequent GC cycles, consume background CPU (mark assist), and can cause visible frame hitches. Keeping the update and draw hot paths at zero allocations per frame prevents GC work during active gameplay. - [Determinism](http://nsgo.games/docs/determinism/): A deterministic simulation produces the exact same state from the same starting seed and inputs on every run, across macOS, iOS, Windows, Linux, Android and the web. Determinism makes replays, seeded daily runs, save/load continuity and automated gameplay tests under nsgotest reliable instead of flaky. - [Playtest](http://nsgo.games/docs/playtest/): Define automated playtests in playtest.yaml, run bots headless across seeded runs with deterministic input recordings, and check measured metrics against the game's goals. - [statedump](http://nsgo.games/docs/statedump/): game/statedump runs a game headless for a fixed number of steps and writes its entities, components and scene state as deterministic YAML. Two runs with the same seed and inputs write identical files, so an agent or a test checks its work by diffing one run against another, and a change shows as a few changed lines. - [gametest](http://nsgo.games/docs/gametest/): game/gametest rasterizes recorded core.DrawOp slices without a window or GPU, compares rendered frames against golden PNG fixtures, generates visual diff images, and extracts drawn image rectangles for structural assertions. Testing games shows where these checks fit beside world, replay and playtest tests. - [Testing games](http://nsgo.games/docs/testing/): NSGo keeps game tests in the same fixed-step and headless paths used by the game. A small unit test checks a rule or system, an nsgotest test drives a loop and view, a replay test protects a complete input run, and a gametest golden test protects pixels. Keep each test deterministic so a failure is reproducible on a developer machine and in CI. ## Tutorial - [Tutorial: Star Catcher](http://nsgo.games/docs/tutorial/): Build a whole game, Star Catcher, from an empty project to a release you can ship, in nine chapters. Each chapter adds one idea to the game, and each chapter's finished code is in the repository, where CI builds it for every target and runs its tests. - [Tutorial 1: An Empty Project](http://nsgo.games/docs/tutorial-01-empty-project/): This page is self-contained: the commands, nsgo.yaml and main.go below and the complete game.go and game_test.go at the end of the page are everything chapter 1 needs in a new module. - [Tutorial 2: The Game Loop](http://nsgo.games/docs/tutorial-02-game-loop/): Give the game a world that moves in fixed steps, drive it with a game.Loop, draw it at a virtual resolution that screen.Viewport scales to any window, and test the world without one. - [Tutorial 3: Input](http://nsgo.games/docs/tutorial-03-input/): Let the player move the basket from lane to lane by touching or clicking a side of the playfield, or with the arrow keys, through game/input's named actions, sampled once per step. - [Tutorial 4: Sprites](http://nsgo.games/docs/tutorial-04-sprites/): Draw the basket and the star as sprites: paint a sprite sheet, describe its frames in a sprite.Atlas, play the star's twinkle with a sprite.Animation, and draw everything with one sprite.Batch. - [Tutorial 5: Rules](http://nsgo.games/docs/tutorial-05-rules/): Turn the falling star into a game: drop stars and rocks from a seeded random.Stream, decide what the basket catches with physics boxes, keep score and lives, end the game with the last life, and prove that the same seed always plays the same game. - [Tutorial 6: Screens](http://nsgo.games/docs/tutorial-06-screens/): Give the game a title screen, a pause menu and a game-over screen. They are native NSGo views over the canvas, shown by phase, with real buttons that screen readers, keyboards and game tests can all press. - [Tutorial 7: Sound](http://nsgo.games/docs/tutorial-07-sound/): Play a sound for each catch, hit, miss and the end of a game: synthesize the effects in Go, load them with NSGo's audio, play them through a sound.Mixer, and give the player a mute switch the game remembers. - [Tutorial 8: Saving](http://nsgo.games/docs/tutorial-08-save/): Keep the player's best score and the number of games they played across launches, in a versioned save slot from game/save, and show the best on the title and game-over screens. - [Tutorial 9: Shipping](http://nsgo.games/docs/tutorial-09-ship/): Get Star Catcher ready for players: give it a name, version and icon for the stores, pause it when the app loses the focus, play whole games in a test before each release, check every target, build release packages, and validate its store listings. ## Coming from Another Engine - [Coming from Godot](http://nsgo.games/docs/from-godot/): A map from Godot 4's scenes, nodes, resources, signals, input map, physics and export to this layer, with the page that covers each one. - [Coming from Ebitengine](http://nsgo.games/docs/from-ebitengine/): A map from Ebitengine's game loop, images, input, audio and builds to this layer, and to the scenes, nodes, resources, signals, input maps, physics and export it adds on top, with the page that covers each one. - [Coming from Unity](http://nsgo.games/docs/from-unity/): A map from Unity's scenes, GameObjects and components, assets, events, Input System, physics and builds to this layer, with the page that covers each one. - [Coming from Unreal Engine](http://nsgo.games/docs/from-unreal/): A map from Unreal Engine's levels, actors, Blueprints, data assets, Enhanced Input, Gameplay Ability System, AI, Niagara, audio, Sequencer, UMG, Chaos Physics, materials, replication, saves and packaging to this layer, with the page that covers each one. - [Coming from GameMaker](http://nsgo.games/docs/from-gamemaker/): A map from GameMaker's rooms, objects, events, sprites, sequences and export to this layer, with the page that covers each one. - [Coming from Construct](http://nsgo.games/docs/from-construct/): A map from Construct's layouts, object types, event sheets and behaviors to this layer, with the page that covers each one. - [Coming from RPG Maker](http://nsgo.games/docs/from-rpgmaker/): A map from RPG Maker's database, maps, events, messages and plugins to this layer, with the page that covers each one, and the parts that are not here yet. ## 2D Core - [Loop](http://nsgo.games/docs/loop/): game.Loop drives fixed-step updates and interpolated frame draws on an NSGo scope's display frames, pausing automatically while the app is in the background. - [sprite](http://nsgo.games/docs/sprite/): game/sprite loads packed sprite atlases, plays frame animations on a fixed step, and draws Z-ordered sprite batches into an NSGo core.Canvas. - [sound](http://nsgo.games/docs/sound/): game/sound layers a persistent volume Mixer, voice-limited sound Effects, crossfading Music, and automatic background muting on top of NSGo's audio package. - [input](http://nsgo.games/docs/input/): Actions can report controller lifecycle changes through OnControllerLost and OnControllerRestored. The callbacks receive the stable controller ID and run when the next gamepad snapshot is applied. These callbacks report raw connection changes for every controller seen by Actions. - [tilemap](http://nsgo.games/docs/tilemap/): game/tilemap draws orthogonal, isometric, staggered, and hexagonal tiled worlds with camera frustum culling, loads Tiled .tmx/.tmj maps (with embedded or external .tsx/.tsj tilesets and animated tiles) and YAML tilesets (*.tileset.yaml), queries tile collision flags and rays, and drives a 2D camera with smoothing, clamping, and screen shake. - [tileshape](http://nsgo.games/docs/tileshape/): github.com/nsgo-dev/game/pkg/tilemap/tileshape derives collision and lighting geometry from a tilemap.Tilemap: a View that physics and the platformer controller take as their TileGrid, slopes from slanted and partial tiles, the merged outline of solid cells and tile shapes, static boxes, and lights2d occluders. - [scene](http://nsgo.games/docs/scene/): game/scene composes ordered world- and screen-space layers, hit-tests sprites and custom drawables in view coordinates, and manages scene lifecycles, overlay stacks, and animated transitions. - [physics](http://nsgo.games/docs/physics/): game/physics provides 2D collision shapes (Box, Circle, convex Polygon, Capsule, Segment and Chain), exact overlap contacts, anti-tunneling tile resolution with MoveAndSlide, and deterministic spatial queries and raycasts on World. - [2D Rigid Bodies & Joints Architecture](http://nsgo.games/docs/physics2d-rigid/): This document records the design decision for 2D rigid-body dynamics in github.com/nsgo-dev/game/pkg/physics (#320, #321, #322, #804, #805, #1710). - [screen](http://nsgo.games/docs/screen/): game/screen maps a fixed virtual canvas onto any window size and aspect ratio, converts pointer input between view and virtual coordinates, snaps pixel-art coordinates, computes safe-area rectangles for HUD layers, and applies the player's video settings. - [assets](http://nsgo.games/docs/assets/): For the trade-offs between resources/, embedded startup files and first-load groups, see Small downloads and fast starts. - [resource](http://nsgo.games/docs/resources/): game/resource reads and writes shared resource files: data that several scenes and pieces of code use, kept in a YAML file of its own and referenced by path instead of being repeated. Materials, curves, gradients, animation clips, UI themes, sound bus layouts and physics materials are resource files. - [Entities](http://nsgo.games/docs/entities/): A small, zero-reflection entity-component-system (ECS) for NSGo games: generational entities, typed sparse-set components, allocation-free queries, topologically ordered systems, prefabs and JSON world snapshots integrated with game/save. - [text](http://nsgo.games/docs/text/): game/text renders AngelCode BMFont bitmap fonts through sprite.Batch (with kerning, word wrapping, and alignment), signed-distance-field fonts that stay sharp at any size, on the screen or in 3D world space, and platform-rendered Unicode/CJK text through core.Drawing.FillText. - [particles](http://nsgo.games/docs/particles/): game/particles provides deterministic, seeded particle emitters for both 2D (Emitter, drawn through sprite.Batch) and 3D (Emitter3D + GPUParticles3D, drawn in a single instanced gpu.View draw call). - [save](http://nsgo.games/docs/save/): game/save stores game save slots as versioned JSON envelopes in core.Storage or on disk (such as cx.DataDir()), with sequential schema migrations and atomic backup recovery. - [gamedebug](http://nsgo.games/docs/gamedebug/): game/pkg/tooling/gamedebug provides development-only diagnostics for NSGo games: a key-toggled frame-time graph, a live scene/layer inspector, and world-space collision and sprite-bounds wireframes — all stripped to zero-cost no-ops with -tags release. - [mcp](http://nsgo.games/docs/mcp/): game/mcp exposes a running game's scenes, layers, entities, components, fixed-step loop controls, game-coordinate input injection, tunables, debug console, loaded asset groups and hot reload controls to coding agents over MCP through NSGo's github.com/nsgo-dev/nsgo/automation package. - [flow](http://nsgo.games/docs/flow/): game/flow holds gameplay control-flow primitives driven exclusively by game.Loop's fixed dt: game-clock Timers, typed finite state machines (Machine[S]), hierarchical state machines (HSM[S]), composable step sequences (Seq, Parallel, Race), and a zero-global-state typed event Bus. - [dialogue](http://nsgo.games/docs/dialogue/): game/dialogue runs branching conversations written as Yarn Spinner scripts. ParseYarn reads a script of titled nodes into a Script, and a Runner steps through it one line or choice menu at a time, keeps its variables and node visit counts, and hands each <> to the game. vn presents a script as a visual novel on top of a Runner. - [tween](http://nsgo.games/docs/tween/): game/tween animates numbers, points, colors, custom types, timelines, and tilemap.Camera moves deterministically on game.Loop's fixed steps using NSGo's core.Curve easing functions and named eases. - [animclip](http://nsgo.games/docs/animclip/): game/animclip plays animation clips, the resource files of type animation, on scene objects: any registered property keyed on a timeline. The editor keys clips with the same package, so a clip plays the same in the game as in the editor's preview. - [skeletal](http://nsgo.games/docs/skeletal/): 2D skeletal rigs, forward kinematics, skins, keyframe animation and crossfade blending, drawn into a core.Drawing through sprite.Batch. - [ai](http://nsgo.games/docs/ai/): game/ai provides deterministic game AI building blocks stepped cleanly on game.Loop: steering behaviors, velocity-based local avoidance (ORCA) in 2D and 3D XZ, behavior trees, utility AI scoring, goal-oriented action planning (GOAP), attack tokens and squads, spatial influence maps, EQS-style tactical position queries with cover points and reservations, perception with sight, hearing and memory, and smart objects with claimable interaction slots. Grids, A*, graphs, waypoints and 2D navigation meshes are in pathfind. - [pathfind](http://nsgo.games/docs/pathfind/): game/pathfind provides deterministic 2D pathfinding stepped cleanly on game.Loop: grid AStar pathfinding with line-of-sight smoothing and hexagonal or staggered topologies, HPA hierarchical pathfinding, JPS Jump Point Search, generic GraphSearch (A*, Dijkstra, and budgeted movement ranges with paths over hex tilemaps, waypoint graphs, or custom graphs), 2D NavMesh navigation with funnel smoothing, off-mesh links, polygon areas and filters, tiled meshes with dynamic obstacles, NavAgent path corridors, and bounded, partial, and incremental searches scheduled by a PathQueue. navbake bakes its navigation meshes from level geometry, and ai steers agents along its paths and scores tactical positions by path distance. - [navbake](http://nsgo.games/docs/navbake/): game/pathfind/navbake bakes the 2D navigation meshes that pathfind.NavMesh searches: from a level's outline with concave obstacles and holes, or from a tilemap's solid cells, shrunk by each agent type's radius and divided into convex polygons. A baked mesh saves to a versioned YAML file beside the level, and Draw shows it as a debug overlay. - [procgen](http://nsgo.games/docs/procgen/): github.com/nsgo-dev/game/pkg/procgen generates 2D levels on a tile grid with four generators: BSP rooms joined by corridors, cellular-automata caves, wave function collapse over a YAML rule file, and hand-made room templates placed on a dungeon layout graph. - [replay](http://nsgo.games/docs/replay/): game/replay records fixed-step game inputs into delta-encoded YAML text files and replays them deterministically for bug reproduction, ghost runs, and automated regression tests. - [cutscene](http://nsgo.games/docs/cutscene/): game/cutscene plays both pre-rendered video cutscenes and in-engine timeline cutscenes in a game, in a scene or between scenes. Video cutscenes play in NSGo's own video view (core.Video) over the game's view while pausing Loop and Mixer. Timeline cutscenes run deterministically on game.Loop fixed steps against a sceneformat.BuiltScene or sceneformat.SceneDoc, driving camera, actor, localized dialogue, sound effect and music tracks. Both kinds are skippable and call the game back when they end. - [undo](http://nsgo.games/docs/undo/): game/undo records the reversible moves of puzzle and turn-based games, with undo and redo, and gives in-game editors a move limit, merging and a saved marker. ## 2D Systems - [math2d](http://nsgo.games/docs/math2d/): game/math2d provides small, zero-allocation 2D value types shared across NSGo game packages: Vec2, axis-aligned Rect, Circle, and 3×2 Affine transforms, with lossless conversions to and from NSGo's core geometry types. - [gameui](http://nsgo.games/docs/gameui/): game/gameui builds stylized in-canvas menus and HUD widgets drawn directly into core.Drawing, with box layout, virtual-resolution scaling, 2D spatial action focus navigation, and world-anchored native NSGo overlays. - [lights2d](http://nsgo.games/docs/lights2d/): game/lights2d adds 2D lighting to NSGo canvases: an ambient darkness layer, point and directional cone lights, exact 2D visibility-polygon shadows from occluders, and CPU tangent-space normal-mapped sprite shading. - [quality](http://nsgo.games/docs/quality/): game/quality picks a low, medium or high quality preset for the device a game runs on, moves it with the frame times the game measures, and holds whatever the player picks in settings instead. - [postfx](http://nsgo.games/docs/postfx/): game/postfx draws a game's frame through a chain of shader passes, in order, with uniforms animated on the platform's frame clock. The frame is usually a pixel buffer the game writes each frame (core.ImageSource.Pixels), which NSGo shaders read since nsgo#1052. - [pixelfx](http://nsgo.games/docs/pixelfx/): game/pixelfx is a Go port of pixelfx, a library of pixel art effects and animations under the MIT license. Each effect is a small procedural program (fire, explosions, magic, weather, UI, pickups, transitions, critters, and character moves acted out with wind-up, hit-stop and recovery) that takes a palette, a seed and placement options and draws a frame with a back layer, a front layer and additive light. A game built on NSGo plays, recolors and mirrors them at run time and exports them as sprite sheets, with no JavaScript. - [worldmap](http://nsgo.games/docs/worldmap/): game/worldmap remembers which rooms of a game world the player has discovered and draws them as a minimap of the current area and a world map, with markers. What the player has discovered goes into a save slot and comes back on load. - [rooms](http://nsgo.games/docs/rooms/): game/rooms splits a 2D world into rooms with their own camera bounds, as metroidvania platformers do. When the player walks from one room into the next, a Director clamps the tilemap.Camera to the new room and plays its transition: a cut, a slide or a fade. - [fog](http://nsgo.games/docs/fog/): game/fog tracks fog of war for strategy games on orthogonal, isometric, staggered, and hexagonal tile grids: which cells each team can see now, which it has explored before, and which it has never seen. It draws the fog aligned to the tilemap's projection and saves it with the rest of a game. - [a11y](http://nsgo.games/docs/a11y/): game/a11y provides accessibility building blocks built on NSGo's public API: live dialogue and directional SFX captions, color-blind-safe palettes with CVD simulation and WCAG contrast helpers, persisted assist options, and screen-reader-ready native menus. - [l10n](http://nsgo.games/docs/l10n/): game/l10n provides game localization built on NSGo's core package and the Go standard library: versioned YAML and JSON string tables with BCP-47 fallback and CLDR plurals, script-aware FontSet[F], RTL visual reordering and HUD mirroring, and per-language asset catalogs with selective group reloads. - [mempool](http://nsgo.games/docs/mempool/): game/mempool provides deterministic object pools for hot game loops (Pool, Arena, SlicePool) that allocate nothing once warm. The spatial indices and culling helpers are in spatial. - [spatial](http://nsgo.games/docs/spatial/): game/spatial finds the 2D objects near an area or inside the view without testing every one: broad-phase spatial indices (Hash, Quadtree) and viewport sprite culling (CullBatch, BatchCuller, Cull), allocation-free once warm. The object pools are in mempool. - [datatable](http://nsgo.games/docs/datatable/): game/datatable loads typed game data, such as enemies, items, levels and quests, into slices of your own Go struct, and reloads it while the game runs when a designer saves the file. Tables are YAML, so designers and AI tools edit them directly and every change reads as a line in review; CSV and JSON exports from spreadsheets and other tools load too. - [stats](http://nsgo.games/docs/stats/): game/stats keeps an entity's gameplay stats: named base values changed by additive, multiplicative and override modifiers that come from sources such as equipment and buffs. Values are recomputed the moment anything changes, and timed modifiers count fixed steps, so a buff that lasts 300 steps ends on exactly the 300th. - [platformer](http://nsgo.games/docs/platformer/): github.com/nsgo-dev/game/pkg/platformer turns a physics.CharacterBody into a platformer character with coyote time, jump buffering, variable jump height, wall slides and wall jumps. Each helper's timing is a tunable in a YAML config. - [inventory](http://nsgo.games/docs/inventory/): game/inventory holds gameplay items: item definitions in versioned YAML, slot-based containers of stacks, typed equipment slots, and snapshots that round-trip through game/save. - [ability](http://nsgo.games/docs/ability/): github.com/nsgo-dev/game/pkg/ability runs gameplay abilities: costs, cooldowns, charges, cast and channel times and conditions, activated by input actions and advanced one fixed game.Loop step at a time. - [cues](http://nsgo.games/docs/cues/): github.com/nsgo-dev/game/pkg/cues keeps gameplay presentation mappings in a versioned YAML file, so gameplay code names a cue tag and never an asset. The package owns deterministic parsing and cue lifecycle bookkeeping. A game supplies cues.Hooks to connect the mapping to its particle, audio, camera and sprite systems. - [quest](http://nsgo.games/docs/quest/): game/quest runs quests with objectives (collect, reach, defeat, talk), quest states and rewards. Quests are defined in a versioned YAML book, advanced by game events published on a flow.Bus, and saved as a small snapshot that round-trips through save.Store. - [loot](http://nsgo.games/docs/loot/): github.com/nsgo-dev/game/pkg/loot rolls nested weighted drop tables with guaranteed drops and pity counters. Every roll draws from a random.Stream, so a seed and a sequence of rolls give the same drops on every platform, in replays and on a dedicated server. - [battle](http://nsgo.games/docs/battle/): github.com/nsgo-dev/game/pkg/battle resolves turn-based battles between a party and a troop. It holds no presentation: each turn returns a list of events for the game to animate in its own time, and every roll draws from a random.Stream, so a seed and the same commands replay the same battle on every platform. - [cards](http://nsgo.games/docs/cards/): game/cards drags cards between the slots of a board in the game view and lays them out as fanned hands, decks, piles and grids. A card dropped on a slot that accepts it snaps into place; one dropped anywhere else flies back to where it came from. Every move is a game/tween advanced on game.Loop's fixed steps, and the mouse and touch take the same path. - [bullets](http://nsgo.games/docs/bullets/): game/bullets spawns, moves and draws the bullet patterns of shooters: rings, spirals and aimed bursts defined in YAML, taken from a mempool.Pool and drawn through one sprite.Batch. - [fighting](http://nsgo.games/docs/fighting/): github.com/nsgo-dev/game/pkg/fighting buffers fighting-game input one fixed step at a time and recognizes motion inputs (quarter circles, dragon punches, charges, double taps), button presses, chords and combos described in a YAML move set. - [framedata](http://nsgo.games/docs/framedata/): github.com/nsgo-dev/game/pkg/framedata gives fighting games per-frame hitboxes, hurtboxes and hit properties (damage, hitstun, blockstun, knockback, cancel windows) for their moves. A character's frame data is a YAML file, and a World resolves it into hits once per fixed step, the same way every time. - [rts](http://nsgo.games/docs/rts/): game/rts is the unit-control layer of a real-time strategy game: flow fields that steer many units toward a goal over a pathfind.Grid, a Crowd that moves those units with push-apart separation or ORCA local avoidance and wall sliding, formations kept in versioned YAML, box and click selection, and numbered control groups. - [rhythm](http://nsgo.games/docs/rhythm/): game/rhythm keeps a rhythm game in time with its music: a beat map read from YAML, a music clock that tells the track's position and beat at any engine time, and a calibration of each device's audio and video latency. - [idle](http://nsgo.games/docs/idle/): idle.Meter provides deterministic wall-clock refill for lives, energy and stamina. Persist ValueNow with Anchor, pass saved timestamps explicitly, and call Value, NextIn or FullIn when the game resumes. Add permits rewards above Max, which pauses refill until the value falls below the cap. Spending or granting while the meter is refilling keeps the progress toward the next unit, so NextIn and FullIn count it, and spending from a full meter starts the next interval then. A rewound device clock never grants progress, including when the player spends at the rewound time and sets the clock forward again. - [vn](http://nsgo.games/docs/vn/): github.com/nsgo-dev/game/pkg/vn plays a dialogue script as a visual novel: character portraits with expressions, a text box with name plates and a typewriter, choices, a backlog, auto and skip modes, and voice lines. ## Multiplayer & Modding - [netplay](http://nsgo.games/docs/netplay/): game/online/netplay provides cross-target multiplayer networking for NSGo games: a unified Transport across WebTransport (HTTP/3 QUIC, native + WebAssembly), WebSocket (native + WebAssembly), native UDP, and simulated loopback; server-authoritative delta snapshot replication with client prediction and interpolation; and deterministic lockstep and rollback netcode. - [netplay/wire](http://nsgo.games/docs/netplay-wire/): game/pkg/online/netplay/wire defines the YAML wire message schema format used by pkg/online/netplay and game-specific binary payloads (such as typed EntityState.Props), pure-integer float quantization helpers, MSB-first bit packing, and a deterministic zero-allocation Go codec generator driven by game wire. - [gameserver](http://nsgo.games/docs/gameserver/): github.com/nsgo-dev/game/pkg/online/gameserver runs a game's fixed-step updates in a plain Go process, without an NSGo app, window, core.Scope or cgo. - [accounts](http://nsgo.games/docs/accounts/): github.com/nsgo-dev/game/pkg/online/accounts is a self-hostable player account service. A player starts as a guest, upgrades to an email address or links an OAuth or platform identity (Game Center, Play Games, Steam) without losing their data, and every device gets short-lived tokens a game server verifies offline. - [cloudsave](http://nsgo.games/docs/cloudsave/): github.com/nsgo-dev/game/pkg/online/cloudsave is a self-hostable cloud save service: each player account has save slots over HTTPS, kept in versions. Two devices writing the same slot at once cannot overwrite each other, a slot over the size limit is refused with a clear error, and the last few versions of each slot can be listed and restored. Games talk to it through liveops.CloudClient, a liveops.CloudSync, so a liveops.CloudSyncer keeps local saves in step with it and resolves conflicts by its policy. - [leaderboard](http://nsgo.games/docs/leaderboard/): leaderboard submits scores to and shows the platform's own leaderboards: Game Center on iOS, iPadOS, tvOS and macOS, Play Games Services on Android, and friend rankings on WeChat and Douyin mini games through host user cloud storage and the open data context. It is a thin layer over NSGo's gameservices package and mini-game host APIs that lets a game name its boards once in a YAML file instead of passing platform IDs around its code. - [leaderboard/selfhost](http://nsgo.games/docs/leaderboard-selfhost/): leaderboard/selfhost is a self-hostable leaderboard service for games that run on several platforms or on platforms without a game service (the web, Windows, Linux). Where leaderboard shows Game Center's and Play Games' own boards, this service keeps one board for every platform, keyed by the account the account service signs players in to, so a score from a browser and a score from a phone land on the same board. - [admin](http://nsgo.games/docs/admin/): admin gives the self-hosted services an operator door of their own: who the operators are, what each may do, how they sign in, and an audit record of every operator call that changes something. accountsd, cloudsaved and leaderboardd serve it on a second listener when their configuration has an admin: block, and a dedicated server can mount gameserver.Inspector on the same foundation. Operator routes never mount on a player-facing listener. - [Achievements](http://nsgo.games/docs/achievements/): achievements declares a game's achievements once, in a versioned YAML file, tracks the player's progress toward them, and reports that progress through NSGo's gameservices package: Game Center on macOS, iOS and tvOS, and Google Play Games Services on Android. It uses only Go's standard library, NSGo's public API and the YAML library the module already depends on. - [presence](http://nsgo.games/docs/presence/): presence publishes what the player is doing (level, game mode, party size, timestamps, artwork, and custom localization tokens) to Steam and Discord friend lists through a single provider-neutral API. Both built-in providers are pure Go with no cgo or hand-written C: Discord speaks Discord's local IPC v1 protocol directly over Unix domain sockets or Windows named pipes, and Steam dynamically loads the Steamworks shared library through purego to call ISteamFriends::SetRichPresence and ClearRichPresence. - [steam](http://nsgo.games/docs/steam-stats/): steam is the engine-facing boundary for Steam achievements, stats, leaderboards and rich presence. It defines a Driver interface that a Steamworks adapter implements and a Platform that wraps the driver for one core.Scope. This package ships no native adapter: a game injects its own Driver, and until one exists New with a nil driver returns ErrUnavailable. A Driver that calls Steamworks should attach to the process's shared client from steamworks (steamworks.Open, then ResolveSymbol and AwaitCall for the ISteamUserStats flat API) instead of initializing Steamworks itself; that client already pumps callbacks and shuts Steamworks down, so the driver's RunCallbacks and Shutdown have nothing to do. To ship a build on Steam, see Shipping on Steam. - [steamworks](http://nsgo.games/docs/steamworks/): steamworks owns the one Steamworks client a process may have. It loads the Steamworks shared library through purego (no cgo or hand-written C), initializes Steamworks once, pumps Steam's callbacks once per display frame on the engine goroutine, and shuts Steamworks down when the last scope that opened it is disposed. presence.Steam and modding.SteamWorkshop attach to the same client instead of initializing Steamworks themselves. Achievements, stats and leaderboards go through steam, whose Driver can be implemented on this client. - [Live operations](http://nsgo.games/docs/liveops/): liveops.Portal provides a provider-neutral seam for Poki and CrazyGames web SDKs. Call LoadingFinished after the first playable scene and bracket active play with GameplayStart and GameplayStop. Break and Rewarded pause the game, mute audio and reset input before invoking the SDK, then restore audio and play state on success, error or timeout. A rewarded result is granted only when the provider returns true; PortalNone is a no-op for native builds and tests. - [modding](http://nsgo.games/docs/modding/): Hosts that want to give authors a starter directory can call modding.WriteModKit(dir). It writes deterministic game.d.ts, mod.yaml, mod.tsx, and README.md files. The helper is a kit artifact generator. Manifest checking and runtime loading remain the host game's responsibility. ## 3D - [3D Models from Blender](http://nsgo.games/docs/3d-models-blender/): Prepare static, skinned, and animated 3D models in Blender 4.x or convert FBX and OBJ assets into glTF 2.0 (.glb/.gltf) matching NSGo's 3D conventions, verified against two committed round-trip sample models. - [3D Math Conventions](http://nsgo.games/docs/math3d/): math3d provides pure-Go float32 vectors, matrices, quaternions, transforms, bounding volumes, rays, planes, and frustums with a single consistent set of conventions matching glTF 2.0, WebGPU, and Metal. - [scene3d](http://nsgo.games/docs/scene3d/): game/scene3d provides a 3D scene graph with dirty-propagated transforms, named sockets and typed attachments, a dynamic fat-AABB / SAH BVH for fast spatial queries, perspective/orthographic cameras with Orbit/FPS/ThirdPerson controllers, screen-space 3D picking, and box-projected 3D decals for the mobile forward path. - [render3d](http://nsgo.games/docs/render3d/): game/render3d provides mesh buffers, textures and samplers, metallic-roughness PBR materials, directional, spot and point light shadow maps, camera uniforms, offscreen render-to-texture cameras and multi-viewport split-screen rendering, distance and height fog, and an HDR render target with a tone-mapping pass for the NSGo GPU view alongside the GPU-agnostic, zero-steady-state-allocation CPU 3D render pipeline and developer tools: frustum culling, opaque/transparent draw sorting, automatic instancing, LOD selection with hysteresis, camera-facing billboards and 3D ribbon trails, 3D debug wireframes and transform gizmos, frame profiling, and mobile/desktop GPU budgets. - [scenemodel](http://nsgo.games/docs/scenemodel/): game/scenemodel gives the objects of a scene file their 3D look, so a 3D level is a text file a person or an AI can edit and review, as a 2D one is, instead of being assembled in Go. An object names a built-in primitive in mesh, a glTF 2.0 model in model, or a modular 3D grid map in gridMap, and scenemodel.Build turns the scene into a scene3d node tree whose nodes carry their geometry, materials and bounds, ready for render3d.Queue or the package's own Renderer. - [anim3d](http://nsgo.games/docs/anim3d/): game/anim3d provides 3D skeletal animation driven on game.Loop's fixed steps: glTF 2.0 node and skin playback (Player, ClipFromGLTF), pose state machines with cross-fade transitions, 1D/2D blend spaces with foot-phase synchronization, bone-masked override and additive layers, timed clip events, two-bone and FABRIK inverse kinematics, and root motion extraction. - [physics3d](http://nsgo.games/docs/physics3d/): Compact, deterministic 3D collision detection, raycasting, rigid-body dynamics, and a kinematic character controller written in pure Go. - [vehicle3d](http://nsgo.games/docs/vehicle3d/): Raycast cars on a physics3d world: wheel colliders, spring-damper suspension, longitudinal and lateral tire friction and a car controller, plus race checkpoints, lap times and ghost replays. - [world3d](http://nsgo.games/docs/world3d/): game/world3d provides 3D world-building primitives built on math3d: heightmap terrain, modular 3D mesh GridMaps, procedural scattered foliage with frustum/distance culling, and floating-origin chunk streaming. pathfind3d builds 3D navigation meshes and agents on its chunk coordinates. - [pathfind3d](http://nsgo.games/docs/pathfind3d/): game/pathfind3d provides deterministic 3D navigation on math3d: multi-level navigation meshes over ramps, bridges and stacked floors with off-mesh links, polygon areas and filters, reusable zero-allocation queries and incremental searches, NavAgent path corridors with agent groups, and tiled meshes with dynamic obstacles that stream in and out with world3d's chunks. It shares NavArea, NavFlags and NavFilter with pathfind, its 2D counterpart, and navbake3d bakes its meshes from level geometry. - [navbake3d](http://nsgo.games/docs/navbake3d/): game/pathfind3d/navbake3d bakes 3D navigation meshes from a level's geometry, so a 3D game no longer authors the convex polygons of a pathfind3d NavMesh by hand. It reads the level from glTF models, scene files, terrain heightmaps, GridMaps and physics colliders, bakes one mesh per agent type, and saves them in a versioned YAML file that a scene names. For a 2D level, navbake bakes pathfind.NavMesh polygons instead. - [voxel](http://nsgo.games/docs/voxel/): game/voxel provides chunked 3D voxel worlds for sandbox games: dense cubic chunks, per-voxel sky and block light propagation (0..15) across chunk borders, greedy face meshing into render3d buffers, cross-chunk neighbor culling and ambient occlusion, minimal dirty-chunk tracking on edit, 3D DDA voxel raycasting, direct solid-block collision for physics3d bodies and characters (plus an axis-separated AABB move-and-slide character mover), and deterministic versioned YAML saves. ## More - [Deploying backend services](http://nsgo.games/docs/backend-deploy/): Use Postgres for production accounts, cloud saves and self-hosted leaderboards. SQLite is suitable for development, tests and a single node with a durable volume. Memory stores are test-only. - [backend](http://nsgo.games/docs/backend/): github.com/nsgo-dev/game/pkg/online/backend composes the online services' HTTP handlers and compiled game RPC routes into one embeddable http.Handler, so one server process can host accounts, cloudsave, leaderboard/selfhost and the game's own server-side calls. - [Economy](http://nsgo.games/docs/economy/): pkg/online/economy is the provider-neutral wallet core for server-owned balances. It validates versioned currency definitions, applies caps, rejects insufficient spends, and makes grants, spends and exchanges idempotent with caller-supplied keys. Wrap it in a records-backed transaction and expose it through a service that authorizes player reads/spends separately from server grants. - [eos](http://nsgo.games/docs/epic/): eos is the Go boundary for Epic Online Services: exchange-code login, achievement unlocks and progress, leaderboard scores and queries, and rich presence, with every result delivered on the engine goroutine. The package defines the contract a native adapter implements, eos.Driver, and the eos.Platform that games call. It does not ship the native adapter yet: binding the EOS SDK shared libraries through purego, epic IDs in the achievement and leaderboard files, and shipping the library are tracked in #1770. Until then a game passes its own driver, and tests pass a fake. - [Farming rules](http://nsgo.games/docs/farming/): pkg/farming contains deterministic rules for farming and life-sim projects. Calendar advances through versioned seasons from an explicit duration, rolling to the next season after its configured number of days. CropKind and Crop model staged growth. A crop advances only when WateredDay is called, so an unwatered day cannot silently mature it. Both APIs avoid time.Now, which keeps saves, replays and headless tests reproducible. - [Game time](http://nsgo.games/docs/gametime/): gametime.Clock advances a deterministic in-game day from explicit fixed durations, rolls season lengths, and skips to a sleep hour without reading the device clock. Time shorter than an in-game minute carries over in Partial, so stepping once per frame keeps the same time as one step of the total length, and a saved clock keeps it. - [Inventory crafting](http://nsgo.games/docs/inventory-crafting/): inventory.Recipe and inventory.Craft atomically exchange input and output stacks, leaving the bag unchanged when an input is missing or outputs do not fit. - [Match-3 levels](http://nsgo.games/docs/match3-levels/): match3.Level defines versioned YAML dimensions, move limits, goals, and initial cells with strict validation. - [Match-3 boards](http://nsgo.games/docs/match3/): pkg/match3 detects deterministic horizontal and vertical runs of three or more equal non-zero pieces and supports adjacent swaps that are accepted only when they create a match. Returned cells are sorted for stable tests and replays. - [Mod packages](http://nsgo.games/docs/modding-pack/): modding.PackDir validates mod.yaml and writes a deterministic zip with sorted paths and normalized timestamps. - [Placement grids](http://nsgo.games/docs/placement/): pkg/placement supplies generic square-grid footprint checks. A footprint can be rotated in quarter turns, tested against bounds and occupancy, placed, removed, and queried by cell. Failure records identify each blocked or out-of-bounds cell for a ghost preview. - [portmap](http://nsgo.games/docs/portmap/): game/pkg/online/portmap is the stable contract for player-hosted gateway mappings. Request validates the transport protocol, internal port, and lease lifetime. Providers return a Mapping with an external address, renewal, and close operations. The default provider reports ErrUnsupported until a platform provider is installed. - [Level progression](http://nsgo.games/docs/progression/): pkg/progression defines a versioned level pack with unique IDs, one-to-three star targets, and star thresholds for unlocking levels. Its parser refuses unknown fields and invalid thresholds, and Encode produces deterministic YAML. The rules are pure data operations, so a game can persist earned stars separately and use the same checks in a level-select UI and a headless test. - [records](http://nsgo.games/docs/records/): github.com/nsgo-dev/game/pkg/online/records provides a server-authoritative JSON record boundary. Records are keyed by owner, collection and key, carry monotonically increasing versions and can be applied in one compare-and-set transaction. A record's Read permission decides who may Get and List it: Private records are read only by server code (reader records.Server), OwnerRead records also by their owner, and PublicRead records by anyone. Apply is server code and does not check Write; a player-facing service checks it before applying a player's write. - [Releasing](http://nsgo.games/docs/releasing/): Before tagging, bump every release reference with go run ./tools/changelog bump X.Y.Z. The command updates README.md, both documentation indexes, the editor manifest, localized README tables, website release copy and every template go.mod.tmpl; review its diff and keep pinned NSGo references aligned. Add a fragment under changelog.d/ for each user-visible change. Run go run ./tools/changelog check, go run ./tools/changelog collect, go run ./tools/changelog release X.Y.Z, and go run ./tools/changelog verify-release X.Y.Z from the repository root. Review the generated CHANGELOG.md, stability rows, API compatibility notes, schemas and release artifacts, then run go tool nsgo check for supported targets and the full go tool nsgo test matrix before pushing the tag. Record changed experimental paths and stable signatures affected by an NSGo upgrade. - [rpgdata](http://nsgo.games/docs/rpgdata/): game/rpgdata reads and writes an RPG's database: classes with level curves and learned skills, actors, skills, enemies and troops, in one versioned YAML file whose IDs and cross-references are checked on load. Progression tracks a character's level and experience. - [sessionstats](http://nsgo.games/docs/sessionstats/): github.com/nsgo-dev/game/pkg/sessionstats records release-safe frame pacing without the debug overlay. Feed completed frame durations to Recorder.Observe, then read Summary for p50/p95/p99, longest frame, frames at least twice the target interval, peak heap, runtime memory and GC cycles/pause observations. The recorder uses a fixed ring and can be sampled from a release build. - [Small downloads and fast starts](http://nsgo.games/docs/small-downloads/): The first frame should load only what it needs. Put runtime files under resources/ and refer to them with asset: URIs. They remain outside the Go binary and the web target can fetch them on demand. Use //go:embed or assets.WithFS for small files that must be available before the resource system starts, such as a loading-screen image or a tiny startup table. - [Social chat](http://nsgo.games/docs/social-chat/): social.Chat provides canonical room, group and DM channel IDs, bounded JSON messages, history paging, sender edits/deletes and a pre-send moderation hook. - [Social friends and blocks](http://nsgo.games/docs/social-friends/): social.Graph models invite, mutual friend and blocked edges with deterministic listings and block checks for chat, parties and leaderboards. A block belongs to the account that made it: Unblock by the blocked account does not lift it, and RemoveFriend never removes a block. See Social for the calls and limits. - [Social](http://nsgo.games/docs/social/): online/social holds the in-memory cores of a game service's social features, and online/realtime the notifications that carry them to players. Both are server-side code: a game client reaches them through the service that embeds them, and the service persists what it must keep. - [Spawn director](http://nsgo.games/docs/spawn/): spawn.Document and spawn.Director provide deterministic versioned wave schedules for shooters and survivors-like games. Director.Step emits Spawn values without creating entities, keeps the live count under maxLive, and uses RingPosition to place events outside the camera rectangle. Save Director.State with game replays or saves. - [Gameplay tags](http://nsgo.games/docs/tags/): pkg/tags provides a strict versioned YAML registry, reference-counted hierarchical containers, and all/any/none queries for shared ability, AI, item, and UI vocabularies. - [Working as a team](http://nsgo.games/docs/teams/): NSGo projects are designed to be reviewed and merged by Git. Scenes, prefabs, resources, settings and data stay in text files, while the repository records stable file IDs and the permissions that every teammate should review. - [Tap2D template](http://nsgo.games/docs/template-tap2d/): Tap2D is a portrait-first one-touch endless game for phones, web portals and mini-game shells. The player taps to move through lanes while obstacles move toward the player. A tap after the run ends, or the Retry button, resets the in-memory run immediately, and the best score persists through save.Store. - [wsclient](http://nsgo.games/docs/wsclient/): game/online/wsclient is a plain RFC 6455 WebSocket client for servers that are not a netplay WebSocketServer: third-party game backends, a Node or Elixir game server, Twitch or YouTube chat integration for a streamer game, a hosted realtime database, or a custom JSON protocol shared with a web dashboard. The same API works on native targets and in the browser (js/wasm). ## Optional - [NSGo for language models](https://nsgo.dev/llms.txt): the docs of the UI engine the game layer runs on - [API reference](http://nsgo.games/docs/api/): every exported identifier of the game packages - [Showcase](http://nsgo.games/showcase/): games, official examples and starter templates - [Changelog](https://github.com/nsgo-dev/game/blob/main/CHANGELOG.md) - [Source](https://github.com/nsgo-dev/game)