Documentation
¶
Overview ¶
Package kit is the shellcade game developer kit: the authoring surface for wasm games targeting the shellcade ABI (see ABI.md; the wire package is the ABI's code form).
A game implements Game + Handler and calls Main(game) from main(), plus the eight //go:export trampolines for the wasm build — run `gamekit new` for a working scaffold, and see GUIDE.md for the full authoring guide.
This package is a curated facade over internal/game; the implementation is internal so the public surface stays deliberate and versionable.
Index ¶
- Constants
- Variables
- func Main(g Game)
- type Account
- type AccountStore
- type Action
- type Aggregation
- type Attr
- type Base
- type Cadence
- type Cell
- type Character
- type Color
- type ConfigKeySpec
- type ConfigStore
- type ConfigType
- type ControlDecl
- type Direction
- type Frame
- type Game
- type GameMeta
- type Handler
- type Input
- type InputContext
- type InputKind
- type KVStore
- type Key
- type Kind
- type LeaderboardSpec
- type Lifecycle
- type MergeRule
- type MetricFormat
- type Mode
- type Player
- type PlayerResult
- type Result
- type Room
- type RoomConfig
- type ScoreKeeper
- type Services
- type Status
- type Style
Constants ¶
const ( KindGuest = game.KindGuest KindMember = game.KindMember InputRune = game.InputRune InputKey = game.InputKey KeyNone = game.KeyNone KeyEnter = game.KeyEnter KeyBackspace = game.KeyBackspace KeyEsc = game.KeyEsc KeyTab = game.KeyTab KeyUp = game.KeyUp KeyDown = game.KeyDown KeyLeft = game.KeyLeft KeyRight = game.KeyRight KeyCtrlC = game.KeyCtrlC CtxCommand = game.CtxCommand CtxText = game.CtxText ActNone = game.ActNone ActUp = game.ActUp ActDown = game.ActDown ActLeft = game.ActLeft ActRight = game.ActRight ActConfirm = game.ActConfirm ActBack = game.ActBack )
const ( ModeQuick = game.ModeQuick ModePrivate = game.ModePrivate ModeSolo = game.ModeSolo MergeKeepWinner = game.MergeKeepWinner MergeKeepLoser = game.MergeKeepLoser MergeSum = game.MergeSum MergeMax = game.MergeMax HigherBetter = game.HigherBetter LowerBetter = game.LowerBetter CtxFeatRosterEpoch = game.CtxFeatRosterEpoch CtxFeatCharacter = game.CtxFeatCharacter LifecycleResumable = game.LifecycleResumable LifecycleEphemeral = game.LifecycleEphemeral LifecycleResident = game.LifecycleResident ConfigText = game.ConfigText ConfigNumber = game.ConfigNumber ConfigBool = game.ConfigBool ConfigJSON = game.ConfigJSON BestResult = game.BestResult SumResults = game.SumResults Integer = game.Integer Decimal = game.Decimal Duration = game.Duration OnImprove = game.OnImprove OnChange = game.OnChange StatusFinished = game.StatusFinished StatusDNF = game.StatusDNF StatusFlagged = game.StatusFlagged )
const ( Rows = game.Rows Cols = game.Cols AttrBold = game.AttrBold AttrDim = game.AttrDim AttrUnderline = game.AttrUnderline AttrReverse = game.AttrReverse )
const ABIVersion = game.ABIVersion
ABIVersion is the ABI major version this SDK targets.
Variables ¶
var ( White = game.White Red = game.Red Green = game.Green Yellow = game.Yellow Cyan = game.Cyan DimGray = game.DimGray )
Standard palette.
Functions ¶
func Main ¶
func Main(g Game)
Main, built natively, runs the instant inner-loop dev runner: `go run .` plays the game in this terminal with normal Go tooling and zero wasm. Flags: -seed N · -heartbeat 50ms · -config k=v · -seats N · -handle name.
With -smoke <file> [-smoke-out <dir>] it instead runs the smoke script non-interactively and writes the named shot files — see the smoke package and GUIDE.md "Smoke scripts".
Types ¶
type AccountStore ¶
type AccountStore = game.AccountStore
type Action ¶
func Resolve ¶
func Resolve(in Input, ctx InputContext) Action
Resolve maps an Input to a semantic Action for the given context — the platform's canonical control vocabulary, reimplemented locally.
type Aggregation ¶
type Aggregation = game.Aggregation
type Cell ¶
func CharacterCell ¶ added in v2.9.0
CharacterCell returns the one ready-made cell of a member's character tile: the glyph styled with the resolved ink and background. The zero Character (the game's meta does not declare CtxFeatCharacter) yields a blank cell.
type ConfigKeySpec ¶
type ConfigKeySpec = game.ConfigKeySpec
type ConfigStore ¶
type ConfigStore = game.ConfigStore
type ConfigType ¶
type ConfigType = game.ConfigType
type ControlDecl ¶ added in v2.10.0
type ControlDecl = game.ControlDecl
func KeyControl ¶ added in v2.10.0
func KeyControl(k Key, label string) ControlDecl
KeyControl declares a named-key extra control for GameMeta.Controls, e.g. KeyControl(KeyBackspace, "UNDO").
func RuneControl ¶ added in v2.10.0
func RuneControl(r rune, label string) ControlDecl
RuneControl declares a printable-rune extra control for GameMeta.Controls, e.g. RuneControl('r', "RESIGN").
type InputContext ¶
type InputContext = game.InputContext
type LeaderboardSpec ¶
type LeaderboardSpec = game.LeaderboardSpec
type MetricFormat ¶
type MetricFormat = game.MetricFormat
type PlayerResult ¶
type PlayerResult = game.PlayerResult
type RoomConfig ¶
type RoomConfig = game.RoomConfig
type ScoreKeeper ¶ added in v2.11.0
type ScoreKeeper = game.ScoreKeeper
ScoreKeeper standardises live/disconnect/periodic leaderboard posting.
func NewScoreKeeper ¶ added in v2.11.0
func NewScoreKeeper(c Cadence) *ScoreKeeper
NewScoreKeeper constructs a ScoreKeeper with the given auto-post cadence.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
shellcade-kit
command
Command shellcade-kit is the shellcade game developer kit (PROTOTYPE):
|
Command shellcade-kit is the shellcade game developer kit (PROTOTYPE): |
|
Package docs embeds the author-facing getting-started guide so the shellcade arcade can render it directly in its "Add your own game" screen — a glamour-rendered Markdown pane inside an 80x24 SSH TUI.
|
Package docs embeds the author-facing getting-started guide so the shellcade arcade can render it directly in its "Add your own game" screen — a glamour-rendered Markdown pane inside an 80x24 SSH TUI. |
|
host
|
|
|
blobstore
Package blobstore is the arcade's wasm blob storage: published catalog artifacts (`artifacts/<sha256>.wasm`, immutable, content-addressed) and room state under the `snapshots/` prefix, in two coexisting schemes:
|
Package blobstore is the arcade's wasm blob storage: published catalog artifacts (`artifacts/<sha256>.wasm`, immutable, content-addressed) and room state under the `snapshots/` prefix, in two coexisting schemes: |
|
canvas
Package canvas owns the fixed 80x24 cell grid that the lobby and every game render into.
|
Package canvas owns the fixed 80x24 cell grid that the lobby and every game render into. |
|
gameabi
Package gameabi is the host side of the shellcade wasm game ABI: the Extism (wazero) host adapter that makes a .wasm artifact satisfy sdk.Game/sdk.Handler, and the host functions exposing the Room effect/read surface to the guest.
|
Package gameabi is the host side of the shellcade wasm game ABI: the Extism (wazero) host adapter that makes a .wasm artifact satisfy sdk.Game/sdk.Handler, and the host functions exposing the Room effect/read surface to the guest. |
|
gameabi/conformance
Package conformance runs a scripted scenario against a wasm game through the REAL gameabi adapter (limits ON) and reports per-callback latency, exit codes, frames, and peak linear memory, plus budget verdicts that name the breached limit, the measured value, and the step that breached it.
|
Package conformance runs a scripted scenario against a wasm game through the REAL gameabi adapter (limits ON) and reports per-callback latency, exit codes, frames, and peak linear memory, plus budget verdicts that name the breached limit, the measured value, and the step that breached it. |
|
memsvc
Package memsvc is a public, in-memory implementation of the host-side sdk.ServicesFactory (and the matching sdk.AccountStore, sdk.KVStore, sdk.ConfigStore, and leaderboard surfaces).
|
Package memsvc is a public, in-memory implementation of the host-side sdk.ServicesFactory (and the matching sdk.AccountStore, sdk.KVStore, sdk.ConfigStore, and leaderboard surfaces). |
|
render
Package render converts the fixed 80x24 canvas.Grid into the styled, ANSI- encoded strings the bubbletea front door renders.
|
Package render converts the fixed 80x24 canvas.Grid into the styled, ANSI- encoded strings the bubbletea front door renders. |
|
sdk
Package sdk is the game engine boundary.
|
Package sdk is the game engine boundary. |
|
session
Package session defines the transport-agnostic Session boundary.
|
Package session defines the transport-agnostic Session boundary. |
|
internal
|
|
|
diffbench
Package diffbench measures candidate frame-delta wire encodings for the shellcade guest->host frame channel against the current full-frame baseline.
|
Package diffbench measures candidate frame-delta wire encodings for the shellcade guest->host frame channel against the current full-frame baseline. |
|
game
Package kit is the shellcade guest SDK: the authoring surface for wasm games targeting shellcade ABI v2.
|
Package kit is the shellcade guest SDK: the authoring surface for wasm games targeting shellcade ABI v2. |
|
smoke
Package smoke is the engine behind the public smoke package and the dev runner's -smoke mode: it parses a game's smoke.yaml, executes the script deterministically against a native game (virtual clock, seeded RNG), and renders the named shots.
|
Package smoke is the engine behind the public smoke package and the dev runner's -smoke mode: it parses a game's smoke.yaml, executes the script deterministically against a native game (virtual clock, seeded RNG), and renders the named shots. |
|
Package keyhold derives "key held" state from terminal auto-repeat — the closest a terminal game can get to press/release semantics.
|
Package keyhold derives "key held" state from terminal auto-repeat — the closest a terminal game can get to press/release semantics. |
|
Package kittest is an in-memory test double for the kit authoring surface: a Room (plus Services/KV/config) you can drive from plain Go tests, with the sends, posts, and settle recorded for assertions.
|
Package kittest is an in-memory test double for the kit authoring surface: a Room (plus Services/KV/config) you can drive from plain Go tests, with the sends, posts, and settle recorded for assertions. |
|
Package smoke runs a game's smoke.yaml: a small deterministic script (seed, seats, steps) that drives the game on a virtual clock and dumps named 80×24 screens.
|
Package smoke runs a game's smoke.yaml: a small deterministic script (seed, seats, steps) that drives the game on a virtual clock and dumps named 80×24 screens. |
|
Package wire IS the shellcade game ABI as code: the version handshake, the export and host-function names, and the packed little-endian payload encodings, expressed over neutral types with zero dependencies.
|
Package wire IS the shellcade game ABI as code: the version handshake, the export and host-function names, and the packed little-endian payload encodings, expressed over neutral types with zero dependencies. |