Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

"Where is the player?" - Luke Cardelli | 16 November 2023

The Problem:

As we got close to developing our final build, issues began arising when we started play testing the game. One of the most glaring issues that pertained to the things I was working on was that the enemies could be seen not pursuing the player in the level environments. The map used for AI testing was smaller then the actual levels being developed. It appeared once the enemies were added to larger maps, they didn’t know what to do until the player got within a certain range.

 

The Solution:

The solution ended up being relatively simple. First, I confirmed what was causing the issue. I had created a behavior tree task node decorator that checked whether the enemy was within a certain range of the player. If they were, the enemy would transition to an attack state. What I had forgotten to add was the opposite condition i.e. what the enemy should do if the player is out of range.

I created a new decorator that checked for inverse range value, meaning check if the player is out of attacking range. If yes, I created a new function that would force the enemy to close the gap between itself and the player and to continue to move to the player until it got within attacking range. Once in attacking range, the enemy would then transition to its attacking state.


<Reference Image of the new decorator logic>

<Reference Image of the two different states, one for moving to the player and the one for attacking>

The lesson out of this is to always ensure that when testing development, ensure that you are testing with like conditions. In this case, my testing environment should have match the size and scale of the levels so that I could have spotted this issue earlier on. Regardless, the issue was a simple one to fix over all.

Support this post

Did you like this post? Tell us

Leave a comment

Log in with your itch.io account to leave a comment.