|
|
|
|
|
|
CGF (AI) Overall Design
CGF in areas and layers
The CGF AI has been organized in three main areas and five layers.
The three main areas are illustrated as columns in the diagram below
and reflect the three different kinds of AI required:
- individual (bot) AI
- team AI
- terrain specific AI
These three areas together cover about 90% of the CGF AI. Solely the CGF
mission parsing and execution is not covered.
|
|
strategic
(mission)
|
|
tactic
(2.5 - ... s)
|
|
planning
(0.5 - 60 s)
|
|
behavior
(0.1 - 1 s)
|
|
env i/o
(frame)
|
|
bot AI
|
|
team AI
|
|
terrain AI
|
|
bot strategy
|
|
objectives & orders
|
|
|
|
individual tactics
|
|
team tactics
|
|
tactical terrain analysis
(off-line)
|
|
activity planning
|
|
procedure planning
|
|
path planning
(off-line)
|
|
basic behavior
|
|
team behavior
|
|
location based
action recording
|
|
sensing / impulses
|
|
team input collection
|
|
terrain description
environment model
|
|
The five layers reflect a time-wise separation of AI functionality (from bottom to top):
- frame level environment input & output (< 0.1 s)
Bots sample the environment for vision, hearing and radio/chat messages reception.
Bots also generate (emulated) player input for firing, turning, movement, special
animations.
Teams sample the positions, and lines of vision/fire, of all visible friendly and
enemy teams.
Terrain AI maintains an easy-to-query model of the environment, with information on
the more complex entities in the game (breakable glass, elevators, doors, etc.).
Off-line (during terrain file creation) the terrain AI already labelled way points
with the location's characteristics (to save on in-game environment sampling).
- behavior level elementary tasks (0.1 .. 1.0 s)
Bots execute elementary tasks such as reloading, opening doors, aiming,
moving from way point to way point to way point, jump calculations. These tasks depend
on information obtained during frame level sampling.
Teams execute the SOP (standard operating procedure) steps, take into account request
from team members for cover, new positions, reload/bandage breaks, and issue new
commands as a result.
The terrain AI tries to collect (location based) activity data for subsequent analysis.
In addition, the terrain AI is able to perform various path finding queries.
- action planning/execution level (0.5 .. 60+ s)
To handle complex situations that cannot be dealt with by elementary tasks, the
bots construct and execute (small) plans. Examples of these complex situations
include: opening doors that rotate towards the bot, using button operated
doors and elevators, entering team formations.
The plans are constructed when a bots needs to accomplish a (new) goal.
Team planning and plan execution mainly occurs during procedure execution. Then, planning is done based on procedure goal,
team size and team member positions. Depending on the procedure, these plans
are adjusted more or less frequently.
The terrain AI pre-computes all possible paths at fore hand (thus off-line), to
enable speedy on-line path finding and distance calculations.
- tactics level (2.5 .. s)
Bot tactics include sniping, suppression fire, aimed fire, move while ready to engage,
move for cover, and surroundings scanning. And the tactics include the decision to
switch to other tactics, either bot inspired or in response to team procedures.
Team tactics include the continuous evaluation of the team's (and team's threat)
positions and lines of fire. Based on this evaluation, new procedures are selected,
and the set of acceptable procedures is adjusted.
Terrain AI can get tactical as well. Most of the tactical terrain rating is done
off-line, but part of the info is obtained in-game after each mission.
- strategic level (mission duration)
CGF bots do not really have a strategy, since they consider team instructions
all important - or, in other words, their strategy is to comply with team
instructions disregarding their own survival. (Typically Q2 DM bots do have
more explicit strategies, including, for example guarding specific item respawn
spots).
The CGF team strategy is to comply to the mission's script and objectives.
There is no strategic terrain AI.
CGF: communicating subsystems
In addition to distinguishing layers and areas, the communications between
the AI components was given a good deal of attention.
Bot behavior basically deals with sensor input, and responds via emulated keyboard
and mouse activity. The bot behavior is directed by tactical actions and plans to
be performed.
The tactical behavior consists of a finite state machine taking care of the
continuity in the behavior, and of planning subsystem assisting the finite state
machine with longer term complex actions and navigation.
The tactical behavior, in turn, is directed by the team orders.
The team action, seen per team procedure, results in commands issued to the
individual team members. The team procedure is a bit similar to a 'play'
in american football, but typically deals with more diverse situations, notably
in team size, surroundings and duration.
All bot behavior, bot action, and team activity is being observed and analyzed.
Based on the analysis of the situation (including visible and predicted friendly
and hostile teams), decisions are made about team procedures to be executed.
Combined with information and instructions from the mission script, the team will
select the best tactical procedure.
Finally, the mission script captures initial positions and plans for the teams.
Plans either define a 'rule-of-engagement', such as patrol or snipe, or contain
more detailed movements and responses to enemy contact. As can seen from the diagram,
the mission script affects team behavior only.
CGF: code organization and size
Code-wise, CGF is composed of the original (Action) Quake2 code, extended with an
AI consisting of 6 modules. The (Action) Quake2 is about 42KLOC, and accounts
for solely 28% of CGF (in other words, the AI occupies 100KLOC and is almost three times as big the game code). Already the module handling tactics (threats, terrain, team procedures) is bigger than AQ2.
For the really nosey people among us, an overview of an older archive is listed as well. It is easy to see where most of the effort was spent (though a good amount of code was removed as well).
CGF 0.85 archive, June 2000
|
bot AI
|
18,000
|
12
|
team AI (excluding team procedures)
|
12,000
|
8
|
tactics (threats / terrain / procedures)
|
45,500
|
31
|
navigation
|
7,500
|
5
|
mission / mission scripts
|
9,500
|
6
|
miscellaneous
|
13,000
|
9
|
|
|
|
(Action) Quake2 (monster code stripped)
|
41,500
|
28
|
CGF 0.80 archive, November 1999
|
bot AI
|
16,000
|
13
|
team AI (excluding team procedures)
|
12,000
|
10
|
tactics (threats / terrain / procedures)
|
25,500
|
21
|
navigation
|
7,500
|
6
|
mission / mission scripts
|
8,500
|
7
|
miscellaneous
|
10,000
|
8
|
|
|
|
(Action) Quake2 (monster code stripped)
|
40,000
|
34
|
The six AI modules handle the AI for the individual bot (state machine and planning engine),
the team (state machine, and commands), tactics (a large set of (key) algorithms analyzing
threats, teams and terrain to support bot actions and team procedures), path finding, mission support
and some miscellaneous code.
William
|
|
|
|
|
|
|
|
|
|