Nodes/Comfy-URN-Arcade-Games/URN Arcade Space Invaders
ComfyUI Node

URN Arcade Space Invaders

Space bar fires, arrow keys panic

By Clivey1234·Created about a month ago·Updated about a month ago· 2
URN Arcade Space Invaders

      The genuinely great bit of URN Arcade Space Invaders isn't the shooting - it's the march. The formation steps down a notch, the four-beat alien march sample drops in pitch as you thin the rows out, and you can hear exactly how much time you have left before they reach the bottom. Then a UFO slides across the top and you completely forget about the render that's been at 60% for nine minutes.

      What it is

      One of five playable arcade classics in Clivey1234/Comfy-URN-Arcade-Games, installed as nodes that sit on the ComfyUI canvas. Space Invaders needs nothing wired - no inputs, no outputs, no relationship with the graph around it. Add it, play it while the queue runs, ignore it when the render's done.

      Its practical niche is that it's free. On a heavy video job your GPU is saturated and alt-tabbing into a real game just fights the render for VRAM - a 2D canvas in the tab you already have open doesn't. Plus it's a five-second game to learn: left, right, fire.

      How it works

      The Python class is basically an empty shell - no visible inputs, an empty return tuple, not an output node - so ComfyUI's executor never runs it and it cannot affect a render. The game itself is web/urn_arcade_space_invaders.js, loaded as a frontend extension because the pack declares WEB_DIRECTORY = "./web".

      On node creation the JS attaches a DOM widget holding the canvas and grows the node to a usable size (minimum 460×520). The widget is non-serialising, so it won't end up inside workflow JSON. It also listens for ComfyUI's execution events: starting a render auto-starts an idle game, with a status dot that goes green while the workflow is running. The idle screen even says so - "QUEUE A WORKFLOW OR CLICK TO START."

      Controls

      ← and → move the turret. Space fires - and it doubles as the start button from idle or game over, which means the natural first instinct (mash space) is also the correct one. P pauses, R restarts, the NEW and PAUSE buttons do the same.

      Click the play area before you use keys. The listener is bound to the canvas element, and it calls preventDefault() on the space bar and arrows while focused so ComfyUI's own shortcuts - queue prompt, canvas panning - don't fire mid-wave.

      What's actually in the machine

      • Destructible bunkers. Four shields sit between you and the formation, and both your shots and theirs chew holes in them. Clear a channel through your own cover and you'll regret it.
      • The four-frame march. The formation animates through four frames, each tied to its own WAV, gated by a step timer that speeds up as invaders die - so the sound is the difficulty signal, which is a nice bit of fidelity for a browser mini-game.
      • A UFO. Every so often it crosses the top and is worth 150 points, which is more than any two invader rows combined.
      • Points by row: 30 for the top row, 20 for the middle, 10 for the bottom. Clearing a full wave pays a 500-point bonus.
      • Losing conditions that matter: three lives, but if the formation reaches the bottom it's an instant game over regardless of how many you had left. You also can't let one land on your turret - same result.

      High score lives in localStorage as comfySpaceInvadersHighScore, so it's per browser and per origin, not per machine.

      Install

      ComfyUI Manager → search URN Arcade, install, restart. Or by hand:

      cd ComfyUI/custom_nodes
      git clone https://github.com/Clivey1234/Comfy-URN-Arcade-Games.git
      

      Restart ComfyUI afterwards, because frontend extensions are only picked up at startup. There's no requirements.txt, no pyproject.toml, no install.py, and no model downloads - the README's "No Requirements needed" holds up in the repo, which is worth appreciating given how often a node pack quietly rewrites your Python environment.

      Sound, and swapping it out

      Sounds/SpaceInvaders/ ships the full set: shoot.WAV, alien_move_1 through _4, alien_hit.WAV, player_death.WAV, ufo.WAV, level_complete.wav. They're served from a route the pack registers on the ComfyUI server with no-cache headers, so replacing a file with your own (keep the name) takes effect on a refresh - and updates are designed to skip the Sounds folder so git pull won't wipe your edits.

      Missing file, or the browser hasn't seen a click yet? The code falls back to synthesised oscillators rather than silence, using the four march pitches at 92/78/66/55 Hz. The SND button and volume slider remember your setting - and there's a comfySpaceInvadersV10AudioFix flag in localStorage, a fossil of a past audio fix, which is a decent sign this specific game has had real iteration.

      Where people hit trouble

      • An empty node means an old frontend. Without addDOMWidget it retries for two seconds and logs addDOMWidget unavailable after 2 seconds. Update ComfyUI.
      • Nodes 2.0. ComfyUI's Vue-based node rewrite moved rendering off the LiteGraph canvas and broke plenty of canvas-patching packs, DOM-widget games included. If the widget draws wrong or the node juggles itself on zoom, try the legacy canvas.
      • Space bar queuing your prompt instead of firing: the game doesn't have focus. Click it once; that also unlocks audio, which browsers block until there's a user gesture.
      • Chrome and Edge only - the README says so plainly. Firefox and Safari are untested.
      • Dead code in web/. The pack also ships comfy_space_invaders.js, an older version watching for a node named ComfySpaceInvadersSPB1234T. It does nothing unless that older node exists. Console chatter, not a bug.
      CategoryURN Arcade Games

      Inputs (0)

      No inputs

      Outputs (0)

      No outputs