Debug a creative coding sketch visually
Use temporary visual evidence to locate errors in generative artwork, separating drawing state, geometry, and changing values before adding more complexity.
Make the hidden construction visible
A creative sketch can run without errors and still draw the wrong thing. Visual debugging makes the hidden construction visible: origins, bounds, sample points, paths, and intermediate values. Treat those marks as removable scaffolding, not as an admission that the artwork has failed.
Add construction points and local origins
Build a debug switch that draws cell boundaries, local origins, or particle directions. Label just a few representative objects. Freeze animation while inspecting geometry. Then isolate one object and draw it with fixed values before restoring the complete generated system.
Write down the current setting for debug information density before making a second interpretation of the idea. Keep the ordinary state beside the most extreme intended state. The useful boundary is where the relationship remains understandable, rather than where the tool stops allowing a larger value. Check both ends before filling the middle. A useful acceptance check is whether the diagnostic marks answer one question without obscuring the geometry. Judge that at the intended viewing size or working distance, where tiny construction mistakes and exaggerated effects can have very different consequences.
Match symptoms to state or geometry
When every object after a certain point is displaced, inspect transformations and style state. When one object is wrong, inspect its data. When the entire drawing changes between refreshes, stabilize random inputs before comparing outputs. Different symptoms call for different kinds of evidence.
To locate a fault, inspect the part of the result most directly affected by debug information density. Temporarily show construction points and intermediate values. Reduce repeated elements to a handful and pause anything that changes over time.
Break and repair a six-house ring
Deliberately introduce a missing restored transformation into a small repeated drawing. Predict which later objects will move incorrectly, then reveal their origins. Repair the problem and describe why that specific evidence located it.
Arrange a small experiment with origins only, origins with bounds, and selected numeric labels, keeping its other decisions consistent. Predict one consequence before each trial, then compare that prediction with the actual result. Record a surprise in plain language and identify the part of the construction that could explain it. This turns a set of variations into information you can use in a later, more ambitious piece.
Use a deliberately wrong local axis
In the six-house example, draw the local horizontal axis in a bright temporary color before drawing each house. Add an origin dot at the same local zero point. If the house is misplaced but the axis is correct, inspect the house's own coordinates. If both move together, inspect translation and rotation. That distinction reduces the search area immediately and avoids rewriting correct geometry to compensate for a faulty transformation.
Six houses and their local axes
Create a ring of six tiny houses, each translated and rotated around a shared center. In debug mode, show each local horizontal axis. A roof facing the wrong direction becomes easy to diagnose when its axis is visible beside it.
References & further reading
Examples and exercises in this guide are original teaching scenarios.
