A normal agent consists of an .xml file that describes the different states and the script code to execute at that state. All script is executed as a thredded program with voluntary process change. The basics demands of the system:
- 100% scripted: This means that it has to be possible to create a new agent entirely from LUA and XML. But not excluding any amount of c++ code. - Funcionality such as voluntary process shift, waitForNextFrame, sleep time, sleep until, and other yield commands must be exposed. - With regard to special AI algorithms, these should be created in a way such that they have a nice LUA interface and can blend into the exisisting system. - Basic functionality like a state machine has to be availerble and this functionality has to be loggerble. - The in game timer must be able to handle sleeping agents.
Types of Agents
There exists two kinds of agents - 1) Dormant Agents: These agents are the ones that are being serialized or are waiting to be used (again). Their scripts are not being evaluated. Most of them are either waiting on a timer event or some other ingame event. 2) The active (next frame) agents: These agents are all being evaluated each frame. As this system has it's basis on voluntary process handling they can easily hug the CPU, but game designers must be able to handle this.
The system will have to be build into the general framework of the engine. This means that all AI-scripts are "entities" (see the editor description). And an agent can there for have a geometry and can be simulated. This also means that the engine can expose controller functions to the AI script so it is possible to communicate with other devices. This interface makes sure that it is possible to start and stop animations in the geometry, start stop simulation, bind agents to input devices, cameras, sounds and such. All these things are described in the definition of the agent, either the .xml file or some similar c++ definition and must be checked when serializing the agent. This is done to make sure that the agent is not trying to call undefinded controller functions.