Jump to content
IGNORED

EricBall's Tech Projects - Leprechaun AI


RSS Bot

Recommended Posts

QUOTE(vdub_bobby @ Thu Aug 31, 2006 12:41 PM) the enemies are so darn dumb!

 

He's right, I just didn't notice. Well, now I have and I'm going to do something about it. Unfortunately, it's tricker than it sounds.

 

Fundamentally, the enemies are at a major disadvantage to the player. The player can see the entire level; the enemies are almost blind. Not only is it not feasible to put in some kind of path finding algorithm, but I'd like to avoid doing any level data lookups at all. Fortunately, the enemies have a much simpler purpose - chase down the player and touch 'em.

 

Earlier this week I was modifying the enemy's joystick routine to handle left/center/right better so the player doesn't have to be precisely above or below the enemy to register "center". I was hoping this would allow the enemies to fall off ropes when the player passed below them. I also re-enabled some code which changes the enemy color depending on whether they are in hunt or chase mode. After playing a short while I saw the problem. (But not the solution....)

 

In the current version the enemy AI is based around two simple states: hunt and chase. In chase mode the enemy points it's virtual joystick towards the player, while in hunt mode the enemy holds the joystick in one direction, changing that direction when it stops moving. The enemies go from hunt to chase mode when they are going in the correct direction, and from chase to hunt mode when they stop moving. (Falling and dying also kick in chase mode automatically.)

 

It's the chase to hunt transition which causes the main problem. Basically, when the player runs over or under the enemy on a different platform the enemy's joystick points either straight up or down. Unless the enemy is on a ladder this will probably cause them to stop, which then flips them to hunt mode and they stop chasing - i.e. act dumb.

 

Unfortunately, I haven't come up with an ideal solution yet. Right now, the basic structure of the code is:

1. Each enemy has a state byte. It also knows it's position, the player's position, and what it's last action was (i.e. moving, climbing, stopped).

2. Using this information, and nothing else, it needs to determine it's joystick direction (which gets fed into a subroutine, also used by the player, that determines the current action).

3. If desired, the current action could be used as additional information for the state bye.

 

It should also be noted the joystick -> action subroutine has some intelligence regarding diagonal moves. i.e. on ladders up/down is preferred to right/left, and the opposite is true for ropes.

 

Now, I'm thinking that the AI will be more effective (less dumb) if it continued in the direction it was going in rather than always trying to go in the direction of the player. (Although there may be some exceptions for ladders & ropes, which would make "mind control" possible.)

 

However, I'm open to suggestions. What I've found is it's the transitions which are tricky to handle. Not only hunt versus chase, but also simply when to change direction.

 

http://www.atariage.com/forums/index.php?a...;showentry=2026

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...