Presentation is loading. Please wait.

Presentation is loading. Please wait.

Enemy and Friendly AIs Richard Gesick.

Similar presentations


Presentation on theme: "Enemy and Friendly AIs Richard Gesick."— Presentation transcript:

1 Enemy and Friendly AIs Richard Gesick

2 Objectives finite state machine behavior tree
combining two AI techniques for complex AI dealing with internal and external actions handling outside actions that affect the AI playing character animations Pathfinding using a waypoint system using Unity's NavMesh pathfinding system combining waypoints and NavMesh for complete pathfinding

3 AI techniques There are two very common techniques used to create AI: the finite state machine and the behavior tree. Depending on the game that you are making and the complexity of the AI that you want, the technique you use will vary

4 Finite state machines a finite state machine breaks down to a system, which controls an object that has a limited number of states to exist in. Each state has its own functions. Some of the functions of each state affect each other, while some do not. The functions that do affect each other are the functions that control what state the finite state machine is in.

5 FSM In video games, you can use a finite state machine to create AI with a simple logic. You can also combine finite state machines with other types of AI systems to create a unique and perhaps more complex AI system

6 The behavior tree AI system
A behavior tree is another kind of AI system that works in a very similar way to finite state machines. Actually, behavior trees are made up of finite state machines that work in a hierarchical system. This system of hierarchy gives us great control over an individual, and perhaps many finite state systems within the behavior tree, allowing us to have a complex AI system.

7 behavior tree

8 Internal and external actions
The actions of a finite state machine can be broken up into internal and external actions. Separating the actions into the two categories makes it easier to define what our AI does in any given situation. The separation is helpful in the planning phase of creating AI, but it can also help in the scripting part as well, since you will know what will and will not be called by other classes and GameObjects. Another way this separation is beneficial is that it eases the work of multiple programmers working on the same AI; each programmer could work on separate parts of the AI without as many conflicts.

9 External actions External actions are functions and activities that are activated when objects outside of the AI object act upon the AI object For example:nbeing hit by a player, having a spell being cast upon the player, falling from heights, losing the game by an external condition, communicating with external objects, etc

10 Internal actions Internal actions are the functions and activities that the AI runs within itself. For example: patrolling a set path, attacking a player, running away from the player, using items, etc. These are all actions that the AI may choose to do depending on a number of conditions

11 Pathfinding waypoints – list or array of points/objects
Standard routing from 1 to the next in order Obstacle avoidance still a problem Navmesh will help This is a patrol pattern. To find the player, add a distance function that allows the enemy to see the player and use process to then follow the player.

12 Animations There is a difference between unity’s animator and animation Animator requires adding the animator component and making the animator with the state transitions Animation requires that the animation component be added and the animations be placed in an array of animations. Then as we change states within the game, we use animation.Play("idle");


Download ppt "Enemy and Friendly AIs Richard Gesick."

Similar presentations


Ads by Google