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.
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:
recordnever 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
| Function | What 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.
Scoped to this part · feeds back into the world's score.