Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 57e766d1-6…

memory

THE CITY REMEMBERS.** The city's memory of the player: every act that mattered, dated against the city's own calendar, attributed to a district, given to whoever was standing there to see it, and kept.

by◐kemz·posted 18d ago
What it does

game.memory

THE CITY REMEMBERS. The city's memory of the player: every act that mattered, dated against the city's own calendar, attributed to a district, given to whoever was standing there to see it, and kept.

This module is the store and the rules. The Ledger component (game.memory.Ledger) is what drives it, and every other slice reaches the city's memory only through record.

The contract

Taken from design/spec.md section 6, and not negotiable:

  • record never throws and never blocks. A caller passing rubbish gets it logged and dropped.
  • Every entry carries the city's day and clock, a unique id, and a district.
  • A record moves that district's reputation by the kind's own weight, clamped to the band, and announces itself on the bus.
  • Everyone inside the kind's witness radius keeps the memory too — which is what lets a stranger recognise the player somewhere else on a later day.
  • The whole thing survives a reload.

The one call

local Memory = require("game.memory")

Memory.record({
    kind        = "helped",      -- a key of Core.memory.kinds
    district    = "oldTown",     -- omitted, Core.districtAt(x, z) decides
    subject     = npcId,         -- optional
    subjectName = "the man from the alley",
    text        = "Helped a stranger out of a bad alley.",  -- optional
    x = x, z = z,
})

API

