Sebastian - V0.0.1 Devlog - Bringing Enemies to Life
For this week, I have taken up the task of working on enemy AI. Since I am mostly just familiar with making enemy AI in Unity, I felt that it would be a nice way to experiment more with Unreal Engine's AI tools. There was two types of enemy behavior that I had to figure out how to make before the end of the sprint: a basic enemy that will move around to random locations, and an enemy that will patrol a specified area. Along with these behaviors, I also wanted to make sure they could spot an opponent and recognize if a spotted character is friendly or not.
To begin making these enemy types, I created a testing enemy, since Unreal Engine characters come with basic content such as colliders and an empty skeletal mesh, I only needed to add a placeholder model and interface methods to the enemy’s class. Then I needed to create an AI Controller so that our enemy characters can use perception components and run behavior trees. The Enemy needs to be able to sense actors, so I added a sight component to the controller. The enemies should also be able to tell enemies and friendlies apart, to achieve this, I created an override to the Generic Team Agent Interface that would set the AI Controller's team ID and update the perception component to make it aware of the change. I also ensured that when a target is perceived, it will only be set as the active target if it is considered hostile, meaning it is not on the same team as the AI Controller instance.
Now that the AI Controller has been created, we can pass it any behavior tree that we want it to use. The next step is to make the behavior trees, I started with the “objectiveless” AI that will move to a randomly chosen location. This one is simple, as we only need to find a random point on the map that can be traversed to and move to it, and if we see an enemy, stop traversing and start attacking them.
The Patrolling AI is similar, but instead of a random location, we will grab the next patrol point and move to that point.
The attacking behavior tree is the same for both trees, if it is out of ammo, reload, if not, then move to the spotted enemy and begin attacking them.
Now that we have an AI Controller with the ability to see and determine enemies, along with behavior trees for an objectiveless enemy and a patrolling enemy, we can set the AI Controller as each enemy’s controller, and pass the appropriate behavior tree to them. This is the final result:
Get Echo in the Shadows
Echo in the Shadows
Status | In development |
Authors | IDC_DEV6, aesthetical, Mrr_Memez, dgiardino, hookc123 |
Genre | Adventure |
Tags | Action-Adventure, Stealth |
More posts
- Dominic - V0.0.3 Devlog - Doorway System65 days ago
- Sebastian - V0.0.3 Devlog - Groovin' and Collidin'65 days ago
- Riley - V0.0.3 Devlog - Respawning & Checkpoints65 days ago
- Dominic - V0.0.2 Devlog - Shadow Detection68 days ago
- Sebastian - V0.0.2 Devlog - I Heard That!71 days ago
- Riley - V0.0.2 Devlog - Crouch Animation72 days ago
- Dominic - V0.0.1 Devlog - Creating the Tutorial and Level 178 days ago
- Riley - V0.0.1 Devlog - Enhancing Players Inputs79 days ago
Leave a comment
Log in with itch.io to leave a comment.