Shortest path algorithm in pacman
hi,
any idea abt the algorithm need to make the enemy take the shortest path to pacman?
P.S.
thanx a lot to those who replied to my first query!
for A*
You have your dots(pills), that could be your measuring device. just round each character to the nearest dot.
A* might be a bit of an overkill for pacman, A* is a great algorthm for pathfinding, but fooling pacman ghosts is fun! A* might make the ghosts too intellegent.
--
At every turn, draw a line from pacman to the ghost. You can use this as your guide, just pick the turn that follows the line the closest.
For added ghost intellegence, you can have a ghost that trys to get to the turn pacman is facing, rather than where pacman is.
You have your dots(pills), that could be your measuring device. just round each character to the nearest dot.
A* might be a bit of an overkill for pacman, A* is a great algorthm for pathfinding, but fooling pacman ghosts is fun! A* might make the ghosts too intellegent.
--
At every turn, draw a line from pacman to the ghost. You can use this as your guide, just pick the turn that follows the line the closest.
For added ghost intellegence, you can have a ghost that trys to get to the turn pacman is facing, rather than where pacman is.
~~~~~Screaming Statue Software. | OpenGL FontLibWhy does Data talk to the computer? Surely he's Wi-Fi enabled... - phaseburn
I don't know this A* Algorithm, but Dijkstra shortest path finding algorithm is a very popular one. Don't know if it's usefull for games though. Never had to use it until now.
Here you can find an applat showing of the algorithm in action.
Dunno if that is what you're looking for, but as I said, it's quite a popular shortest path algorithm
[edited by - rizman on February 26, 2003 10:13:59 AM]
Here you can find an applat showing of the algorithm in action.
Dunno if that is what you're looking for, but as I said, it's quite a popular shortest path algorithm
[edited by - rizman on February 26, 2003 10:13:59 AM]
I just programmed a Pacman like game and i use the A* for finding the shortest path.
I learn it from here.
BTW:That's just the theory/method/algorithm, u shall need to write the codes yourself according to the data structures you have in your game.
[edited by - remi on February 26, 2003 10:28:49 AM]
I learn it from here.
BTW:That's just the theory/method/algorithm, u shall need to write the codes yourself according to the data structures you have in your game.
[edited by - remi on February 26, 2003 10:28:49 AM]
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"
FYI, Pacman had some interesting AI. Each ghost had a particular task and I don''t remember them all but I remember one would chase packman and another would follow the path where pacman would be chased to. Basically they worked together.
-YoshiXGXCX ''99
I dunno. I was never that hot on AI.
What I did was create an array to construct the level, and then used a simple pathfinding thing based on an analog robot to determine the shortest path.
--------------------------------------------
"Wait, so Bush is pro-life AND pro-death penalty? Am I the only one who sees something wrong with this?
What I did was create an array to construct the level, and then used a simple pathfinding thing based on an analog robot to determine the shortest path.
--------------------------------------------
"Wait, so Bush is pro-life AND pro-death penalty? Am I the only one who sees something wrong with this?
With love, AnonymousPosterChild
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement