Issue with the enemy shooting the damageable wall


Issue with the enemy shooting the damageable wall

Author: Chayathorn Kanjanapetcharat 

The Problem

While I was implementing the feature to have the enemy be able to attack the damageable wall, I encountered an issue where the enemy did not shoot at the wall accurately. The enemy always aims off from the wall that is being targeted and does not destroy the wall as intended. Without this feature, it will turn into a poor gameplay experience for the end user and find the enemy's behavior to be irrational. The end user will notice that this feature has a crucial mistake that the developer should have resolved before making it to the release phase. If the issue remains at the release stage, the end user will find the game quality to be poorly made and not be willing to support the game.  

The Solution

The first thing I did to investigate the issue was to check if the enemy perception did detect the damageable wall to attack. I did this by turning on the debug mode for enemy perception and saw that the enemy registered the wall that they were attacking. So, I can conclude that the enemy perception that is used for detecting the wall is working fine. The next thing that I investigate is the rotation task on the enemy behavior tree, I adjust the value of the rotation precision to test if the precision when the enemy rotating is accurate or not. It turns out that adjusting the value did not affect how the enemy aims at the wall, so this is also not the cause of this issue.

At this point, I was not sure what could be causing this issue, so I decided to turn on debug mode again to test enemy behavior. After some time, I realized that the position that the enemy detects the damageable wall is not within the wall itself so I started to guess that the issue could be caused by the wall itself. I opened the damageable wall blueprint and checked if the relative location of the wall was off, but everything turned out to be set up correctly. I swapped back to the game map again and examined the wall, after I clicked on the wall, I noticed that the pivot point of the wall was not within the wall itself. I compared this pivot point position with the position that the enemy detected and found that the AI aimed at the pivot point of the wall that was not set up properly. Therefore, this issue was caused by the wall, not the enemy.


After I discovered this issue, I contacted the team member who is working on the damageable wall features and discussed how the pivot point of the wall needs to be set up properly as it is a way the enemy perception uses to find its location. By letting the team member know about this issue, they will also know that when they create the new damageable object. The pivot point of each object must be set up properly to enable the enemy to detect the position accurately. In the end, this issue was resolved by editing the pivot point of the damageable wall to be at the center of the wall and the enemy is now aiming at the wall accurately.


Get Dustborn: Code of Survival