![Page 2: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/2.jpg)
OMNI-BOT - Resume• Bots• Resume Omni-Bot• Game functioning,• Framework• Agent structure,• Goals• Society and interaction between agents,• Waypoints and traversal,• Manual routing,• Scripting,• Problems and scripting,• Conclusion
![Page 3: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/3.jpg)
What’s a bot? Everyone who has played a
computer game has encountered a bot.
Computer controlled game player.
Computational equivalent of a ‘robot’
Bot Agent
![Page 4: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/4.jpg)
Why bots? Fill a game with more players.
Help humans to train.
Execute tasks boring for us.
Etc.
![Page 5: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/5.jpg)
OMNI-BOT
Framework implementing bots in FPS Games supported:
Wolfenstein: Enemy Territory, Doom 3, Quake 4, Fortress Forever, Return To Castle Wolfenstein, Team Fortress 2
“BDI” agents, internally state machines. Oriented towards completing goals while sensing their environment.
Not ALL games fully working (currently).
Best implementation on W.E.T.
![Page 6: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/6.jpg)
Enemy TerritoryEnemy Territory- Resume -- Resume -
Comprised of various environments (maps) usually set in WW2, with different goals (frequently contradictory) for the factions.
Two factions: Allies and Axis, equal in characteristics, spawning in pre-determinated locations.
Five classes: Soldier, Medic, Engineer, Field Ops, Covert Ops, each one with it’s advantages and disadvantages.
![Page 7: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/7.jpg)
Wolfenstein – Enemy TerritoryWolfenstein – Enemy Territory- Goals -- Goals - Goals like stealing vehicles, escorting or not allowing them to move, destroying or constructing entities, healing and reviving teammates, etc.
Completing goals may create contradictory goals on the opposing faction.
Game development may also create or delete goals, possibly specific for some faction.
Show Demo.
![Page 8: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/8.jpg)
Wolfenstein – Enemy TerritoryWolfenstein – Enemy Territory Limbo, with map’s goals for allied faction:
![Page 9: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/9.jpg)
Wolfenstein – ET : MODsWolfenstein – ET : MODs SDK for changing game logic available
Various game modifications (mods) with different game plays:
ETPub
NoQuarter
ShrubMod
ETPro
Jaymod
True Combat Elite
PowerBall
etc.
Installed on the game’s directory
![Page 10: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/10.jpg)
OMNI-BOT
Independent ‘Library’ installed on ET’s folder (usually “omni-bot”) “omnibot_et.dll has the implementation
“qagame_mp_x86.dll” = server side engine (game logic)
“cgame_mp_x86.dll” & “ui_mp_x86.dll” = client side engine and graphics (client side logic and corresponding graphics)
“Omnibot_et.dll” linked by the running mod (must support omni’s interface)
mod initializes omnibot and bots are connected to the engine as clients (like players)
supported mods: ETPub, Jaymod, NoQuarter
![Page 11: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/11.jpg)
OMNI-BOT - agent structure List of goals, with execution states, positions, priorities and availability
Sensory memory, with list of attractive entities, like enemies or ‘aimable’ things.
Available weapons, with their preference and firing parameters.
Motor Control, executing the path following algorithm as well as the aiming mechanism.
![Page 12: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/12.jpg)
OMNI-BOT - agent structure Simplified version of a BDI agent
Beliefs = Stored on sensory memory
Desires = List of goals
Intentions = desire selected for execution, being performed
Basically a state machine (deterministic finite automaton, DFA)
![Page 13: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/13.jpg)
OMNI-BOT - State Tree
•Show bigger state tree
![Page 14: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/14.jpg)
OMNI-BOT – Agent’s behaviourif(incapacitated) {
do {for(medic:team.medics) {
evaluation = avaliate(medic.proximity);}evaluation = avaliate(timer.spawn);decideRespawn(evaluation);selectEquipment();
} while(incapacitated);} else {
updateSensoryMemory(world.getNeighborhood());// additional behaviour scriptsexecuteScripts();selectEquipment();goal = getHighestPriorityAvailableGoal(); // goal may include alternative routepath = computePath(goal);// wait for world eventswhile(not(world.changed)) {
waypoint = nearestWaypoint(path);motorControl.setDestination(waypoint);if(near(waypoint)) {
do {execute(goal);
} while(not(executed(goal)));}
};};
• Simplified algorithm for bots' behaviour. Actually implemented in parallel threads, like path following, enemy aiming and firing, sensory information, etc. (external scripts)
![Page 15: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/15.jpg)
OMNI-BOT – Agent’s behaviour
• Executed on each server frame (usually 20 per second, server side cvar “sv_fps”)
• ‘Threads’ and execution details on Debug’s window, section profiler
![Page 16: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/16.jpg)
OMNI-BOT - Goals Retrieved from the map’s script and bsp’s entities
Following example: destroy ‘Side Door’, for axis
![Page 17: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/17.jpg)
OMNI-BOT - Goals Example of map goals:
x: “goal” -> |bitflag| serial |y| priority |z|
bitflag specifying allowed team (axis, allies);
serial = internal goal identification;
priority = goal priority (relating to others).
and more properties
![Page 18: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/18.jpg)
OMNI-BOT - Society By default goals are shared by different agents (excluding some cases).
If not, the goal is assigned by the framework to some agent (actually, first come, first served).
An agent may require support from others (ammunition and health / revival). In this case, it creates a specific goal (like ‘heal me’).
No negotiation of goals between the agents.
Individual behaviour
![Page 19: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/19.jpg)
OMNI-BOT - Waypoints Goals are reached by following paths
Paths created using waypoints
Directed graphs (typically cyclic)
Diagonal descending edge = connection direction
![Page 20: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/20.jpg)
OMNI-BOT - Waypoints
Travelling properties (flags):
Crouch, prone, sprint, walk, jump, route, radius, etc.
radius of waypoint affects path cornering
waypoint flag affects bot‘s behaviour when it’s approaching the node or when reaches it’s radius
![Page 21: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/21.jpg)
OMNI-BOT – Path travelling
Uses Dijkstra's algorithm for waypoint selection
Essentially uses the shortest path from the source (where the agent selected the goal) to it’s destination (where goal resides or next route point if used)
![Page 22: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/22.jpg)
OMNI-BOT – Routing Path travelling easily expected
Boring for humans
Solution = Manual routing
Basically a human ‘codes’ different paths for different map traversal
Goal X = travel through waypoint 1, then 2 OR 3, then 4, etc. until reach destination
Define waypoint selection probability
Route is chosen when goal acquired near ‘first’ route waypoint.
![Page 23: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/23.jpg)
OMNI-BOT – Routing
If ‘goal’ got when at ‘spawn’ waypoint, choose next waypoint from A, B or C, with probabilities of 2, 1 and 0.66. Calculate shortest path to chosen route point and travel the path;
When arrive to A or B, travel shortest path to ‘goal’s waypoint;
If chose waypoint C and reached it, choose B or D (with corresponding probabilities) and calculate shortest path to ‘goal’. Then travel it.
From ‘SPAWN’ to ‘GOAL’:
MapRoutes = { GOAL = { ROUTE_SPAWN = { ROUTE_A = {Weight = 2.0,}, ROUTE_B = {}, ROUTE_C = {Weight = 0.66 ROUTE_B = {Weight = 0.5} ROUTE_D = {},},},},};
![Page 24: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/24.jpg)
OMNI-BOT – Scripting Written in GameMonkey language
Add functionality to goals, maps, weapons, bots, utils, etc.
Goal scripts: Tells or helps the bot how to achieve some goal (map or another);
Map scripts: Control the logic of the map, like enabling or disabling routes and goals (for instance according to the game’s progress);
Weapon scripts: Configure how to use and handle some weapon or item
Bot scripts: Stores a behaviour which can be associated to some bots.
Utils: implement some usefull functions for been called in other scripts.
![Page 25: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/25.jpg)
OMNI-BOT – Map scriptsGoal script example: goal_askforhealth.gm
this.GetPriority()
if my health < threshold and I’m alive (me, the bot) then
increase this goal’s priority
get nearest health pack
if no pack near, and my team has medics, request medical support
this.update()
if acquired pack, get pack’s position, aim towards it and try to acquire the pack
![Page 26: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/26.jpg)
OMNI-BOT – Goal scripts
Goal script example: bunker.gm
Store the logic of the map (the bots don’t know the goal’s dependencies as well as their importance)
• If objective taken → leave the stairs and attack the radio;
• If objective returned → leave the radio and attack the stairs;
• On map start → start attacking the stairs, forget the radio;
![Page 27: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/27.jpg)
OMNI-BOT – ProblemsHuman waypointing, quite boring. Done manually. Detailed waypoints take time as well as routing them.
Proposed navigational mesh, detailed version of waypoints, but with the problem of the mesh resolution.
![Page 28: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/28.jpg)
OMNI-BOT – Problems Can’t plan a sequence of intentions; No objectives negotiation between agents (assigned FCFS); Objectives are not assigned to the nearest agent; Human coded intentions’ order and priorities; Don’t ‘learn’ the best paths (currently and in the past); Don’t predict (and learn) actions taken by others (cooperation and synchronization); …
![Page 29: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/29.jpg)
OMNI-BOT – Referencehttp://www.omni-bot.com/wiki/index.php?title=Main_Pagehttp://en.wikipedia.org/wiki/Wolfenstein:_Enemy_Territoryhttp://www.omni-bot.dehttp://www.gamasutra.com/gdc2005/features/20050311/isla_01.shtml
![Page 30: AI Bot for First Person Shooters João Carlos Gonçalves jcgonc@student.dei.uc.pt](https://reader034.vdocuments.site/reader034/viewer/2022042615/56649d235503460f949f9011/html5/thumbnails/30.jpg)
OMNI-BOT – Questions
Tuesday, 16 December 2008