Going into this last block of work, I was uncertain how to make improvements and what to add. At the end of the previous post, I mentioned working on enemies to make the combat experience more exciting but as I started brainstorming ways of doing this I realized that what would really take the project forward was trying to turn what I had already made into a game instead of a test level.
The Level
One of the first steps towards making this project into a game was creating an idea of what a level could look like. My original idea was to try designing encounter spaces and string those together into a series of rooms to make a level. However, after some thought I transitioned to using an asset from the Unreal Marketplace called Endless Random Procedural Worlds (With Level Streaming) to generate a world. With this asset, I am able to design custom sections that get tiled together to create the world. Going forward I plan to keep adding more sections, there are only three being used currently.
Enemies
Since enemies were added they have had a simple behavior of running at the player and attacking. This attack could be interrupted by the player's parry ability or when they got hit. Once multiple groups of enemies were added into the level it was easy to get completely surrounded and hit from all sides by large amounts of enemies.

New Behavior
The first idea I had for improving the enemies was to create a new behavior for them. Instead of always trying to attack the player they would now move to a location in front of the player. Once in this position, they will check if the player is currently getting attacked and by how many enemies. This way the number of enemies attacking the player can be limited and new enemies will wait for their turn.
Although I have created this kind of behavior from scratch in Lucky Limbo's bouncer enemy, I decided to use this opportunity to learn how to use the Environment Query System (EQS) in Unreal Engine to help determine where the enemies should be moving to. With EQS I was able to generate points in a cone in front of the player. These points were then filtered out based on if they could see the player and finally scored by distance from the player, in this case, the points further from the player had a higher score. With this EQS setup enemies move towards points towards the edge of the cone, giving the effect of them keeping their distance before they go in to attack.

Updating Behavior Tree
One of the big issues with the previous behavior tree was the attack node, which did many condition checks internally. These conditions better belong in decorators when using a behavior tree which will also help with clarity in what enemies are doing.
Another change made to enemies with the goal of making the behavior tree simpler was creating states for the enemies. Instead of tracking what is happening with a collection of bools an enum for states determines what the current action is. For patrol and attack these are branches in the behavior tree but for something like stun it pauses behaviors being executed by the enemy.

While testing the changes to the behavior tree small additions were made such as having enemies skip the patrol state if there are no other enemies around, having enemies start attacking if they are close to the player, and having enemies rotate toward the player while attacking.
Wrapping Up
Those are many of the changes made since the last update. I'm finding myself happy with where this project is headed and I'm enjoying the chance to learn more about Unreal. Thank you for reading.
Comments