3 ms·
The ghost patterns in most Pac-Man gameplay are designed on purpose, but the directions they turn when running from Pac-Man once he’s eaten a pellet are intende
by Miraste 4y ago
The ghost patterns in most Pac-Man gameplay are designed on purpose, but the directions they turn when running from Pac-Man once he’s eaten a pellet are intended to be random. From a broadly interesting look at the game’s internals (https://www.gamedeveloper.com/design/the-pac-man-dossier https://www.gamedeveloper.com/design/the-pac-man-dossier):
“The PRNG generates an pseudo-random memory address to read the last few bits from. These bits are translated into the direction a frightened ghost must first try. If a wall blocks the chosen direction, the ghost then attempts the remaining directions in this order: up, left, down, and right, until a passable direction is found. The PRNG gets reset with an identical seed value every new level and every new life, causing predictable results.”
I don’t know how the initial RNG works (the source is available online, but my Atari ASM skills seem to be lacking), but more modern takes sometimes use a linear-feedback shift register, as seen here: https://www.randomterrain.com/atari-2600-lets-make-a-game-spiceware-10.html https://www.randomterrain.com/atari-2600-lets-make-a-game-sp...