Jared's Pac-Man-like game
I built this game over the past couple of months to give me
the experience of building a complete game.
It is more or less the typical Pac-Man game, with a few exceptions:
- Two
players. The opposing player can
run in autopilot for single-player action.
- Players
can create Lock 'n' Chase-style walls to stop ghosts (and the opposing
player).
- The
goal is not to simply clear all of the coins from the board. Rather, the goal is to get as many
coins as possible within 60 seconds and yet reach the exit. The player must be careful to not get
too greedy or he may end up with nothing.
Note that I am presently working to make the opposing player's AI much more intelligent. Right now it is not aware of ghosts or of the other player and doesn't understand that a key is necessary to unlock doors.

Download (ZIP, 680 KB
)
Goal:
- Accumulate
500 coins from one or more levels before the other player does.
Rules:
- If you
accumulate 500 coins (over one or more levels) before your opponent then
you win.
- If you
don't reach the exit before the timer runs out, you don't keep any coins
for that level.
- If you
get hit by an enemy, you lose ten coins and respawn at the beginning of
the level.
- You
can create up to two temporary walls (like in Lock 'n’ Chase). These walls
block enemies, your opponent, and yourself.
- You
need to get the key (a blue square) before you can walk through a blue
gate
- An
auto-piloted player will head toward the exit after a certain length of
time.
Controls:
Left/Right/Up/Down -- move player 1
(yellow)
a/d/w/s -- move player 2 (purple)
c -- toggle autopilot for player 2
m -- toggle autopilot for player 1
/ -- create wall for player 1
z -- create wall for player 2
1 -- disable ghosts
2 -- enable ghosts
Technical features:
- Game has beginning, middle, and end
- 2D collision detection implemented by dividing world into
1x1 squares
- We perform collision detection over a vector of entities
that exist in a particular square
- Iterative deepening depth-first search path finding
- Used to control movement of ghosts and of players in
autopilot mode
- Note: Ghosts will move randomly unless within five units of
a player
TODO list
- more
levels and/or automatic level generator
- improved
player AI
- should get key when needed
- should be aware of other player
- should be aware of ghosts
- sometimes slows down
- player
should use temporary gates in appropriate situations; if opposing player
is about to win then try to stop him
- add
bonus (which is worth multiple coins)
- in-game tutorial to show how game is played