AI For Games: Week 10
Bug fixing
I spent the final week fixing bugs! I also added a visual representation of the last known location
Last Known location
Each enemy holds a last known location model that becomes visible when they cant see the player but are suspicious, its position is set to the last place they saw the player.
Bugs
Movement bug
I encountered a bug where the enemies moved really jerky, I figured out the fix was having a static interpolation point instead of using the players position, but the jerkeyness reminded me of chess pieces so I thought why not make the enemies of my game chess pieces! So this bug became a feature.
Rotation bug
When the enemy rotated it rotated the ray that is cast, for this one I just set the rotation of the ray to 0 when I rotate the enemy.
Pathfinding bug
A mixup in global and local coordinates caused all enemies to move to the same point when the player was spotted. I just switched the local position to global position when getting the path to the player and it fixed it.
Enemies spotting the player through walls
When the enemies when from suspicious to calm they would spot players, this is because of a bug where it wasnt checking if it could see players when the enemy was slightly suspicous but couldn’t see them, causing the detection meter to rise.
Player would get stuck on walls
I used the move_and_collide method instead of the move_and_slide, move and slide moves the player along the object on collision, allowing it to move while touching walls.
Player would stop while changing direction
This was because I was setting my movement vector to 0 after every key release, not checking if another key was using it.
Conclusion
These were all the bugs I found, there are probably more as there are with every game, but I’m happy with how much I fixed. And other ones are not blatantly obvious so they’re less of an issue.
Enjoy Reading This Article?
Here are some more articles you might like to read next: