Godot Pacman
Arrow Keys to move, enable the Debug switch (top left) if you want to see the paths the ghosts calculate. (You may have to click on the game if you're playing it on browser to let it catch keyboard input)
Godot Pacman is a demo project I'm working on to showcase Godot's capabilities. This is a test run for when I'll be live-streaming the development project under GEC FOSS Club. If you'd like to know how this was made, find out more on the event page.
Pacman is an interesting game. Though the premise is simple (eat every collectible without getting caught) it has a remarkable AI that through simple rules leads to some engaging experiences.
The most basic of these rules is that each ghost can't backtrack. So if it enters a tile with only 2 exits, it only has one choice to leave from, since it used the other to get in. When it does come across a tile with 3 or more exits, it uses a path finding algorithm (A* in my implementation) to find which option would lead to the shortest path
Additionally, each ghost has it's own personality. Blinky, the red ghost, is introduced as "shadow". Which is quite apt, since it directly targets the player. This also makes it the most predictable of the 4 ghosts.
Pinky, the pink ghost, is supposed to be "speedy". This ghost doesn't target the player directly, but rather the space 4 tiles ahead of them. This results in a pincer movement of sorts when combined with Blinkys intentions.
Inky, the purple ghost, targets a special spot that can be found by drawing a line from Blinky to two tiles ahead of Pacman. And then extending the line by the same amount again. (linear interpolating it by a factor of 2 in this implentation)
The orange ghost, Clyde, targets Pacman directly just like Blinky. But if it gets too close. It scatters to its corner in the bottom left of the level.
The other ghosts have their own corners too. Ever so often they'll give up chasing pacman and instead head to their corners. The timing for this varies as the level progresses, with the ghosts never relenting if there are less than 20 collectibles left. In this implementation however, they cycle through every 10 seconds. I'll be fixing this behaviour next.
PS: enable the DEBUG switch (top left) if you want to see the paths the ghosts have calculated
There's quite a lot to be said about pacman's design. If you'd like to know more, check out this video essay by Mark Brown:
Status | Released |
Platforms | HTML5 |
Author | JadeMaveric |
Download
Click download now to get access to the following files: