Pages

AI director

How [ai] director names the Lua script that steers the AEX AI in a mod's matches.

[ai] director names a Lua script that steers the AEX AI's goals in the mod's matches; what a director can see and set is in AI_DIRECTOR.md. No mod needs one.

The worked example

[ai]
director = "ai/director.lua"

ai/director.lua is a file in the mod folder.

Rules

  • director is a path relative to the mod folder, with forward slashes, ending in .lua. An absolute path, one that leaves the folder (..), holds a backslash or :, or is not a non-empty string is ignored with a warning; the mod plays without a director.
  • An unknown key in [ai], or ai written as anything but a table, is ignored with a warning.
  • A named file that is missing or unusable is logged when a match loads, and the match plays without a director; it is never an error.

What goes wrong

A bad path is logged when the mod is listed:

[mods] <mod folder>: ai.director='..\ai\director.lua' must be a relative .lua path inside the mod (forward slashes, no '..'); no AI director
[mods] <mod folder>: field 'ai.director' must be a non-empty string; no AI director
[mods] <mod folder>: unknown field 'ai.script'; ignored
[mods] <mod folder>: field 'ai' must be a table; ignored

A missing file is logged when a match loads:

[ai] the AI director 'ai/director.lua' named in mod.toml was not found; the AEX AI plays without a director

A good one reads [ai] AI director 'ai/director.lua' loaded (<n> bytes).

Next