Tetris Game
Tetris inside ComfyUI — and you're starting in second place behind RAYMAN
- image
- IMAGE
The TetrisNode is the flagship of ComfyUI-Games, and it's the real deal: a complete, playable Tetris with rotation, hard drop, a scoring system, and a persistent top-five leaderboard - all embedded as a canvas widget inside a ComfyUI node. It's the node you add to every workflow when you're convinced the render will be "done in about a minute," then never look at the KSampler again.
How it works: a frontend game wearing a pass-through costume
The Python half of TetrisNode is shamelessly small:
def play_tetris(self, image):
return (image,)
The node accepts one image tensor and hands it straight back. All the gameplay - the seven pieces, rotation, hardDrop, the grid, the sound effects - runs in web/js/tetris.js, which extends ComfyUI so a canvas appears inside the node when you add it to a graph. Everything plays in your browser; the backend just keeps the node honest as part of the workflow.
Here's the catch you need to internalize before you're disappointed: your input image does not become the playfield. Wire your generated art into this node and Tetris will draw its own dark grid on top of whatever you imagined. The image input is a placeholder so the node has an input at all - it's a passenger, not the game's texture.
The surface area
From the info_schema, there's not much to configure:
- Input:
image(IMAGE, required) - passed through unchanged. - Output:
IMAGE- the identical tensor comes back out.
Controls are classic: arrows to move, up or a key to rotate, space (or similar) to hard drop. When you finish a round the game drops you into a name-entry screen, and your score posts to ComfyUI's own server at /tetris/highscores, landing in tetris_highscores.json in the pack folder. That file ships with the author's own placeholder entries - score 5000 under the name RAYMAN - so on a fresh install you're literally starting in second place behind the developer. Beat it. It's the only way to make the pack yours.
Installing ComfyUI-Games
Tetris is one of six games in the pack, so one install gets you all of them. In ComfyUI Manager, search for ComfyUI-Games, or:
cd ComfyUI/custom_nodes
git clone https://github.com/GraftingRayman/ComfyUI-Games
Restart ComfyUI. No requirements.txt, no model files, no VRAM cost - the only server-side dependency is aiohttp, which ComfyUI already bundles. This is the easiest custom-node install you'll do all month.
Common issues
- The output looks identical to the input. Correct - it's a passthrough. The game lives in the node widget, not the tensor.
- Leaderboard resets after updates. Scores are plain JSON in
custom_nodes/ComfyUI-Games/; a git pull can wipe them. - Name entry or key handling feels sticky. The game registers global key listeners and removes them only when you delete the node, so it can occasionally swallow ComfyUI's own keys.
- Red "Node Loaded" lines at startup. One per game in the pack. Cosmetic.
It's a time-sink with a leaderboard and a barely believable install story. And yes - that 5000 is beatable.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| IMAGE | IMAGE | — |