Issue with setting up EQS to have enemy move to the control unit


Issue with setting up EQS to have enemy move to the control unit 

Author: Chayathorn Kanjanapetcharat 

The Problem

While I was working on the behavior tree, I was setting up to have the enemy walk to the closest location to the control unit. If there is a structure blocking the enemy's path, the enemy will register that structure and attack it until the structure is destroyed. Then the enemy will keep walking towards the closest location to the control unit until it reaches the control unit. However, I encountered an issue where the enemy kept walking constantly towards the wall and did not destroy it. Therefore, the enemy did not follow the behavior that was set up in the behavior tree. Without this feature, the end user will find the product to be poor quality as the enemy did not act hostile and complete its goal which is to destroy the control unit. There will be no lose state of the game if this issue is not fixed.  

The Solution

The first thing I did to resolve this issue was to check the behavior tree. At first, I believe that the decorator in the behavior tree is the cause of this issue. However, after testing and adjusting the behavior tree condition, the walk to the closest location task is still being called throughout the game. I used the enemy debugger to test if the enemy detected the closest structure that needed to be destroyed, and the enemy did detect it. So, I checked another condition which is the closet location condition. I found out that when the enemy is at the wall, it is still able to find the new closest location despite the current location being the real closest location.


So, I decided to check on the environment query system or EQS to see if the calculated value was correct. At first, everything seemed to be correct so I did not believe the issue would be caused by EQS. I continued to debug on behavior for a while then back to checking EQS again, I tried to move the testing pawn that has this EQS then I found out the EQS did not register the wall as a structure that will block the enemy path. Therefore, when the enemy updated closest location, it registered the location behind the wall and the behavior tree order it to move to that location which result in this issue. 


I resolved this issue by filtering the EQS with enemy visibility. This resolved the issue of the enemy always walks to the wall and the enemy now follows the behavior tree properly. While resolving this EQS issue, I also tested out other ways such as using a pathing grid instead of donut to generate the EQS. I find the pathing grid to behave the best as the enemy will be able to determine the control unit location effectively so this will be the implementation for the current version. In the future, the EQS will be updated and might use other methods to generate such as donut if it improves the correctness of enemy behavior.



Get Dustborn: Code of Survival