CPE 471: 3D PacMan
Figure 1: Starting PacMan Screen
By: Rafael Kaliski
3D PacMan is a simple 3D game with two characters, PacMan and the ghost. The goal of the game is to eat all of the pellets before the ghost gets you. Only a single map is loaded per game, i.e. this game is single level only. Currently this program only loads the original PacMan map. This game does not support transportation of PacMan.
This Game achieves its 3D look by loading a map file and changing the properties of each block based on the contents of the map file, at the given row and column. Obstructed blocks are raised (z-coordinates) and subsequently a 3D look is achieved. Each character is a Quadric like a Sphere (PacMan) or a cylinder (Ghost). Normals are computed per face (square), for the map. The pellets, power or normal, are created using glutSolidSphere. Both glutSolidSphere and the Quadrics automatically compute the normals, for lighting. Alpha blending is used for transparency. Both the ghost and PacMan have 2D texture mapped faces (visible below).
The ghost utilized a greedy search algorithm; consequently, it bounces around the screen. The greedy algorithm is an informed search, i.e. it knows where the target (goal) is. Bitmap characters are used to display the text (Statistics and data); most of the important statistics are echoed to the console. When the program ends (normally), the console waits for user input before the program terminates.
Object collisions are detected at the data structure, versus graphical, level. For example, when the ghost and PacMan are on the same square, a collision is detected. A map of any size can be loaded.
Keyboard Controls:
Movement:
PacMan can be moved by using the direction keys, i.e.
® Right
Up
¯
Down
¬ Left
Mouse Controls:
Object and Camera
Transformations:
(Warning:
Text may disappear)
Mouse Button: Left -- Translate Middle-Scale Right-Rotate
Key Commands:
H -- Help
S –- Pauses/Continues Game (game starts paused)
U -- Restore Camera back to its un transformed view (text may
not appear)
R --
Remove All Transformations (Camera and Object).
Q -- Quit
V -- Toggle between Perspective and Orthographic Viewing.
G -- Toggle Grid (useful for seeing camera transformations)
on/off
O –- Enters/Exits into Object transformation mode, exits camera
transformation
mode, camera restored to default.
C –- Enters/Exits Camera Transformation mode, exits object
transformation mode.
Previous Camera
transformations are restored.
Game Status:
All
relevant statistics regarding the game are displayed in the window, i.e. the
text.
The
data displayed is
1)
Score
2)
Lifes
Remaining
3)
Game
Play Status (Paused, In-Play, Win, Lose).
a.
Winning
the game, all pellets must be eaten and PacMan must be alive.
b.
Losing
the game, all of PacMan’s lifes are gone.
4)
Object
Camera or no transformation mode.
Scoring:
1)
Pellets
– 100 points
2)
Power
Pellets – 1000 points
3)
Vulnerable
Ghost – 3000 points, only score-able once per power pellet.
SourceForge OpenGL documentation
OpenGL @ Lighthouse 3D - GLUT Tutorial
OpenGLUT 0.6.1 development - OpenGLUT 1.0 Text Rendering API Proposal
How to Tex Using Bitmaps for OpenGL Texture Mapping in Microsoft Visual Studio
Ascii Table - ASCII character codes and html, octal, hex and decimal charts
Figure 2: Starting PacMan screen.
Figure 3: The chase is on.
Figure 4: The tables have turned.
Figure 5: PacMan’s face.
Figure 6: The Ghost’s face.
This game is based off of the original PacMan by Namco.