GitHubGet started
Go 1.27+v0.1.0 · Pure Go

Write games in Go.Ship one codebase to six platforms.

game is the 2D and 3D game layer for NSGo: a fixed-step loop, input actions, sprites, glTF rendering, a visual scene editor and plain-text YAML formats. Your game draws into one NSGo view; its HUD and menus stay native.

go run github.com/nsgo-dev/game/cmd/game@latest new mygame
Cave RunPlatformerLIVE · WEB BUILD
Play in the browser
One Go codebase, built for →
  • macOS
  • iOS
  • Windows
  • Linux
  • Android
  • Web
60 HzFixed-step loop
320×180Virtual resolution, scaled
< 8.3 msA frame of 1000 sprites

Consoles (Switch, PlayStation, Xbox) are out of scope: their SDKs are under NDA and need C toolchains, and this project is Go only.

Example games

The examples run on desktop, mobile and the web, with their source in the repository.

See all examples

Field Medic · A small game that ships its own scene editor and editor plugin.Star Catcher · The tutorial: nine chapters from an empty project to a shipped game.

The game is drawn. The interface is native.

  1. Draw the game in one view

    A game draws into one NSGo view: a Canvas, a pixel buffer or a shader. The loop, sprite batches and tilemaps all work around it.

  2. Native views for HUD and menus

    Scores, pause menus and settings are ordinary NSGo views on top of the game, with native text, accessibility and input methods.

  3. Link only what you use

    It uses only NSGo’s public API, so an app that does not import it links none of it, and every package imports on its own.

Cave Run
HUD · native NSGo viewsGame · core.Canvas

2D and 3D on one shared foundation.

The loop, input actions, sound and scene switching are shared by both 2D and 3D, so you can mix scenes freely without rewriting your game.

Available

2D

A fixed-step loop, input actions, sprites, tilemaps, scenes, physics, lighting and sound, drawn at 60 fps or the display’s refresh rate.

  • game.Loop
  • sprite
  • tilemap
  • scene
  • physics
  • particles
Available

3D

Meshes, cameras, PBR lighting, skeletal animation, 3D physics and glTF models on NSGo’s GPU view, with models imported from Blender.

  • scene3d
  • render3d
  • gltf
  • anim3d
  • physics3d
  • math3d
Examples · Lantern 3D

One component is one game.

A game is an NSGo component. It binds its actions once, runs a game.Loop on its scope, steps the actions each fixed update and redraws a Canvas from Draw. This is Cave Run’s skeleton, cut down to one sprite.

  • Fixed-step updates, interpolated draw frames
  • Keys and gamepads bound to the same action
  • Hot reload on save: go tool nsgo dev
import (
	"time"

	"github.com/nsgo-dev/game"
	"github.com/nsgo-dev/game/pkg/input"
	"github.com/nsgo-dev/game/pkg/sprite"
	"github.com/nsgo-dev/nsgo/core"
	"github.com/nsgo-dev/nsgo/gamepad"
)

func Game(cx *core.Scope) core.Node {
	atlas, _ := sprite.LoadAtlas(core.Src("asset:sprites.png"), spritesJSON)
	hero := sprite.NewSprite(atlas.Frames["hero_idle_0"])
	batch := &sprite.Batch{Atlas: atlas, Sprites: []*sprite.Sprite{&hero}}

	actions := input.NewActions()
	actions.Bind("left", input.Key("a"), input.GamepadButton(gamepad.ButtonDPadLeft))
	actions.Bind("right", input.Key("d"), input.GamepadButton(gamepad.ButtonDPadRight))
	actions.BindAxis("move", "left", "right")
	actions.WatchKeys(cx)

	frame := core.NewSignal(cx, 0)
	loop := &game.Loop{
		Rate: 60,
		Update: func(dt time.Duration) {
			actions.Step()
			hero.X += float32(actions.Axis("move")) * 98 * float32(dt.Seconds())
		},
		Draw: func(alpha float64) { frame.Update(func(n int) int { return n + 1 }) },
	}
	loop.Run(cx)

	return core.Canvas{
		Draw: func(d *core.Drawing, _ core.Size) { frame.Get(); batch.Draw(d) },
	}
}

Plain-text projects. Visual editor. Built for AI agents.

Every scene, prefab, material, animation and data table is versioned YAML that humans and coding agents can read, diff and edit cleanly.

EDITOR

Visual 2D & 3D scene editor

Launch game editor for a live viewport, hierarchy, inspector, transform gizmos and asset browser — or extend it with custom Go plugins.

YAML

Plain-text, schema-validated files

No opaque binary scenes. Every format carries a version, rejects unknown fields, ships a JSON Schema and round-trips cleanly in Git.

TEMPLATES & AI

16 starter templates & MCP tools

Scaffold platformers, RPGs, roguelikes, 3D action, FPS or racing games with game new -template, and inspect live scenes via MCP and Agent Skills.

202 packages. Import only what you need.

From sprites to dedicated servers, every package has a guide and is marked stable or experimental.

Browse all packages

Three commands to your first game.

  1. 1Create a projectgo run github.com/nsgo-dev/game/cmd/game@latest new mygame
  2. 2Run it here, hot reload on savecd mygame && go tool nsgo dev
  3. 3Switch to another targetgo tool nsgo dev -target web
Needs Go 1.27+ and NSGo v0.4.0+. iOS builds need macOS and Xcode.Coming from another engine:UnityUnreal EngineGodotEbitengine

v0.1.0 is here. Build and ship your game in pure Go.

Every package is documented and marked stable or experimental in the API stability policy. Start from a template or explore games built with NSGo Game.