Skip to content

JerryASNew/batchpacman

Repository files navigation

batchpacman

A Pac-Man clone written in native Windows Batch (cmd.exe) — no engine, no dependencies, just .bat files. The maze, ghosts, pellets, fruit, death animation, and high-score board are all driven by batch script, rendered with ANSI escape sequences and a hand-built 8×8 sprite font.

Requirements

  • Windows 10 or later
  • Runs in native Windows Batch (cmd.exe), which is single-threaded and CPU-bound — a reasonably modern CPU is recommended for smooth play. Tested on an AMD Ryzen 7 3700X with a little headroom to spare; older or low-power machines may see choppier movement.

Quick start

  1. Install the sprite font. Right-click BatchPac8x8.ttfInstall (or open it and click Install). Without it the sprites show up as blank/▯ boxes — see Font setup below.

  2. Set your console to that font. In the terminal you'll run the game from (Windows Terminal, or the classic cmd.exe console), set the font face to BatchPac 8x8.

  3. Run the game. Double-click PacBatch.bat, or from a prompt in the repo folder:

    PacBatch.bat

That's it — map01.dat ships with the repo, so there's nothing to generate.

Controls

Key Action
W/A/S/D Move up / left / down / right
P Pause / unpause
L Add a life
X Exit

When a game ends, if your score cracks the top 10 you'll be prompted for initials; the board is shown and you can choose to play again.

Font setup

The sprites (Pac-Man, ghosts, fruit, score popups, death animation) are real glyphs in BatchPac8x8.ttf, mapped into the Unicode Private Use Area (U+E000+). The console must be using this font to render them — in any other font they appear as empty boxes.

  • Windows Terminal: Settings → your profile → AppearanceFont faceBatchPac 8x8.
  • Classic cmd.exe console: open a cmd window, click the title-bar icon → PropertiesFont, and pick BatchPac 8x8. (Custom fonts only appear here after the TTF is installed and may require a sign-out/in.)

A black background is recommended; the game paints its own colors over it.

Regenerating the maze (optional)

map01.dat is prebuilt, so you don't need this to play. To build a different level:

  1. Draw a maze in PacLevelEditor.html (open it in a browser) and export the mapRow[] block, or edit the ASCII maze in PacMazeGen.bat directly.
  2. Run PacMazeGen.bat to regenerate map01.dat (movement, pathfinding, pellet, node, and spawn data).

Files

File Role
PacBatch.bat The game engine — run this to play.
PacConfig.bat All constants: colors, sprite glyphs, fruit/ghost tables, timing.
PacMazeGen.bat Converts a hand-drawn ASCII maze into map01.dat.
colorgen.bat Generates the per-level spectral wall-color gradient.
hscore.bat Submits a score and renders the top-10 board.
map01.dat Prebuilt level data consumed by the engine.
BatchPac8x8.ttf The custom 8×8 sprite font (install this).
PacLevelEditor.html Browser maze editor (exports levels for PacMazeGen.bat).
ARCHITECTURE.md How it all fits together — render model, data formats, conventions.

The high-score board is written to highscores.txt next to the scripts the first time you finish a game; it isn't shipped with the repo.

How it works

See ARCHITECTURE.md for the render model (selective ANSI redraws over conhost), the map01.dat data sections, ghost targeting, the spectral wall gradient, the sprite-font layout, and the comment/style conventions.


Disclaimer

This is a fan-made, non-commercial, educational project, created as a programming exercise. It is not affiliated with, endorsed by, or sponsored by Bandai Namco Entertainment Inc.

PAC-MAN® and all related characters and trademarks are the property of Bandai Namco Entertainment Inc. All other trademarks are the property of their respective owners.

About

A Pac-Man clone written in native Windows Batch (cmd.exe), with a hand-built 8x8 sprite font and ANSI rendering.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors