AI Chasing & Detection Prototype (Unreal)
3D • Top Down • AI • Blueprints • Unreal
This prototype was created using the Unreal Engine. The core focus of this project was to learn to develop an AI system using Blueprints. Within the game, the player must run away from enemies through a simple Unreal map. AI NPC’s can detect the player’s location, follow them, and maneuver around obstacles while in pursuit. Another behavior of the AI is the ability to lose the player if they are out of their line of sight.
Aspects of the implementation include: creating a Nav Mesh, setting up Basic Assets, Character Blueprint, Blackboard Asset, AI Controller Blueprint, Behavior Tree, Services, Tasks, and Decorators. Overall this project took 4 hours to complete and allowed me to become more familiar with AI systems and Blueprints in Unreal.Date02/2018 EngineUnreal
Gameplay video featuring Chasing & Detection AI. In the game, the player controls the main character avatar using point-n-click with the mouse. Throughout the enclosed map are a number of AI characters. As seen in the video, the AI functions very similar to that of zombies, following the player and “training” behind them. However another feature is that the AI can lose sight of the player thus halting their pursuit.
In this project we go the through various steps to implement AI functionality via a behavior tree. Step 1 is to create a Nav Mesh Bounds Volume and the Basic Assets. Essentially, the Nav Mesh builds area for characters to navigate. Once completed, we create an AI Controller Blueprint, a Character Blueprint, a Behavior Tree Asset, and a Black Board Asset.
Step 2, we setup the Character Blueprint. This Characters will function as the AI Character, and we use it over the Pawn to access the Character Movement Component’s functionality. Other substeps include adding an animation, capsule, walk speed, and assign the AI Controller.
Step 3, we setup the Blackboard Asset, which stores all the data needed for the various instances of the AI Controller which include, Actor to Follow (TargetToFollow), AI’s Starting Location (HomeLocation), and the Actor we’re following Location (TargetLocation).
Step 4, we setup the AI Controller Blueprint. This acts as the AI Controller, which creates the functionality for the AI Character to move around. We build out the Event Graph and once completed, we can then drag the AI Character into the scene.
Step 5, we begin implementing the basic structure of the Behavior Tree, starting at Root, and essentially engaging in 2 primary decision making nodes: Selector and Sequence, the former running through its children until one succeeds, and the latter until one fails.
Step 6, we make a Service. The Service essentially is used to make checks and update the Blackboard. The implemented behavior for this Service is to look for any Pawn that is NOT an AI Character and then set a TargetToFollow and TargetLocation Blackboard keys.
Step 7, we make a Task. The Tasks will create the functionality to have the AI Character always follow the Player Pawn, and not just its location.
Step 8, we build the Behavior Tree. Essentially this is the behavior. 1. The AI will stay idle in place until the Player Pawn is detected 2. AgroCheck Service will be constantly scanning for the Player Pawn 3. If Play Pawn found, left branch executes and the AI begins chasing the Player Pawn. 4. If the Player Pawn is hidden, the right branch executes, which tells the AI Character to move to the last known location of the Player Pawn. There is a then a delay for 2.5 seconds and the AI Character returns to its original starting location.
There you have it! This AI System was completed by referencing the Unreal documentation and was a learning experience to get my bearings in AI design, Blueprints, and Unreal.
Isometric Low Poly Room (Maya)