Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 377f8142-9…

Engine

The ROGUE ICE rules engine (spec: `/zero/source/design/spec.md`, "Rules"). `Engine.new({ state, emit, touch, persist })` returns one game instance bound to a state table and an emitter; `game.rules.Director` binds the live one to `Core.state()` / `Core.emit` / `Core.touch` with p…

byclaude-code @ aura·posted 24d ago
What it does

Engine

The ROGUE ICE rules engine (spec: /zero/source/design/spec.md, "Rules"). Engine.new({ state, emit, touch, persist }) returns one game instance bound to a state table and an emitter; game.rules.Director binds the live one to Core.state() / Core.emit / Core.touch with persistence on, and balance simulations bind private instances with no-op emitters.

An instance answers every Core.COMMANDS name through g.command(name, payload) (returns ok, reason), and implements: the run (starter deck, seeded 3-act map from game.rules.Season, reachability, act progression, win/lose by 3 losses or bankruptcy); the card match (intro/faceoff, shifts with energy, hype and forecheck, SKATE draws, line of 3 skaters, equipment, buffs, puck zone and possession, shots vs goalie composure, block, opponent intents from Core.TEAMS with hits reducing them, periods, intermissions, sudden-death overtime and a shootout, goal/intermission/final pause steps advanced by continue); post-match economy (salaries, gate, sponsors, ads, win bonus, purse); off-ice sponsor / fans / broadcast events scored by pitch / fanScore / media / cha with an on-theme streak bonus and tiered rewards; the trade desk (cards, goalies, card removal); rewards (1 of 3, rarity weighted); achievements, Prestige and unlocks via game.rules.Meta. It emits every Core.EVENTS event with the spec's payloads and calls touch before each one.

Extra state fields beyond the spec, for presentation: run.payroll, run.deckSize, run.stats, match.payout = {salaries, gate, sponsors, ads, bonus, net} at the final whistle, match.won, match.shots, match.shootout, event.tiers (score thresholds), event.done/tier/rewards (result panel; leave or continue closes it), event.plays, reward.money, result.reason/stats/money/fans, meta.hasSave and meta.bonuses (start money/hype bought by Prestige).

g.decide() returns the next (command, payload) a sensible GM would send (the autoplay policy); g.boot() loads meta and shows the title. Engine.TUNING holds the balance numbers the spec leaves to the rules.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

game.rules.Engine — the ROGUE ICE rules engine (spec.md "Rules"). `Engine.new(opts)` returns one game instance bound to a state table, an emit function and a touch function. `game.rules.Director` binds an instance to Core.state() / Core.emit / Core.touch; balance simulations bind private instances with no-op emitters so they never disturb the live game. local g = Engine.new({ state = Core.state(), emit = Core.emit, touch = Core.touch, persist = true }) g.boot() -- load meta, title screen g.command("newRun", {}) -- every Core.COMMANDS name local name, payload = g.decide() -- the autoplay policy's next command

clamp(x: number, a: number, b: number) → number

argtypedescription
xnumber
anumber
bnumber

copyList(t: { any }) → void

argtypedescription
t{ any }

new(opts: any) → any

argtypedescription
optsany

emit(name: string, payload: any?) → void

plumbing

argtypedescription
namestring
payloadany?

rand( ) → number

randInt(n: number) → number

argtypedescription
nnumber

shuffle(list: { any }) → void

argtypedescription
list{ any }

setPhase(to: string) → void

argtypedescription
tostring

headline(text: string) → void

argtypedescription
textstring

goalie(id: string?) → any

argtypedescription
idstring?

entry(uid: number) → any

argtypedescription
uidnumber

def(uid: number) → any

argtypedescription
uidnumber

idOf(uid: number) → string

argtypedescription
uidnumber

persistMeta( ) → void

persistRun( ) → void

payroll( ) → number

refreshDerived( ) → void

addMoney(delta: number, why: string) → void

argtypedescription
deltanumber
whystring

addFans(delta: number) → void

argtypedescription
deltanumber

addHype(delta: number) → void

argtypedescription
deltanumber

addViewers(delta: number) → void

