Gauntlet-style bot movements

Post: #1
This should be so simple...

Let's say I have 10 computer controlled ghosts on the screen.
I don't want them to be able to run one another down.
They are directly following and pursuing the main player... i.e. they turn towards the player and they move in the direction, adjusting every frame to continuously point at him.

I test all 10 ghosts for collisions with one another, so that I can keep them from runing over one another.

When I do detect a collision, I'm not sure what to do to get them to not run over each other.

If I just tell them to not move, well then eventually none of them will move (i.e. once they all bunch up next to one another and they are technically all colliding with at least one ghost)

I have had them "bounce back" a pixel or two, but this shows in a really jerky way.

Any advice?

Quote this message in a reply
Posts: 365
Joined: 2002.04
Post: #2
How about using the map to remember where the ghosts are? Set a flag in the map data when a ghost enters a square, clear it when it leaves, and don't allow any other ghosts to enter the same square while the flag is still set.

That way you don't have to do collision tests between every pair of ghosts, so it should be faster too.

Neil Carter
Nether - Mac games and comic art
Quote this message in a reply
Posts: 370
Joined: 2002.04
Post: #3
Have your pathfinder take into account where the other ghosts are so that they don't collide in the first place...

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Posts: 112
Joined: 2002.06
Post: #4
For group movement, look into the flocking technique. It tries to emulate the way a flock of birds flies. The head bird (or ghost in your case) moves toward the player, and the other birds follow the one in front of them. Craig Reynolds wrote a paper on it that you can download from the Web, and there's an article about it in the book Game Programming Gems.

Mark Szymczyk
Quote this message in a reply
Posts: 7
Joined: 2007.02
Post: #5
Yeah, Craig Reynolds rocks. He has a bunch of java examples of behaviours. Check out It sounds like the "Queuing" behaviour would prevent your bots from bunching up and blocking each other.
But I'm sure Gauntlet itself had a very coarse grid of allowable positions, like 20*30 or so. So you just need an array of these positions, and only move a bot into a space if it's free. As you iterate over all the bots in successive frames the bots at the front will move, so the ones behind can move forward, etc. I think I'm just repeating what NCarter said. Oh well :?:
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  style of game AREM 2 5,575 Aug 28, 2003 06:56 AM
Last Post: Bjoernke
  Thrust Style calculations? Scoops 7 7,670 Jul 2, 2002 11:32 PM
Last Post: Scoops