On a shooting game, player frequently face a multiple enemy which sometime act like a squad (team).
F.E.A.R (First Encounter Assault Recon) is a fps which have a "revolutionary" ai system. On this mini project,I try to integrate a ai system similar to the game
Analysis
Thing that I undestand from the paper "Three State and a plan : The AI from FEAR" by Jeff Orkin,it's that a AI can be summary 2 states moving entities and perform animation (because I'am just using basic shape like triangle and quad, they will not have animations). So the idea is to make the transition less as possible. One other thing is to separat between goal , action , and reaction, that way designer and programmer have a maximum of modularity to create different action and goal
Sensor, Goal , and Action
To create a maximum goals, actions and reactions . I create each action and reaction (call "sensor") separately.
By example sensor , I create sensor call "View player" (player enter in ai sight) , " search ally" (ai can detect if he got allies around him)
By example actions, i create by example , "looking at position" (ai goes to inspect strange location), "attacking player" (shoots at player position) "go to cover" etc etc
An I create goals, goals is form by actions create previously, that way goal is create by juste combining different to create specific goal.
Squad Behaviors
AI agent work as a squad entity (thant mean it's form by multiples soldiers). AI Entity have role like soldier which follow order of a captain, a catpain which give orders to soldier.
Each goals is selected with a Behavior Tree (and black board) to select the best actions on each situations
Each AI entities need to gather all the information on the world to select actions.. if an agent detect by himself an information, it's update his blackboard but he also needs to share this informations with his colleagues. Worldstate is an instance share by all ai entities , each time a entity wants to say something to other ea, he put a message on this WorldState. His colleague just need to get the message to update theirs status.
By example, supose that the commando hear a fire shoot from the player, he wants to send soldiers to inspect the zone. He send an order on the world state (Call "FACT") , soldier can pull the order from the worldstate, if the order is more important than he current action, he will follow the new order from his boss. He then update the worldstate to tell his boss that he gots the informations.
The modularity by separating action and goal play a role in this example, because commando can give order goal to soldier but only soldiers with the goal can answer
the order.
Soldiers patrols |
Soldiers inspect suspect location |
soldiers attach the players |