Problem: Go To Your State!
Reported By: David Tarnowski
September 29th, 2023
THE PROBLEM
This week I spent time debugging issues with our enemy AI's behavior. The main problems were inconsistent state transitions and irregular NavMesh agent movements. The culprits were the state scripts controlling transitions and the NavMesh agent controlling movement.
First, enemy detection of the player was unreliable. Sometimes the enemy wouldn't detect or store the player's location correctly. Other times the enemy would get stuck targeting old player positions instead of updating properly.
Second, when quickly moving around a stationary enemy, the NavMesh agent would sometimes fail to smoothly turn and face the player's new position.
Finally, occasionally enemies would inexplicably start sliding backwards until hitting an obstacle.
THE SOLUTION
Image A
To improve enemy detection, I refactored the logic into the enemy's manager script instead of the initial state script. This enabled regular updates and made the detection code accessible to all states. I also switched from collision to raycast detection (Image A), which is more robust.
Image B
I'm still investigating the inconsistent player location updating between the combat stance and attack states. I've verified correct functionality in the ambush and pursue states (Image B), but the transition between combat stance and attacking needs more work. I'm methodically reviewing the scripts and enemy stats to find the issue.
The irregular NavMesh movements also remain a mystery. I suspect fixing the state transition bugs may help. However, I've reached out to a lab specialist for a fresh perspective in case it's an unrelated issue.
Overall, refactoring the detection logic and moving it to the manager script has improved enemy behavior. I'm continuing to scrutinize the state transition and NavMesh code to resolve the remaining inconsistencies. Once done, our enemy AI should feel intelligent and responsive.
Get Psyche
Psyche
Welcome to your next great souls-like adventure!
Status | In development |
Author | Sad Ogre Studios |
Genre | Role Playing, Adventure |
Tags | Atmospheric, Fantasy, Indie, mind-bending, psyche, Sci-fi, Singleplayer, Souls-like, Third Person |
More posts
- Problem: Harder Isn't Always More FunDec 14, 2023
- How to make the controller feel more responsiveDec 14, 2023
- ModelMayhem: A Programmer's TaleDec 08, 2023
- Problem: Face Your FearsDec 03, 2023
- Time to show our real main characterDec 01, 2023
- Problems: melee combat system is too boringNov 24, 2023
- Problem: Frames Win Games?Nov 17, 2023
- Problem with camera transitionNov 16, 2023
- Combo Attack systemNov 11, 2023
- Problems with code reusabilityNov 03, 2023
Leave a comment
Log in with itch.io to leave a comment.