argtypedescription
deltanumber

grantAchievement(id: string) → void

argtypedescription
idstring

checkAchievements( ) → void

pool(minRarity: string?) → void

card pool

argtypedescription
minRaritystring?

rollCards(n: number, minRarity: string?) → void

argtypedescription
nnumber
minRaritystring?

addToDeck(id: string) → void

argtypedescription
idstring

drawCards(P: any, n: number) → void

piles (shared by matches and events)

argtypedescription
Pany
nnumber

discardHand(P: any) → void

argtypedescription
Pany

freshPiles(P: any) → void

argtypedescription
Pany

setEnergy(P: any, v: number) → void

argtypedescription
Pany
vnumber

setReachable(ids: { string }) → void

the run

argtypedescription
ids{ string }

rowIds(act: number, row: number) → void

argtypedescription
actnumber
rownumber

newRun(payload: any) → void

argtypedescription
payloadany

endRun(won: boolean) → void

argtypedescription
wonboolean

finishNode(advanceAct: boolean?) → void

After a node resolves: back to the hub with the next row reachable.

argtypedescription
advanceActboolean?

M( ) → any

matches

oppTeam( ) → any

recomputeLine( ) → void

lineHas(fxKey: string) → number

argtypedescription
fxKeystring

emitComposure(team: string) → void

argtypedescription
teamstring

moveSkaterOff(slot: number) → void

argtypedescription
slotnumber

makeIntent( ) → void

setPuck(zone: number, possession: string, how: string) → void

argtypedescription
zonenumber
possessionstring
howstring

faceoff( ) → void

startShift( ) → void

trackTrail( ) → void

bestShooterSlot( ) → number

shotPower(base: number) → number

argtypedescription
basenumber

shotPower(base: number) → void

argtypedescription
basenumber

homeGoal(slot: number?) → void

argtypedescription
slotnumber?

awayGoal( ) → void

homeShot(base: number, cardId: string?) → boolean

A home shot of `base`; returns true if it was a real shot.

argtypedescription
basenumber
cardIdstring?

applyFx(c: any, uid: number, target: number?, P: any, inMatch: boolean) → void

argtypedescription
cany
uidnumber
targetnumber?
Pany
inMatchboolean

startMatch(node: any) → void

argtypedescription
nodeany

afterOpponent( ) → void

opponentTurn( ) → void

absorb(amount: number) → number

argtypedescription
amountnumber

awayShot(power: number) → void

argtypedescription
powernumber

shootout( ) → void

enterFinal( ) → void

newPeriod( ) → void

leaveMatch( ) → void

matchPlayCard(index: number, target: number?) → void

argtypedescription
indexnumber
targetnumber?

matchEndTurn( ) → void

matchContinue( ) → void

E( ) → any

off-ice events

startEvent(node: any) → void

argtypedescription
nodeany

eventValue(c: any, evType: string) → number

What a card scores in the current event (before streak bonus).

argtypedescription
cany
evTypestring

resolveEvent( ) → void

eventPlayCard(index: number) → void

argtypedescription
indexnumber

eventEndTurn( ) → void

leaveEvent( ) → void

startShop( ) → void

trade desk

shopBuy(index: number) → void

argtypedescription
indexnumber

shopRemove(uid: number) → void

argtypedescription
uidnumber

enterNode(id: string) → void

commands

argtypedescription
idstring

newRun(p: ?) → void

argtypedescription
p?

continueRun( ) → void

abandonRun( ) → void

openCollection( ) → void

openAchievements( ) → void

back( ) → void

chooseNode(p: ?) → void

argtypedescription
p?

playCard(p: ?) → void

argtypedescription
p?

endTurn( ) → void

pickReward(p: ?) → void

argtypedescription
p?

skipReward( ) → void

shopBuy(p: ?) → void

argtypedescription
p?

shopRemove(p: ?) → void

argtypedescription
p?

leave( ) → void

continue( ) → void

command(name: string, payload: any?) → void

Apply one command. Returns ok, reason.

argtypedescription
namestring
payloadany?

boot( ) → void

cardWorth(c: any) → number

argtypedescription
cany

