GizStackGizStack
View .mdOpen in ChatGPTOpen in Claude

gizgame/online

a networked world of a Game's kinds. Each being is a kind's record: its walk, strike, dodge, fall, experience, brain and cues (Kind) are the rules that gizgame/net's Server runs and each Client predicts, so a game writes none of them. The crew this program drives thinks on a navigation mesh (gizgame/navigation); a quest is data held to the world's facts (gizgame/procgen). gizgame/view draws the beings and their HUD.

gizlang
import * as Online from "gizgame/online";

Types

Being

gizlang
type Being = { id: i64; kind: i64; body: Physics.Character; yaw: f64; pitch: f64; health: i64; most: i64; level: i64; xp: i64; kills: i64; falls: i64; step: i64; count: i64; down: i64; cool: i64; chain: i64; combo: i64; dodge: i64; rest: i64; swung: bool; home: Point3; weapon: i64; bag: Bag; ends: i64; gold: i64; }

A being of an online world: seat ID, of the Game's kind KIND, its BODY, the way it faces (YAW) and looks up (PITCH), its HEALTH of MOST, its LEVEL, XP and KILLS, the FALLS it took, the quest's STEP (-1 before its giver gives it, its length once done) and the COUNT the step has counted; in ticks, DOWN while it lies fallen, COOL until it strikes again, CHAIN while a strike goes on with the next of its COMBO, DODGE while it dodges and REST until it may again. SWUNG says it struck this tick; HOME is where it rose last. WEAPON is the strike it holds (0 its kind's attack, N the Nth of its arms), BAG what it carries, ENDS the tick its round ends (0 without rounds), GOLD its coin: a felled foe pays a tenth of its worth (at least 1), and minds trade their wares for it (gizgame/mind sell).

  • id: i64
  • kind: i64
  • body: M195.Character
  • yaw: f64
  • pitch: f64
  • health: i64
  • most: i64
  • level: i64
  • xp: i64
  • kills: i64
  • falls: i64
  • step: i64
  • count: i64
  • down: i64
  • cool: i64
  • chain: i64
  • combo: i64
  • dodge: i64
  • rest: i64
  • swung: bool
  • home: gizlang_geometry.Point3
  • weapon: i64
  • bag: M194.Bag
  • ends: i64
  • gold: i64

Bag

gizlang
type Bag = { first: i64; second: i64; third: i64; fourth: i64; }

How many of each of the realm's items (Realm.items, at most four) a being carries, in their order.

  • first: i64
  • second: i64
  • third: i64
  • fourth: i64

Order

gizlang
type Order = { forward: i64; aside: i64; yaw: f64; pitch: f64; jump: bool; attack: bool; use: bool; dodge: bool; swap: bool; item: i64; }

One tick's order: forward and aside in -1, 0, 1, the way to face and to look, and whether it jumps, strikes, uses (talks), dodges and swaps its weapon; ITEM is the item of its bag it uses (-1 none).

  • forward: i64
  • aside: i64
  • yaw: f64
  • pitch: f64
  • jump: bool
  • attack: bool
  • use: bool
  • dodge: bool
  • swap: bool
  • item: i64

Item

gizlang
type Item = { name: string; heals?: i64; most?: i64; }

An item of a realm: its NAME, the health one gives back when used (HEALS), and the most a bag holds (MOST; no limit unless given).

  • name: string
  • heals: _gizlang_sdk_core.Option<i64>
  • most: _gizlang_sdk_core.Option<i64>

Round

gizlang
type Round = { seconds: f64; kills?: i64; }

Rounds of SECONDS each; a round ends early when a being reaches KILLS. Then every being rises at home, its kills counted from 0.

  • seconds: f64
  • kills: _gizlang_sdk_core.Option<i64>

Zone

gizlang
type Zone = { name: string; within: (at: Point3) => bool; }

A zone of a world that servers share (Realm.zones): its NAME and the ground it holds (WITHIN).

  • name: string
  • within: (arg0: gizlang_geometry.Point3) => bool

WorldEdit

gizlang
type WorldEdit = { id: i64; kind: string; thing: string; spots: Vec<Point3>; yaws: Vec<f64>; size: f64; at: Point3; to: Point3; radius: f64; text: string; by: string; data: bytes; of: i64; }

A change of an online world: the one record of its edit log (Net.Server edit). The server applies it, keeps it, sends it to every player and keeps it in the vault for the next visit; each side applies it once, by its ID. Its places are the server's, so every side puts things in the same spots. KIND says what it does:

  • place: the scene thing THING at each of SPOTS, turned YAWS, SIZE meters; each stands solid, a box of its size.

  • remove: within RADIUS of AT, what edits placed, the scene's props and the beings edits brought.

  • populate: a being of kind THING living at each of SPOTS (a crew seat the server drives).

  • terrain: the ground within RADIUS of AT raised by SIZE meters (lowered when negative), or levelled at SIZE meters with TEXT "flatten"; along the line from AT to TO when they differ (a river's bed, a road).

  • weather: TEXT names it: clear, rain, storm, fog, snow, night or day.

  • kind: the kind THING's fields as TEXT gives them, "field=value; ...": speed, jump, hits, lift, worth, team.

  • make: as place, of a new thing THING whose GLB model DATA holds (gizgame/mind made it from words); TEXT is its use: "light" (it glows) or "heal" (a being that uses it, E, within reach heals). It finishes the making edit OF, if any, standing in its spot.

  • making: THING being made at SPOTS, SIZE meters: a sign that it comes, until a make or an unmade edit finishes it.

  • unmade: the making edit OF ended with nothing made. BY is the account that asked for it.

  • id: i64

  • kind: string

  • thing: string

  • spots: Vec<gizlang_geometry.Point3>

  • yaws: Vec<f64>

  • size: f64

  • at: gizlang_geometry.Point3

  • to: gizlang_geometry.Point3

  • radius: f64

  • text: string

  • by: string

  • data: bytes

  • of: i64

Carried

gizlang
type Carried = { item: Item; count: i64; }

An ITEM of a bag and the COUNT carried.

  • item: M194.Item
  • count: i64

Crew

gizlang
type Crew = { kinds: Vec<string>; count: i64; home: (n: i64, falls: i64) => Spot; }

The seats this program drives (bots, the dead of a field): COUNT of KINDS in turn; seat N stands at HOME(n, falls).

  • kinds: Vec<string>
  • count: i64
  • home: (arg0: i64, arg1: i64) => M189.Spot

Heroes

gizlang
type Heroes = { kinds: Vec<string>; home: (n: i64, falls: i64) => Spot; }

The players who join: of KINDS in turn; seat N stands at HOME(n, falls).

  • kinds: Vec<string>
  • home: (arg0: i64, arg1: i64) => M189.Spot

Keys

gizlang
type Keys = { move?: StickKeys; look?: StickKeys; attack?: Vec<string>; jump?: Vec<string>; use?: Vec<string>; dodge?: Vec<string>; lock?: Vec<string>; swap?: Vec<string>; items?: Vec<string>; talk?: Vec<string>; }

The keys of the orders; each has its default. LOOK turns the view (Game.mouseLook's keys), LOCK locks on to a foe, SWAP takes the next weapon and ITEMS use the bag's items, one key each in order; with minds in the realm, the player speaks aloud while TALK is held (V).

  • move: _gizlang_sdk_core.Option<M189.StickKeys>
  • look: _gizlang_sdk_core.Option<M189.StickKeys>
  • attack: _gizlang_sdk_core.Option<Vec<string>>
  • jump: _gizlang_sdk_core.Option<Vec<string>>
  • use: _gizlang_sdk_core.Option<Vec<string>>
  • dodge: _gizlang_sdk_core.Option<Vec<string>>
  • lock: _gizlang_sdk_core.Option<Vec<string>>
  • swap: _gizlang_sdk_core.Option<Vec<string>>
  • items: _gizlang_sdk_core.Option<Vec<string>>
  • talk: _gizlang_sdk_core.Option<Vec<string>>

Realm

gizlang
type Realm = { hz: f64; space: Physics.Space; heroes: Heroes; crew?: Crew; mesh?: () => Navigation.Mesh; reach?: f64; quest?: Procgen.Quest; facts?: Vec<Procgen.Fact>; talk?: f64; reward?: i64; items?: Vec<Item>; round?: Round; chat?: Chat; zones?: Vec<Zone>; keys?: Keys; folk?: Vec<Dweller>; minds?: Minds; }

An online realm (online) at HZ ticks a second: its solid SPACE, the HEROES who join and the CREW this program drives, which finds its way on the walkable MESH; a hero is sent the beings within REACH meters. The QUEST, checked against the FACTS (Procgen.checked) when the world is made, leads to the places of its facts (AT): its go and talk steps, and its giver, heard within TALK meters; a defeat step names the team of the beings to fell; a done quest pays REWARD experience. ITEMS are what a bag holds (a kind's drop names one), ROUND makes a match of rounds, and CHAT lets the players talk (Enter). A host's vault keeps each account's hero between visits (Net.Vault). ZONES split the world among servers: a hero that walks into another zone goes to its server. KEYS bind the orders. FOLK live in it from the start. MINDS give the crew and the folk personas that hear, talk and act, and a director that edits the world from words (gizgame/mind).

  • hz: f64
  • space: Ref<M195.Space>
  • heroes: M194.Heroes
  • crew: _gizlang_sdk_core.Option<M194.Crew>
  • mesh: _gizlang_sdk_core.Option<() => Ref<M192.Mesh>>
  • reach: _gizlang_sdk_core.Option<f64>
  • quest: _gizlang_sdk_core.Option<M196.Quest>
  • facts: _gizlang_sdk_core.Option<Vec<M196.Fact>>
  • talk: _gizlang_sdk_core.Option<f64>
  • reward: _gizlang_sdk_core.Option<i64>
  • items: _gizlang_sdk_core.Option<Vec<M194.Item>>
  • round: _gizlang_sdk_core.Option<M194.Round>
  • chat: _gizlang_sdk_core.Option<M193.Chat>
  • zones: _gizlang_sdk_core.Option<Vec<M194.Zone>>
  • keys: _gizlang_sdk_core.Option<M194.Keys>
  • folk: _gizlang_sdk_core.Option<Vec<M194.Dweller>>
  • minds: _gizlang_sdk_core.Option<M191.Minds>

Dweller

gizlang
type Dweller = { kind: string; at: Point3; heading: f64; }

A being who lives in the world from its start, a seat the server drives as the crew: of KIND, at home AT, facing HEADING.

  • kind: string
  • at: gizlang_geometry.Point3
  • heading: f64

Seen

gizlang
type Seen = { being: Being; slot: i64; fell: f64; rose: f64; struck: f64; lost: i64; speaks: f64; }

A being as this program sees it: its replica in the Game's World, beside its Actor and its pose, which the view, the HUD and the effects read. SLOT is its place among the beings of its kind (a figure keeps its animation); FELL, ROSE and STRUCK are the game's times it last fell, rose and struck; LOST the health it lost this tick; it speaks aloud until the game's time SPEAKS.

  • being: M194.Being
  • slot: i64
  • fell: f64
  • rose: f64
  • struck: f64
  • lost: i64
  • speaks: f64

Rising

gizlang
type Rising = { amount: i64; xp: bool; own: bool; }

A number that rises over the world and fades (its Lifetime): a hit's damage AMOUNT, or the experience won (XP), of this program's being (OWN) or another.

  • amount: i64
  • xp: bool
  • own: bool

Said

gizlang
type Said = { text: string; at: f64; }

A seat's last line: its TEXT and the game's time AT it was said.

  • text: string
  • at: f64

Online

gizlang
class Online { game: Game; realm: Realm; target: i64 = -1; moved: f64 = -10; private laws: Laws; private session: Session<Being, Order>; private seen = new Map<i64, Entity>(); private again: bool = false; coming(): Vec<WorldEdit> { return this.world.filter(e => e.kind === "making" && !this.world.some(f => f.of === e.id)); } world: Vec<WorldEdit> = []; constructor(game: Game, realm: Realm) throws string { const laws = new Laws(game, realm); this.laws = laws; this.game = game; this.realm = realm; this.session = new Session<Being, Order>(realm.hz, laws.rules()); } typing: bool = false; draft: string = ""; private played: bool = false; say(text: string): void { this.session.client.say(text); } lines(): Vec<string> { return this.session.client.lines; } building: bool = false; query: string = ""; offers: Vec<Offer> = []; pick: i64 = 0; size: f64 = 1.5; searching: bool = false; preview: bytes = b""; previewError: string = ""; shown: string = ""; private asked: string = ""; private pending: BuildQuery | undefined = undefined; said = new Map<i64, Said>(); private build(code: string): void { if (code === "Escape") { this.building = false; this.preview = b""; this.shown = ""; return; } if (code === "ArrowDown") { this.choose(this.pick+1); return; } if (code === "ArrowUp") { this.choose(this.pick-1); return; } if (code === "Minus") { this.size = Math.max(0.25, this.size/1.25); return; } if (code === "Equal") { this.size = Math.min(30.0, this.size*1.25); return; } if (code === "Enter") { if (this.query.trim() !== this.asked || this.offers.length === 0) { this.search(); } else { this.place(); } return; } if (code === "Backspace") { this.query = this.query.slice(0, Math.maxI64(0, this.query.length-1)); return; } const ch = letter(code); if (ch !== "" && this.query.length <60) { this.query+ = ch; } } private search(): void { const q = this.query.trim(); if (q === "") { return; } this.asked = q; this.searching = true; this.offers = []; this.pick = 0; this.preview = b""; this.shown = ""; this.previewError = ""; this.askBuild(); } private choose(n: i64): void { if (this.offers.length === 0) { return; } this.pick = (n+this.offers.length)%this.offers.length; if (this.offers[this.pick].spec !== this.shown) { this.preview = b""; this.shown = ""; this.previewError = ""; } this.askBuild(); } private askBuild(): void { if (!this.building || this.pending !== undefined) { return; } const word = this.searching ? this.asked: this.offers.length === 0 ? "": this.offers[this.pick].spec; if (word === "" || (!this.searching && word === this.shown)) { return; } const q: BuildQuery = { word, preview: !this.searching }; this.pending = q; this.session.client.build(q); } private place(): void { const o = this.offers[this.pick]; const size = Math.round(this.size*100)/100; this.say(o.spec === "" ? `/make ${this.asked } ${ size }`: `/place ${o.spec } ${ size }`); this.building = false; this.preview = b""; this.shown = ""; } private heard(g: Game): void { let client = this.session.client; for (const r of client.builds) { const pending = this.pending; if (pending === undefined || pending!.word !== r.word || pending!.preview !== r.preview) { continue; } this.pending = undefined; if (r.preview) { if (this.offers.length> 0 && this.offers[this.pick].spec === r.word) { this.preview = r.model; this.shown = r.word; this.previewError = r.error; } } else if (r.word === this.asked) { this.searching = false; this.offers = r.offers.concat([{ spec: "", name: `make with ai: ${r.word }`, note: r.error === "" ? "a minute or two": r.error }]); this.choose(0); } } client.builds = []; this.askBuild(); for (const c of client.chats) { if (!c.text.startsWith("/")) { this.said.set(c.seat, { text: c.text, at: g.time() }); } } client.chats = []; } private type(g: Game): void throws string { const playing = g.phase() === PLAYING; const fresh = playing && !this.played; this.played = playing; for (const code of g.typed()) { if (this.building) { this.build(code); continue; } if (!this.typing) { if (code === "Enter" && !fresh && playing && this.realm.chat !== undefined) { this.typing = true; this.draft = ""; } else if (code === "KeyB" && playing && this.realm.minds !== undefined && this.realm.chat !== undefined) { this.building = true; this.query = ""; this.offers = []; this.asked = ""; this.searching = false; } continue; } if (code === "Enter") { if (this.draft.trim() !== "") { this.say(this.draft); } this.typing = false; continue; } if (code === "Escape") { this.typing = false; continue; } if (code === "Backspace") { this.draft = this.draft.slice(0, Math.maxI64(0, this.draft.length-1)); continue; } const ch = letter(code); if (ch !== "" && this.draft.length <200) { this.draft+ = ch; } } } room(): Seats { return this.laws.seats(); } local(): void throws string { this.session.local(this.room()); } player(): Client<Being, Order> throws string { return new Client<Being, Order>(this.realm.hz, this.laws.rules()); } carry(input: bytes): bytes { if (!this.session.online) { this.again = true; } return this.session.carry(input); } mine(): Being | undefined { return this.session.client.mine(); } private item(g: Game): i64 { for (const n of range(0, Math.minI64(ITEMS, (this.realm.items ?? []).length))) { if (g.pressed(`item${n }`)) { return n; } } return -1; } bag(): Vec<Carried> { const m = this.mine(); return (this.realm.items ?? []).map((i, n): Carried => ({ item: i, count: m === undefined ? 0: held(m.bag, n) })); } roundLeft(): f64 | undefined { const m = this.mine(); if (this.realm.round === undefined || m === undefined || m.ends === 0) { return undefined; } return Math.max(0.0, f64(m.ends-this.session.client.tick)/this.realm.hz); } beings(): Vec<Being> throws string { let all = this.session.client.others(); const m = this.mine(); if (m !== undefined) { all.push(m); } return all; } kind(b: Being): Kind { return this.laws.kind(b); } at(b: Being): Point3 throws string { const r = this.seen.get(b.id); return r !== undefined && this.game.alive(r) ? this.game.pose3D(r).position: b.body.position; } eye(b: Being): Point3 throws string { return add(this.at(b), sub(this.laws.eye(b), b.body.position)); } foes(b: Being, t: Being): bool { return this.laws.foes(b, t); } stepOf(b: Being): Procgen.Step | undefined { return this.laws.stepOf(b); } hearing(): bool { const m = this.mine(); const q = this.realm.quest; if (m === undefined || q === undefined) { return false; } const st = this.laws.stepOf(m); const who = m.step <0 ? q.giver: st !== undefined && st.kind === "talk" ? st.target: ""; const at = this.laws.placeOf(who); return at !== undefined && this.laws.near(m, at, this.realm.talk ?? 3); } goal(): Point3 | undefined { const m = this.mine(); const q = this.realm.quest; if (m === undefined || q === undefined) { return undefined; } if (m.step <0) { return this.laws.placeOf(q.giver); } const st = this.laws.stepOf(m); if (st === undefined) { return undefined; } if (st.kind !== "defeat") { return this.laws.placeOf(st.target); } const crew = this.realm.crew; if (crew === undefined) { return undefined; } let best: Point3 | undefined = undefined; for (const n of range(0, crew.count)) { if (this.game.design.kinds[this.laws.spawn(n).kind].kind.team !== st.target) { continue; } const at = crew.home(n, 0).at; if (best === undefined || length(sub(at, m.body.position)) <length(sub(best, m.body.position))) { best = at; } } return best; } yaw(): f64 { return this.mine()?.yaw ?? 0; } bearing(): f64 | undefined { const m = this.mine(); const g = this.goal(); return m === undefined || g === undefined ? undefined: yawOf(sub(g, m.body.position)); } private slotOf(b: Being): i64 { const name = this.game.design.kinds[b.kind].name; const crew = this.realm.crew?.kinds ?? []; const of = (kinds: Vec<string>, n: i64): i64 => { if (kinds.length === 0) { return 0; } let before = 0; for (const at of range(0, n%kinds.length)) { if (kinds[at] === name) { before+ = 1; } } return (n/kinds.length)*kinds.filter(k => k === name).length+before; }; return b.id <this.laws.crew ? of(crew, b.id): of(crew, this.laws.crew)+of(this.realm.heroes.kinds, b.id-this.laws.crew); } private nearestFoe(): i64 throws string { const m = this.mine(); if (m === undefined) { return -1; } let best = -1; let nearest = 15.0; for (const o of this.session.client.others()) { const to = sub(o.body.position, m.body.position); const d = length(to); if (o.down === 0 && this.laws.foes(m, o) && d <nearest && dot(unitOf(point3(to.x, 0, to.z)), facing(m.yaw))> 0.3) { nearest = d; best = o.id; } } return best; } private edited(): void throws string { let client = this.session.client; const got = client.edits; if (got.length === 0) { return; } client.edits = []; for (const d of got) { let e = worldEdit(""); try { e = Wire.decode<WorldEdit>(d); } catch (why: Error) { continue; } void(this.laws.apply(e)); this.world.push(e); } } private voiced(g: Game): void throws string { let client = this.session.client; const got = client.voices; if (got.length === 0) { return; } client.voices = []; for (const v of got) { g.speak(v.data); const e = this.seen.get(v.seat); if (e === undefined) { continue; } let r = g.read(e!, Replica); r.speaks = g.time()+v.seconds; g.write(e!, Replica, r); } } talk(recording: bytes): void { this.session.client.talk(recording); } ground(x: f64, z: f64, h: f64): f64 { return this.laws.ground(x, z, h); } tick(g: Game): void throws string { const typed = this.typing || this.building; this.type(g); g.typing = this.typing; const click = this.building && g.pressed("attack"); const quiet = typed || this.typing || this.building; g.typing = quiet; if (click && this.offers.length> 0 && this.query.trim() === this.asked) { this.place(); } const mine = this.mine(); const move = g.march("move"); const look = g.look(); if (!quiet && g.pressed("lock")) { this.target = this.target> = 0 ? -1: this.nearestFoe(); } let yaw = (mine === undefined ? 0.0: mine.yaw)-look.x; const pitch = (mine === undefined ? 0.0: mine.pitch)+look.y; if (this.target> = 0 && mine !== undefined) { const t = this.session.client.others().find(o => o.id === this.target); if (t === undefined || t.down> 0) { this.target = -1; } else { yaw = yawOf(sub(t.body.position, mine.body.position)); } } this.session.client.input(quiet ? { ...STILL, yaw, pitch }: { forward: move.forward, aside: move.aside, yaw, pitch, jump: g.pressed("jump"), attack: g.held("attack"), use: g.pressed("use"), dodge: g.pressed("dodge"), swap: g.pressed("swap"), item: this.item(g) }); if (this.realm.minds !== undefined) { g.listen(!quiet && g.held("talk")); const said = g.recording(); if (said.length> 0) { this.talk(said); } } this.session.tick(); this.edited(); this.sync(g); this.voiced(g); this.heard(g); } private sync(g: Game): void throws string { if (this.again) { for (const e of this.seen.values()) { g.despawn(e); } this.seen = new Map<i64, Entity>(); this.again = false; } const now = this.mine(); const time = g.time(); let gone = new Set<i64>(this.seen.keys()); for (const b of this.beings()) { gone.delete(b.id); const own = now !== undefined && b.id === now.id; const k = this.kind(b); let body = Actor.value(); body.kind = b.kind; body.team = g.design.team(k.team ?? ""); body.radius = HITBOX; body.hits = b.health; const known = this.seen.get(b.id); if (known === undefined || !g.alive(known)) { const e = g.spawn([Actor.of(body), at3D(b.body.position, b.yaw, b.pitch), Replica.of({ being: b, slot: this.slotOf(b), fell: b.down> 0 ? time: -100, rose: -100, struck: -100, lost: 0, speaks: -100 })]); if (!own) { g.remotely(e); } this.seen.set(b.id, e); continue; } const e = known; let r = g.read(e, Replica); const was = r.being; r.being = b; r.lost = Math.maxI64(0, was.health-b.health); const fell = (b.down> 0 && was.down === 0) || (b.falls> was.falls && was.down === 0); const rose = b.falls> was.falls; if (b.swung) { r.struck = time; } if (fell) { r.fell = time; } if (rose) { r.rose = time; } g.write(e, Replica, r); g.write(e, Actor, body); g.write(e, Transform3D, pose3D(b.body.position, b.yaw, b.pitch)); if (b.swung && own) { run(g, e, k.swing); } if (fell) { run(g, e, k.die); } else if (r.lost> 0) { run(g, e, k.hit); } if (rose) { run(g, e, k.spawn); } if (!own) { continue; } if (b.xp> was.xp) { rising(g, e, b.xp-was.xp, true); } if (b.kills> was.kills) { run(g, e, k.kill); } if (b.level> was.level) { run(g, e, k.grow); } if (b.step !== was.step) { this.moved = time; run(g, e, k.quest); } } for (const id of gone) { g.despawn(this.seen.get(id)!); this.seen.delete(id); } } }

A player's side of an online world: its match (alone, the server and the crew run in this program; once a host carries the messages, the server it reaches), its orders from the keys each tick, and each being it sees as a replica in the Game's World (Replica), whose kind's effects run as things happen to it. The HUD reads the own being, the quest's goal and the foe the own being locks on to (TARGET, -1 none).

  • game: Ref<M189.Game>
  • realm: M194.Realm
  • target: i64
  • moved: f64 — The game's time when the own quest last moved on.
  • laws: Ref<M194.Laws>
  • session: Ref<M193.Session<M194.Being, M194.Order>>
  • seen: _gizlang_sdk_collections.Map<i64, M201.Entity> — Each seen being's replica, by its seat; AGAIN when the match went online and the replicas start over.
  • again: bool
  • world: Vec<M194.WorldEdit> — The world's edits as this side got them, oldest first (Net.Server edit): the art draws from them.
  • typing: bool — Whether the player types a line to say (Enter opens it), and the line so far.
  • draft: string
  • played: bool — Whether the game played at the last tick.
  • building: bool — The build panel (B, with minds in the realm): whether it is open, the words to look for, what is offered for them (the catalogs' models, then a make by the AI), the one picked, the meters it will stand, whether a search runs, and the model of the picked offer as it shows before it is placed (PREVIEW, the GLB of the offer SHOWN).
  • query: string
  • offers: Vec<M193.Offer>
  • pick: i64
  • size: f64
  • searching: bool
  • preview: bytes
  • previewError: string
  • shown: string
  • asked: string — The words last searched.
  • pending: _gizlang_sdk_core.Option<M193.BuildQuery>
  • said: _gizlang_sdk_collections.Map<i64, M194.Said> — What each seat said last, by seat, for its bubble over its head.

Functions

held

gizlang
function held(bag: Bag, n: i64): i64

How many of item N BAG holds.

worldEdit

gizlang
function worldEdit(kind: string): WorldEdit

An edit of KIND with nothing else set.

Effects: fail, alloc.

shaped

gizlang
function shaped(h: f64, x: f64, z: f64, e: WorldEdit): f64

H, the ground's height at X, Z, after terrain edit E: raised (or levelled) fully at its line, less and less to its radius, smoothly.

gizlang
function popup(): Effect

A popup of the health a being lost: an effect of its hit (Kind.hit).

Effects: fail, alloc.

constructor

gizlang
constructor(game: Game, realm: Realm) throws string

The side of GAME in REALM, waiting for the host to supply a match.

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

online

gizlang
function online(game: Game, realm: Realm): Online throws string

GAME as an online world of REALM: the orders' keys bound, and its player's side run each tick.

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

Methods

Online.coming

gizlang
coming(): Vec<WorldEdit>

The things being made now: each making edit that no make or unmade edit has finished yet.

Effects: fail, read, alloc.

Online.say

gizlang
say(text: string): void

Says TEXT to every player of the match.

Effects: fail, read, write, alloc.

Online.lines

gizlang
lines(): Vec<string>

The last lines the players said, oldest first.

Effects: fail, read.

Online.room

gizlang
room(): Seats

The seats of a match, for a served game's room (gizapp/netplay).

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

Online.local

gizlang
local(): void throws string

Runs that same room in the native process for a solo player.

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

Online.player

gizlang
player(): Client<Being, Order> throws string

A player's side of this world's rules, as a remote program plays it on a room: it predicts its being.

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

Online.carry

gizlang
carry(input: bytes): bytes

The host's call (Program.net): the match goes online.

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

Online.mine

gizlang
mine(): Being | undefined

The own being, once it has joined.

Effects: fail, read.

Online.bag

gizlang
bag(): Vec<Carried>

The own bag: each of the realm's items and how many the own being carries.

Effects: fail, read, alloc.

Online.roundLeft

gizlang
roundLeft(): f64 | undefined

The seconds left in the round, if the realm has rounds and the own being has joined.

Effects: fail, read.

Online.beings

gizlang
beings(): Vec<Being> throws string

The own being and every one it sees.

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

Online.kind

gizlang
kind(b: Being): Kind

The kind of being B.

Effects: fail, read.

Online.at

gizlang
at(b: Being): Point3 throws string

Where B stands as drawn: its replica's pose between ticks, else its record's place.

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

Online.eye

gizlang
eye(b: Being): Point3 throws string

Where B looks from, as drawn.

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

Online.foes

gizlang
foes(b: Being, t: Being): bool

Whether beings B and T are foes.

Effects: fail, read.

Online.stepOf

gizlang
stepOf(b: Being): Procgen.Step | undefined

The quest's step of B, if it is on one.

Effects: fail, read.

Online.hearing

gizlang
hearing(): bool

Whether the own being stands where its giver hears it.

Effects: fail, read, alloc.

Online.goal

gizlang
goal(): Point3 | undefined

Where the quest leads the own being next: its giver, a step's place, or the nearest home of the team to fell.

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

Online.yaw

gizlang
yaw(): f64

The own being's yaw, and the yaw toward its goal.

Effects: fail, read.

Online.bearing

gizlang
bearing(): f64 | undefined

The yaw from the own being to the quest's goal; none without either.

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

Online.talk

gizlang
talk(recording: bytes): void

Says a RECORDING aloud: the server hears it, and it becomes the own being's line (gizgame/mind).

Effects: fail, read, write, alloc.

Online.ground

gizlang
ground(x: f64, z: f64, h: f64): f64

H, the ground's height at X, Z, as the world's terrain edits reshaped it.

Effects: fail, read.

Online.tick

gizlang
tick(g: Game): void throws string

One tick of play: the own order from the keys (a lock turns it to the target), the match's tick, then the replicas of what changed.

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

Constants

Replica

gizlang
const Replica = component<Seen>("gizgame.Replica", { being: NOBODY, slot: 0, fell: -100, rose: -100, struck: -100, lost: 0, speaks: -100 })

The component of a replica (Seen).

gizlang
const Popup = component<Rising>("gizgame.Popup", { amount: 0, xp: false, own: false })

The component of a popup (Rising).