Skip to content

ThreatMap beta ​

Class of @v12-engine/engine/ai

ts
export declare class ThreatMap

Where the strength is, on a coarse grid over the map (AiView.threat, Brain.threat): at(point) reads a place, around(point, radius) the worst cell near it, hot() the cells where the enemy is strongest near what is one's own, cells() every cell with something in it (for a drawing of it). Made from the view's picture when first asked, once a think; all zeros for no point, or one off the map, so that a question about "the first base known" needs no guard

Members ​

constructor ​

ts
constructor(
    view: AiView);

Constructs a new instance of the ThreatMap class

around ​

ts
around(point: Vec2 | undefined, radius: number, query?: ThreatQuery): Threat;

The worst cell within a distance of a point: the one the most enemy strength reaches. Zeros off the map

at ​

ts
at(point: Vec2 | undefined, query?: ThreatQuery): Threat;

What reaches a place: the friendly and the enemy strength at its cell, on a layer (ground when left out). All zeros for no point or one off the map

built ​

ts
get built(): boolean;

Whether a reading has been made this think: for the timing and the debug tools

cell ​

ts
readonly cell = 8;

The side of a cell in cells of the map

cells ​

ts
cells(query?: ThreatQuery): ThreatCell[];

Every cell that any strength reaches on a layer, in the grid's order: for a drawing of the map

cols ​

ts
readonly cols: number;

Cells across and down, and the side of one

hot ​

ts
hot(query?: ThreatQuery & {
        owner?: number;
    }): ThreatCell[];

Where the enemy is strongest near what is one's own: the cells that enemy strength reaches and that hold a unit or building of the player's (an ally's with owner), the hottest first. A raid at an expansion reads here while the main is quiet

rows ​

ts
readonly rows: number;

How many cells down the grid has

view ​

ts
readonly view: AiView;

The picture it is made from