Friday, November 16, 2007

Scriptable AI

I've added some new objects to the map editor that will allow mission designers to control what the computer player does.

The objects include: AIPlayer, AISquad, AISoldier, AIWaypoint

The picture shows the new objects in the map editor.














When the game loads soldiers and waypoints are assigned to a squad. When the game starts the squad follows the waypoints until the last waypoint is reached.

Waypoints have a number of properties:
- radius (squad inside radius has reached the waypoint)
- squad ID (squad that will move along this waypoint)
- waypoint number (0,1,2... determines the order in which waypoints are moved along. The squad will stop moving at last waypoint)
- TimeToRemainAtWaypoint (time the squad waits at the waypoint before continueing to next waypoint)

- StanceOnArrive (Prone, Crouch, Standing)
- StanceOnLeave (Prone, Crouch, Standing)

- MoveIntoBuilding (True, False)
- BuildingLevel (0,1,...)

The video shows soldiers following waypoints and acting according to the properties.