Before you begin
Make sure you have installed all required dependencies. If you haven’t done this yet, follow the installation guide first.Get up and running
Navigate to the project directory
Open a terminal and change to the Pacman source directory:Verify you’re in the correct directory by listing the contents:You should see files like
Makefile, README.md, and directories like src/ and data/.Compile the game
Build the game using Make:The compilation process will:
- Compile all C source files in
src/directory - Link with SDL, GLFW, and MikMod libraries
- Generate an executable named
pacman
Makefile
Compilation typically takes 5-10 seconds on modern hardware. If you see any errors, verify all dependencies are installed correctly.
Launch the game
Run Pacman in your preferred mode:Fullscreen mode (
-f):- Captures the entire display
- Saves current resolution before starting
- Generates restoration script at
/tmp/restaurar_xrandr.sh - Automatically restores settings on exit
-w):- Runs in a 320x200 window
- Does not modify display settings
- Useful for testing or playing alongside other applications
Game controls
Pacman uses simple arrow key controls:Arrow Up
Move Pacman up
Arrow Down
Move Pacman down
Arrow Right
Move Pacman right
Arrow Left
Move Pacman left
Escape Key
Exit the game and restore display settings
Movement mechanics
The game implements smooth, authentic Pacman movement:src/teclado.c
- Movement is grid-based with smooth interpolation
- You can buffer the next direction by pressing early
- Pacman stops when hitting walls
- Special tunnel passages wrap around the screen
Gameplay basics
Objective
Navigate the maze, eat all dots, and avoid ghosts. Collect power pellets to temporarily turn the tables and hunt the ghosts.Scoring
- Regular dot: 10 points
- Power pellet: 50 points (plus the ability to eat ghosts)
- Ghost: Bonus points when eaten in powered-up mode
- Fruit: Special bonus items appear periodically
Power pellets
Four power pellets are located in the corners of the maze:src/teclado.c
- Ghosts turn scared and flee to random positions
- You can eat ghosts for bonus points
- Effect lasts for a limited time (managed by
CntStepcounter) - Ghosts flash before returning to normal state
Level progression
When you clear all dots:src/teclado.c
- Level advances automatically
- Ghost speed and AI difficulty increase
- Pacman respawns at starting position
- New maze appears with fresh dots
Cleaning up after playing
Normal cleanup
If you exit using ESC, the game automatically:- Runs the restoration script at
/tmp/restaurar_xrandr.sh - Restores your original resolution and refresh rate
- Repositions all monitors to their original layout
- Restores the primary display designation
src/main.c
Manual restoration
If the game crashes or you need to manually restore your display:Building and cleaning
Rebuild after changes
If you modify source files:What gets built
The build process creates:*.oobject files insrc/directory (one per C source file)pacmanexecutable in the root directory
.gitignore:
Troubleshooting
Game doesn't start - SDL initialization failed
Game doesn't start - SDL initialization failed
This usually means SDL can’t access your display. Ensure:
- You’re running on X11 (not pure Wayland)
- The DISPLAY environment variable is set:
echo $DISPLAY - X11 server is running
./pacman -wNo sound effects
No sound effects
The game requires MikMod for audio. Check:
libmikmod-devis installed- Your sound system (ALSA/PulseAudio) is working
- Volume is not muted
speaker-test -t wav -c 2Resolution not restored after exit
Resolution not restored after exit
If your display settings aren’t restored:
- Check if the script exists:
ls -l /tmp/restaurar_xrandr.sh - Run it manually:
/tmp/restaurar_xrandr.sh - If that doesn’t work, use xrandr directly:
(Replace HDMI-1 with your display name from
xrandr --query)
Game runs too fast or too slow
Game runs too fast or too slow
The game uses a fixed 18ms timer interval:If timing seems off, it may be related to your system’s timer resolution. This is uncommon on modern Linux systems but can occur on virtual machines.
src/main.c
Next steps
Now that you’re playing:- Master ghost AI patterns by observing their behaviors
- Learn optimal power pellet timing for maximum points
- Explore the tunnel passages for strategic advantages
- Try to beat your high score
The game saves your current score in memory but doesn’t persist high scores between sessions. Consider tracking your personal bests manually if you want to compete with yourself over time.