Moving Enemies

Hello All,

after writing some basic games, I’m trying to create something like Pacman, but at the moment I have no idea how to move the monsters/enemies.
At the moment the I decide at random in which direction they should turn when hitting an obstacle, but this leads often to some aimless moving.
How do I get their moving a bit goal-oriented?

Any hint would be appreciated.

Regards

Ralf

Pacman is interesting because each of the ghosts used a slightly different algorythm for its movement. You could try googling for more details (there are bound to be explanations on fan sites).

I think it was something like:

  • One ghost always moved alternately (randomly?) left/right when it hit a junction.
  • One tried to follow the player (turned towards the player at a junction)
  • One tried to get in front of the player (same as above, but the target point was the next junction ahead of the player)
  • The last moved randomly until it ‘saw’ the player and then chased him until player was out of range (pacman moves faster than ghosts)

The idea was, with 4 behaviours, the ghosts all behaved differently, and any wirdness was lost in the general chaos of the game.

Hope this helps,

Dom

Also, have a look at the A* algorithm (A star) for a little ghost “AI”. You get some pretty nifty results from it ( well… I thought it was nifty :slight_smile: ).

Good for advanced AI.

However - the original pacman didn’t use it, and doesn’t need to. there is a big risk (especially in AI) of overcomplicating things enormously. I have seen neural nets produce results indistiguishable from ‘rand()’ when moving objects, only the Neural Net took over 50% of a frame to reach its result…

Simplicity is great :slight_smile: