starter

command
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

NSGo Game Starter Template

A minimal 2D game template built with NSGo and github.com/nsgo-dev/game.

It demonstrates:

  • A fixed-step game.Loop (60 Hz updates, interpolated Draw via alpha, automatic background pause).
  • sprite.Atlas, sprite.Animation, sprite.Sprite, and sprite.Batch drawn into a full-screen core.Canvas.
  • A native NSGo HUD (core.Text and base.Button) layered above the canvas with safe-area padding and pass-through pointer events.
  • Headless tests using nsgotest.Main and nsgotest.Start.

The game's settings live in game.yaml, its project file. Edit the name and identifier there before shipping it, then write them into nsgo.yaml and check the project:

go run github.com/nsgo-dev/game/cmd/game project sync
go run github.com/nsgo-dev/game/cmd/game project check

Running and Testing

Run with hot reload on your host desktop (macOS, Windows, or Linux):

go tool nsgo dev

Run on other targets:

# Web (opens in browser)
go tool nsgo dev -target web

# iOS simulator or connected device
go tool nsgo dev -target ios_simulator
go tool nsgo dev -target ios

# Android emulator or connected device
go tool nsgo dev -target android

Run headless tests:

go tool nsgo test ./...

Vet and check across platforms:

go tool nsgo check -target macos,windows,linux,android,web
go tool nsgo check -target ios,ios_simulator   # on macOS with Xcode

Build release artifacts (output goes to dist/, with -tags=release to strip development-only debug code):

go tool game release
# or invoke nsgo build directly with GOFLAGS=-tags=release:
GOFLAGS=-tags=release go tool nsgo build -target macos_arm64,windows_x64,linux_x64,web
GOFLAGS=-tags=release go tool nsgo build -target ios,android_arm64

Layout

  • game.yaml — the project file: the game's name, id and version, its window and its export presets per platform, with a virtual resolution, an input map, audio buses and autoloaded scenes and resources to add as the game grows.
  • project.go — embeds game.yaml as Project.
  • main.go — entry point (nsgo.Run(Root, ...) with the window from Project).
  • game.go — fixed-step game.Loop, procedural two-frame sprite.Atlas, core.Canvas, and native HUD overlay.
  • game_test.go, project_test.go — headless nsgotest and unit tests, and a check that game.yaml is canonical, nsgo.yaml agrees with it and the files it autoloads load.
  • nsgo.yaml — NSGo app metadata and dev settings; its name, id, version, appearance and build output and targets follow game.yaml.

Git setup

Each clone enables the object-by-object scene merge driver once (.gitattributes names it, while Git keeps driver config local to .git/config):

go tool game merge -setup

Documentation

Overview

Command mygame is a starter 2D game built with NSGo and game.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL