Hopefully this will be the last update to the enemy AI routines. I would appreciate if the various level creators can update their levels to the latest code (using the Leprechaun Level Editor, v20061101) and see how well things work. For the attached WIP the leprechauns eventually find the player at the starting position, something I was having great difficulty accomplishing with drop off detection.
The Leprechaun (and player) color indicates the direction their joystick is pointing:
The Leprechaun (and player) color indicates the direction their joystick is pointing:
gold UP orange DOWN pink LEFT blue RIGHT purple UP & LEFT violet DOWN & LEFT lt blue UP & RIGHT cyan DOWN & RIGHTA lighter color means the leprechaun is in hunt mode, versus chase mode. The AI is mostly based on the last action and hunt versus chase mode. See do_enemy in LEPBANK1.ASM for the gory details.



Create a custom theme









They just go back and forth forever.
Second thought: When an enemy is in chase mode and hits a wall, currently it moves in a random direction, changing state to hunt, correct? A suggestion: if an enemy hits a wall and is also on a ladder, move him up/down towards the player (if the player is above/below) and leave him in chase mode. Same when moving up/down on a ladder.
Take this situation, for example:
- are floors, | are walls, = are ladders.
P is the player
E is the enemy, chasing P to the right. When he hits the wall (and ladder), 80% of the time he just turns around.
The behavior appears to be the same when reaching the top/bottom of a ladder.
Third thought: this is a wild, completely out-of-the blue idea, but have you considered, or tried, implementing a Pac-Man style logic? Have the enemies chase the player on a timer; when the timer elapses, have them head towards a corner for a short period of time before starting the chase timer again. Some variety of this might be very nice, especially if the behavior was slightly different for the different enemies (like in Pac-Man): different enemies might have different length timers, they might chase directly towards the player or towards a spot ahead/behind the player, etc.