AI Framework

From The DarkMod Wiki
Revision as of 17:33, 28 October 2007 by Greebo (talk | contribs) (WIP)
Jump to navigationJump to search

AI Framework

Ok, I'll try to explain in a few paragraphs, what the new AI code framework is about and how it can be used. I'll start off with a scetch of the current AI components.:

AI Components.png

Subsystems

Each AI has four distinct Subsystems: Senses, Movement, Communication and Action. Each Subsystem can perform one single Task at a time.

The idea behind the Subsystems is that the AI should be able to perform several Tasks at the same time. Previously, many things in the script were handled via eachFrame loops, each of which had to “remember” calling the standard routines, like SensoryScan, which was tedious. The Subsystem approach is there to provide four Task slots which correspond to a logical part of the AI. Hopefully, this should allow for a more “high-level” programming of the AI’s behaviour.

For example, an attacking AI has several Tasks to perform: chase the enemy, watch out for his position and attack him when he's near enough. Translated into the Subsystem framework this would be: Push a ChaseEnemyTask into the Movement Subsystem, a CombatSensoryTask into the Senses Subsystem and the CombatTask into the Action subsystem.

To allow for serial task processing, each Subsystem has its own TaskQueue which gets exectuted, one Task after the other.

TODO: explain Subsystem interface.

Mind

Each AI has a Mind, whose purpose is to control the Subsystems. The Mind is always in a certain State (e.g. Idle, Combat, Searching), which have a distinct priority assigned to them.

Legacy documents:

AI Priority Queue

Please refer to this article for documentation about the priority queue scripts: AI Priority Queue

This article is meant to be expanded over time as the AI documentation project progresses.