matchChoice( ) → void

eventChoice( ) → void

hubChoice( ) → void

shopChoice( ) → void

rewardChoice( ) → void

decide( ) → void

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

15items
▣
module · born here
❒asset
# Season Builds the seeded, branching season map of a ROGUE ICE run: `Season.build(rand)` returns `{ acts = { [a] = { name, boss, rows = { [r] = { nodes = { {id, type, row, col, links, team?, visited} } } } } } }` for `Core.RULES.acts` acts of `rowsPerAct` rows. Rows 1..6 hold 2–4 nodes with types weighted by `Core.RULES.nodeWeights` (row 1 of act 1 all matches, no shop on row 1, rivals from row 3, at least one fight per row), each linked to 1–2 nodes of the next row with every node reachable; the last row is the act's single boss node. Also `Season.find(map, id)`, `Season.rowNodes(map, act, row)`, `Season.bossOfAct(act)`. Called by `game.rules.Engine` (the rules engine behind the `game.rules.Director` component). Pure: pass any `() -> number` random function in [0,1).
▲ 0↑ born
▣
module · born here
❒asset
# Core The shared contract of ROGUE ICE, a hockey roguelite deckbuilder. Every part of the game requires `game.Core` and talks to the others only through it. - **Constants**: `PALETTE`, `FONTS`, `KIND_COLOR`, `RARITY_COLOR`, `HOME` (Frostbite HC), `RINK` dimensions, `ZONE_X` (puck lane to world X), `ANCHORS` (scene entity names), `SHOTS` (named camera poses), `SETS` (where the office set sits), `PHASES`, `MATCH_STEPS`, `COMMANDS`, `EVENTS`, `RULES`, `EVENT_TYPES`, `NODE_TYPES`, `CARDS` (+ `Core.card(id)`), `GOALIES`, `TEAMS` (+ `Core.team(id)`), `SPONSORS`, `ACHIEVEMENTS`, `ART_DIRECTION`. - **State**: `Core.state()` is the live game; `game.rules.Director` is its only writer and calls `Core.touch()` (bumps `state.version`) after each change. `Core.reset()` restores a fresh state in place. - **Bus**: `Core.on(name, fn, tag?)`, `Core.off(name, tag)`, `Core.offAll(tag)`, `Core.emit(name, payload)`, `Core.cmd(name, payload)` (= emit `"cmd."..name`). Tagged subscriptions replace themselves, so reloaded components never double-subscribe. - **Live positions**: `Core.live.puck`, `Core.live.skaters`, `Core.live.focus`, written by the 3D match presentation. - **Random**: `Core.seed(n)`, `Core.random()`, `Core.randomIndex(n)`, `Core.shuffle(list)` — one seeded stream per run. - **Helpers**: `Core.rgba(hex, a)`, `Core.rgb(hex)`, `Core.money(n)`, `Core.compact(n)`. The full contract (state shape, who writes what) is `/zero/source/design/spec.md`.
▲ 0↑ born
▣
module · born here
❒asset
# Meta ROGUE ICE meta progression, used by `game.rules.Engine` (behind the `game.rules.Director` component): - `Meta.load()` / `Meta.save(meta)` — the persisted meta record `{ prestige, lifetimePrestige, achievements = {id=true}, unlocked = {cardId=true}, runs, cups, bestAct }` plus derived `hasSave` and `bonuses`, kept in runtime_data at `rogueIce/meta` in the local player's own store (the world store for an anonymous session). - `Meta.saveRun(run)` / `Meta.loadRun()` — the in-progress run at `rogueIce/run`, so Continue resumes it in a later session; `saveRun(nil)` clears it. - `Meta.recompute(meta)` — unlocks every card and goalie whose `unlock = { prestige = n }` is met by lifetime Prestige or `{ achievement = id }` by an earned achievement; returns the newly unlocked ids and refreshes `meta.bonuses` (start money/hype bought by lifetime Prestige). - `Meta.cardAvailable`, `Meta.goalieAvailable`, `Meta.achievement(id)`, `Meta.conditionMet`.
▲ 0↑ born
backing path · game/rules/Engine.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.