What is Pacman?
Pacman is a faithful recreation of the classic arcade game, developed in C using SDL 1.2. This implementation brings the nostalgic gameplay of the original Pacman to Linux systems with modern conveniences like automatic display resolution restoration and multi-monitor configuration support. The game features four colorful ghosts with distinct AI behaviors, power pellets that turn the tables on your pursuers, and progressive difficulty levels that challenge even experienced players.Key features
SDL 1.2 graphics engine
Classic 2D rendering with hardware-accelerated graphics and audio support
Automatic resolution restoration
Intelligently saves and restores your monitor configuration when exiting the game
Multi-monitor support
Handles extended desktop setups with proper position and primary display management
Authentic gameplay
Four ghosts with unique AI behaviors, power pellets, and progressive difficulty
Display management
One of the standout features of this Pacman implementation is its sophisticated display management system. Built for Linux with X11, the game uses a combination of GLFW and xrandr to:- Capture your current screen resolution and refresh rate before launching
- Generate a restoration script at
/tmp/restaurar_xrandr.shthat preserves:- Resolution for each connected display
- Relative positioning between monitors
- Primary display designation
- Automatically restore your desktop configuration when you exit
The restoration process typically takes 1-2 seconds, especially with multiple monitors connected.
Ghost AI personalities
Each of the four ghosts has its own hunting behavior:- Red Ghost (Nagosia): Directly targets Pacman’s current position
- Blue Ghost (Beltzak): Follows Pacman’s previous position with slight delay
- Yellow Ghost (Azkar): Switches between aggressive pursuit and random wandering within a 9-tile radius
- Gray Ghost (aMoK): Similar behavior to yellow, providing unpredictable gameplay
Get started
Quickstart
Get playing in under 5 minutes
Installation
Install dependencies and set up your system
Technical stack
The game is built with classic Linux development tools:src/main.c
Project structure
The codebase is organized into modular components:- src/main.c - Entry point and display management (src/main.c:160)
- src/gfx.c - Graphics initialization and rendering
- src/movefant.c - Ghost movement and AI logic
- src/mov_fig.c - Pacman movement and collision detection
- src/teclado.c - Keyboard input handling (src/teclado.c:17)
- src/sprites.c - Sprite loading and management
- data/ - Game assets including sprites, sounds, and fonts