Enemy AI: Sight and Sound early tests

I have, well I should say had, a pretty basic but working enemy AI that would respond to sound and vision from the player. The problem was, that it was possible for me to kill an enemy, but somehow that enemy would continue shooting me from its dead state.  I know Nazi Zombies can be cool but this shouldn't of been possible.

The state dead  is the zero sum affair. If the enemy ends up in this state, it should be impossible for the enemy to move to any other.

However, I did have code in there that you can see in the video that would return the enemy to their original position if they didn't hear or see anything else.

I don't - famous last words, believe my code to be at fault, however the order in which my code is running is wrong. Also, I currently have my Audio and Sight sensors as separate components, and whilst that is fine, I need to manage them in code so they behave as one.

On the subject of components, I currently have the enemy object set up as the following classes.

ENEMY AI 
ENEMY HEALTH 
ENEMY SIGHT 


The sound sensor at the moment is part of the player object. The reason for this is it is triggered by the player firing their gun. The enemy AI class is controlling both movement, animation, damage as well as the state machine. So what I have started to do is change it to the following

ENEMY AI
ENEMY MOVEMENT 
ENEMY ANIMATION 
ENEMY HEALTH 
ENEMY SIGHT 

The AI state was working on triggers, i.e. if this happens change state to X, or  if this happens change state to Y. What I am trying to implement now is to remove the triggers and have the AI tell me what state it should be. 

The simple example being, if the enemy health is zero then the enemy is dead. 

Anyway, here is the video along with a reminder of how the soldiers behaved in the original game. 












Comments