ArticlePDF Available

The Quake III Arena Bot

Authors:

Figures

Content may be subject to copyright.
II
The Quake III Arena Bot
by J.M.P. van Waveren
June 28
th
2001
Revision 1
University of Technology Delft
Faculty ITS
III
The Quake III Arena bot is an artificial player for the computer game Quake III Arena.
This document is copyright 2001 by J.M.P. van Waveren, all rights reserved.
Quake III Arena, the QIIIA logo, the id logo and the id Softwarename are
trademarks of id Software, Inc., Mesquite, Texas.
All other trademarks are properties of their respective owners.
c
IV
Abstract
Games play an important role in the field of artificial intelligence (AI). They offer an
environment to test ideas about human reasoning, problem solving and other human
abilities. The ultimate goal of AI is to create an artificial man. Games offer the
opportunity to create artificial players which are modeled after human beings. Playing
the game, human beings can interact with these artificial creatures and experience how
well these creatures show human-like behaviour.
Quake III Arena is a computer game that belongs to the genre of first person shoot-em
up games. The player views from a first person perspective and moves around in a real-
time 3D virtual world. The most important tasks are staying alive and eliminating
opponents within this virtual world. These opponents are other people, equal in strength
and abilities, connected to the same game through a network or the Internet. The game
has a set of different virtual environments called levels or maps, that contain rooms and
hallways. The players have a whole range of weapons, items and powerups available to
aid in the battles that take place in these maps. Quake III Arena offers various ways to
play the game including team based gameplay modes.
This thesis presents the Quake III Arena bot which is an intelligent artificial player
emulating a human player in the game environment. This artificial player is often called a
bot as an abbreviation for the word robot. With this bot everyone can enjoy the game
and practice, without the need for a network connection to other people. The bot is an
artificial player that only livesinside the computer, side by side with the game. The bot
receives information about the game environment directly from the game program as a
set of variables. The game input from the bot is also sent directly to the game program.
Although the bot only livesinside the computer, the ingame behaviour of the bot has to
be hard to distinguish from the behaviour of human players. To make the game more
enjoyable and more versatile, a range of different bot characters is used that each play
the game in their own style, and provide different challenges for the human player.
To show human-like behaviour a wide range of techniques and common sense solutions
are used for the bot AI. The Quake III Arena bot is the first commercially developed
artificial player that uses fully automated path and route finding through arbitrary
complex 3D polygonal worlds, without the need for the bot to acquire knowledge about
routing and navigation during gameplay. No human intervention is required to provide
the bot with all the information needed to navigate through, and understand new game
environments. The bot uses a volume (area) based representation of the 3D game
environment, which serves as a back-bone for the bots cognitive world model. Together
with a high performance path finding solution this cognitive model makes the bot rather
resource efficient.
Key words and phrases: Quake III Arena bot, Quake3 bot, artificial player, artificial
intelligence, automated route finding through polygonal worlds, navigation through
polygonal worlds, hierarchical routing.
V
Acknowledgements
First of all, my thanks to id Software for making some of the best and most addictive
games, and giving me the freedom to make the Quake III Arena bot reality as I deemed
best.
Thanks to my supervisor and mentor at the University of Technology in Delft the
Netherlands, drs. dr. L.J.M. Rothkrantz, for support, encouragement and inspiration.
It has always been a pleasure working with Miklos de Rijk. My thanks and appreciation
to him for lots of input, feedback and bringing previously developed bots alivewith
characters and ideas.
I would like to thank Alan [Strider] Kivlin for being a great sounding board and source of
inspiration.
Special thanks to some of the best students at the university, Ronald Kroon, Edward van
Bilderbeek and Karin de Boer. Both as friends and colleagues they have made life at the
university a lot more enjoyable. Also my appreciation to them for keeping up with my
mindless chatter.
Thanks to William van der Sterren for inspiration with his work on Computer Generated
Forces (CGF) and for his many suggestions to this thesis.
Last but not least I am greatful to my family and friends for their love and
encouragement.
J.M.P. van Waveren
June 28
th
2001
VI
Contents
1. Introduction ................................................................................................................................1
1.1 Quake III Arena ........................................................................................................................................................... 1
1.2 Artificial player............................................................................................................................................................. 1
1.3 Cognitive model........................................................................................................................................................... 2
1.4 Domain knowledge...................................................................................................................................................... 3
1.5 Knowledge acquisition................................................................................................................................................. 4
1.6 Bot behaviour .............................................................................................................................................................. 4
1.7 Perfect simulation vs. enjoyable opponent................................................................................................................... 5
1.8 Generic vs. map specific knowledge............................................................................................................................ 6
1.9 Overview ..................................................................................................................................................................... 7
2. Requirements .............................................................................................................................8
3. Background ................................................................................................................................9
3.1 Robots......................................................................................................................................................................... 9
3.2 Path finding.................................................................................................................................................................10
3.3 Finite state machine....................................................................................................................................................11
3.4 Fuzzy logic .................................................................................................................................................................12
3.5 Neural networks..........................................................................................................................................................13
3.6 Expert systems...........................................................................................................................................................14
3.7 Genetic algorithms......................................................................................................................................................15
4. Related work.............................................................................................................................16
4.1 FPS games & AI.........................................................................................................................................................16
4.2 Previous work.............................................................................................................................................................18
4.2.1 Omicron bot.............................................................................................................................................................19
4.2.2 Gladiator bot............................................................................................................................................................20
5. Bot Architecture.......................................................................................................................21
5.1 Layered architecture...................................................................................................................................................21
5.2 Information flow..........................................................................................................................................................22
5.3 Structure of game engine............................................................................................................................................23
6. Area Awareness System .........................................................................................................24
6.1 AAS............................................................................................................................................................................24
6.2 Creating areas............................................................................................................................................................25
6.3 Environment sampling................................................................................................................................................32
6.4 Reachability................................................................................................................................................................34
6.5 Routing.......................................................................................................................................................................40
6.6 Entities........................................................................................................................................................................46
7. Basic Actions ...........................................................................................................................47
7.1 Human and Bot Input Interface...................................................................................................................................47
7.2 Actions........................................................................................................................................................................47
VII
8. Bot Characters .........................................................................................................................49
8.1 Characters..................................................................................................................................................................49
8.2 Characteristics............................................................................................................................................................50
9. Bot Decisions & Preferences..................................................................................................52
9.1 Fuzzy Logic................................................................................................................................................................52
9.2 Representation...........................................................................................................................................................52
9.3 Preferences................................................................................................................................................................54
9.4 Genetic Selection........................................................................................................................................................56
10. Bot Chats ................................................................................................................................57
10.1 Communication with text...........................................................................................................................................57
10.2 Interpreting text sentences........................................................................................................................................57
10.3 Initiating chats and Eliza chats..................................................................................................................................59
10.4 Chat reasoning.........................................................................................................................................................63
11. Bot Goals ................................................................................................................................65
11.1 Ingame goals............................................................................................................................................................65
11.2 Short term goals .......................................................................................................................................................65
11.3 Long term goals........................................................................................................................................................66
12. Bot Navigation........................................................................................................................67
12.1 Moving towards a goal..............................................................................................................................................67
12.2 Moving in a direction.................................................................................................................................................68
13. Bot Fighting............................................................................................................................69
13.1 Acquiring an enemy..................................................................................................................................................69
13.2 Using weapons.........................................................................................................................................................69
13.3 Movement.................................................................................................................................................................71
14. Obstacles and puzzles ..........................................................................................................72
14.1 Obstacles .................................................................................................................................................................72
14.2 Solving Puzzles........................................................................................................................................................72
15. AI network...............................................................................................................................75
15.1 The network..............................................................................................................................................................75
15.2 The nodes.................................................................................................................................................................76
16. Bot Commands.......................................................................................................................80
16.1 Interpreting chat messages.......................................................................................................................................80
16.2 Commands...............................................................................................................................................................81
16.3 Questions.................................................................................................................................................................84
VIII
17. Team AI ...................................................................................................................................85
17.1 Individual team AI.....................................................................................................................................................85
17.2 Team leader .............................................................................................................................................................85
18. Implementation & tests .........................................................................................................87
18.1 Implementation.........................................................................................................................................................87
18.2 Bot characters ..........................................................................................................................................................87
18.3 AAS & Maps.............................................................................................................................................................88
18.4 AAS visualisation......................................................................................................................................................89
19. Conclusion..............................................................................................................................90
19.1 Bots..........................................................................................................................................................................90
19.2 AAS..........................................................................................................................................................................91
19.3 Future directions.......................................................................................................................................................91
20. References..............................................................................................................................93
20.1 Books and articles ....................................................................................................................................................93
20.2 Websites...................................................................................................................................................................94
20.3 Previous work...........................................................................................................................................................95
A. Quake III Arena ........................................................................................................................97
A.1 Getting about..............................................................................................................................................................97
A.3 Environmental hazards...............................................................................................................................................98
A.4 Structural systems......................................................................................................................................................99
A.5 Weapons..................................................................................................................................................................100
A.6 Items & Powerups....................................................................................................................................................103
A.7 Deathmatch..............................................................................................................................................................105
A.8 Teamplay.................................................................................................................................................................105
A.9 Capture the Flag.......................................................................................................................................................105
B. Bots.........................................................................................................................................106
C. Terms and abbreviations......................................................................................................108
IX
List of figures
1.1 View in Quake III Arena.
1.2 Cognitive model.
1.3 Turing test.
3.1 Maze with waypoints represented by dots.
3.2 FSM for a light switch.
3.3 Simple FSM for a bot.
3.4 Example of a neural network.
4.1 Wolfenstein 3D, 1993 by id Software
4.2 Doom, 1994 by id Software
4.3 Duke Nukem 3D, 1995 by 3D Realms
4.4 Quake, 1996 by id Software
4.5 Quake II, 1997 by id Software
4.6 Unreal, 1998 by Epic
4.7 Half-Life, 1999 by Valve Software
4.8 Unreal Tournament, 1999 by Epic
4.9 Omicron bot.
4.10 Quake map with waypoints
4.11 Gladiator bots.
5.1 Layered architecture.
5.2 Information flow through layers.
5.3 Integration of bot AI with the game engine.
6.1 Bounding box on cube shaped brush.
6.2 Expanded cube shaped brush.
6.3 Mins and maxs vector in a bounding box.
6.4 2d view of a bounding box colliding with a brush.
6.5 Bounding box on wedge.
6.6 Expanded wedge.
6.7 Beveled wedge.
6.8 BSP tree of four brushes.
6.9 Three brushes.
6.10 Three expanded brushes with overlap.
6.11 Two adjacent brushes.
6.12 Area with gap.
6.13 Area subdivided around a gap.
6.14 Trace subdivided by a BSP tree.
6.15 Step.
6.16 Step with low water.
6.17 Low water onto step.
6.18 Barrier.
6.19 Barrier with low water.
6.20 Step down.
6.21 Ledge.
6.22 Ledge with water.
6.23 Ledge with obstacle.
6.24 Water jump.
6.25 Water jump with low water onto floor.
6.26 Jump reachability.
6.27 Clusters separated by portals.
6.28 Entities linked into areas.
9.1 Teleporter item.
9.2 Lightning gun.
9.3 Lightning gun fuzzy weight.
11.1 Two items which can be goals.
11.2 A bot camping.
X
11.3 A flag in a CTF game.
12.1 Route through areas (only area ground faces are shown).
13.1 Enemy in fog.
13.2 Shooting projectiles at both sides of a pillar.
14.1 Top down view of a puzzle.
15.1 AI network.
15.2 C code for Battle FightAI node.
17.1 Four states of a CTF game.
18.1 Area underneath arch.
18.2 Jump reachability.
18.3 Jump pad reachability.
1. Introduction Quake III Arena Bot 1
1. Introduction
1.1 Quake III Arena
Quake III Arena belongs to the genre of the first person shoot-em up games. A player
views from a first person perspective and moves around in a real-time 3D virtual world.
The most important tasks are staying alive and eliminating opponents within this virtual
world. These opponents are other people, equal in strength and abilities, connected to
the same game through a network or the Internet. The players have a whole range of
weapons, items and power-ups available to aid in the battles. The game has a set of
different virtual environments called levels or maps, that contain rooms and hallways.
The battles in the game take place within these maps much like gladiators fight in an
arena. Players can score points by taking out other players. When killed, a player
respawns at one of the designated locations on the map and can continue to fight.
Quake III Arena also has several team oriented gameplay modes. In normal teamplay
there are two teams with players that fight each other. The team with the highest
accumulated score, of all players on that team, wins. There is also a Capture The Flag
(CTF) team based game mode. Again there are two teams with players. Each team has
a base structure in the game world or map. A flag is positioned in such a base. A team
scores points by capturing the flag of the opposing team and bringing it back to their own
flag in their own base. More detailed information about the game can be found in
appendix A. However playing Quake III Arena is probably the best way to acquire a
better understanding of a lot of concepts in the game.
1.2 Artificial player
The Quake III Arena bot is supposed to act like a human player in the virtual world of the
game. The bot replaces the need for other people to connect to the game. Just like a
player can play the game with multiple other people the game can be played with one or
more bots. To make the game more enjoyable and more versatile, a range of different
bot characters is used that each play the game in their own style, and provide different
challenges for the human player. In order to act like a human player the bot does not
only need to understand the rules of the game and how the game works. The bot also
needs basic abilities like navigating through the game environments, picking up items
and handling weapons. Quake III Arena includes team based game modes like regular
teamplay and Capture The Flag (CTF). The bot has to be able to play these game types
and has to operate in teams. In order to operate in a team, with both human players and
other bots, the bot needs to communicate with other players.
The bot lives inside the computer next to the game program and only appears as a
human player in the game. The same (game) rules that apply to human players in the
game, also apply to the bot. The bot does however not use the same input and output
devices as human players. Instead of the output devices human players use, like the
computers monitor and sound card, the bot receives information about the virtual world
directly from the game program as a set of variables. The bot also does not use the
commonly used input devices like the keyboard and mouse. The bot sends a sequence
of actions or intentions directly to the game program. These actions however, are very
similar to the actions a human player can input using the computers input devices. The
1. Introduction Quake III Arena Bot 2
bot uses knowledge that has been provided in advance and knowledge acquired during
gameplay to construct such sequences of actions.
1.3 Cognitive model
People often use different representations to deal with or remember different aspects of
the environment they live in. Some people have a better visual memory. To remember
things more easily they can try to visualize things that do not have a visual
representation by default. Such different representations for different purposes are used
a lot throughout life. In the same way the bot needs its own cognitive model of the virtual
world it lives in. This internal model plays an important role in how the bot perceives and
understands the virtual world. In particular, the bot cannot notice aspects of the world
that are not represented within its cognitive model.
Figure 1.1: View in Quake III Arena. Figure 1.2: Cognitive model.
Usually the cognitive model used by a bot is a simplified version of the virtual world. If
the bot were to live in the real world it would simply not be feasible to create a perfect
model, because the real world is too complicated. Some of the models, available to
model the real world, are quite sophisticated and accurate, but there are too many
variables in play which, makes it infeasible to model the real world perfectly. Since the
virtual world resides somewhere inside the computer, just like the bot itself, it is up to
some degree possible for the bot to have a perfect model of this world. There can still be
factors from outside the virtual world, for instance entities beyond the game programs
control like human players, but most of the virtual world works according to explicit rules
which can be modeled perfectly. However, a perfect model of the virtual world is usually
not desired for several reasons. It would be rather computationally time consuming to
use a model that simulates every single aspect of the virtual world. The required
computation time grows very fast when the bot wants to evaluate a number of alternative
courses of actions, and their influence on how the virtual world advances. Using a
perfect model can also result in unrealistic behaviour of the bot. A bot would be able to
look into the future and precisely predict what is going to happen. The bot would also be
omniscient and could easily manipulate other entities in the world, and in effect set the
world to its hand. However it is not desirable for the bot to have such an ability, not
common to human beings. Aside from these problems, the representation used for
simulating the virtual world is usually not suitable as a cognitive model for the bot. A
different model is required, which allows the bot to perceive and understand aspects of
the virtual world more easily.
stairs
stairs
stairs
Team mate
1. Introduction Quake III Arena Bot 3
For Quake III Arena the bot needs a cognitive model which allows the bot to represent
the things required for autonomous behaviour within the virtual world. In its simplest
form this internal model can be a set of variables that represent the current state of the
world. This state of the world includes the position of the bot, position of enemies and
items, the weapons the bot has gathered etc. To be able to navigate through the virtual
world and find certain locations in the virtual world the bot also needs a representation of
the level or map the bot is situated in. Not all aspects of the 3D environment need to be
included in such a representation. The bot will most likely care less about the textures
and colors on the walls of the rooms the bot navigates through. Of course such colors
might make opponents harder to spot, depending on their outfit, or perhaps have an
influence on the mood of a player. However such influences are often not found to be
significant enough to be taken into account.
1.4 Domain knowledge
For autonomous behaviour the bot also needs to maintain an explicit representation of
how the virtual world changes. This knowledge is referred to as domain knowledge, and
is required to reason about the effects of different sequences of actions. The reasoning
is necessary for the bot in order to select actions, that are useful within the game and
allow the bot to achieve certain goals. Human players often think intuitively about the
effects of actions and make a lot of implicit common sense assumptions. A bot does of
course not have this common sense by default. A certain level of domain knowledge and
common sense will have to be built into the bot.
The Quake III Arena bot needs at least a basic level of domain knowledge in order to
operate in the game. The bot needs to know about certain aspects of the virtual world
that advance continuously as time passes. For instance when items are picked up by a
player they will respawn within a certain amount of time. No effort from the bot is
required for items to respawn, this happens automatically. Also some platforms in the
environment continuously move up and down or back and forth. When the bot knows
about the things that continuously advance or change, the bot can predict when certain
items reappear, and the bot will know how long to wait before it can hop onto a platform
in order to ride it.
A lot of things in the environment only change due to actions from players. Usually such
actions only have an effect on other players, and little or no effect on the geometry of the
environment. For instance when a player fires a weapon, another player might be hit and
get damaged, which results in a loss of health for that player. However the walls, floors
and ceilings of rooms in the environment show no or little change due to the impact of
projectiles fired. Usually an impact marker is displayed where projectiles hit the wall, but
the geometric representation of such a wall does not change. This means the bot cannot
create shortcuts to other rooms by blowing up a wall. Sometimes actions do have an
effect on the geometry in the environment. Some doors and bars are opened by pushing
a button. In some cases the player has to walk up to such a button and press it, in other
cases the player needs to shoot at a button in order to activate it.
How other players are likely to behave in reaction to certain events in the game world is
also part of the domain knowledge. A player can perform certain actions in an attempt to
influence other players. The player could walk into the direction of a certain item in order
to make another player believe he is going for that item, but instead set a trap by waiting
just around a corner. This kind of strategic domain knowledge is usually much harder to
represent.
1. Introduction Quake III Arena Bot 4
1.5 Knowledge acquisition
The bot does not only need basic knowledge in advance to be able to operate in the
virtual world, the bot also has to acquire knowledge while playing the game. The current
state of the world is one of the simplest kinds of knowledge the bot can acquire. This
knowledge acquisition is referred to as sensing. Human players acquire knowledge
about the current state of the world through the output devices of the computer. The
player can look at the 3D image projected on the monitor and listen to sounds generated
by the computers sound card. To acquire more, or specific knowledge the player might
need to look around or walk to a certain location for a better view or better acoustics.
The bot however, does not necessarily need to perform special actions within the virtual
world to acquire knowledge about the state of that world. The bot does also not use the
same output devices used by human players. The bot receives information about the
state of the world as a set of variables directly from the game program. Within the game
program all the information about the current state of the virtual world is readily
available. As a matter of fact there is more information available to the bot than a human
player is able to acquire. The bot could peek at any information within the world since
this virtual world resides inside the computer next to the bot. However it is usually not
desirable for the bot to directly acquire information which is not available to a human
player. For instance the bot should not be able to always know where its opponents are
within the virtual world. The bot is supposed to be a fair player and the ability to directly
acquire more knowledge than a human player would be considered cheating. The bot
may however predict where opponents are, based on knowledge that is available to any
player. Of course the bot will also know the positions of opponents when they are visible
to the bot. This however, requires a definition of what is visible to the bot and what is not.
Based on a players view direction only a limited portion of the surroundings are visible
at any time. Certain aspects of the virtual world, for instance fog, can also blur the view
or reduce the visibility of parts of the world. Such factors should also be taken into
account when the bot acquires knowledge. The bot should not only be limited in the
access to certain information in the virtual world, the bot should sometimes also acquire
knowledge with a certain inaccuracy. When for instance several sounds are playing at
the same time it can be hard to distinguish the different sounds. This can lead to an
inaccuracy in the sounds the bot might recognize.
Aside from knowledge about the current state of the world the bot can also acquire
knowledge about the dynamics of the world, the domain knowledge. The bot could
acquire knowledge about how the world behaves and how other entities like other
players within the world behave. This kind of knowledge acquisition is called learning
and is far more complex than sensing. Often learning requires the recognition of patterns
in a large amount of observations and evaluations of the effects of certain sequences of
actions. Usually most, if not all domain knowledge a bot uses is provided in advance.
1.6 Bot behaviour
Just like a human player the bot has to be autonomous: the bot needs to decide how to
behave on its own. To be autonomous a computational model of the bots behaviour is
required. The bots behaviour is defined by the sequence of actions it executes. Such
sequences of actions could all be predefined. The bot would then always act the same
and not adjust to different situation. The bots behaviour would be determined in
advance. Predefined behaviour makes the bot rather predictable and will not make a
very interesting opponent. Human players are often very unpredictable and a bot should
have this same characteristic. Randomly choosing sequences of actions will make the
1. Introduction Quake III Arena Bot 5
bot rather unpredictable, but this random behaviour is not particularly useful within the
game. The bot has to choose its behaviour based on what it wants to achieve in the
game. The domain knowledge and knowledge about the state of the world can be used
to reason about and choose sequences of actions. The bot will want to choose only
those sequences of actions that will lead to achieving the goals the bot sets out for. The
bot has to choose these goals first and sometimes use several sub-goals in order to
break down a complex task into several simpler tasks. In the teamplay game types the
bots goals might also be determined by a team leader who communicates certain tasks
to the bot. During the course of the game the bot has to continuously evaluate if it comes
closer to the goals it tries to achieve. The bot will have to adjust to changes in the game
environment in order to achieve the goals.
1.7 Perfect simulation vs. enjoyable opponent
When creating an artificial player for a game, a natural approach is simulating a human
player and how a human player thinks. One would try to simulate the human player into
perfection. In order to simulate a human player the artificial player will need a certain
degree of intelligence. As of now no-one has shown to be able to understand every
aspect of human intelligence, let alone perfectly simulate a human being. However one
can try to get as close as possible. This might seem feasible because within a game not
all aspects of human intelligence have to be simulated, simply because not all aspects
are applicable to the game. However a question arises. Is it really desirable to simulate a
human player into perfection? And should an artificial player simulate exactly how a
human player thinks and operates?
Another approach might also be plausible. One could try to create an artificial player that
is not (easily) identified as being artificial and most of all is fun to play with. If an artificial
player should not be easily identified as being artificial it still needs a certain degree of
intelligence.
Alan M. Turing (1912-1954) came up with a test to identify machine intelligence. In 1950
he wrote an article about this test in Mind, a quarterly review of psychology and
philosophytitled Computing machinery and intelligence. In this test there are two
people and the machine to be tested. One person and the machine are respondents,
and the other person is an interrogator. The interrogator and respondents are all in
different rooms. The interrogator can only ask questions via a keyboard or terminal. Both
respondents attempt to convince the interrogator that they are the human respondent.
The machine passes the test if the interrogator cannot tell the difference between the
respondents, or guesses at chance at the identity of the respondents. If the interrogator
can tell the difference the machine fails the test. Turing thought that any machine which
passes the test should be considered intelligent or able to think. In other words, Turing
Human
machine
answer
answer
interrogator
question
Human or machine ?
Figure 1.3: Turing test.
1. Introduction Quake III Arena Bot 6
proposed the test as a sufficient criterion for machine intelligence. He felt it was not a
necessary condition, because of the possibility that some intelligent creatures might not
be able to correctly participate in the test for some physical reason. However, as Block
(1995) shows it is possible to satisfy the Turing test with an unintelligent, physically
possible machine. This means that the test does not seem to be a sufficient criterion
either. If the test is neither necessary nor sufficient, perhaps it can be considered a mark
of intelligence, rather than criterion for intelligence. The Turing test does provide the idea
that for a machine to be considered intelligent, it is not required to operate in exactly the
same way as existing intelligence. It is far more important that the machine appears
intelligent and cannot be identified as being artificial.
Creating an artificial player that is not (easily) identified as being artificial and that is fun
to play with seems a better approach, especially since the game Quake III Arena is
meant to be fun and entertaining and the bots are part of the game. It is more important
for people to have the illusion the bot is human and not artificial. However, one should
also keep in mind that trying to more or less exactly simulate human intelligence and
how humans think, is in some cases the best path to follow. In such cases it is the best
way to make sure the artificial player is not identified as being artificial.
1.8 Generic vs. map specific knowledge
Even though the game play rules for Quake III Arena and the game itself seem not all
that complex at first sight, there is a vast range of different and more or less complex
strategies that can be applied. With the team based game modes included even more
strategies can be thought of. A lot of strategy guides have been written for first person
shoot-em up games. It is interesting to see that often only a small portion of such a guide
discusses general strategies. The larger parts of a guide usually deal with level or map
specific strategies. Usually the best strategies are listed per map. This is not without
reason. Perhaps general strategies are harder to describe but they are always executed
in different ways for each map or game environment. Since players usually play in a
limited number of different maps, strategies can be described per map in these strategy
guides.
Of course providing the bot with a certain degree of strategic knowledge is desirable.
The above might lead to believe this knowledge needs to be implemented specific to a
map or environment. To some degree the bot will need knowledge specific to a map.
The bot will have to know its way around in the 3D environments of the game. As will be
shown, this type of knowledge can be deduced from the maps. The question is if
strategic knowledge can also be deduced from the game environments by a bot. Human
beings seem capable of doing this as they develop the map specific strategies. Is it also
desirable to create a bot, which is capable of doing this? A lot of information can be
deduced from the environment, like strategic positions, tactics [9] and perhaps even new
strategies. One could also try to match a fixed set of strategies to a certain environment
and try to find out which strategies are applicable. As to date this area of artificial
intelligence in FPS games remains largely unexplored.
Providing the bot with all the strategic knowledge for each map by hand does not seem
feasible. During the development of an FPS game the maps tend to change a lot.
Designing and implementing a good map involves a lot of work. Implementing map
specific strategies requires a lot of additional work and expertise. When the maps, and
as a result the strategies change frequently, this is too time consuming and requires
people with the right expertise.
However an approach somewhere in middle could be pursued. One could try to deduce
as much information from the environment as possible. On top of this, scripting could be
1. Introduction Quake III Arena Bot 7
used to aid the bot in certain situations. Such a script provides the bot with a specific
plan, or tells the bot how to perform a specific task in its current environment. If a script
resides at a relatively abstract level without referencing too much detailed information
about a specific environment, then the script is also less sensitive to changes in a map.
1.9 Overview
The requirements for the Quake III Arena bot are outlined in section 2. Creating a bot for
an FPS game is an extensive task which requires expertise from many different areas
within the field of artificial intelligence. Some of the more commonly used methods and
techniques will be loosely described in section 3. Relevant prior work related to both
FPS games and the artificial intelligence in these games is reviewed in section 4.
Section 5 describes how the Quake III Arena bot is structured. Section 6 through 17
describe the sub-systems that are used for the AI of the bot. The order of these sections
is based on how the bot is built from the ground up. Section 18 provides some details on
the implementation of the bot, and shows the results of some tests of the subsystems
used by the bot. Section 19 concludes with the findings that surfaced during the
development of the Quake III Arena bot. This section also provides some future
directions for improvement and the development of new bots.
2. Requirements Quake III Arena Bot 8
2. Requirements
The Quake III Arena bot has to act like a human player in the virtual world of the game.
As such, the bot should be hard to distinguish from a human player. In particular the bot
has to be visualized in the environment just like human players. The bot also has to
navigate through the environment in a life-like manner, pick up items and handle
weapons just like human players do. The bot has to be entertaining and suitable for
practice and training purposes. To make the game more enjoyable and more versatile,
there has to be a range of different bot characters that each play the game in their own
style, and provide different challenges for the human player. The bot has to be a fair
opponent and should in no event cheat. The communication with a bot should also be
hard to distinguish from communication with human players. The bot has to be able to
chat with other players. The bot also needs to communicate with team mates in the team
based game modes like CTF. Life-like interaction with team mates is required to operate
in a team with both human players and other bots.
The bot also has to meet a number of requirements on a technical level. The bot has to
be resource efficient, both CPU and memory usage have to be low. Since the bot AI
code is running concurrently with the game engine, the bot code may typically not
consume more than 10 to 15% of the available CPU time. This is rather limiting
especially since multiple bots will often play the game at the same time. The CPU usage
should also be as constant as possible over time. Spikes in the CPU usage will cause
interruptions in the game simulation, which are rather annoying for human players, and
take away some of the gameplay experience. All the bots that exist in the game at the
same time may not consume more than a few mega bytes (MB) of memory together.
Any cognitive models and other kinds of knowledge, provided in advance or acquired
during gameplay, have to fit in the limited amount of available memory.
The bot AI code has to be of commercial quality. Special attention has to be paid to the
implementation and coding style. Both the architecture and code have to be robust and
extendible. The code also has to be portable across various platforms because the
game Quake III Arena ships for multiple different PC architectures and game consoles.
The Quake series of games are well known for their open structure, which allows third
party developers to extend upon and modify the game. Third party developers have to
be able to easily modify and customize the bot AI code to make the bots work with new
game variants and modifications. Professional and amateur level designers can also
create new game environments or maps for the game. The bot has to be able to
understand and navigate through these new maps or environments without the need for
complicated instruction from the level designers.
3. Background Quake III Arena Bot 9
3. Background
Creating a bot touches many different areas within the field of Artificial Intelligence (AI),
and also areas not directly associated with AI. This section by no means provides a
complete and detailed description of the different algorithms and techniques used for the
AI of a bot. However some of the commonly used methods and techniques are
described.
3.1 Robots
An artificial player in an FPS game is often called a bot as an abbreviation for the word
robot. The word 'robot' was coined by the Czech playwright Karel Capek from the Czech
word for forced labor or serf. The use of the word Robot was introduced into his play
R.U.R. (Rossum's Universal Robots) which opened in Prague in January 1921. The play
was an enormous success and productions soon opened throughout Europe and the
US. In part R.U.R's theme was the dehumanization of man in a technological civilization.
The term 'robotics' refers to the study and use of robots. The term was coined and first
used by the Russian-born American scientist and writer Isaac Asimov (1920 - 1992). The
word 'robotics' was first used in Runaround, a short story published in 1942. I, Robot,
a collection of several of these stories, was published in 1950. Asimov also proposed his
three "Laws of Robotics", and he later added a 'zeroth law'. 0: A robot may not injure
humanity, or, through inaction, allow humanity to come to harm. 1: A robot may not
injure a human being, or, through inaction, allow a human being to come to harm, unless
this would violate a higher order law. 2: A robot must obey orders given it by human
beings, except where such orders would conflict with a higher order law. 3: A robot must
protect its own existence as long as such protection does not conflict with a higher order
law.
According to these laws robots serve humanity in that they can perform certain tasks,
and thereby take away the need for humans to perform these tasks. Bots in FPS games
serve the purpose of entertainment and practice, and certainly do not always obey
orders from human beings. However creating bots for an FPS game is closely related to
robotics, especially the area of robotics that deals with life-like robots. Many of the same
problems that arise in the field of robotics also surface when creating an artificial player
for an FPS game. Both for robots and bots cognitive models play an important role in
how the world they live in is perceived and understood. This world is usually the real
world for a robot where a bot for an FPS games lives in a virtual world. However a lot of
representations used to represent things in the real world can also be used to represent
things in the virtual world. Both robots and bots in FPS games use sensing to acquire
knowledge about the state of the world. Usually this sensing is far more complex for
robots in the real world. Here sensing might involve recording images with a camera and
recognition of patterns in such images. For bots in an FPS game retrieving the current
state of the world is much easier. However the methods used for robot sensing often
provide useful information on how to make a bot in an FPS game more life-like. Robots
and bots can also both learn how the world advances under certain conditions or as a
result of executed actions. The methods for acquiring and storing this kind of knowledge
can be quite similar. Also navigating through the environment they live in is a complex
problem for both bots and robots.
3. Background Quake III Arena Bot 10
3.2 Path finding
One of the requirements for autonomous behaviour in FPS games is the ability to
navigate around the game world in a life-like manner. Determining how to navigate
through a map is an interesting problem. Many different approaches to solving this
problem have been presented. Very simple AI just lets a bot walk forward until
something is hit. At that point the bot turns and continues walking forward. There are
also more complex path finding algorithms that use heuristics to find routes through the
environment. A special representation of the environment or map is often used for these
more complex algorithms. One of the most commonly used representations is a
waypoint system. Such a waypoint system is a collection of points or locations
(waypoints) with directional links between them. The waypoints represent the places
where the bot can go and the links between them represent the paths the bot can follow
in order to easily travel from one waypoint to another. Usually the links represent straight
line directional paths. Creating an efficient waypoint system for a specific environment is
an interesting and often complex task. A bot could create the waypoint system during
gameplay and drop waypoints as it wanders through the environment. The bot will have
a hard time reaching most places in the environment until it has wandered through most
of the game world. Using this method the bot often never finds out how to go to certain
hard to reach places. The waypoint system could also be created in advance before the
bot enters the game. Placing waypoints throughout the environment and linking them is
often a time consuming task to be completed by the level designer. Some algorithms
have been developed to aid in creating a waypoint system in advance, but usually
human intervention is required to optimize the system.
When a good waypoint system is available to the bot, a whole range of different paths
can be calculated. Usually only the shortest paths towards specific goals are used by a
bot. However different kinds of paths can be useful as well. For instance paths that lead
towards a goal, while avoiding certain areas of the world at the same time. Several
algorithms are available to calculate the shortest path between a source location and a
destination. The most commonly used algorithms are Floyds, Dijkstras and A* (A - star)
[11]. These algorithms were designed in the context of graphs and graph theory. Since a
waypoint system is very similar to a directed graph these algorithms can also be used to
calculate paths along one or more waypoints. Traveling along a path, the bot might still
encounter small or larger obstacles. A bot often uses sensing and environment sampling
to identify the nature of such obstacles. The bot then tries to avoid or navigate around
the obstacles. The Quake III Arena bot does not use waypoints to find routes and
navigate through the environment. The path finding and navigation used by the Quake III
Arena bot is described in section 6 and section 12.
Figure 3.1: Maze with waypoints represented by dots.
3. Background Quake III Arena Bot 11
3.3 Finite state machine
A finite state machine (FSM) is a system that has a limited number of states of
operation. A real world example could be a light switch which is either on or off. The
finite state machine that represents a light switch has an on stateand an off state.
In the light switch example there are only two states and from either state the light switch
can change to the other state. Usually there are more than just two states and the state
transitions are often limited. The subject being modeled usually cannot directly change
from any state to every other state. The state transitions are also bound by certain
conditions. The light switch for instance only changes state when a person pushes the
switch in a certain direction.
Any system that has a limited number of possible states can be modeled as a finite state
machine. Finite state machines are often used to simulate human beings, how they
behave and think. Although there are other systems that can more accurately model the
way humans think and learn, the simplicity of finite state machines makes them rather
popular. The finite state machine only needs to be as complex as the desired complexity
of the subject being modeled.
Finite state machines are often used to model the line of thinking for a bot. The different
states of the finite state machine can represent different states of mind, or different kinds
of behaviour. There can be states for different situations and state transitions are often
based on certain events in the game environment. A very simple bot could be modeled
with a finite state machine using four states as shown in figure 3.3. The Quake III Arena
bot uses a similar structure as the FSM to model its think process. This structure is
described in section 15.
on
off
Figure 3.2: FSM for a light switch
attack
chase
enemy
gather
items
retreat
Figure 3.3: Simple FSM for a bot
3. Background Quake III Arena Bot 12
3.4 Fuzzy logic
Fuzzy logic [2] is a superset of conventional (Boolean) logic. This logic was extended to
handle the concept of partial truth, also using values between "completely true" and
"completely false". Dr. Lotfi Zadeh of UC/Berkeley introduced fuzzy logic in the 1960's as
a means to model the uncertainty of natural language.
Fuzzy Subsets
Just as there is a strong relationship between Boolean logic and the concept of a subset,
there is a similar strong relationship between fuzzy logic and fuzzy subset theory. Let's
assume there's a set S and to all its elements there's one element of the set {0,1}
attached. The subset U of the set S is defined as all the elements of S that have a '1'
attached. The truth or falsity of the statement "x is in U" can be determined. The
statement is true if there's a '1' attached to the element 'x' in S. Otherwise the statement
is false.
Similarly for the fuzzy case there's a set S. But now a value from the interval [0, 1] is
attached to every element of S. The subset U of the set S isn't strictly defined in this
case. However it can be determined how much an element from the set S belongs to the
fuzzy subset U. A value of zero attached to an element from S represents complete non-
membership of U. A value of one represents complete membership. The values between
zero and one represent intermediate degrees of membership. The degree to which the
statement "x is in U" is true can also be determined. The degree of truth of the statement
is given by the attached value to the element x in the set S.
Fuzzy functions and relations
Often a value from the interval [0, 1] is attached to an element of the set S using a
function, the membership function. Such a function is one-dimensional because it's
based solely on one criterion. In practice membership functions are based on two or
even more criteria. Such a function gives a value from the interval [0, 1] to a combination
of criteria and is often referred to as a "fuzzy relation". The criteria don't have to be
elements from the same set. They can just as well be elements from different sets. The
criteria also do not have to be elements from sets. Variables of some kind can also be
used as criteria.
Fuzzy logic and bots
Fuzzy logic can be used by bots to express how much they want to have, or do certain
things. For instance a bot might think of how much it wants to retrieve a certain item as a
fuzzy value. The more the bot wants the item the higher the fuzzy value. Fuzzy relations
can be used to express the relation between the current state of the bot and how much
the bot wants something. For instance based on which weapon the bot is holding, and
how much ammunition the bot already has for the weapon, the bot can attach a fuzzy
value to how much it wants to retrieve more ammunition for the weapon. The Quake III
Arena bot uses this kind of fuzzy logic to express how much it wants to have or do
certain things. How the bot represents and uses the fuzzy logic is described in section 9.
3. Background Quake III Arena Bot 13
3.5 Neural networks
A neural network (NN) [2] is a parallel distributed information processing structure based
on the way biological nervous systems, such as the human brain, process information.
This information processing structure consists of processing elements that are
interconnected via signal channels, much like there are synaptic connections between
the neurons in the human brain. Neural networks can differ in their number and
arrangement of neurons, the way their neurons are connected, the specific kinds of
computations their neurons perform and the way they transmit patterns of activity
throughout the network. A human-like technique of learning is used to resolve problems
with a neural network. Just as in biological systems, learning involves adjustments to the
synaptic connections that exist between the neurons. A learning process called training
is used to configure the neural network for a specific application, for instance data
classification or pattern recognition. Different training strategies can be applied with
different results and various learning rates.
Neural networks are being applied to an increasing number of real world problems. Their
primary advantage is that they can often solve problems that are too complex for
conventional technologies, problems that do not have an algorithmic solution or for
which an algorithmic solution is too complex to be defined. In general, neural networks
are well suited to problems that people are good at solving, but that are hard to solve
with programmed computing. These problems include pattern recognition and
forecasting, which requires the recognition of trends in data.
Neural networks can also be used by bots to store and acquire different kinds of
knowledge. Training of neural networks can be especially useful for a bot to acquire
certain kinds of domain knowledge. Much like fuzzy logic a neural network can also be
used by bots to express how much they want to have, or do certain things. A neural
network can be trained in advance before a bot enters the game. During the game the
bot will then only retrieve knowledge stored in the neural network. It is also possible to
train a neural network during gameplay, which allows the bot to acquire all kinds of
knowledge. However training of a neural network is often a time consuming process.
The learning capabilities of the neural network will often have to be limited due to the
time constraints in a real-time application like a game. Although neural networks can be
useful in several areas in bot AI they are not used for the Quake III Arena bot.
Figure 3.4: Example of a neural network
input
output
connections
processing elements
or neurons
3. Background Quake III Arena Bot 14
3.6 Expert systems
An expert systems [7] is a system that stores human expertise, gained from training and
experience. Such a system has three important aspects. The knowledge of facts, the
knowledge of relations between the facts, and a heuristic or efficient method for storage
and acquisition of this information. The construction of an expert system is called
knowledge engineering. A knowledge engineer extracts the knowledge (procedures,
strategies, information filters, common events, etc.) out of human experts and transforms
this knowledge into an expert system. The key issue in expert systems is the way
knowledge is stored in, and extracted from the knowledge base. Logic systems provide
powerful tools to represent and infer knowledge in an expert system. Production rules or
rule-based systems are therefore often used to implement an expert system. Production
rules originate from the IF () THEN structure, which is known from traditional
procedural languages. The rules consist of a condition side (the antecedent) and an
action side (the consequent): IF (condition) THEN (action). The condition is a logical
expression of facts from the knowledge base. The action either creates one or more new
facts, removes facts or triggers certain events. The difference in rule-based
programming as opposed to conventional programming lies in the fact that the
statements in conventional programming languages are executed in a predefined order.
Rule-based systems use an inference engine, which determines the rules to be fired
based on the current facts. In this way new facts can change the course of the program
as it proceeds to fire other rules, that are not necessarily stored consecutively to
previously fired rules.
An expert system can be used to implement the reasoning of a bot. The expertise from
human players is extracted and stored in a knowledge base. Production rules can be
used to create new facts or initiate certain actions. For instance the bot could use the
following production rule: IF the bot is fighting AND the bot is low on health AND the bot
does not have a powerful weapon THEN retreat from the fight. The concepts low on
healthand does not have a powerful weaponare not clear facts in this example.
Fuzzy logic as described in section 3.4 can be used to give a clear meaning to such
concepts. A value of truth can be attached to the statement low on healthbased on the
amount of health the bot has. In the same way a value of truth can be attached to the
concept the bot does not have a powerful weaponbased on the weapons and
ammunition the bot is carrying. Using a fuzzy relation, it is also possible to combine the
concepts low on healthand does not have a powerful weaponinto the new concept
the bot is not fit enough to fight. The example production rule could then be replaced
by: IF the bot is in a fight AND the bot is not fit enough to fight THEN retreat from the
fight. A neural network as described in section 3.5 could also be used to give a clear
meaning to the concepts low on healthand does not have a powerful weapon.
An inference engine of some kind can be used in combination with production rules as in
the examples. However, such production rules are also often just listed in several
procedures. The Quake III Arena bot uses production rules to explicitly represent certain
knowledge and make certain decisions. The usage of these production rules is
described in section 15.
3. Background Quake III Arena Bot 15
3.7 Genetic algorithms
A genetic algorithm (GA) is a search procedure that uses the mechanics of natural
selection and natural genetics. A genetic algorithm was first developed by J.H. Holland
in the 1960's. It uses evolutionary techniques, based on function optimization to develop
better solutions to a problem. First a population of possible solutions to a specific
problem is generated. The better solutions are then recombined with each other to form
new solutions. These new solutions are used to replace the poorer of the original
solutions. When creating new solutions they are often slightly mutated in order to keep
the search domain somewhat larger, and perhaps find solutions that were not
anticipated. This process of natural selection is repeated many times to acquire the best
solution to the problem.
A genetic algorithm can be used on a collection of bots where each bot is slightly
different. The process of recombining better bots to new ones, and replacing the bots
that perform less good with the new ones, can be used to let a better bot evolve. Genetic
algorithms can also be used to optimize subsystems used for the AI of a bot. For the
Quake III Arena bot a genetic algorithm is used to optimize fuzzy logic for specific
purposes. The experiments with this genetic algorithm are described in section 9.
4. Related work Quake III Arena Bot 16
4. Related work
4.1 FPS games & AI
Several first person shooter (FPS) games have been developed before Quake III Arena.
The graphics engines of these games steadily advanced over the years. However such
a continuous progression is not quite found for the artificial intelligence of the opponents
in these games. Some of the most important and influential FPS games over the years
are listed here.
In 1993 one of the first 3D shoot-em up
games saw the light of day: Wolfenstein 3D.
This game by id Software set a standard for
FPS games to come. The player has to
navigate through a maze-like map taking out
enemies on the way. The enemies are
usually on patrol through the maze and
initiate an attack when the player is sighted.
When the player runs away the enemies can
chase the player but they are limited in their
ways. They can open doors but usually try to
reach the enemy navigating in a more or less straight line. As a result they easily loose
track of the player in the maze.
In 1994, Doom set a new standard for FPS
games. This game, also developed by id
Software, has a much more advanced
graphical engine than Wolfenstein 3D. The
opponents however, are not notably smarter
than the enemies in Wolfenstein. In this game
the player also has to go through maps taking
out numerous enemies. There are a variety of
different opponents of which some are able to
fly.
In 1995 3D Realms released the FPS
game Duke Nukem 3D. The graphical
engine in this game is slightly more
advanced than the Doom engine. Not all
the floors and ceilings are necessarily
horizontal, and the player is able to swim
in certain areas. The opponents however,
are not notably smarter.
Figure 4.1: Wolfenstein 3D, 1993 by id Software
Figure 4.2: Doom, 1994 by id Software
Figure 4.3: Duke Nukem 3D, 1995 by 3D Realms
4. Related work Quake III Arena Bot 17
Quake was released by id Software in
1996. In this game the player has six
degrees of freedom. In previous games
the player was only able to turn left and
right. The player can now also look up and
down and the view tilts slightly when
running around a corning. The opponents
and items are modeled as true 3D objects
instead of flat images (sprites) as used in
previous games. The artificial intelligence
of opponents is still relatively simple as in
previous games. Some of the enemies
patrol through the environment and initiate
an attack when they sight the player or hear sounds from the player.
Quake II was released late 1997 by id
Software. This time around not only the
graphics engine got more advanced. The
opponents appear more intelligent than
the opponents in previous games. The
enemies are able to duck to avoid
incoming missiles, and they also do a
much better job at chasing when the
player runs away from a battle.
In 1998 Unreal was released by Epic. This
was the first game to ship with artificial
players or bots. Such a bot can be used
as a substitute for a human player in any
of the multiplayer game modes. The bots
appear considerably smarter than the
enemies in previous games. To navigate
through the game environments the bots
use waypoints. These waypoints are
placed throughout the environments.
Using these waypoints the bots can find
specific locations on the map and retrieve
items and powerups to put up a better
fight.
Figure 4.4: Quake, 1996 by id Software
Figure 4.5: Quake II, 1997 by id Software
Figure 4.6: Unreal, 1998 by Epic
4. Related work Quake III Arena Bot 18
In 1998 Valve Software released Half-Life.
Although the graphics engine is not
revolutionary the game does add to the
genre of FPS games. In this game the
player is up against both aliens and the
army after a failed scientific experiment.
The opponents seem able to team up with
each other and team members can
provide suppressing fire. Interesting are
also the scientists and security guards in
the game. They can follow the player
around and often open secured doors if
necessary. The security guards can also
attack enemies when they come into sight. However in such an attack little attention is
paid to friendly forces that might be in their line of sight. As a result security guards will
often hurt co-workers or the player. The security guards do not seem to care much about
their own lives as they never abandon a fight and keep shooting at enemies till either
party dies. Overall Half-Life does bring some new and interesting artificially intelligent
behaviour into the genre of FPS games.
In 1999 Unreal Tournament was released
by Epic. This game is mostly a multiplayer
game where in single player mode the
player works his way through a
tournament playing against bots, much
like playing with human players on a
network or online. These bots are quite
sophisticated and do a pretty good job at
simulating human players. The bots can
also play the included team games like
Capture the Flag (CTF), Assault and
Domination. Just like the bots in Unreal
these bots use waypoints to get around
the levels.
4.2 Previous work
Before and during the development of the Quake III Arena bot there was little literature
available on the subject of artificial players for FPS games. Due to the lack of a solid
literature foundation a lot of experimenting was required for the development of the
Quake III Arena bot. Unreal Tournament is a game very similar to Quake III Arena which
also uses artificial players to provide a single player experience. However this game did
not provide any reference material because it was released only shortly before Quake III
Arena, and the development of both games was mostly concurrent. The previous
development of the Omicron bot for Quake and the Gladiator bot for Quake II did
however provide a solid base for tests and experiments. The experience gained from the
development of these bots was used to create Quake III Arena bot.
Figure 4.7: Half-Life, 1999 by Valve Software
Figure 4.8: Unreal Tournament, 1999 by Epic
4. Related work Quake III Arena Bot 19
4.2.1 Omicron bot
The Omicron bot [31] is an artificial player for the computer game Quake. Quake is,
much like Quake III Arena, a first person shoot-em up game. However Quake is not
solely focused on playing with other people on a network or the Internet. The game also
includes a single player experience where the player goes through several dimensions
eliminating numerous demons and other enemies.
Figure 4.9: An Omicron bot
The Omicron bot does not play the single player game. The bot was created to emulate
a human player as an alternative to playing with other people on a network or online.
The Omicron bot is very limited in both design and technology due to the language it
was coded in. This language is QuakeC, which is similar to the commonly used
programming language C. QuakeC is used to modify the game and implement the AI.
QuakeC has no means to implement complex data structures and string manipulation is
not possible. The code is interpreted by the game, which makes it relatively slow.
The bot has no prior knowledge about the environment when it enters the game and has
to find its way around while playing. The bot wanders around and drops bread crumbs or
waypoints as it goes. These waypoints allow the bot to find back locations along the
route it followed.
Figure 4.10: Quake map with waypoints represented by blue stars
After wandering through the whole map the bot should be able to travel to most locations
on the map. However a lot of locations are still hard to reach for the bot at that point. The
bot relies on very limited functionality to explore its environment. The bot is much like a
blind man exploring his surroundings with a stick.
4. Related work Quake III Arena Bot 20
The Omicron bot comes with a variety of bot characters. Although these characters have
not much more depth than their own outfit, name and personal chatter, human players
often have the illusion that all bots have different personalities with different skills and
abilities. The bot uses fuzzy logic to decide on how much it wants to have or do certain
things. Fuzzy logic is also used for weapon preferences and to decide which items the
bot wants most. These preferences are the same for all bot characters.
4.2.2 Gladiator bot
The Gladiator bot [32] is an artificial player for the computer game Quake II. This game
is the successor of Quake. Quake II is much more focused on the single player
experience with a compelling story line. However there is also a multi player experience.
The Gladiator bot is created, just like the Omicron bot, as an alternative to playing with
other people on a network or the Internet. The bot does not play the single player game.
Unlike the Omicron bot the Gladiator bot is not limited due to the language it is coded in,
or due to how the bot code cooperates with the game program.
Figure 4.11: Quake II bots
A whole range of different Gladiator bot characters are available for people to play with.
These characters have a lot more depth than just a different name and looks. The
characters have their own play style and preferences. These preferences are stored in
personal fuzzy logic for each bot character.
Several new systems have been developed for the Gladiator bot. The Quake III Arena
bot uses and builds upon a lot of technology that has first been developed for the
Gladiator bot.
5. Bot architecture Quake III Arena Bot 21
5. Bot Architecture
5.1 Layered architecture
The Quake III Arena bot is build up in several layers. The awareness of decisions the bot
makes while playing the game increases with higher layers. The decisions from higher
layers are executed through lower layers. The layered structure of the bot is shown in
figure 5.1.
The 1
st
layer is basically the input and output layer for the bot. The Area Awareness
System is the system that provides the bot with all the information about the current
state of the world. Information about the state of the world is received as a set of
variables directly from the game program. For fast and easy access and usage, a lot of
formatting and pre-processing is performed on this information. Everything the bot
senses goes through the Area Awareness System.
The basic actions are the output of the bot. The output is formatted in a way that
conforms to the parameters of the game. The output of the bot is the player input for the
game, much like a human player uses a keyboard and a mouse.
The 2
nd
layer provides the intelligence that is often subconscious to skilled human
players. This layer includes AI to select goals using fuzzy logic, AI to navigate towards a
goal, AI to interpret chats, AI to construct chat messages and also functionality to store
and retrieve characteristics of bots is included.
The 3
rd
layer is a mixture of production rules (if-then-else) and an AI network with special
nodes for different situations and states of mind. This network is very similar to a state
machine. All the higher-level thinking and reasoning takes place in this layer. This layer
also contains a command module which allows the bot to understand orders and
commands from other players or a team leader. The miscellaneous AI module contains
AI to support behaviour used in, and decisions made in the AI network. This includes AI
for the fighting behaviour of the bot and AI to navigate around obstacles and solve
puzzles.
The 4
th
layer is the brainof the team leader or command center. In a team game one of
the bots is designated to be the team leader and has this extra brainused to command
Figure 5.1: Layered architecture
Team leader AI
Misc. AI AI Network Commands
Character Fuzzy Chats Goals Navigation
Area Awareness System Basic Actions
4
th
3
rd
2
nd
1
st
5. Bot architecture Quake III Arena Bot 22
teammates. This allows the team leader to organize the team and accomplish tasks in a
team.
The whole game typically runs in small time steps or frames, which is referred to as
time-based simulation. Each frame the time and the whole game world advance a little
bit. The ingame physics are also computed in a series of steps synchronous with the
game. The bots brainalso operates in frames but not necessarily synchronous with
the game. The bots brainalways operates at 10 Hz. Every tenth of a second the bot
checks upon its status and situation and decides for the best actions to be taken. The
bot uses the information available from the Area Awareness System to stay up to date
about its status and the environment.
5.2 Information flow
Figure 5.2 shows the information flow between the layers.
All the arrows that go upwards in figure 5.2 represent the flow of information about the
bots status and its environment. The bot uses this information to stay up to date on
what is happening in the game world. The bot also uses this information to decide which
actions should be taken in order to achieve certain goals in the game. This information
usually becomes more abstract as it propagates towards higher layers. All the arrows
that go downward represent the flow of information resulting from decisions the bot
makes. These decisions and the resulting information eventually translate into a
sequence of basic actions. These basic actions represent the player input of the bot.
Aside from the information flow between the four layers there is also limited
communication between components within one layer. The AI Network in the third layer
retrieves information from both the Miscellaneous AI and Commands component. In the
second layer the Goals component retrieves information from the Fuzzy component for
goal selection.
4
th
3
rd
2
nd
1
st
Team leader AI
Misc. AI AI Network Commands
Character Fuzzy Chats Goals Navigation
Area Awareness System Basic Actions
Figure 5.2: Information flow through layers.
5. Bot architecture Quake III Arena Bot 23
Code at higher layers requests information from lower layers. Information that is readily
available can be used immediately. Calculations might be required to retrieve certain
information. Such calculations are performed immediately and may not take up more
than several milliseconds. If a calculation takes up too much time the game might hitch,
because the game simulation only continues as soon as the calculation is completed.
5.3 Structure of game engine
The code of the game engine including the bot AI is structured as shown in figure 5.3.
The Gamemodule sets the rules for the game and dictates how the game works. The
Servermodule provides the functionality for players to connect to the game. The
Client, Client Gameand Renderermodules together provide the Input/Output (IO)
functionality for a human player. The Clientmodule records input from the input
devices and sends it to the server. This module also forwards information from the
server about the game, and what is visible to the player to the Client Gamemodule.
The Client Gamemodule interprets this information and sends the necessary data to
the Rendererwhich provides a 3D image to the player. The Client Gamemodule also
sends back information about sounds to the Client, which makes the sounds audible to
the player.
In figure 5.3 the bot AI is shown in two parts: the lower two layers and the upper two
layers. The Gamemodule provides the Area Awareness System with all the necessary
information about the state of the game world. This information consists mainly of entity
data. The position, type, appearance etc. of entities in the game are communicated to
the Area Awareness System. The bot input, a sequence of basic actions or intentions,
generated by the bot, is sent directly to the Gamemodule.
Game
Server
Client
Client Game
Renderer
Bot Lib (1
st
& 2
nd
layer)
Bot AI (3
rd
& 4
th
layer)
networking
Figure 5.3: Integration of bot AI with the game engine.
Client code providing
the IO functionality for
human players
3D image
Player input
Sound
6. Area Awareness System Quake III Arena Bot 24
6. Area Awareness System
6.1 AAS
The Area Awareness System (AAS) is the whole system used to provide the bot with all
the information about the current state of the world. This includes information about
navigation, routing and also other entities in the game. All the information is formatted
and preprocessed for fast and easy access and usage by the bot. The heart of AAS is a
special 3D representation of the game world. All information provided to the bot is in
some way related to or linked with this 3D representation.
A waypoint system is commonly used for routing and navigation purposes in 3D
environments. The basics of a waypoint system are described first, in order to explain
the basics of the 3D representation used for AAS. A waypoint system used for routing
and navigation is a collection of nodes with links between them. For navigational
purposes the links between these nodes have specific properties. The most important
property is, that one can easily travel from one waypoint to another if they are linked. In
other words the navigational complexity to reach one waypoint from another along a link
is minimal, for instance the navigation along a straight line. A waypoint system with such
a property is the result of a divide and conquerapproach. Traveling from one waypoint
to another is a sub problem with a simple solution. All places reachable from waypoints
should now be reachable from any waypoint by traveling along one or more other
waypoints. The disadvantage of using waypoints is that correctly determining if a point is
reachable from a waypoint, or if a waypoint can be reached from a certain point, still
involves complex and time consuming real-time calculations.
AAS has a similar property as the waypoint system. AAS uses 3D bounded hulls, called
areas, with a specific property: the navigational complexity for traveling from any
reachable point in an area to any other reachable point in the same area is minimal. In
Quake III Arena this means a player can move between any such two points by just
walking or swimming along a straight line.
Of course only knowing this property of each area does not provide all the information
required for routing and navigation. However, so called reachabilities between areas can
be calculated. Such a reachability is created from one area to another if a player can
easily travel from one area to the other. Calculating these reachabilities is not all that
difficult because a lot of areas will touch each other. When two areas touch, it can easily
be verified if a player can really travel from one area to the other. This does not cover all
the possible reachabilities between areas, but as will be shown later on, calculating other
reachabilities is sometimes more complex, but definitely possible.
The system, as it is presented here, is primarily focused on navigation and routing.
However a lot of other information can be retrieved from or linked to this 3D
representation.
6. Area Awareness System Quake III Arena Bot 25
6.2 Creating areas
To satisfy the basic navigation property of AAS, areas will have to be created with
minimal navigational complexity from any reachable point in an area to any other
reachable point in the same area. A convex open space has this property. Convex areas
do not have obstacles within them that can make the navigation more difficult. If a player
can swim in an area, then the convex area always has minimal navigational complexity.
However if the player has to walk through the area, then the requirement of the area
being convex is not restrictive enough. The reason is that convex areas can still have
gaps in the ground the player can fall into. However areas with gaps can be subdivided
into multiple areas that do not have gaps. Basically all convex areas either have minimal
navigational complexity or can easily be transformed into such areas. The areas do not
have to be convex based on the visual geometry in Quake III Arena, but have to be
convex for navigation. The basics of the collision detection in Quake III Arena will be
outlined to acquire a better understanding of what convex for navigation actually means.
Collision detection
Quake III Arena uses bounding boxes for collision detection. The player resides inside
such a bounding box and there is only collision with this bounding box. The detailed
player model that is visible in the game is not used for collision detection. The bounding
boxes are axial; the bounding planes of the box are aligned with the coordinate axes of
the game world. The bounding boxes are never rotated so the bounding planes always
stay aligned with the coordinate axes. The blue outlines in figure 6.1 show a bounding
box. The red cross inside the bounding box is the origin of the box. In the picture the
bounding box of a player is shown. However a bounding box of any size can be used for
collision detection in Quake III Arena.
The Quake III Arena world is built up using so called brushes, which are convex building
blocks. A brush is a volume bounded by a number of planes. The space contained
between these bounding planes is convex. The normal vectors of the bounding planes of
a brush point outward. For instance, the green cube in figure 6.1 is a brush with 6
bounding planes. In Quake III Arena there is only collision between bounding boxes and
these convex building blocks.
Collision detection calculations can be simplified because convex brushes are used, and
the bounding boxes are always axial. Instead of calculating the collision between a
bounding box and a brush, the collision between an expanded brush and the origin of
the bounding box can be calculated. For the expansion of a brush the bounding planes
have to be moved appropriate distances along their normal vectors. The expansion
distance for a brush bounding plane depends on the orientation of the plane.
6. Area Awareness System Quake III Arena Bot 26
Figure 6.1: Bounding box on cube shaped brush. Figure 6.2: Expanded cube shaped brush.
In figure 6.1 a bounding box is standing on top of a cube shaped brush. In figure 6.2 the
cube shaped brush has been expanded and now the origin of the bounding box is on top
of the brush.
The expansion distance along the normal vector of a brush plane, is the smallest
distance between the bounding box origin and the brush plane, when the bounding box
touches the brush plane. This distance is shown by the dashed line in figure 6.4 and can
be calculated as follows. Assume there are two vectors. A vector mins, which has the
minimums of the bounding box relative to the bounding box origin (blue arrow in figure
6.3). And a vector maxs, which has the maximums of the bounding box relative to the
bounding box origin (red arrow in figure 6.3). Depending on the orientation of the brush
plane, one of the corners, edges, or sides of the bounding box will collide with the plane
first.
A new vector is constructed between the bounding box origin and a point on the brush
plane where the bounding box first touches this plane. This vector, called v1, can easily
be derived from the minsand maxsvector and the orientation of the brush plane. The
normal vector of the brush plane is denoted with nin figure 6.4.
Now let v2be the inverse of the brush plane normal vector. And let ?be the angle
between the vectors v1and v2then the following holds:
(v1 * v2) / (|v1| * |v2|) = cos( ? ) = expansion distance / |v1|
(v1 * v2) / |v2| = expansion distance
v2 is normalized and therefore |v2| = 1
v1 * v2 = expansion distance
Figure 6.4: 2D view of bounding box colliding with brush.
n
V1
?
brush
V2
Y
X
Z
Figure 6.3: minsand maxsvector in bounding box.
6. Area Awareness System Quake III Arena Bot 27
A problem is encountered when all brushes are simply expanded and the bounding box
origin is used to collide with these expanded brushes.
Figure 6.5: Bounding box on wedge. Figure 6.6: Expanded wedge. Figure 6.7: Beveled wedge.
In figure 6.5 a bounding box is standing on top of a wedge shaped brush. When the
bounding panes of this wedge are expanded the wedge as seen in figure 6.6 is obtained.
Clearly can be seen, that the wedge expanded too far in certain places. The origin of the
bounding box is contained within the wedge, where it should rest on top of the wedge
after expansion. Why does the expansion not work with the wedge while it worked fine
for the cube? The cube had only axial planes where the wedge does not. When two non-
axial planes are expanded, the edge that they create is expanded more than it should.
Expansion like that can be prevented by adding additional bounding planes to the wedge
shaped brush. These additional bounding planes will not change the shape of the brush,
because they are only added at the edges and/or corners of the brush. These additional
bounding planes will be called brush bevels. The required bevels are all axial planes
going through an edge or corner of the brush that are not already part of the brush. Also
along edges all planes that are parallel to one of the coordinate axes and do not change
the shape of the brush need to be added. When all these bevels are added to the wedge
shaped brush and the brush is expanded including all the brush bevel planes, the brush
as shown in figure 6.7 is obtained. As can be verified, this expanded brush has the
shape, which should be used for collision with the bounding box origin.
Besides brushes, Quake III Arena has another primitive used to build maps. This
primitive is the Bezier curve. [12] With these curves nicely rounded shapes can be
visualized in the maps. In Quake III Arena the curves are tesselated and the polygons
that approximate the curve are transformed into (invisible) brushes for collision
detection. Actually any polygon can be transformed into a brush. After adding bevels to
these brushes, they can also be expanded and easily used for collision detection. A
brush created from a single polygon has no volume, but is perfectly valid for expansion.
The first bounding plane of this brush is the plane going through the polygon boundary
points and the second boundary plane is the opposite of the first. The brush also has a
bounding plane for each edge of the polygon. Any additional bevel planes are added as
well.
Creating areas
All primitives used for collision in Quake III Arena can now be expanded. All the space
outside these expanded solid brushes is the space, where players can move around i.e.
where the origin of the player bounding box can be. At this point convex hulls can be
defined within this space. Within these convex hulls the player will be able to move with
minimal navigational complexity. These convex hulls will become the areas of AAS.
6. Area Awareness System Quake III Arena Bot 28
Binary Space Partitioning is used to create these convex hulls or areas of AAS. H.
Fuchs, Z. Kedem, and B. Naylor introduced Binary Space Partitioning (BSP) for graphics
rendering purposes [12]. With binary space partitioning a tree structure is created, a so-
called BSP tree. This BSP tree is a binary tree, which represents the entire space, an
entire map in the game. Each node in the tree represents a convex subspace and stores
a plane, which splits the space the node represents in two halves. A node also stores
references to two other nodes, which represent each half. These two nodes are often
called children or child nodes.
The BSP tree created for AAS uses the bounding planes of the expanded brushes as
split planes at the nodes. At each node one of these bounding planes is used, which
splits the space represented by the node in two halves. Only a bounding plane of an
expanded brush side, that is totally or partly in the space represented by a node, may be
used as splitter for that node. A node may not use planes as splitters, which are found,
when going from the node back to the root of the tree. No further splits are made at a
node when there are no sides from expanded brushes inside the space represented by
the node. When no further splits can be made at a node, the planes that are found when
going from this node back to the root of the tree, define the convex hull the node
represents. Nodes where no further splits can be made, will be called leaf nodes. A
selection of these leaf nodes will become the areas of AAS.
Many such BSP trees can be created from the same set of expanded brushes. The tree
best suitable for AAS is the one that defines the smallest number of convex hulls. While
building the tree, for each node the split plane will be chosen that will minimize the
number of convex hulls created. A BSP tree with a minimal number of convex hulls is
best suitable for AAS, because routing between areas has to be calculated. This will be
explained in detail in section 6.5.
The bounding planes of the brushes as shown in the image
have names that start with the first letter of their color followed
by the first letter of the side: front, back, left, right, up or down
respectively. For instance Y-F stands for the front of the yellow brush.
All no
des that split space in two halves have the name of the split plane
used. All nodes without name are convex sub-spaces where no further splits
could be made. The node with the name X represents the space surrounded by
the four brushes. The nodes with the n
ames Y, R, G and B represent the yellow,
red, green and blue brush respectively.
Figure 6.8: BSP tree of four brushes.
Y-F
Y-B
R-B
Y-L
Y-R
R-L
G-R
R-R
R-F
G-F
G-L
G-B
B-L
B-B
B-R
B-F
X
B
G
R
Y
R-D
R-U
6. Area Awareness System Quake III Arena Bot 29
Constructive Solid Geometry
The more bounding planes from expanded brushes there are, the more potential splits
are made in the BSP tree. More splits usually also means more convex hulls. A lot of
potential splitters can be removed before the BSP tree is built.
Figure 6.9: Three brushes Figure 6.10: Three expanded brushes with overlap.
After expanding all the primitives used for the collision detection in Quake III Arena there
are a lot of expanded brushes that either overlap or are contained within other brushes.
Figure 6.9 shows three brushes before expansion. Figure 6.10 shows how after
expansion one of the brushes is fully contained within the other two brushes, and also
shows how the brushes overlap. All the contained brushes and brush overlap can be
removed. Contained brushes can be removed because a bounding box will never collide
which such brushes. Also one of the overlapping parts of brushes that overlap can be
removed, because a bounding box only needs to collide with one of the parts. The
removal of contained brushes and overlapping parts can be accomplished with simple
Constructive Solid Geometry (CSG) [12] operations, because the expanded brushes are
convex. After removing contained brushes and overlapping parts there are less brush
bounding planes that need to be used as splitters in the BSP tree.
More bounding boxes
So far the assumption has been made that the player is only using one bounding box.
This is not the case. When a player crouches, another, smaller bounding box is used for
collision detection calculations. This does not really provide a problem for AAS though.
Multiple sized bounding boxes can be compiled into the same BSP tree. For each
bounding box a set of brushes is created and expanded for that bounding box. CSG
operations are only performed on and between brushes that are expanded for the same
bounding box. From all sets of expanded brushes one BSP tree is created. After creating
the BSP tree it can easily be determined which bounding box(es) can move in each
convex sub-space represented by a leaf node. When a convex sub-space represented
by a leaf node contains no expanded solid brushes then all bounding boxes can move
around there. When a convex sub-space represented by a leaf node contains one or
more solid brushes expanded for a certain bounding box, then that bounding box cannot
move around there.
6. Area Awareness System Quake III Arena Bot 30
Contents of volumes
In Quake III Arena the contents of certain volumes is also defined with brushes. For
instance a water volume is defined with a special brush. The same goes for lava and
slime. These brushes that define a contents can also be expanded and compiled into the
BSP tree. The leaf nodes that only contain (parts of) these brushes, that define content,
can be marked as volumes with that content.
Solid sub-trees
The BSP tree now defines convex hulls (areas). Before another representation for these
convex hulls is created, the BSP tree can be optimized. The BSP tree contains
completely solid sub-trees. When the sub-space represented by a node contains only
solid expanded brushes and there is no openspace between them, then the whole
node is considered solid. For AAS only the areas where the player can move around are
interesting. Obviously the player cannot move around in a completely solid sub-space.
The node that represents such a solid sub-space can still have child nodes. These child
nodes represent solid sub-spaces within the solid space represented by the node. These
solid sub-spaces are not interesting for AAS, and the tree structures that represent them
can be removed. Removing all solid sub-trees can make the BSP tree significantly
smaller. In some cases, it can more than half the total number of nodes in the BSP tree.
There are several causes for the existence of solid sub-trees within the BSP tree. One of
them is shown in figure 6.11.
Figure 6.11: Two adjacent brushes.
A BSP tree is created from these two expanded brushes and the plane used at the last
node of the tree is the plane that separates the two brushes. This node represents a fully
solid sub-space and its children represent the original brushes. Since the node is
already fully solid there is no need to store its children. Especially after the CSG
operations are performed on the expanded brushes this situation is quite common.
Portalisation
In order to calculate reachabilities and routes between areas (as will be done later on),
another representation is required for the convex hulls (areas). The BSP tree does store
all the information needed, but the representation cannot easily be used to calculate
relations between areas. A representation with areas that are bounded by faces would
be much more suitable. These faces are polygons that either represent solid walls or
lead to other areas. With such a representation adjacency of areas can easily be
determined, and it is easier to find or calculate geometric properties. Such a
representation can be created by portalising the BSP tree. This technique creates
6. Area Awareness System Quake III Arena Bot 31
portals between all the leaf nodes defined by the BSP tree. These portals are the faces
that bound the areas.
After portalisation the basic representation needed for AAS is created. However this
portalised BSP tree still needs some work and the whole representation can be
optimized in several ways. The BSP tree structure is also not thrown away at this point,
because it is a very useful access structure to the areas of AAS, as will be shown later
on. Each area, with the face boundary representation, is linked into the BSP tree at the
node that represents its convex sub-space.
Outside maps
A map in Quake III Arena is a space enclosed by brushes. There is no way for a player
to go outside this enclosed space. Now that adjacent areas can easily be found through
the created portals, it is possible to flood through these portals. When starting from all
known valid positions inside the map, the convex hulls these positions are in can be
found. Flooding through the portals of these convex hulls all other convex hulls or areas
that are also within the enclosed map space can be found. If all these convex hulls are
marked then all convex hulls that are not marked can be eliminated because those
convex hulls are outside the map, and a player can never move around there.
Gravitational subdivision
As mentioned earlier not all convex areas satisfy the basic navigation property required
for AAS. All areas that contain water, or another liquid the player can swim in, satisfy the
basic navigation property. However areas a player walks in can have gaps in the floor.
Basically if a player is able to stand somewhere in an area, there should not be any gaps
in the floor in the same area. If an area does have gaps the player can fall in the gaps,
and the player might not be able to move in a straight line between any two reachable
points in the area. When an area, with both places where the player can stand, and one
or more gaps in the floor is found, this area needs to be split into several areas. Every
time such an area is found it is split with a vertical plane that goes through one of the
edges of the gap. These split planes will be called gravity planes. Instead of this area a
new node is added to the BSP tree that stores the new split plane. The new node will
have the two new areas, created after splitting the original area, as its children. All
areas, that have both places where the player can stand and gaps in the floor, are split
with gravity planes until no such areas are left.
Figure 6.12: Area with gap.
Figure 6.13: Area subdivided around gap.
6. Area Awareness System Quake III Arena Bot 32
In figure 6.12 the green area has a gap in the floor. The gap leads to the red area. In
figure 6.13 the green area is subdivided into multiple areas, using gravity planes through
the edges of the gap.
Merging areas
The BSP tree is already optimized to define the least number of convex hulls or areas. In
addition to that, there is another way to reduce the total number of areas. As long as the
new area satisfies the navigation property of AAS, two adjacent areas can be merged
into one new area. Each pair of adjacent areas is tested and merged if and only if the
new area is still convex, and no gaps are introduced to an area in which the player can
stand. When two areas are merged the BSP tree is modified accordingly. This can cause
multiple branches of the BSP tree to point to the same area.
Melting things together
The data used for AAS is the collection of all the areas with their face boundary
representation and the BSP-tree as a fast and very useful access structure to the areas.
All the boundary representations of the areas will share data. The areas will share faces,
edges of faces and vertices. This will allow to more easily find shared faces, edges and
vertices between adjacent areas.
6.3 Environment sampling
There are various ways to extract information from the 3D representation used for AAS.
Especially the BSP tree is a very useful structure, which allows to calculate and extract
certain information about the environment very easily.
Finding the area a player is in
First of all it will be useful to know which area a bot is in. Using the BSP tree there is a
very fast and easy way to calculate the area a bot is in. One can start at the root node of
the BSP tree and calculate the side of the plane, stored at that node, the origin of the
bots bounding box is at. Depending on the side of the plane the origin is at, one
continues with one of the child nodes that represents either the sub-space at the front, or
the sub-space at the back of the plane. At this child node one again calculates which
side of the plane, stored at the child node, the origin of the bounding box is at, and one
continues with one of its children accordingly. This procedure is continued until one of
the areas of AAS is found. That area is the area the bot is situated in.
The planes at the nodes are stored as a normal vector with a distance. This makes it
rather easy to determine at which side of the plane a point is located. The side of the
plane a point is at, can be determined from the sign of the dot product of the plane
normal vector and the point, minus the plane distance. If the value is positive then the
point is at the front of the plane. If the value is negative, the point is at the back of the
plane, and if the value is zero then the point is on the plane. If the origin of the bounding
box is on one of the split planes at a node, then one also continues with the child node
that represents the sub-space at the front of the split plane.
6. Area Awareness System Quake III Arena Bot 33
Recursive subdivision by the BSP tree
Collisions of the bots bounding box with the world can also easily be calculated using
the AAS data structures. The collision with the environment of a bot moving along a
straight line from a start to an end position can be calculated using the BSP tree.
Figure 6.14: Trace subdivided by a BSP tree.
The collision can be calculated with recursive subdivision by the BSP tree of the line
along which the bot moves. The movement along a straight line from a start to an end
position will be called a trace. Figure 6.14 shows how a trace is subdivided into several
trace segments by the planes of a BSP tree.
One starts at the root node of the BSP tree and calculates which side of the plane,
stored at that node, the trace is at. Depending on the side of the plane the trace is at,
one continues with one of the child nodes that represents either the sub-space at the
front or the sub-space at the back of the plane. In case the plane stored at the node
splits the trace, one continues with both children. At each child node one continues with
only that segment of the trace that is inside the sub-space represented by the child
node. At the child nodes one again calculates which side of the plane, stored at the child
node, the trace or trace segment is at, and one continues with one or both of its children
accordingly. This procedure is continued until all the areas of AAS and solid leaf nodes
the trace goes through have been found. When the trace is split into two trace segments
in this recursive process, one always continues first with the child node that contains the
trace segment closest to the start of the trace. This way one ends up with a sorted list of
trace segments from the start to the end of the trace. As soon as a line segment in this
sorted list enters a solid sub-space there is a collision at the start of that line segment.
Finding the areas a trace goes through
Just like collisions of a bots bounding box with the environment are calculated, it can
also be calculated through which areas the movement along a straight line goes.
Recursive subdivision by the BSP tree of the trace is also used here. The trace is
chopped up by the BSP tree into one or more trace segments that go through certain
areas. These areas can easily be listed and used for numerous things.
6. Area Awareness System Quake III Arena Bot 34
Areas a bounding box is in
In order to calculate if the bots bounding box can or will touch the bounding boxes of
other entities in the world, it is often useful to know in which area(s) the bounding boxes
of entities are. To calculate this the bounding box of the entity has to be expanded, just
like the brushes are expanded for collision calculations. This expansion is necessary,
because the not expanded bounding box can be outside all areas, when at the same
time the bot might be able to touch the bounding box while standing in a certain area.
After expansion it can be calculated in which area(s) the bounding box resides, by
testing on which side of the BSP tree split planes the bounding box is situated. This
works similar to how the area a bot is in, is found. However a bounding box is now used
instead of a point. One starts at the root node of the BSP tree and calculates which side
of the plane, stored at that node, the bounding box is at. Depending on the side of the
plane the bounding box is at one continues with one of the child nodes, that represents
either the sub-space at the front or the sub-space at the back of the plane. In case the
plane stored at the node splits the bounding box one continues with both children. At
each child node one again calculates which side of the plane, stored at the child node,
the bounding box is at, and one continues with one or both of its children accordingly.
This procedure is continued until all the areas of AAS the bounding box is in are found.
6.4 Reachability
Just the area representations are not sufficient for the bot to travel through the whole
map. The bot will need to know how to travel from one area to the other, if possible at all.
Therefore so-called reachabilities between areas are calculated. Such a reachability
always starts in a certain area and leads to one other area. All possible reachabilities
can be classified using about 12 different types. The different types used in Quake III
Arena are listed below:
- Swimming in a straight line
- Walking in a straight line
- Crouching in a straight line
- Jumping onto a barrier
- Walking of a ledge
- Jumping out of the water
- Jumping
- Teleporting
- Using an elevator
- Using a jump pad
- Using a bobbing platform
- Rocket jumping
The reachabilities are calculated for each area, and they link the area to another area.
They also store a start and end point of the movement along the reachability. The
reachabilities often also store a reference to the area boundary face and/or edge that
leads to the other area. Below the area a reachability is created for will be called, A1.
The area a reachability leads to, will be called A2.
6. Area Awareness System Quake III Arena Bot 35
Swimming in a straight line
The swimreachability is one of the easiest to find in the AAS data. From each area
filled with water, or another liquid the player can swim in, one can look at the faces that
lead to other areas also filled with a liquid the player can swim in. A swimreachability is
then created from the area to the other area which is found through the face.
Walking and crouching in a straight line
Most of the walkreachabilities are also very easy to find. From each area one can look
at adjacent areas through the faces. When the player can walk in both areas, and there
are floor planes in both areas that meet at an edge, then a walkreachability can be
created. Finding crouchreachabilities is very similar to how the walkreachabilities are
found. When the player has to crouch in either one of the two adjacent areas a crouch
reachability is created.
Several reachabilities
Boundary faces of an area on which the player can stand will be called ground faces.
Several reachabilities can be calculated using the edges of these ground faces. A
vertical plane is created through a ground face edge that is not shared with other ground
faces in the same area. Now one searches for edges from ground faces of other areas
that are on this same plane. When an edge is found to be on the same plane, the
shortest distance between that edge, and the edge used to create the plane is
calculated. Several different reachabilities can be created depending on this distance.
The edge used to create the plane will be called E1, and the edge found to be on the
same plane, E2. The figures 6.15 through 6.17 are side views, and the edges E1 and E2
are coming towards the viewer. The vertical line represents the shortest distance
between the edges E1 and E2. In all three cases the edge E2 is positioned higher
relative to the edge E1. Also in all three cases the shortest distance between the two
edges is smaller than the maximum step height. Players can walk up stairs automatically
if the step height is smaller than a certain number of units. Figure 6.15 shows a normal
step. Figure 6.16 shows a step with shallow water in area A1. Figure 6.17 shows a step
with water up to the step.
In all three cases the water is too shallow to swim in and a walkreachability will be
created.
Figure 6.15: Step.
Figure 6.16: Step with low water.
Figure 6.17: Low water onto step.
E2
E1
A2
A1
6. Area Awareness System Quake III Arena Bot 36
In case edge E2 is positioned higher than the maximum step height relative to the edge
E2, one checks if a player can jump up onto the barrier. The maximum height of a
barrier, a player can jump onto, is a fixed value in the game physics. If the edge E2 is
not higher than this maximum height relative to E2, a barrier jumpreachability is
created.
Figure 6.18 and 6.19 show two cases where a barrier jumpreachability would be
created. The reachability is also created when area A1 is filled with water that is too
shallow to swim in as shown in figure 6.19.
The edge E2 can also be positioned lower relative to the edge E1. If the edge E2 is not
lower than the maximum step height relative to edge E1 a walkreachability is created.
The player will just walk down the step and/or stairs. In case the edge E2 is lower than
the maximum step height relative to the edge E1 a walk off ledgereachability is
created. The player will not be able to walk back up, the player will have to jump back up
or may not be able to get back up directly at all.
A walk off ledgereachability reachability is also created when the area the reachability
will lead to is filled with water a player can swim in.
Figure 6.20 shows the situation where the player walks down a step and/or stairs. Figure
6.21 and 6.22 show cases where a walk off ledgereachability is created.
Figure 6.20: Step down.
Figure 6.21: Ledge.
Figure 6.22: Ledge into water.
E1
E2
A2
A1
Figure 6.18: Barrier.
Figure 6.19: Barrier with low water.
E2
E1
A2
A1
6. Area Awareness System Quake III Arena Bot 37
When the edge E2 is lower than the maximum barrier height, relative to the edge E1,
one will have to make sure there are no solid objects the player might bump into when
walking off the ledge. If the edges are far enough apart, obstacles as shown in figure
6.23 can obstruct the player.
A player bounding box is traced from edge E1 to edge E2 to find such obstacles. In case
obstacles are found no reachability is created. When looking back at the reachabilities
created for steps and barriers one will notice that no such check for obstacles is used
there. The reason is, that the step and barrier height are smaller than the vertical size of
the player bounding box. Due to the expansion of the solid brushes in the map before
compiling them into the BSP tree, there simply cannot be any obstacles along that
height.
Jumping out of the water
If none of the above reachabilities were created from area A1 towards area A2 one tests
for a water jumpreachability. Players are able to jump out of the water onto a floor at
the side of the water if the floor is not too high. Such a water jumpreachability is only
created if area A1 is filled with water, and area A2 is either not filled with water or the
water is too shallow to swim in. Figure 6.24 and 6.25 show these situations.
To test if the floor at the side of the water is not too high, the distance between the water
surface and the floor will have to be calculated. The water surface is also represented by
one or more area boundary faces because water brushes are also compiled into the
BSP tree (section 6.2). In figure 6.24 an edge of this water boundary face is denoted
with E1. The edge of a ground face of the area the water jumpreachability will lead to,
Figure 6.23: Ledge with obstacle.
E1
E2
A2
A1
obstacle
Figure 6.24: Water jump.
Figure 6.25: Water jump with low water onto floor.
E2
E1
A2
A1
6. Area Awareness System Quake III Arena Bot 38
is called E2. A water jumpreachability is created when the shortest distance between
these two edges is smaller than the maximum height a player can jump up to out of the
water.
Jumping
To find jumpreachabilities one looks once again at the edges of ground faces of the
areas of AAS. The two closest points on the ground of two areas is searched for. One of
the points will be on an edge of a ground face of area A1 and the other on an edge of a
ground face of area A2. In case there is a range of closest points, the point in the middle
of this range is used. Between these two points there must be one or more gaps. Such
gaps are found by tracing a player bounding box down at the points on the edges.
If the gaps exist a potential jump is predicted from area A1 towards area A2. Basically
the full player movement along the jump arch is predicted to see if the player would
bump into any obstacles. When no obstacles are found the jumpreachability is created
from area A1 to area A2. If the two points on the edges of ground faces of area A1 and
A2 are very close to each other, or the point on the edge of area A2 is situated a little bit
lower, then players sometimes do not even have to jump. The player can bridge the
gap(s) between area A1 and area A2 by running. In such a case a walk off ledge
reachability is created instead of a jumpreachability.
Teleporting
There are teleporter entities in certain maps. These entities come with a trigger brush.
When this trigger brush is touched the player is teleported instantly to another location
on the map. These teleporter brushes are compiled into the BSP tree just like water
brushes. The leaf nodes or areas that contain only these or part of these brushes are
then marked as areas that will teleport the player when entered. For each teleporter
entity one searches for the areas that were created by the teleporter brush. Such areas
are found by retrieving all the areas that are within the smallest bounding box that
contains the teleporter brush, and only selecting those areas that are marked as
containing the teleporter. From all these areas, teleporterreachabilities are created
towards the area that the destination of the teleporter entity is in. Portals that teleport a
player work exactly the same.
Figure 6.26: Jump reachability.
6. Area Awareness System Quake III Arena Bot 39
Using an elevator
Quake III Arena also has elevator entities in certain maps. The bottom and top position
of the elevator are stored with these entities. At these two positions one looks around for
nearby areas the player can walk towards when standing on the elevator, or walk from
onto the elevator. At both positions such areas can be found by tracing in several
directions using the environment sampling functionality described in section 6.3. An
elevator goes up automatically when a player is standing on top of it. elevator
reachabilities are only created from areas nearby the bottom position towards areas
nearby the top position.
Using a jump pad
There are also jump pad entities in a lot of maps. These entities also come with a trigger
brush just like the teleporter entities. When a player touches such a trigger brush the
player is pushed in a specific direction with a certain velocity, much like an oriented
trampoline. The jump pad brush is compiled into the BSP tree just like the teleporter
brush and water brushes. The leaf nodes or areas that contain only these or part of
these brushes are then marked as areas that will push the player into a specific
direction. For each jump pad entity one searches for the areas that were created by the
jump pad brush. Such areas are found by retrieving all the areas that are within the
smallest bounding box that contains the jump pad brush, and only selecting those areas
that are marked as containing the jump pad. From all these areas jump pad
reachabilities are created towards the area that the player ends up in, after being pushed
by the jump pad and having flown through the air. The area towards which the
reachability is created is found by predicting the player movement from the jump pad to
where the player lands on the ground. The area the player lands in will be the area
towards which the reachability is created. Acceleration pads work exactly the same as
jump pads.
Using a bobbing platform
The bobbing platform is an entity that continuously moves up and down or horizontally
back and forth. Players can often stand on top of these, to travel to other locations on
the map. The positions between which the platform moves up and down or back and
forth can be calculated from the entity. At these positions one looks around for nearby
areas from which the player can move onto the platform or towards which the player can
move from the platform. Such areas are found by tracing a bounding box at the edges of
the platform. Between all combinations of areas at both positions, reachabilities are
created both going up and down or back and forth.
Rocket jumping
In Quake III Arena a player can perform a so called rocket jump. The player shoots a
rocket at the floor, and jumps at the same time. The player of course gets damaged by
the rocket but does not necessarily get killed. The rocket explosion also pushes the
player upwards. In combination with the jump the player can jump up to very high
places. For the bots, rocket jumpreachabilities are only created towards areas that
have one or more items in them. Many rocket jumpreachabilities can be created and a
lot of them are of no interest to the bot. Also it would not be good to make the routing
(see section 6.5) slow due to a lot of rocket jumpreachabilities, which the bot will not
use most of the time. rocket jumpreachabilities are also only created from the center of
6. Area Awareness System Quake III Arena Bot 40
areas the player can stand in. This is simply to choose one of many possible start points
for the rocket jump. From this center the upward velocity is calculated and the player
movement is predicted towards areas that have items in them within range. When, in the
prediction, the player is not obstructed by obstacles, and the player ends up in the right
area, the rocket jumpreachability is created.
Complexity of calculations
Calculating all these reachabilities seems to involve rather time consuming operations.
Testing each area against every other area for reachabilities is of O(n
2
) on the number of
areas. However in a lot of cases there is no need to test each area against every other
area. The ability to flood through the faces of one area towards other areas can speed
up calculations considerably. For some reachabilities like the jumpreachability, this
method cannot be used though. The jumpreachability is probably one of the most
complex and time-consuming reachabilities to find. However since players can jump only
so far and only jump up to a certain height a lot of areas can be discarded before trying
to create jumpreachabilities towards them. Knowing the bounds of each area can
speed up the search even more. The same of course goes for rocket jump
reachabilities.
6.5 Routing
Real-time vs. fixed pre-calculated tables
Having both the area descriptions and reachabilities, routes between areas can be
calculated. A pre-calculated table with routing data is very fast for lookup in real-time, but
the table will also take up quite some memory. The Quake III Arena environment hardly
changes, so a pre-calculated table will work in most cases. However there are also quite
a few situations where routes change due to small but significant changes in the
environment. For instance doors that only open by pushing a button located elsewhere
in the map can change the route towards a goal. To be able to deal with these situations
a real-time dynamic routing algorithm is used. Calculating routes on the fly consumes
quite some more calculation time than a simple lookup table. However in return a lot of
flexibility is obtained. Because the Quake III Arena environment does not change
continuously, part of the real-time calculated routing data is temporarily stored or cached
for fast look up. With a restricted amount of the routing cache the memory requirements
can be minimized.
Conventional algorithms
There are several algorithms readily available to calculate routes and travel distances
and/or times in a graph. Dijkstras algorithm and A* are two examples [11]. However,
using these algorithms a problem is encountered. The Quake III Arena maps are usually
quite complex and detailed. As a result the number of areas that are created for a typical
map, is rather high. Maps with 5000 areas or more are not uncommon at all. Not all
areas will be used for routing purposes. Only areas a player can stand or swim in are
used. Still there will be a lot of areas used for routing. Algorithms like Dijkstras or A* are
simply to slow for usage in real-time with such large area counts. Especially when there
is a game engine running at the same time, which consumes quite some calculation
time. Another approach is required than using one of these conventional routing
algorithms.
6. Area Awareness System Quake III Arena Bot 41
Multi-level algorithm that calculates cache
A multi-level routing algorithm is used. This routing algorithm calculates routing data with
the same accuracy as conventional routing algorithms. There are no significant
drawbacks compared to these commonly used routing algorithms. However the multi-
level routing algorithm often requires significantly less calculation time and storage
space. The routing algorithm always calculates and caches routing data for a specific
goal area. The routing cache stores per goal area, the travel times of areas towards this
goal, and the first reachability to be used from these areas towards this goal. The
algorithm does not store the travel times towards goals per source area. The routing
cache is stored per goal area, and not per source area because there are a lot of goals
in Quake III Arena that stay at fixed locations. At the same time the bot will be moving
around a lot and thus the source area will change a lot. Of course there are also goals
that move around, for instance another player when being chased by the bot. However
when the bot chases another player both the goal and source area change continuously.
Calculating routing caches per goal area will save calculation time and storage space
because the cache can be reused more often.
Routing cache and Clusters
The multi-level routing algorithm calculates routing caches at two levels. It calculates
cache for areas in a cluster and it calculates cache for cluster portals. In a map one or
more clusters with areas are created. Such a cluster is a group of connected areas.
Shared bounding faces and reachabilities connect the areas. The clusters are separated
by cluster portals, which are areas themselves. The only way to travel from one cluster
to another is through one or more cluster portals. A cluster portal always separates no
more and no less than two clusters. The cache for areas in a cluster will be called area
cache, and the cache for cluster portals, portal cache. The area cache stores the travel
times of all areas within a cluster, including the cluster portal areas that touch the cluster,
towards goal areas that are in the same cluster. The portal cache stores the travel times
of all portal areas in a map, towards a goal area which can be anywhere on the map.
Such a goal area can be any area from any cluster, including cluster portal areas.
Figure 6.27 shows three clusters separated by two portals both denoted with a p.
cluster p
cluster p
cluster
Per goal area, the portal cache stores
the travel time of each portal area
towards the goal ar
ea. This goal area
can be any area on the map.
Per goal area that is in the cluster, the area cache
stores the travel time of each area in the cluster
towards the goal area. This goal area can only be
an area within the same cluster, including the
cluster portals that touch the cluster.
Figure 6.27: Clusters separated by portals.
6. Area Awareness System Quake III Arena Bot 42
In general not all routing cache will be calculated. Routing cache will only be calculated
and stored for areas the bot has had, or still has as a goal. The maximum memory
requirements to store all the possible routing cache is given by the following equation:
TNA = Total Number of Areas
NCP = Number of Cluster portals
NC = Number of Clusters
NA
i
= Number of Areas in cluster i
Assume cache is created for all goal areas in a map. In that case portal cache is
created, which stores for each goal area, the travel times towards this goal area from all
cluster portals. Added to that all area cache is created within each cluster. Within each
cluster, cache is created for every goal area within the cluster. The number of possible
goal areas within a cluster is equal to the number of areas within the cluster including the
cluster portals that touch the cluster. For each such goal area travel times towards this
goal are stored, of all areas within the same cluster.
As an example a map with a total of 100 areas is used. 10 clusters are created with 10
areas each. 9 cluster portals separate these clusters. The total number of travel times
that would ever need to be stored in cache is: 100 * 9 + 10 * (10 * 10) = 1900. Now if the
100 areas within the map would all be part of one big cluster 100 * 100 = 10000 travel
times would have to be stored. This makes a quite significant difference in required
storage space. The less travel times that ever need to be stored, the less calculation
time will also be required to calculate them.
Calculating routing caches
The area cache is calculated with a simple breadth first routing algorithm [11]. The areas
are assumed to be nodes of a graph and the reachabilities the reversed links between
the nodes. The breadth first algorithm starts at the goal area and uses the reversed
reachability links to flood to other areas. The algorithm never floods to areas outside the
cluster. The algorithm does flood into cluster portals that touch the cluster. The
reachabilities store a travel time, which is the time it takes the bot to travel along the
reachability. These travel times are used in the routing algorithm. The areas are
assumed to be nodes of a graph, but of course the areas are not points in space. It also
takes time to travel through an area. These travel times through areas are also used in
the routing algorithm. For each area a small table is used with travel times from every
end point of a reachability that leads towards this area, to every start point of a
reachability that starts in this area and leads to another area.
M = TNA * NCP + (NA
i
)
2
NC
i = 1
Eq. 6.5.1
6. Area Awareness System Quake III Arena Bot 43
The portal cache is also calculated with a breadth first routing algorithm. The cluster
portal areas are assumed to be nodes of a graph, and the routes through the clusters
between these portal areas, are assumed to be the links between the nodes. The goal
area is also assumed to be a node in the graph. The routes from the goal area, through
the cluster the goal area is in, towards portals of that cluster are also used as links in the
graph. The travel times for routes through clusters can be retrieved from the area cache
for those clusters.
Dijkstras algorithm could also be used instead of the breadth first algorithm. However
the areas in the Quake III Arena maps are usually not that different in size. Also the
travel times stored with reachabilities between areas are not that different. Due to these
properties of the Quake III Arena maps the sorting of the nodesin Dijkstras algorithm
usually takes up more time than the algorithm is faster by only visiting nodesonce.
Using routing caches
Now that routing caches can be created they can be read from, and used for routing
purposes. Functionality is created to retrieve the travel time from a point within a source
area towards a goal area. At the same time the first reachability to be used from this
source area towards the goal area can also be retrieved. Reading this data from the
routing cache works as follows. In case the source area is a cluster portal area, the
travel time and reachability can be read directly from the portal cache. If the source area
is not a cluster portal then the travel time towards the goal is taken from each portal area
that touches the cluster the source area is in. To each of these travel times, the travel
time from the source area towards the specific portal area within the cluster is added.
From all the added travel times the smallest one is taken. This is the travel time towards
the goal in case the goal area is not in the same cluster as the source area. The first
reachability to be used from the source area is retrieved accordingly. In case the goal
area is in the same cluster as the source area, the travel time from source to goal within
the cluster is also retrieved. Then the smallest travel time is taken from the ones through
the portal areas and the one within the cluster. Here the first reachability to be used from
the source area is also retrieved accordingly.
The routing cache is created on request. As soon as the cache is needed and it is not
already available it is calculated. Retrieving routing information from the cache involves
a loop over the portals of the cluster the source area is in and some additions. However
the number of portals that enclose a cluster is usually very small, often 10 or less. This
makes retrieving routing data from the cache rather fast.
6. Area Awareness System Quake III Arena Bot 44
Optimal clusters
It has been shown that by creating clusters in a map the maximum memory
requirements for routing cache can be minimized. The question how to create clusters
that are optimal remains. First of all, clusters that all have about the same number of
areas will be preferred. If all clusters have the same number of areas then calculating
and storing routing data will take up an equal amount of time and space for any
combination of source and goal area. To minimize the calculation time and memory
requirements for routing data, the equation below should be minimized. From the
equation follows that the number of cluster portals should be minimized at all times.
TNA = Total Number of Areas
NCP = Number of Cluster portals
NC = Number of Clusters
NA
i
= Number of Areas in cluster i
All clusters are assumed to have the same number of areas. At least X-1 cluster portals
are required to separate X clusters. Equation 6.5.1 can now be written as:
M = TNA * (NC-1) + NC * (TNA / NC)
2
The number of portals is the number of clusters (NC) minus one. Each cluster will have
the total number of areas (TNA) divided by the number of clusters (NC) areas. Equation
6.5.2 can be written as:
M = TNA * NC TNA + TNA
2
/ NC
The minimum of this equation is found by setting the derivative
equal to zero for the variable NC.
TNA + TNA
2
* -1 * NC
2
= 0
TNA - TNA
2
/ NC
2
= 0
TNA
2
/ NC
2
= TNA
TNA / NC
2
= 1
TNA = NC
2
NC = TNA
From the above follows that the optimal number of clusters is the square root of the total
number of areas in a map. In the optimal case the total number of travel times that would
ever need to be calculated and stored is approximately 2 * TNA * TNA. This grows
significantly slower with the total number of areas, than TNA
2
, which would be required
when a conventional routing algorithm is used. For instance with 5000 areas
2 * TNA * TNA is a little bit more than 700.000. On the other hand TNA
2
is 25 million.
Eq. 6.5.2
Eq. 6.5.3
Eq. 6.5.4
d
dNC
M
M = TNA * NCP + (NA
i
)
2
NC
i = 1
Eq. 6.5.1
6. Area Awareness System Quake III Arena Bot 45
Now that the optimal number of clusters is known under certain conditions the clusters
still have to be created inside the map. Clusters are created by marking areas as cluster
portals. A special algorithm is used to automatically mark areas as cluster portals. This
algorithm uses geometric properties within the map to mark certain areas as cluster
portals. Areas within door openings and windows are marked by this algorithm. These
are often good cluster portals. However choosing those, the number and size of clusters
are not automatically optimized. For this purpose the map designers can create cluster
portals by hand. The map designers can do this by placing a special cluster portal brush
in the map. These cluster portal brushes are compiled into the BSP tree like water
brushes (section 6.2). The areas created from such a cluster portal brush are marked as
cluster portals. By placing these cluster portal brushes the map designers can optimize
the number of clusters and the number of areas in each cluster by hand.
More levels
The routing algorithm presented here uses two levels. The first level being routing
between the areas within a cluster. The second level being the routing between clusters.
Of course one can extend upon this idea. A third level could be added where several
clusters are grouped together, and even more levels could be added. Using a routing
algorithm with more levels can further reduce memory and calculation time
requirements. However it also introduces more overhead when for instance reading
routing data from the caches. In Quake III Arena the number of areas within maps is not
that tremendous that more than two levels are needed.
6. Area Awareness System Quake III Arena Bot 46
6.6 Entities
Other entities in the game like other players, items, moving objects like doors, etc.
provide some of the most important information for the bot. Information about these
entities, like their type, their position, bounding box size etc. is communicated from the
game program to the Area Awareness System. Within AAS, the information is stored for
usage by the bot and the entities are linked into the areas based on their position and
bounding box size. The environment sampling functionality described in section 6.3 is
used to find the areas the bounding box of an entity is in. The entities are linked into the
areas using a 2-dimensional linked list. This list works like the table shown in figure 6.28.
A dot means the entity is in a certain area.
At the dots there is a link, which allows to easily retrieve all entities within a certain area,
and to retrieve all the areas a certain entity is in. This information is useful for instance
when the bot decides to retrieve a certain item on the map. The bot will need to know in
which area the item entity resides in order to travel towards, and pick up the item.
Area 1
Area 2
Area 3
Entity 1
Entity 2
Entity 3
Area 4
Figure 6.28: Entities linked into areas.
7. Basic actions Quake III Arena Bot 47
7. Basic Actions
7.1 Human and Bot Input Interface
People that play Quake III Arena most often use the keyboard and mouse as input
devices. The keyboard and mouse buttons are used for actions like move forward,
move left, jump, fire weaponand switch weapon, etc. The left to right mouse
movement is used to turn the players view. The forward backward movement of the
mouse is often used to look up and down.
The artificial player does not use these input devices. The bot only lives inside the
computer. However the bot is provided with a similar interface with the same kind of
functionality. The bot will use a range of basic actions that have the same, or similar
results as the input devices used by a human player. All the decisions made by the bot
will eventually be translated into a sequence of basic actions. This sequence of basic
actions is the bots input for the game.
Although these basic actions present an interface very similar to the interface provided
to human players, there is a slight difference. For instance in theory a human player has
no limitations on how fast he or she can change the view angles. However this is not
true in practice. The hands and arms of human players have physical limits to how fast
they can move, and how fast they can react to certain stimuli. The mouse itself, often
used to change the view angles, has physical limits too. The basic actions do not provide
these limits for the bot. These limitations will have to be explicitly implemented in the bot
AI to make the bot appear more human-like.
7.2 Actions
The basic actions the bot can use as input for the game are listed below.
Attack This action equals to a player holding down the fire button. The
bot will fire the weapon the bot currently holds.
Use The bot will use the currently held holdable item.
Respawn This action causes the bot to respawn when the bot is dead.
Human players use the fire button for this purpose.
Jump This action makes the bot jump up.
Crouch This will make the bot crouch. The bot will crouch while this basic
action is used. Just like a human player would hold down the
crouch button.
Move Up This action makes the bot move up when swimming. This equals
to holding down the jump button for human players.
Move Down This action makes the bot move down when swimming. This
equals to holding down the crouch button for human players.
7. Basic actions Quake III Arena Bot