Story

Show HN: Circuit Artist –Circuit simulator with propagation animation and rewind

rafinha Wednesday, December 31, 2025

Hello,

Circuit Artist is a game about drawing digital circuits as pixel art — like MS Paint, but pixels are wires and little triangles are NANDs. Hit play and the simulation runs in real time. It's fully white-box: every wire's state is visible.

I launched it last year with a unit-delay simulation that ran until convergence on each update. It worked, but I realized it had some fundamental problems:

(i) It hid what was actually happening. Players couldn't tell the difference between a ripple carry adder and a look-ahead adder — everything just resolved instantly.

(ii) Design bugs became "game bugs." When players had non-converging wires (like A = not(A)), the game couldn't explain why or where the error was.

(iii) Layout didn't matter. A NAND on one side of the map would instantly propagate to the opposite side, making spatial decisions meaningless. Unit delay probably works better for schematic-based simulators like Logisim, not a layout-focused game like this.

(iv) Propagation visualization couldn't be added on top of the unit-delay engine — there was no notion of direction or distance.

So I rebuilt the engine with variable-delay event-based simulation using an adaptation of Elmore delay. The delay for each wire depends on distance and fanout — longer wires are slower, higher fanout adds delay, branching wires are faster.

For the implementation: I compute Elmore delay over wire trees. Each pixel has resistance and capacitance, with NAND inputs as nodes to account for fanout. For non-tree wire graphs, I build a Dijkstra-based spanning tree (driver as root) and interpolate for edges outside the tree. I calculate the delay for each node and project it back to the image so every pixel has a distance.

This lets me animate propagation with a glow effect during simulation. The shader knows when each wire was triggered, the current time, and the Elmore distance of each pixel, so it resolves state per-pixel in real time.

On top of that:

- Time rewind: the simulation is now delta-based, so players can freeze and scrub backwards to debug. Super useful for cyclic circuits.

- Layers: since timing matters now, I added up to 3 layers. NANDs only go on the bottom layer, upper layers propagate faster (lower capacitance). Lets you route wires above dense NAND areas.

The game has a campaign for learning from scratch, though it's still incomplete and in progress. I'm working toward Steam Workshop support so people can create their own campaigns to teach different concepts or cover more advanced topics.

GitHub (full source): https://github.com/lets-all-be-stupid-forever/circuit-artist

Steam: https://store.steampowered.com/app/3139580/Circuit_Artist/

2 0
github.com
Visit article Read on Hacker News