Nodes/ComfyUI-Games/Pac-Man Game
ComfyUI Node

Pac-Man Game

Pac-Man, ghosts and all, rendered inside a ComfyUI node

By GraftingRayman·Created 8 months ago·Updated 2 months ago· 0
Pac-Man Game
  • image
  • IMAGE

The PacManNode from ComfyUI-Games is the most ambitious of the pack's six games and probably the most fun to lose an afternoon to. It's a real Pac-Man - maze, dots, power pellets, four ghosts with personalities, three lives, escalating levels - all running on a canvas that lives inside the node itself, next to the model loader you're supposed to be babysitting. You will tell yourself you're just checking it once. You will be on level six.

The mechanism: every game in this pack is a frontend trick

Look at the backend and it's almost disappointing:

def play_pacman(self, image):
    return (image,)

The node consumes one image tensor and returns it byte-identical. Every shred of gameplay - the maze layout encoded in web/js/pacman.js, the ghost AI, the power-pellet frenzy timer, the dot counter - runs in a DOM canvas widget that the extension injects into the node when you add it to a workflow. ComfyUI's own aiohttp server is only used for the score endpoints: /pacman/highscore GETs and POSTs a JSON file in the pack folder so your best score and level survive a restart.

Which means the two things beginners get wrong are baked into the design. The game only exists in the browser UI - run this node headless or via API and it's just a pass-through. And your input image is not the maze. You cannot feed it your AI render and get Pac-Man running through your art. The image input is a placeholder so the node slots into a graph; the game draws its own maze and doesn't consult your tensor at all.

Inputs and outputs

From the info_schema, this is as minimal as it gets:

  • Input: image (IMAGE, required) - passed through untouched.
  • Output: IMAGE - the same tensor comes back out.

Everything interesting lives in the widget: arrow keys steer, the maze is a fixed hand-authored layout, and there's no difficulty slider - just you, the ghosts, and three lives. The only persistence is the high score, written to pacman_highscore.json.

Installing ComfyUI-Games

Pac-Man is one of six games shipped by the same pack, so a single install covers the whole set. Use ComfyUI Manager and search for ComfyUI-Games, or:

cd ComfyUI/custom_nodes
git clone https://github.com/GraftingRayman/ComfyUI-Games

Restart ComfyUI and you're playing. There is no requirements.txt and no model download - the only server dependency is aiohttp, already present in every ComfyUI install. For a pack this game-heavy, that's remarkably friction-free.

Common issues

  • "Why didn't my image change?" Because nothing was ever going to change it. It's a passthrough; the game is in the widget.
  • Score resets after an update. High scores live in a plain JSON file in custom_nodes/ComfyUI-Games/; overwriting the folder clears them.
  • Arrow keys misbehaving elsewhere in ComfyUI. The game registers global key listeners and only tears them down when you delete the node.
  • Red log spam at startup. The pack prints a colored "Node Loaded" line per game. Ignore it.

It's a toy node, no question. But it's a good toy node - full game, zero dependencies, zero VRAM - and it makes a long render feel like the loading screen was the point.

Categorygames

Inputs (1)

NameTypeDefaultDescription
imageIMAGE

Outputs (1)

NameTypeDescription
IMAGEIMAGE