Skip to content

GoalDef beta ​

Interface of @v12-engine/engine/ai

ts
export interface GoalDef

A goal: something the computer could do, scored by its considerations, run with what it claims (defineGoal)

Members ​

claims ​

ts
claims?: GoalClaims;

What it takes to run: units, money. None: it runs on its score alone, holding nothing

commitment ​

ts
commitment?: number;

Seconds it keeps its claim once picked, unless another scores more than it by the margin, or an urgent one scores more at all. The picker's default when left out. Hysteresis: without it two close goals swap every think

considerations ​

ts
considerations: Consideration[];

Its questions: the score is their product (a soft AND: one at 0 vetoes the goal), times the weight

cooldown ​

ts
cooldown?: number;

Seconds after it stops before it may be picked again

id ​

ts
id: string;

Unique among the brain's goals, prefixed as components are (the engine's ai.defend, a game's mygame.raid)

margin ​

ts
margin?: number;

How much more another goal must score to take from this one within its commitment: the picker's when left out

min ​

ts
min?: number;

The score under which it is not picked: the picker's (PickingOptions.min) when left out

run ​

ts
run(ai: Brain, claimed: Claimed): void;

What it does, each think it holds its claim: claimed.first on the first, where its orders are sent once and then watched

scope ​

ts
scope?: GoalScope;

What it is about: army when left out

stop ​

ts
stop?(ai: Brain, why: StopReason, claimed: Claimed): void;

Told when it loses its claim, and why: to let go of what it was doing

urgent ​

ts
urgent?: boolean | ((ai: Brain) => boolean);

Whether it may break another goal's commitment as soon as it scores more: a raid that cannot wait

weight ​

ts
weight?: number;

What it is worth against the other goals at their best: 1 when left out