Pacman: how do the eyes find their way back to the monster hole?

后端 未结 22 1769
南方客
南方客 2021-01-29 17:53

I found a lot of references to the AI of the ghosts in Pacman, but none of them mentioned how the eyes find their way back to the central ghost hole after a ghost is eaten by Pa

相关标签:
22条回答
  • 2021-01-29 18:17

    This was the best source that I could find on how it actually worked.

    http://gameai.com/wiki/index.php?title=Pac-Man#Respawn When the ghosts are killed, their disembodied eyes return to their starting location. This is simply accomplished by setting the ghost's target tile to that location. The navigation uses the same rules.

    It actually makes sense. Maybe not the most efficient in the world but a pretty nice way to not have to worry about another state or anything along those lines you are just changing the target.

    Side note: I did not realize how awesome those pac-man programmers were they basically made an entire message system in a very small space with very limited memory ... that is amazing.

    0 讨论(0)
  • 2021-01-29 18:20

    It's a pathfinding problem. For a popular algorithm, see http://wiki.gamedev.net/index.php/A*.

    0 讨论(0)
  • 2021-01-29 18:24

    Short answer, not very well. :) If you alter the Pac-man maze the eyes won't necessarily come back. Some of the hacks floating around have that problem. So it's dependent on having a cooperative maze.

    0 讨论(0)
  • 2021-01-29 18:26

    For my PacMan game I made a somewhat "shortest multiple path home" algorithm which works for what ever labyrinth I provide it with (within my set of rules). It also works across them tunnels.

    When the level is loaded, all the path home data in every crossroad is empty (default) and once the ghosts start to explore the labyrinth, them crossroad path home information keeps getting updated every time they run into a "new" crossroad or from a different path stumble again upon their known crossroad.

    0 讨论(0)
提交回复
热议问题