Knowledge beta
Class of @v12-engine/engine/ai
export declare class Knowledge implements AiAreaWhat a computer player remembers of the enemy, the map and itself, with when (Brain.knowledge). Brought up to date once a think from the view; asked through its parts: enemy (structures, bases, army seen, workers, heroes, tech), map (when a place was last looked at), own (losses, attacks sent, income), events (pings, damage, deaths heard). Plain data underneath (data), saved with the brain
Members
constructor
constructor(options?: KnowledgeOptions,
size?: {
width: number;
depth: number;
},
kept?: boolean);Constructs a new instance of the Knowledge class
afresh
readonly afresh = "the save remembers what the computer player knew in a shape this brain does not read: it starts afresh";What the log says where a save's memory of it is of a shape it does not read
data
data: KnowledgeMemory;What it remembers, as plain data. Replaced as a whole by restore
enemy
readonly enemy: EnemyKnowledge;The enemy: structures, bases, army, workers, heroes, tech
events
readonly events: HeardEvents;What was heard: pings, damage to friends, deaths
forget
forget(olderThan: number): void;Forgets what is older than so many seconds: sightings, workers, losses, attacks, what was heard, structures long gone
id
readonly id = "knowledge";Its id among the brain's areas: what its memory and its report are kept under
inspect
inspect(): Record<string, unknown>;What it knows, in short, for the debug tools: bases, the army seen with its age, the tech seen
map
readonly map: MapKnowledge;The map: when each place was last in sight
options
readonly options: Required<Omit<KnowledgeOptions, 'army' | 'limits'>> & Pick<KnowledgeOptions, 'army'> & {
limits: typeof LIMITS;
};The options it runs with: those given over the defaults, the limits being the built-in ones
own
readonly own: OwnKnowledge;One's own: losses, attacks sent, income
remembers
remembers(): boolean;Whether it has anything to remember now: one that does not is left out of a save
restore
restore(memory: unknown): boolean;Takes back what save gave. Memory of another shape is dropped: it starts afresh
resume
resume(view: AiView): void;Reads the think's picture through this view without remembering anything of it: for a think a game loaded from a save goes on with (BrainMemory.thinking), whose picture the saved game remembered already, so that what is restored is as it was after that; only what is asked of the map now needs the view it is asked through
save
save(): KnowledgeMemory;Gives a copy of what is known, as plain data for a save of the brain
tick
get tick(): number;The tick it was last brought up to date
update
update(view: AiView, before?: AiView): void;Brings it up to date from a think's view. before is the view of the think before: what the dead of this think were (a death says only an id). What the brain calls as each think begins, after the view is made