BrainMemory beta
Interface of @v12-engine/engine/ai
export interface BrainMemoryWhat a brain remembers between thinks, as a save keeps it: its own numbers, each module's memory with its version, the words it was told and not yet taken
Members
areas
areas?: AreaMemories;What each of its areas remembers, by the area's id (AiArea): its knowledge, goals, plans and squads, its economy, scouting and the rest of the kit's, a game's own. Left out by an area with nothing to remember
decisions
decisions?: AiDecision[];What it decided last (Brain.decisions): the last fifty lines, for whoever reads a save
heard
heard?: SessionEvent[];What its seat heard since it last thought (GameSession.pendingEvents): the damage, deaths and pings its next think reads, which a game loaded from the save would not have heard otherwise
modules
modules: Record<string, {
v: number;
data: unknown;
}>;What each module remembers, under its id, with the version it was saved as
orders
orders?: {
unit: number;
key: string;
tick: number;
}[];The orders it sent lately (Brain.sentTo), by unit: what keeps it from telling a unit again what it is doing, in a game loaded from the save too. Left out while there are none
paused
paused?: boolean;Whether it sits still (world.computers.pause)
rng
rng: number;Where the brain's own numbers are in their sequence (Rng.save)
thinking
thinking?: {
snapshot: Snapshot;
passes?: [module: number, units: number, heard: number][];
slice?: number;
};A think under way across ticks as the game was saved (BrainContext.budget): the rest of this memory is the brain as that think began, and this is how far it had got, over what picture: each pass run so far, as the module (its index), the units the tick had looked at before it (ThinkBudget.units) and how many words it had been told by then (told). A game loaded from the save runs the same passes again under the same budget over the same picture, sending nothing (their commands are in the game already), and goes on from there as the saved game did. slice is the form before passes: so many modules run once each
thinks
thinks: number;How many times it has thought: what AiModule.everyThinks counts in
told
told: Told[];The words it was told and no module has taken yet
v
v: 2;The version of this shape