GizStackGizStack
View .mdOpen in ChatGPTOpen in Claude

gizapp/arcade

one server of several games (serve). The bare host's page lists them, each with its cover, and each game is served on the host whose first label is its name (village.DOMAIN): one process, one port and one route for all of them. A program names its games and calls serve (examples/games/arcade); a cluster (giz games) runs it.

gizlang
import * as Arcade from "gizapp/arcade";

Types

Listed

gizlang
type Listed = { name: string; about: string; host: string; served: fn (folder: string, wasm: string, hosted: Play.Hosted) => Surface.Served throws string; }

A game of the list: its NAME, what it is (ABOUT), and its HOST name under the arcade's domain, which also names its folder among the games' and its module. SERVED gives the game as a server takes it (gizapp/play served), from its FOLDER and with its module WASM, hosted as HOSTED says.

  • name: string
  • about: string
  • host: string
  • served: fn (arg0: string, arg1: string, arg2: M148.Hosted) => M143.Served throws string

Functions

serve

gizlang
function serve(title: string, games: Vec<Listed>): i64

Serves TITLE's list and its games at --port N (8090): the list on the bare host, each game at https://HOST.DOMAIN/ (--domain DOMAIN). A game's cover is COVERS/HOST.png (--covers DIR, covers), a frame of the game (--shot); its folder is games/HOST (--games DIR, the folder of the program's) and its module WASM/HOST.wasm (--wasm DIR, build; giz build --wasm). As a worker of a cluster (giz games) it serves the games --only A,B names (all), runs the rooms of those --rooms A,B names (all it serves; "-" none: a game's page then joins its room on another worker), and keeps their accounts in the state service at --vault SOCKET. --list prints each game's host name, a line each, and serves nothing (a cluster reads it). --made makes what the sites serve (each file's gzip form and each model's device forms, in the cache) and serves nothing: a cluster runs it once on a host before its workers start, which then find everything made.

Effects: fail, read, write, console, io, alloc.