Skip to content
nsgo-devPublic

About

A game layer for NSGo apps in Go: a fixed-step loop, input actions, sprites, tilemaps and scenes in 2D first, then 3D

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

game

A game layer for NSGo apps, written in Go, in two stages:

  1. 2D: a fixed-step loop, input actions, sprites, tilemaps, scenes and sound. A game draws into one NSGo view, a Canvas, a pixel buffer or a shader, and its HUD and menus stay ordinary native NSGo views on top.
  2. 3D: meshes, cameras, lights and glTF models on a GPU view NSGo adds for it (nsgo#1059).

The loop, input actions, sound and scene switching are shared by both stages. It uses only NSGo's public API, so an app that does not import it links none of it.

Status

Not started. The plan is nsgo#1047, and its tasks are this repository's issues. The engine-side primitives it needs (key-up and held keys, display frame times, gamepads, audio everywhere, a batched DrawAtlas, the GPU view) are tracked in NSGo.

Layout

A monorepo. The Go module lives in packages/game, and the root go.work uses it, so Go commands also run from the repository root.

game/
├─ go.work
├─ packages/
│  └─ game/          Go module github.com/nsgo-dev/game/packages/game
│     ├─ sprite/
│     └─ sound/
├─ apps/website/     the site at https://game.nsgo.dev
├─ examples/         sample games
└─ docs/
   ├─ en/            the site's docs in English
   └─ zh/            the same pages in Simplified Chinese

Import the packages from github.com/nsgo-dev/game/packages/game:

  • game: the fixed-step Loop every package shares (guide).
  • game/sprite: atlases, frames, animations, sprites and batches drawn into a Canvas (guide).
  • game/sound: the Mixer, its effects and music (guide).
  • game/input: input actions (#3).
  • game/tilemap: tilemaps and the camera (#5).
  • game/scene: drawing layers, hit testing and scene switching (#6).

examples will hold a playable sample game (#8).

Docs

Targets

macOS, iOS, Windows, Linux, Android and the web. See Building and Shipping. macOS, iOS, Windows, Linux, Android and the web.

Contributing

See CONTRIBUTING.md for the repository layout, local test and cross-target check commands, coding conventions and pull request guidelines.

Compatibility

game Go NSGo
Unreleased / v0.1.0 1.27+ v0.2.0+

Networking

game/net provides cross-target WebSocket, UDP and loopback transports with snapshot replication and deterministic lockstep/rollback helpers over game.Loop (#41). Matchmaking, hosted backends and account services stay out of the game layer: games use Go's standard library or any networking package directly. Local multiplayer on one device belongs in game/input (#3, #128).

About

A game layer for NSGo apps in Go: a fixed-step loop, input actions, sprites, tilemaps and scenes in 2D first, then 3D

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages