So now that the A.I is behaving itself, let me show you what I have planned for it.
The enemy A.I will be divided into three different states; idle, suspicious and aggro.
Idle enemies will simply meander around the dungeon, looking for areas that they can see and moving to them as they see fit. Sometimes they'll just stand around doing nothing, depending on how they feel at the time.
Suspicious enemies have thought they heard or saw something abnormal. They have a vague idea of the direction that sight/sound came from and head over to investigate. Once they reach that point, they will either see the player and turn aggro, or see nothing (due to the player either hiding or having moved on) and return to an idle state.
Aggro enemies have seen the player and are on their case. They will ruthlessly hunt the player down and chase them. Once a monster loses line of sight to the player, a countdown will begin. The monster will keep trying to chase the player until that countdown is up. If they get line of sight on the player again, they resume their hunt, but if they can't find the player by the time the countdown is up, they go back to being suspicious and head over to where they think the player was heading. After that, they may find them and turn aggro again or they may assume the player has escaped and revert back to an idle state.
For my early tests I've been using a simple "move forward until you hit something, and then turn in a random direction and keep trying to move" algorithm, but now that it's working I'll be moving to something a little more complex; namely Dijkstra's Algorithm. so far it's working quite well:
So more news on that when there's something to show for it!