# 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 v0.1.0 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; https://game.nsgo.dev/llms-full.txt holds their Markdown in full. ## Guides - [Overview](https://game.nsgo.dev/docs/): game is a pure-Go 2D and 3D game layer for NSGo apps. A game draws into one NSGo view—a Canvas, a pixel buffer, a shader or a GPU view—while its HUD and menus stay ordinary native NSGo views on top. It uses only NSGo's public API (core, audio, gamepad, and GPU views), so an app that does not import it links none of it. - [Getting Started](https://game.nsgo.dev/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. - [Templates](https://game.nsgo.dev/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. - [The platformer2d template](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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, against the CPU, on touch. 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](https://game.nsgo.dev/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 idle template](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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 gameproject 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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/playground/): The playground runs this repository's examples in the browser, built for NSGo's web target, with each example's source beside it. To change an example, run it on your machine with the dev server, which rebuilds and reloads it each time you save. - [Packages](https://game.nsgo.dev/docs/packages/): What each package holds and how its parts behave, from the packages' doc comments. The full API of every package is in the API reference, and every file format the packages read and write is in File Formats. - [API Stability](https://game.nsgo.dev/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. - [Errors an agent can act on](https://game.nsgo.dev/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. - [Building and Shipping](https://game.nsgo.dev/docs/shipping/): Verify your game across every target with nsgo check, configure metadata, icons and signing in nsgo.yaml, and build release packages for macOS, Windows, Linux, the web, iOS and Android with nsgo build. - [Command Line](https://game.nsgo.dev/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, play input recordings headless, check benchmarks against a stored baseline, create projects, 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](https://game.nsgo.dev/docs/cli-reference/): Every subcommand of nsgo game, which go tool game runs alike, with its usage line and flags, generated from the commands' definitions so it always matches game help. Command Line shows how to install the command, what each subcommand is for and how to set up shell completion. - [Asset and Plugin Library](https://game.nsgo.dev/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. nsgo game library runs it from the command line and the scene editor's library panel runs it from the editor. - [Placeholder Assets](https://game.nsgo.dev/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](https://game.nsgo.dev/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 nsgo game CLI, plain-text YAML formats and the game/mcp tool suite. - [Agent Evaluation Suite](https://game.nsgo.dev/docs/agent-eval/): The agent evaluation suite under tools/agenteval/ is contributor tooling with fixed game-development tasks. Each task has a starter workspace, a hand-written reference solution and a rubric that scores a workspace from 0 to 100 with YAML checks, assetcheck, nsgo check and live headless game/mcp tools. It supports three modes: deterministic reference grading (API and format regression checks with no model or key), built-in tool-calling agent grading (Anthropic Messages API or OpenAI-compatible Chat Completions API), and command grading for any external coding agent CLI. - [Package Size Budgets](https://game.nsgo.dev/docs/package-size-budgets/): sizecheck 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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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. ## Tutorial - [Tutorial: Star Catcher](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/tutorial-01-empty-project/): Create the Go module for Star Catcher, describe the app in nsgo.yaml, open a window that paints the playfield in a Canvas, and test it without a window. - [Tutorial 2: The Game Loop](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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, and build release packages. ## Coming from Another Engine - [Coming from Godot](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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. ## 2D Core - [Loop](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/input/): game/input turns touch regions, mouse buttons, relative mouse motion under a pointer lock, keyboard keys and game controllers into named actions and axes, sampled once per game.Loop step and persisted across launches in core.Storage. - [tilemap](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/tileshape/): github.com/nsgo-dev/game/pkg/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. It plays the part of the physics and occlusion polygons of Godot's TileSet. - [scene](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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). - [screen](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/assets/): game/assets loads sprite atlases, sounds, images, raw bytes, and custom game data asynchronously off the engine goroutine, organizes them into per-scene groups with reactive progress signals, releases them cleanly when a scene ends, and provides a ready-made LoadingScreen component. - [resource](https://game.nsgo.dev/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, as Godot's .tres files are. Materials, curves, gradients, animation clips, UI themes, sound bus layouts and physics materials are resource files. - [Entities](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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. - [debug](https://game.nsgo.dev/docs/debug/): game/debug 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](https://game.nsgo.dev/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](https://game.nsgo.dev/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. - [tween](https://game.nsgo.dev/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. - [animclip](https://game.nsgo.dev/docs/animclip/): game/animclip plays animation clips, the resource files of type animation, on scene objects: any registered property keyed on a timeline, as Godot's AnimationPlayer does. The editor keys clips with the same package, so a clip plays the same in the game as in the editor's preview. - [skeletal](https://game.nsgo.dev/docs/skeletal/): 2D skeletal rigs, forward kinematics, skins, keyframe animation and crossfade blending, drawn into a core.Drawing through sprite.Batch. - [ai](https://game.nsgo.dev/docs/ai/): game/ai provides deterministic game AI building blocks stepped cleanly on game.Loop: grid AStar pathfinding, 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, 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, and perception with sight, hearing and memory. - [navbake](https://game.nsgo.dev/docs/navbake/): game/navbake bakes the 2D navigation meshes that ai.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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/undo/): game/undo records the reversible moves of puzzle and turn-based games, with unlimited undo and redo. ## 2D Systems - [math2d](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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. - [effects](https://game.nsgo.dev/docs/effects/): game/effects 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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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. - [perf](https://game.nsgo.dev/docs/perf/): game/perf provides deterministic, zero-steady-state-allocation primitives for hot game loops: reusable object pools (Pool, Arena, SlicePool), 2D broad-phase spatial indices (SpatialHash, Quadtree), and viewport sprite culling (CullBatch, BatchCuller, Cull). - [datatable](https://game.nsgo.dev/docs/datatable/): game/tooling/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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. - [quest](https://game.nsgo.dev/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](https://game.nsgo.dev/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. - [cards](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/bullets/): game/bullets spawns, moves and draws the bullet patterns of shooters: rings, spirals and aimed bursts defined in YAML, taken from a perf.Pool and drawn through one sprite.Batch. - [fighting](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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 an ai.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](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/idle/): game/idle holds what idle and incremental games need: a Number that reaches far past float64's 1.8e308, progress earned while the game was closed, and formatting of very large numbers as 1.23K, 1.23e45 or 1.23万. - [vn](https://game.nsgo.dev/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 - [net](https://game.nsgo.dev/docs/net/): game/net provides cross-target multiplayer networking for NSGo games: a unified Transport across WebSocket (native + WebAssembly), native UDP, and simulated loopback; server-authoritative delta snapshot replication with client prediction and interpolation; and deterministic lockstep and rollback netcode. - [server](https://game.nsgo.dev/docs/server/): github.com/nsgo-dev/game/pkg/server runs a game's fixed-step updates in a plain Go process, without an NSGo app, window, core.Scope or cgo. - [accounts](https://game.nsgo.dev/docs/accounts/): github.com/nsgo-dev/game/pkg/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](https://game.nsgo.dev/docs/cloudsave/): github.com/nsgo-dev/game/pkg/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](https://game.nsgo.dev/docs/leaderboard/): leaderboard submits scores to and shows the platform's own leaderboards: Game Center on iOS, iPadOS, tvOS and macOS, and Play Games Services on Android. It is a thin layer over NSGo's gameservices package that lets a game name its boards once in a YAML file instead of passing platform IDs around its code. - [leaderboard/selfhost](https://game.nsgo.dev/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. - [Achievements](https://game.nsgo.dev/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](https://game.nsgo.dev/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. - [Live operations](https://game.nsgo.dev/docs/liveops/): liveops holds provider-agnostic live operations primitives for NSGo games. It uses only Go's standard library, github.com/nsgo-dev/game and NSGo's public core and cloud APIs, and links no third-party crash, analytics, ad or payment SDKs. - [modding](https://game.nsgo.dev/docs/modding/): game/modding loads and runs capability-sandboxed TSX/JS game mods on top of NSGo's tsx runtime, with mod.yaml manifest validation, topological dependency resolution, fault isolation, persisted enable/disable state, and a "game" module API. ## 3D - [3D Models from Blender](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/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](https://game.nsgo.dev/docs/physics3d/): Compact, deterministic 3D collision detection, raycasting, rigid-body dynamics, and a kinematic character controller written in pure Go. - [vehicle](https://game.nsgo.dev/docs/vehicle/): 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](https://game.nsgo.dev/docs/world3d/): game/world3d provides 3D world-building primitives built on math3d: heightmap terrain, multi-level 3D navigation meshes, modular 3D mesh GridMaps, procedural scattered foliage with frustum/distance culling, and floating-origin chunk streaming. - [navbake3d](https://game.nsgo.dev/docs/navbake3d/): game/navbake3d bakes 3D navigation meshes from a level's geometry, as Recast, Godot's NavigationRegion3D and Unity's NavMeshSurface do, so a 3D game no longer authors the convex polygons of a world3d 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 ai.NavMesh polygons instead. - [voxel](https://game.nsgo.dev/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. ## Optional - [NSGo for language models](https://nsgo.dev/llms.txt): the docs of the UI engine the game layer runs on - [API reference](https://game.nsgo.dev/docs/api/): every exported identifier of the game packages - [Showcase](https://game.nsgo.dev/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)