Você está na página 1de 22

FPS Bot Implementation

Karanveer Singh

Harshal Patil
AIM

To implement intelligence in a FPS Bot, and


enable it to act as humanly as possible.
The field will consist of the bot and a human
player controlled character. The bot will try it’s
best to win.
Project Extension: to include coordination
between a group of bots for common or varied
tasks.
TECHNIQUES

FSMs
Autonomous agent
Neural Networks
Genetic Algorithms
Functional & Structural Layers
FSMs

FSMs receive input, and react by either changing the


state 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.
FPS bot FSM

ATTACK
EVADE Movement = take attack
Movement = run posn.

Direction = opp. Player Direction = to player


If player evades
If Player health is low
If my health low
HIDE
PURSUIT Movement = take
Movement = run cover
Direction = to player Direction = opp.
If Player position not player
visible If Player position is
If Player position is near far
If Player health is low
WHY FSMs?

Quick and simple to code


Easy to debug as agent behaviour is broken down into
manageable chunks
Little computational overhead
Intuitive Logic
Flexible to modify code and extend abilities

Hierarchical FSMs: introduce reusability & increases


performance; decreases transitions to be specified.
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 state’s behaviour, no need to change other
states
PSEUDO CODE FOR AGENT

In the main function, we have an infinite


loop :
Agent a
Loop()
A.update()
Class Agent
State CurrentState //State is another
class
Update()
● CurrentState.Execute()
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
An AUTONOMOUS AGENT

Autonomous Agent : Being able to sense the environment


and act on it’s 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


PATHFINDING

Decompose the world into Navigation Meshes.


Thus, our world becomes like a graph. If there are
no obstacles between 2 nodes, then join them
using an edge. Allocate the weight acc. To stored
tables (large cost for sand, explosive areas, etc)
Now, use a graph search algorithm (like A*) to
find the optimum path to go from A to B.
Heuristics : Manhattan Distance.
PATHFINDING
NEURAL NETWORKS

Relegate key decision making process to a trained neural


network , thus simplifying a complex state machine
Used as a function approximator
NNs not to be used for everything, since they can be
unpredictable.
Example : Decision to engage in combat or not; using
Inputs like bot’s health, enemy’s health, distance from
enemy, skill level of enemy.
Use a 3 layer, feed-forward network (one input, one hidden,
one output)
Back propagation Algorithm.
GENETIC ALGORITHMS

involve a trial-and-error approach


populate the game world with many possible solutions and then determine
which 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 damage
inflicted 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
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 (during
the game), then decide according to it. (Adaptability)
Functional & Structural Layers
BAYESIAN NETWORS

Give NPCs the ability to predict the next strike that is,
to anticipate the next strike at a success rate more than
twice what otherwise can be achieved by just guessing.
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
TENTATIVE WORK DIVISION

Karanveer Harshal

HFSMs HFSMs
Path Finding Game Engine
Game Engine Autonomous agent
Genetic Algo NNs
NNs Ray Casting
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
THANK YOU

Você também pode gostar