fps bot implementation
TRANSCRIPT
-
8/7/2019 FPS Bot Implementation
1/22
K a r a n v e e r S i n g h
H a r s h a l P a t i l
FPS Bot Implementation
-
8/7/2019 FPS Bot Implementation
2/22
AIM
To implement intelligence in a FPS Bot, andenable it to act as humanly as possible.
The field will consist of the bot and a humanplayer controlled character. The bot will try itsbest to win.
Project Extension: to include coordinationbetween a group of bots for common or variedtasks.
-
8/7/2019 FPS Bot Implementation
3/22
TECHNIQUES
FSMs
Autonomous agent
Neural NetworksGenetic Algorithms
-
8/7/2019 FPS Bot Implementation
4/22
Functional & Structural Layers
-
8/7/2019 FPS Bot Implementation
5/22
FSMs
FSMs receive input, and react by either changing thestate or performing some function, or both.
E.g. : Light bulb (2 states : ON or OFF)
Each Bot to be implemented using FSM.
Examples of states : Attack, Pursuit, Find Health,Hide and Evade.
-
8/7/2019 FPS Bot Implementation
6/22
FPS bot FSM
EVADE
Movement = run
Direction = opp. Player
If Player health is low
ATTACK
Movement = take attackposn .
Direction = to player
If player evadesIf my health low
PURSUIT
Movement = runDirection = to player
If Player position notvisible
If Player position is near
HIDE
Movement = take
coverDirection = opp.player
If Player position isfar
If Player health is low
-
8/7/2019 FPS Bot Implementation
7/22
WHY FSMs?
Quick and simple to code
Easy to debug as agent behaviour is broken down intomanageable chunks
Little computational overheadIntuitive Logic
Flexible to modify code and extend abilities
Hierarchical FSMs: introduce reusability & increasesperformance; decreases transitions to be specified.
-
8/7/2019 FPS Bot Implementation
8/22
HOW TO IMPLEMENT FSMs?
Substandard approaches:
Use a series of if-else statements
Each state dependent on other states
State Transition Table
Embedding rules within the states
Improves flexibility
Each state is not dependent on the other states
To modify a states behaviour, no need to change other states
-
8/7/2019 FPS Bot Implementation
9/22
PSEUDO CODE FOR AGENT
In the main function, we have an infiniteloop :
Agent a
Loop()
A.update()
Class Agent
State CurrentState //State is anotherclass
Update() CurrentState.Execute()
-
8/7/2019 FPS Bot Implementation
10/22
MESSAGING
To coordinate between multiple bots
Bots can ask and give info to each other
Will make possible group learning : what 1 bot learns,each bot learns
-
8/7/2019 FPS Bot Implementation
11/22
An AUTONOMOUS AGENT
Autonomous Agent : Being able to sense the environmentand act on its own to achieve a goal.
3 Layers:
Action Selection (Goal selection & Plan making) Steering (Waypoint selection & Behaviours)
Locomotion (the How)
Examples of Behaviours: Seek, Flee, Pursuit, Evade, Wander
Group Behaviours : Flocking, Alignment, etc
-
8/7/2019 FPS Bot Implementation
12/22
PATHFINDING
Decompose the world into Navigation Meshes.
Thus, our world becomes like a graph. If there areno obstacles between 2 nodes, then join themusing an edge. Allocate the weight acc. To storedtables (large cost for sand, explosive areas, etc)
Now, use a graph search algorithm (like A*) tofind the optimum path to go from A to B.Heuristics : Manhattan Distance.
-
8/7/2019 FPS Bot Implementation
13/22
PATHFINDING
-
8/7/2019 FPS Bot Implementation
14/22
NEURAL NETWORKS
Relegate key decision making process to a trained neuralnetwork , thus simplifying a complex state machine
Used as a function approximator
NNs not to be used for everything, since they can beunpredictable.
Example : Decision to engage in combat or not; usingInputs like bots health, enemys health, distance from
enemy, skill level of enemy.Use a 3 layer, feed-forward network (one input, one hidden,one output)
Back propagation Algorithm.
-
8/7/2019 FPS Bot Implementation
15/22
GENETIC ALGORITHMS
involve a trial-and-error approach
populate the game world with many possible solutions and then determinewhich solutions work the best
Solutions will be different for different players
Looks at a class of player. For it, we need to figure out how to attack it.Attack it using method A, then decide its fitness according to the damageinflicted on the player.
Code the attack in a chromosome, and find the optimum chromosome
Decode the chromosome and get the attack
Attack that class of player using that particular attack strategy.
Libraries : GaLib, GAUL
-
8/7/2019 FPS Bot Implementation
16/22
PROBABILITY
Use Hit Probabilities according to skill level of the player
In making decisions in Finite State Machines.
Find probability that you can kill the enemy class (duringthe game), then decide according to it. (Adaptability)
-
8/7/2019 FPS Bot Implementation
17/22
Functional & Structural Layers
-
8/7/2019 FPS Bot Implementation
18/22
BAYESIAN NETWORS
Give NPCs the ability to predict the next strike that is,to anticipate the next strike at a success rate more thantwice what otherwise can be achieved by just guessing.
-
8/7/2019 FPS Bot Implementation
19/22
TOOLS
Use a game engine to abstract away graphics, sound,etc and focus on the logic (AI)
Unity game engine (Free for personal use)
Download agent models, and script their behaviour.Will use C# & Boo(a dialect of Python) for scripting.
OR can directly use ray casting for pseudo-3D graphics
OR top-down view, to decrease agent modeling work
-
8/7/2019 FPS Bot Implementation
20/22
Karanveer Harshal
HFSMs
Path FindingGame Engine
Genetic Algo
NNs
HFSMs
Game EngineAutonomous agent
NNs
Ray Casting
TENTATIVE WORK DIVISION
-
8/7/2019 FPS Bot Implementation
21/22
TENTATIVE SCHEDULE
12th sept - Get familiar with the engine.
& starting to code the bot(s) and State behaviours
3rd oct - Implement Autonomity
4th oct tentative 2nd presentation
3rd nov - Decisions using Neural Networks
~3rd nov - 3rd Presentation
12th nov - Report Submission
-
8/7/2019 FPS Bot Implementation
22/22
THANK YOU