datagod's Feed

09-07-2019 at 09:32 PM
1 Comment
Rate this Entry

Arcade Retro Clock: PacDot algorithms

You may have heard that the ghosts in PacMan have unique behaviours. Well, in my version PacDot they pretty much were zipping about randomly until they "see" Pacdot, then they would follow for a few squares. By then, PacDot fled and they went back to just aimless wandering.

Every once in a while they would gang up on PacDot by trapping him in a corner which was unexpected. I thought the game was crashing, but it turned out PacDot just could not move and the ghosts would not get out of his way. Since the ghosts can't hurt PacDot, I decided to leave this behaviour alone but made PacDot "die" after 20 ticks of the clock with no movement.

That works fine on the 8x8 map, but on the larger 16x16, the ghosts are just unable to trap him. The game just seems to go on forever.

I added code so that every few moves the ghosts will turn towards PacDot and continue moving. It works great. But then I realized PacDot wasn't being very good at eating the white dots like he used to.

To explore this further I set PacDot's speed to the maximum. This makes it quite clear that he is broken.

I'll fix tomorrow and post another video.

  1. datagod's Avatar

    After a few tweaks, PacDot(tm) is getting way better at eating them dots. It turns out my new function AdjustGamma -- which allows me to adjust all colors up towards 255, increasing brightness of the display -- was leaving some color values with decimal places. After I fixed that, PacDot's vision started working again.

    Here is a debug line, showing that the white dots found on the screen are RGB value (97,97,97), but the values stored in a variable were (97.5, 97.5, 97.5)

    Check out the difference:

    I am now working on a function to let PacDot turn towards the nearest dot. More tomorrow! right now it is 4:00am, and I got some robots to feed.

Join us