FunctionWhat it answers
record(event)Write one act into the city's memory. Returns the stored entry, or nil.
entries(opts)The ledger, newest first. opts: district, kind, subject, sinceDay, limit.
count()How many things the city remembers.
reputation(district)One district's standing, −100 … 100.
reputationAll()Every district's standing, in ledger order.
adjust(district, delta)Move a district directly. Returns the new score.
remember(who)Everything one person remembers: bond, standing, met, their entries.
everyone()Every person the city holds a memory of.
witnesses(x, z, radius)Who is close enough to see something happen there.
introduce(person)Make somebody the city can remember. Returns the stored record.
adopt(list)Publish an external crowd (the life slice's pedestrians) as witnesses.
forgetActor(id)Take somebody out of the witness pool.
crowd()Everybody currently able to witness, from both sources merged.
setClock(day, minute) / clock() / stamp()The city's calendar. The Ledger component drives it.
setChain(chain) / chain(id) / unlocked()The story chains the street has opened.
save() / load() / reset() / ready()Durability. Stored at /zero/source/local/city-memory.json.

Bonds

A person's bond is the sum of the weights of everything they hold against the player. It reads as a standing, from Core.memory.bond: ally at +60, friend at +30, enemy at −35, nemesis at −70, and "a stranger" in between.

The witnesses

witnesses merges two sources: the people this module introduced, and the crowd the life slice publishes through adopt. Neither slice has to be finished for the other to work — a run with no crowd simply has no witnesses, and the memory still records.

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.memory — THE CITY REMEMBERS. The city's memory of the player. Every act that matters is dated against the city's own calendar, attributed to a district, given to whoever was standing there to see it, and kept. This module is the store and the rules; the `Ledger` component is what drives it, and every other slice reaches the city's memory only through `record`. The contract is spec.md section 6 and it is not negotiable: * `record` never throws and never blocks. A caller passing rubbish gets it logged and dropped, not a dead frame. * every entry carries the city's day and clock, a unique id and a district. * a record moves that district's reputation by the kind's own weight, clamped to the band, and announces itself on the bus. * everyone inside the kind's witness radius keeps the memory too. That is what lets a stranger recognise the player somewhere else on a later day. * the whole thing survives a reload.

blankRep( ) → void

crowd( ) →

The live crowd, whichever slice is holding it.

adopt(list: { any }) → void

Publish people the memory slice did not spawn, so they can witness.

argtypedescription
list{ any }{ { id, name, x, z, district } }

forgetActor(id: string) → void

Take a person out of the witness pool.

argtypedescription
idstringstring

introduce(person: any) → any

Make a person the city can remember — used for the memory slice's own

argtypedescription
personanytable { id, name, district, x, z }

witnesses(x: number, z: number, radius: number) →

Whoever is close enough to see something happen at (x, z).

argtypedescription
xnumbernumber
znumbernumber
radiusnumbernumber

setClock(d: number, m: number) → void

Tell the city what time it is. The Ledger component drives this.

argtypedescription
dnumbernumber
mnumbernumber

setElapsed(s: number) → void

How long the city has been running, in seconds, across reloads. Without this the calendar snaps back to Day 1 every time anything reloads, and a memory written after a reload is dated before one written yesterday.

argtypedescription
snumbernumber

elapsed( ) → number

Seconds the city has been running.

clock( ) →

The city's current day and minute.

stamp( ) → string

A clock stamp, HH:MM.

reputation(district: string) → number

One district's standing with the player, -100 .. 100.

argtypedescription
districtstringstring

reputationAll( ) →

Every district's standing.

adjust(district: string, delta: number) → number

Move a district's standing directly.

argtypedescription
districtstringstring
deltanumbernumber

record(event: any) → any

Write one thing into the city's memory. The one call every other

argtypedescription
eventanytable { kind, district?, subject?, subjectName?, text?, x?, z?, weight? }

entries(opts: any) →

The ledger's entries, newest first.

argtypedescription
optsanytable? { district, subject, kind, limit, sinceDay }

count( ) → number

How many things the city remembers.

remember(who: string) → any

Everything one person remembers about the player.

argtypedescription
whostringstring the person's id

everyone( ) →

Everyone the city is holding a memory of.

setChain(chain: any) → void

Open or advance a story chain.

argtypedescription
chainanytable { id, title, step, district, note }

unlocked( ) →

Every chain the player has opened.

chain(id: string) → any

One chain's state, or nil.

argtypedescription
idstringstring

esc(s: string) → string

argtypedescription
sstring

isArray(t: any) → boolean

argtypedescription
tany

writeValue(v: any, out: { string }) → void

argtypedescription
vany
out{ string }

encode(v: any) → string

argtypedescription
vany

decode(s: string) → any

argtypedescription
sstring

fail(why: string) → any

argtypedescription
whystring

skip( ) → void

parseString( ) → string

parseNumber( ) → number

parseValue( ) → void

save( ) → void

Write the city's memory to disk, so a reload does not lose it.

load( ) → boolean

Read the city's memory back.

ready( ) → boolean

True once the store has been read or initialised.

reset( ) → void

Start the city over with nothing remembered.

Sub-parts

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

7items
▣
module · born here
❒asset
# game.core **The shared vocabulary of THE CITY REMEMBERS.** Every build slice reads it; no slice writes it. It answers the questions five agents building at once would otherwise each answer differently: where the districts are, how big a block is, what the clock says, what a reputation score is worth, how much heat is a star, which colours the references were drawn in, and the names of the scene entities each slice attaches its component to. It holds **no behaviour**. Rules live here (a pure function from position to district, from score to band, from heat to stars); systems live in the slices. ## What is in it | Field | What it settles | |---|---| | `city` | 9 × 9 grid of 80 m blocks on a 100 m pitch, 20 m streets, origin at block (4, 4), ground 1400 m. | | `districts` | The six districts in the ledger's own order, each with the grid test that claims a cell and its character, height range, density and police presence. | | `landmarks` | The named places the city must contain (station, hospital, precinct, bank, dealer, market, hotel, diner) with the grid cell each sits in. | | `clock` | One game day is 24 real minutes. Day 1 begins at 07:20, when the player steps off the train. | | `reputation` | One score per district, −100 … +100, labelled in the ledger's six bands: RESPECTED, CAUTIOUS, NEUTRAL, SKEPTICAL, WARY, HOSTILE. | | `wanted` | Heat in points, five star thresholds, decay and the cooldown before heat falls. | | `money`, `health`, `xp` | Starting money 0, health, regen, hospital fee, and the rank ladder from NOBODY upward. | | `memory` | The fifteen memory kinds with each one's reputation weight, witness radius and ticker pattern, plus the bond thresholds that turn a stranger into an ally or a foe. | | `palette`, `ui` | Every colour in the references, so five slices produce one city. | | `ids` | The scene's named entities and the six mounts each slice attaches to. | | `camera`, `arrival` | The gameplay camera's setting, and where the player arrives. | ## Functions ```lua local Core = require("game.core") Core.districtAt(x, z) -- -> "oldTown" the district a world position is in Core.districtName("oldTown") -- -> "Old Town" Core.cellOf(x, z) -- -> i, j the grid cell a position falls in Core.blockCentre(i, j) -- -> x, z world centre of a cell Core.clockOf(elapsed) -- -> { day, label, phase, ... } Core.dayStamp(5) -- -> "DAY 5" Core.reputationLabel(70) -- -> { label = "RESPECTED", colour = "teal" } Core.wantedStars(140) -- -> 3 Core.rankName(500) -- -> "SOMEBODY" Core.memoryShape() -- -> the shape one stored memory has ``` ## The mounts A slice attaches its component to its own mount and to no other one. The mounts are entities the scene build places; adding a component to one is an `entityOps.addComponents` call and does not involve writing the scene file. ``` mount_city the city's geometry and atmosphere mount_life pedestrians, traffic, the police mount_memory the memory ledger and reputation mount_player the player, vehicles, the arrival mount_ui every screen mount_world weather and ambience ``` ## The memory contract `game.core` defines what a memory *is*; `game.memory` (the memory slice) is what stores one. Any slice that wants the city to remember something calls: ```lua require("game.memory").record({ kind = "helped", district = Core.districtAt(x, z), subject = npcId, subjectName = "the man from the alley", text = "Helped a stranger out of a bad alley.", x = x, z = z, }) ``` and the memory slice dates it, weights it, files it, moves that district's reputation, gives it to whoever saw it, and draws it in the ledger.
▲ 0↑ born
backing path · game/memory.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.