Pac-Man Ghost AI Explained

13 jul 2019
897 971 visningar

Ever wondered how exactly each ghost follows Pac-Man around? It's all explained right here.
Twitter (updates):
Patreon (support):
Discord (discussion):
Thank you everyone who supports the channel on Patreon!
Ange Albertini, Sten, 333Rich333, Glenn Sugden NPC, Jordan Wiens, Alex Yancey, David Mazarro, Avi Drissman, Steven, LiraNuna, null, Ryan, Corey Ogburn, Martin Trozell, Scott Harper, Garret Kelly, Mike Gerow, Jake Hickman, Larry Koubiak, Narskogr, Joel Kuhn, Joshua Goyder, Dan Shedd, Sembiance, Tina Wuest, Xander, 4F Panda, Max Roncace, David, Owen Christensen, A Sentient JDAM, Gynvael, Alec Johnson, Brian Henriquez, Travis Nellor, Seth Tierney, Zach Hugethanks, Sijmen Schoon, FFVIMan, Buddy, Mikely Whiplash, Chris Margroff, Yakov, Joseph M, Oxygen Chen, Israel Jacquez, Brandan Lennox,, Nik, yuriks, Chris Apple, Ceres, Jason Hughes, Nicholas, Diamond Ice, Jeremiah, F. Murmel, jesugtz, Chris Post, Chris Roy, Chris Connett, Mark, Cypher Signal, Matthew, Shannon Potter, Rupix, sapslaj, Jonathan Scott, Gescheit Gespielt, Gabe S, krivx, Tao Schreiner, Seth N. Hetu, Xkeeper, Bjoern Hansen, Walter Huf, ers35, Pixy011, Daniel Bernard (ReckedCat), Vier Ladair, Bwangry, Jared Johnstone, Phil Clayburn, zephyrin, Kit Spindler, Johnathan Roatch, David Spalding, Jeremy Wright, Acceleration Shark, David Johnson, newnintendo64, Brandon, Matt Shepard, Gary Fenstamaker, Felix Freiberger, Sypwn, Rory Kelly, William Thomas, Carl Cassler, Niles Rogoff, Kusabi, Joe Mecca, Reflet, Michael Greb, tripper, Kefen, nightcap, leftler, Drew Fitzpatrick, Ly Fecha, Dan Salvato, Paxton Sanders, Eugene Bulkin, Walter Weaver, Gethiox, Zoë Mettauer, nexilar, Articate, Julian Meinking, Julien Oster, Braydon Kains, Juniper, Foxchild, buzzert, & Scott Beca

  • I made a lua script that lets you see the ghosts' target tiles and path projections in real-time! You can check it out here:

    Retro Game Mechanics ExplainedRetro Game Mechanics ExplainedÅr sedan
    • W saw rdxcszw see ddzx EEZ

      karanveer singhkaranveer singh18 dagar sedan
    • Bilkey shop

      🌺Ajot Adila אדילה🌺🌺Ajot Adila אדילה🌺5 månader sedan
    • @Fatal Wreck Ms. Pac-Man's ghost logic is similar, but not quite the same. The ghosts in that game still pick target tiles and generally make the same decisions on how to get there, but some intersection decisions are pseudo-random during Chase mode, which precludes the use of memorized patterns. I don't recall off the top of my head if each individual ghost's AI is the same - I believe their rules are a bit different.

      Matt KellnerMatt Kellner9 månader sedan
    • I've seen enough. I'm satisfied.

      Arfan Eka DiandraArfan Eka Diandra11 månader sedan
    • Do these same guidelines also apply in Ms. PacMan?

      Fatal WreckFatal WreckÅr sedan
  • Saca waca

    Diego CortizoDiego Cortizo12 timmar sedan
  • 1:20 ...ok I get this is probably so the first eight timings add up to 65536 frames, but why is it .14 and not .25 or .26? what's the framerate?

    volleo6144 [SM3DW, SSBU, etc.]volleo6144 [SM3DW, SSBU, etc.]Dag sedan
  • Lovely!

    Jack HeadroomJack Headroom4 dagar sedan

    BAT CATBAT CAT4 dagar sedan
  • I love the Pac-Man series!

    Dustin NunnDustin Nunn5 dagar sedan
  • I made a PACMAN game that uses similar mechanics. I tried not to make the A.I. too aggressive.

    K12 GamerK12 Gamer6 dagar sedan
  • Haha....I have played Pacman from the beginning....their movements and personalities are the same in this game as they were in the original arcade game.....PacMan 99 is an incredible game. They made PacMan new again and equally addictive as it was in the early 80s.

    JThur7133JThur713311 dagar sedan
  • it's a big help for recreate the game. Thank you

    SatomSatom12 dagar sedan
  • great video bubba

    ChappyChappy13 dagar sedan
  • Just a random connection I made... in PAC-MAN 99, about halfway through each match, arrows appear above the ghost house and the spawn area. I never knew what these meant until watching this, but it seems that they appear to signify that the intersection turn restrictions mentioned at 13:12 are disabled in order to eliminate the ability to exploit the ghost/jammer AI. I may be completely wrong about that, but if that is the case then that's pretty cool.

    superpi2superpi215 dagar sedan
  • Do they behave the same way in PAC-MAN99?

    DoopnessDoopness15 dagar sedan
  • Who else tryna win pac man 99

    Will SterrettWill Sterrett16 dagar sedan
  • Pac-Man is a hard game for me. But maybe understanding this will help make it easier.

    Shamoa KrasieskiShamoa Krasieski17 dagar sedan
  • me rewatching this video after pacman 99

    KeyshooterKeyshooter18 dagar sedan
  • Poor Clyde

    DazeDaze21 dag sedan
  • Blinky is the chaser Pinky is the ambusher Inky is the trickster Clyde is the hitman with anexiety

    Maxim KonevaMaxim Koneva22 dagar sedan
  • Is there any differences in Pac-Man 99? What I expect is that only the up-left bug would be fixed.

    RudyRudy22 dagar sedan
  • Clyde is a special needs kid who got hired as an assassin

    Super SplintSuper Splint24 dagar sedan
  • I enjoy how you can break this down for all of us to understand.

    Kaleesh SynthKaleesh Synth24 dagar sedan
  • Is this the same for pacman 99?

    sarethumssarethums25 dagar sedan
  • The challenge is to just play the game

    TXFRecordsTXFRecords25 dagar sedan
  • The pac man IOS version also explains the ghost AI.

    Ultimate GamerUltimate Gamer25 dagar sedan
  • So Pac Man is based on the Random Walk programming exercise.

    Sean EdwardsSean Edwards26 dagar sedan
  • This game has also given me the feeling that broke ghost ankles. Even with this knowledge, I’m still going to feel like I hit the juke button lol.

    Tim TLPTim TLP26 dagar sedan
  • Do the ghosts in Pac-Man 99 have the same AI? I’m guessing not.

    TheGreatPaulGTheGreatPaulG26 dagar sedan
  • 14:06 Thanks!I can finally pause the game for a while and continue!

    Vanellope DevonesweetchzVanellope Devonesweetchz27 dagar sedan
  • IT IS TIME! TIME TO MAKE THIS GO VIRAL AGAIN! don't mind me just talking to mr algorithm... hey mrs algorithm Imagine not commenting: "" “Minecraft" "ASMR" "pewdiepie" "music" "Fortnite" "markiplier" “SEworld is a perfectly balanced game with no exploits.” "Runescape" "World of Warcraft" "Shadowlands" "Dream" "MrBeast" "Warzone" "FaZe Clan" "100 Thieves" "Call of Duty" "Pokemon" "Pokemon cards" "card unboxing" "Charizard" "they don't want you to know" "Flat earth" "round earth" "triangle earth" "the earth is not earth" "what even is earth if not earth omg government is lying to you" "Minecraft" "ASMR" "pewdiepie" "music" "Fortnite" "markiplier" “SEworld is a perfectly balanced game with no exploits.” "Runescape" "World of Warcraft"

    GarmoGarmo28 dagar sedan
  • Newly interesting with the arrival of Pac-Man 99 and chasing that leaderboard, especially since as far as I can tell the four ghosts themselves haven’t changed at all or at the very least act VERY close in spirit to their original pathings

    wonderguardstalkerwonderguardstalker28 dagar sedan
  • Good explaining it’s very good please add me please?

    Christopher PritchardChristopher PritchardMånad sedan
  • Lol if you wanna win Pac-man 99 you just need to do 15:18

    Xboy DuboseXboy DuboseMånad sedan
  • Blinky: Chase Inky: Close in Pinky: Surprise Clyde: *I'm just built different*

    Xboy DuboseXboy DuboseMånad sedan
  • An A press is an A press. You can't say it's only a half!

    BeanJrBeanJrMånad sedan
  • Wondering how ghost train is calculated for all ghost in the array?

    Ronin Omega41Ronin Omega41Månad sedan
  • I remember reading write ups of the ghost behaviors & overflow bug a long time ago, but your animations make it a lot more intuitive. Thank you!

    Marco GrubertMarco GrubertMånad sedan
  • Now i'm ready to be the Pac-One!

    Arcimago GixArcimago GixMånad sedan
  • Never knew how they were programmed, this is neat. Side note: this isn't AI, it's just programming.

    ItbelinkItbelinkMånad sedan
  • Interesting, thank you

    Michael HegnerMichael HegnerMånad sedan
  • What if you triggered the safe space in Pacman 99?

    Clark the BreeClark the BreeMånad sedan
    • probably would die to red pacman that spawn

      Duck WorshipperDuck Worshipper29 dagar sedan
  • Here after Pac-Man 99

    SunfluxSunfluxMånad sedan
  • Cool now I can be a pro at pac-man! That’s cool!

  • I wish there was more rng on pacman like they can suddenly change patterns

    The SlayerThe SlayerMånad sedan
  • This outta help me win Pac-Man 99

    The Plush Luigi Bros.The Plush Luigi Bros.Månad sedan
  • Who watched this video immediately after Pacman 99 got announced

    Konmai QualityKonmai QualityMånad sedan
  • So eon's ago in the 80's I was told you could charge at the ghosts (ok, maybe it was just one ghost. I don't fully remember) and they would turn away from you. This explains that nicely. And I knew about the hiding spot, but didn't know why it worked.

    wcemichaelwcemichaelMånad sedan
  • Can't remember now because it was all so long ago but there were definitely routes to take to ensure loads of completed levels with staggeringly high scores.I didn't work that out it was just some random girl that taught me the routes. Happy Days

    Harry JohnsonHarry JohnsonMånad sedan
  • Amazing video. Thank you

    Samir RojasSamir RojasMånad sedan
  • This is an incredible video - so informative and interesting from a beginner in coding's standpoint, like myself. Thank you.

    Sleepy RickSleepy RickMånad sedan
  • Wow, that’s fascinating! Just for giggles I’m writing a Pac-Man-esque game to run on an Atari 800. This gives me lots of ideas. Definitely following your channel now.

    Doug ArrellDoug ArrellMånad sedan
  • weird, i always was under the impression that if they got too close they would just chase you

    khhnatorkhhnatorMånad sedan
  • Pinky: *I am four parallel universes ahead of you*

    Ballistic BooBallistic BooMånad sedan
  • I had often what determined their movement. Great breakdown of how it works. Animation was fantastic. Thanks for making this video.

    Craig VCraig VMånad sedan
  • Great video and explanation, thanks for sharing

    D DacombeD DacombeMånad sedan
  • WHY am I watching this???

    GlockMan945GlockMan945Månad sedan

    BAT CATBAT CATMånad sedan
    • YES

      BAT CATBAT CAT4 dagar sedan
  • Clyde is the most cowardly one with proof Also the ghosts running literally anywhere when scared is like them saying “GO GO GO ANY DIRECTION WILL DO JUST GET AWAY”

    SluggishRainSluggishRainMånad sedan
  • I had no idea that the AI was this complex. I thought the behavior was much simpler. Thanks for explaining this! This is a window into a world that I've known about since the beginning but have never seen!

    swistedfilmsswistedfilmsMånad sedan
  • Sometimes, you can actually scare Clyde off by darting at him.

    Alastair ArchibaldAlastair ArchibaldMånad sedan
  • I did get pretty good at Pacman in the 80s, and found the hiding place very useful if I wanted to get a drink or take a quick comfort break.

    Alastair ArchibaldAlastair ArchibaldMånad sedan
  • It's complicated ;)

    Diana AnaidDiana AnaidMånad sedan
  • Decades ago, I knew all of the patterns, even the super hard 9th key pattern. My best score was around 2.8 million or so, and I ended up losing because my hand was cramping too badly to play.

    SontarSontarMånad sedan
  • Boy howdy I just about went bananas trying to figure out these blasted ghost patterns. The year was 1989. Armed with a notebook, a calculator, and a young and foolish determination, I set out on a magnificent but completely futile 11 hour quest to determine how and WHY the ghosts move the way they do. I was surprised to see that some of my conclusions were correct as this video shows, but not terribly surprised to find out that I was significantly wrong in a lot of areas. I mean, I was a kid playing a nintendo, the idea of looking at the code itself simply never occurred to me.

    A putrid pile of b-moviesA putrid pile of b-moviesMånad sedan
  • One thing you might add is that when you are in the hiding spot and think you are safe, a switch to scatter mode can get you eaten. Clyde can get you if he reverses while in his vertical loop by coming across where the fruit appears. Inky can get you if he loops around the lower right energizer area. This has happened to me when I've left a game to go do something else and it waits long enough for the 4th scatter. Great video! Usually, though, if I have Clyde in his horizontal loop, I make it through fine--probably because the 4th scatter is too short for Inky to do anything harmful.

    William DeFordWilliam DeFord2 månader sedan
  • Clear as mud.

    Anonymous PersonAnonymous Person2 månader sedan
  • 🤯🤯🤯🤯

    Zain AZain A2 månader sedan
  • 1.25x speed ;)

    Eduardo MezaEduardo Meza2 månader sedan
  • Every now and then and in the bottom left I am able to pass through a ghost, what is happening?

    Andrew HayesAndrew Hayes2 månader sedan
  • Huh... Guess I have all the knowledge I need to make Pac-Man clones now :)

    Matthew ReaseMatthew Rease2 månader sedan
  • This was a wasted video to watch, It 's just a game who really cares about the mechanics, just play the game.

    HyperFoxTailsHyperFoxTails2 månader sedan
  • In other words: Pac Man is more elaborate than people give it merit for!

    Tsukiyomaru ZeroTsukiyomaru Zero2 månader sedan
  • They're not "scattering"; each one is checking out his power pellet location. And Pac Man doesn't 'touch', he EATS! It's kind of in his name! Pinky is a male. The only female ghost was Sue in Ms. Pac Man.

    el fleshel flesh2 månader sedan
  • 277 gender studies found this confusing

    henry nenjaminhenry nenjamin2 månader sedan
  • Holy frick this is some advanced math stuff! I was expecting simpler things but this works too 😂

    Internet duckInternet duck2 månader sedan
  • Thanks for clarifying that they can’t pass through walls, I wasn’t sure

    Jonathan UngerJonathan Unger2 månader sedan
  • Pac-Man: is being chased by Pinky Pac-Man: *Turns around* Pinky: *Run away, frightened*

    Денис СафоновДенис Сафонов2 månader sedan
  • Finally, someone who gets into the nitty-gritty technical aspects I've always wanted to learn more about. The visual graphics are super helpful too, and very nice looking

    chemical brrnchemical brrn2 månader sedan
  • What are you talking about? I've seen ghosts go "backwards" all the time.

    Richard ForesterRichard Forester2 månader sedan
  • Imma just simplify it for those who don't want to watch the whole thing. Ghosts alternate from Chase mode with their base AI to Scatter mode where they always run away. Each ghost has a specific corner they retreat to until switching back to chase mode. Red aims for the player, gains speed boost after enough dots are cleared, with the minimum remaining dots changing each 2 or so rounds. Pink aims slightly ahead of player, for ambush maneuver. For some reason, moving up causes the target-point to be off-center. Cyan aims for the spot adjacent from red's position to the player. If red's to your left, Cyan aims for your right. Orange acts similar to red, but switches to scatter mode when you get close, going to the corner.

    Michael JamesMichael James2 månader sedan
  • hmmmmmm, well, considering im a shitty amateur programmer, i'll stick with random movements, still cool though!

    Bilbo BoulderBilbo Boulder2 månader sedan
  • 10/10 video, saving this because I coded a pacman clone a couple of years back and I want to try implementing this AI properly!

    Tom DuffTom Duff3 månader sedan
  • i keep coming back to this

    junipiterjunipiter3 månader sedan
  • f u t u r e

    CihlounCihloun3 månader sedan
  • I am now going to replace every ghost with Clyde.

    Mr. PMr. P3 månader sedan
  • Trinston was here ...

    Trinston MichaelsTrinston Michaels3 månader sedan
  • How many fired up Pacman on MAME and put him in the hiding spot to see if it worked!

    Chanting In The DarkChanting In The Dark3 månader sedan
    • OMG, it totally works! :D

      Chanting In The DarkChanting In The Dark3 månader sedan
  • 💕

    Vince MayoVince Mayo3 månader sedan
  • Pacman: wanders around Ghosts: understandable have an amazing day Pacman: wanders around more Ghosts: and now, you have officially carried it too far buddy

    Shayaan MorshedShayaan Morshed3 månader sedan
  • Absolutely in-depth math analysis, a gem. What a surprise... and homage to Toru Iwatani. Great video, subscribed on the spot! Love Pac-Man, actually it was the very fist game I played in an arcade at the age of 12, @Meta, Costa da Caparica, Portugal. On a rare occasion I entered the arcade in the 1984’s summer holidays with my parents and got a taste of Asteroids, Space Invades and Moon Patrol and Galaga. But it was Pac-Man that remained in my heart, I’m 48 now. Congrats

    Ricardo SRicardo S3 månader sedan
  • 😳...had no idea Pac-Man was rocket science. 🤷🏽‍♂️

    Mort BusinessMort Business3 månader sedan
  • Does Ms PAC Man use the same ghost ai or did they change it?

    KingOfGamesKingOfGames3 månader sedan
  • There is a tendency among some people to think of old games as crude or simplistic. The difference between someone who programmed Pac-Man vs someone who programs a Unity game is the difference between the guy who invented the the the microwave oven's magnetron vs someone who put a microwave oven in a factory on an assembly line.

    EmpyrealEmpyreal3 månader sedan
  • How does this compare to 2020’s Pac Man Championship Edition for NES? been trying to get to 400k

    George MolinaGeorge Molina4 månader sedan
  • This was awesome! Especially the second half.

    J RJ R4 månader sedan
  • What about the ghosts in pacman.exe? Is it the same? I think it is cuz in the .exe version inky still goes randomly and blink still chases you and pinky cuts you off and Clyde?.......uhhhhh.....I think the same

    MimikBlueMimikBlue4 månader sedan
  • Fantastic, thank you!

    Frank LaoFrank Lao4 månader sedan
  • the ghosts are actually so much smarter than they seem. Inky, one of the most chaotic ghosts, is working together with Blinky, Pinky wants to catch Pac-Man from the front, Blinky chases you from behind (which can actually work together with Pinky), and Clyde... does his Clyde stuff

    CupofspidersCupofspiders4 månader sedan
  • I thought I read that one of the ghosts is faster than Pac-Man.

    Reed RReed R4 månader sedan
  • How did you run those simulations with tons of ghosts in the maze? Is it a mod, a special tool, or did you animate it manually?

    phuc kieuphuc kieu4 månader sedan
  • Inky triangulates. It’s some sneaky shit and the hardest to keep track of when all the variables are shifting. The most obvious thing is probably how none of the ghosts make 180 turns under regular circumstances, but together at key moments. That’s when you start to see the ones and zeros. Nothing is totally random. I think they designed it to be consistently surprising regardless of whether or not you saw behind the curtain.

    Christopher HaydenChristopher Hayden4 månader sedan
  • I dont have the brain capacity to understand any thing and im loving it!

    Opwz StuckeyOpwz Stuckey4 månader sedan