<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: The Atomic Shift</title>
    <description>The latest articles on DEV Community by The Atomic Shift (@theatomicshift).</description>
    <link>https://dev.to/theatomicshift</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3392751%2Fd3bac408-a0d8-440a-96ac-87e59ec85610.png</url>
      <title>DEV Community: The Atomic Shift</title>
      <link>https://dev.to/theatomicshift</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/theatomicshift"/>
    <language>en</language>
    <item>
      <title>Closing the Loop: How Clockwork's Built-in AI Agent Uses Kane CLI to Verify the Games It Builds</title>
      <dc:creator>The Atomic Shift</dc:creator>
      <pubDate>Thu, 26 Nov 2026 17:47:53 +0000</pubDate>
      <link>https://dev.to/theatomicshift/closing-the-loop-how-clockworks-built-in-ai-agent-uses-kane-cli-to-verify-the-games-it-builds-17a9</link>
      <guid>https://dev.to/theatomicshift/closing-the-loop-how-clockworks-built-in-ai-agent-uses-kane-cli-to-verify-the-games-it-builds-17a9</guid>
      <description>&lt;p&gt;An AI agent inside a game engine can add objects, attach behaviors and write rules quickly. The agent's own report that it "added coins" doesn't prove the coins work. The proof is a player touching a coin in a real browser, the coin disappearing and the score going up by one.&lt;/p&gt;

&lt;p&gt;Clockwork is a 2D game engine that runs in the browser. Its built-in agent closes that loop. It edits the project through the same commands the editor uses. It then asks Kane CLI to play the result in a real browser and gets back a typed verdict with the exact values Kane read. This post walks through how that works, from the agent's modes to the Test Mode that makes a real-time game testable, and ends with a recorded run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three modes: Ask, Plan and Build
&lt;/h2&gt;

&lt;p&gt;The agent has three modes, defined in &lt;code&gt;shared/protocol.ts&lt;/code&gt;. You switch between them at the bottom of the chat.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ask&lt;/strong&gt; is read-only. The agent reads the live project and answers questions about it, such as which object is the player, what behaviors it has, and which rule raises the score. In Ask mode the agent never edits the project. It explains what it found and suggests edits you can request in Plan or Build.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plan&lt;/strong&gt; drafts a change without applying it. The agent calls &lt;code&gt;preview_commands&lt;/code&gt;, and Clockwork shows the change set in the chat and draws a ghost of the changed objects on the canvas. You click &lt;strong&gt;Apply&lt;/strong&gt; or &lt;strong&gt;Discard&lt;/strong&gt;. If the project changes before you decide, the preview is marked stale and can't be applied. Destructive changes, such as deleting objects or scenes, always come back as a preview first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build&lt;/strong&gt; applies the change. Each tool call shows as a card in the chat, so you can see which reads the agent made and what it applied.&lt;/p&gt;

&lt;h3&gt;
  
  
  The agent reads before it writes
&lt;/h3&gt;

&lt;p&gt;The agent's tools are defined in &lt;code&gt;shared/ai-tools.ts&lt;/code&gt;. Before it edits, it reads the live project with &lt;code&gt;get_scene&lt;/code&gt;, &lt;code&gt;search_entities&lt;/code&gt;, &lt;code&gt;inspect_entity&lt;/code&gt;, &lt;code&gt;get_variables&lt;/code&gt;, &lt;code&gt;get_game_test_profile&lt;/code&gt; and &lt;code&gt;capture_viewport&lt;/code&gt;. When it isn't sure of a command's arguments, it calls &lt;code&gt;list_commands&lt;/code&gt;, which returns every project command as a one-line signature.&lt;/p&gt;

&lt;p&gt;All writes go through &lt;code&gt;apply_commands&lt;/code&gt;. One call applies a batch of commands as &lt;strong&gt;one atomic transaction: one revision and one undo entry&lt;/strong&gt;. Every call carries an &lt;code&gt;expectedRevision&lt;/code&gt;. If the project has moved on since the agent read it, the batch is rejected rather than applied to a state the agent never saw. Agent edits use the same command registry as the editor, so they appear in the normal undo history. &lt;code&gt;undo_last_agent_change&lt;/code&gt; rolls back the agent's last transaction and refuses if you have edited since.&lt;/p&gt;

&lt;p&gt;The agent loop lives in &lt;code&gt;src/features/agent/useAgentSession.ts&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making a real-time game testable
&lt;/h2&gt;

&lt;p&gt;A browser agent can't reliably test a game that runs at 60 frames per second. By the time it reads the score, the player has moved. Clockwork solves this with &lt;strong&gt;Test Mode&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In Test Mode the game loads paused and advances only on request. The frame-stepping controller, &lt;code&gt;src/engine/runtime/test-controller.ts&lt;/code&gt;, never advances on wall time. The caller asks for an exact number of frames, and the runtime advances exactly that many. Inputs go through the same input path as normal play.&lt;/p&gt;

&lt;p&gt;The page shows three panels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Status:&lt;/strong&gt; PAUSED or running, the current FRAME, and the LAST ERROR.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check steps:&lt;/strong&gt; one button per planned step, labelled with the format from &lt;code&gt;shared/kane-check.ts&lt;/code&gt;: &lt;code&gt;RUN STEP n: &amp;lt;CONTROL&amp;gt; &amp;lt;frames&amp;gt; FRAMES&lt;/code&gt;. For example, &lt;code&gt;RUN STEP 1: MOVE RIGHT 45 FRAMES&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Observations:&lt;/strong&gt; readouts such as PLAYER X, PLAYER Y, COLLECTED, DESTROYED, DAMAGE EVENTS, ACCEPTED INPUTS, every variable and a count per tag.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4oqolfi0pohqt2jmiolp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4oqolfi0pohqt2jmiolp.png" alt="Meadow Sandbox in Kane Test Mode: paused at frame 0, with three RUN STEP buttons and the observation readouts" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Each step has a fixed frame count, and the snapshot runs with a fixed seed. A run with the same steps lands on the same frames every time, which makes it reproducible. The readouts are plain page text, so Kane reads them with DOM assertions (&lt;code&gt;--assertion-mode dom&lt;/code&gt;) and doesn't have to interpret pixels.&lt;/p&gt;

&lt;h3&gt;
  
  
  Every game gets a test profile
&lt;/h3&gt;

&lt;p&gt;Kane can only press controls and read values that the game exposes. A &lt;strong&gt;game test profile&lt;/strong&gt; lists them. Thirteen starters have hand-written profiles in &lt;code&gt;src/engine/model/game-test-profiles.ts&lt;/code&gt;. Every other game, including Blank projects, imported projects and games the agent builds, gets a profile derived from the project itself (&lt;code&gt;src/engine/model/derived-test-profile.ts&lt;/code&gt;). The derived profile relabels the six logical actions as controls (MOVE LEFT, MOVE RIGHT, MOVE UP, MOVE DOWN, JUMP and ACTION). Its readouts come from state the runtime already tracks: status, player position, every variable, tag counts and event counts. Every game therefore has a Test Mode, and the profile only observes the game without changing how it plays.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two-stage verification
&lt;/h2&gt;

&lt;p&gt;The agent checks a mechanic with &lt;code&gt;verify_with_kane&lt;/code&gt;. A check is a title, up to six steps and a list of expectations. For example: hold MOVE RIGHT for 45 frames, then expect &lt;code&gt;score&lt;/code&gt; to equal 1 and &lt;code&gt;coin-count&lt;/code&gt; to have changed.&lt;/p&gt;

&lt;p&gt;Verification runs in two stages:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Simulator first.&lt;/strong&gt; Clockwork runs the steps in the engine simulator, using the same inputs through the same runtime, and compares the readouts with the expectations. If an expectation fails here, Kane doesn't run. The agent gets the simulator's values and can adjust the game or the check, for example by adding frames, a jump, or moving the coin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Kane in a real browser.&lt;/strong&gt; When the simulator agrees, Clockwork publishes a snapshot and Kane CLI runs once against it. &lt;code&gt;server/kane/runner.ts&lt;/code&gt; starts &lt;code&gt;kane-cli run --agent&lt;/code&gt; with &lt;code&gt;--assertion-mode dom&lt;/code&gt; and reads Kane's NDJSON event stream. Kane clicks each RUN STEP button once, in order, and stores the readouts.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Clockwork then compares Kane's stored values with the expectations itself, in &lt;code&gt;judgeCheck&lt;/code&gt; (&lt;code&gt;shared/kane-check.ts&lt;/code&gt;). The result is typed, with a status and one outcome per expectation. It streams back into the chat as a verification card through &lt;code&gt;src/features/agent/kane-check-session.ts&lt;/code&gt;. A &lt;strong&gt;PASSED&lt;/strong&gt; card means the simulator and the real browser agree on every readout. The agent reads the same typed result, so its reply is based on the values Kane recorded.&lt;/p&gt;

&lt;h2&gt;
  
  
  Walkthrough: coins in Meadow Sandbox
&lt;/h2&gt;

&lt;p&gt;Meadow Sandbox is a starter built for this kind of experiment. It has the Clockwork Meadows look and feel and no gameplay content: Marlow the player, the parallax meadow, one unbroken floor and three easy ledges. It has no coins, enemies, hazards, checkpoints, goal, variables or HUD, so anything the agent adds is easy to see. Start a fresh Meadow Sandbox project, open the agent in &lt;strong&gt;Build&lt;/strong&gt; mode and send:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Add collectible coins, drawn as simple gold circles, along the player's path, starting along the ground and using the tag coin. When the player touches a coin, it should disappear and the score should increase by one. Display the score in the HUD. After implementing it, verify with Kane that touching a coin removes it and increases the score by one.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Recorded run &lt;code&gt;a20a4b28&lt;/code&gt; asked the agent for the same mechanic: coins tagged &lt;code&gt;coin&lt;/code&gt;, +1 score per coin, a SCORE HUD and a Kane check. Here is what the agent did:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build.&lt;/strong&gt; It applied 6 coins, a &lt;code&gt;score&lt;/code&gt; variable and a Score HUD widget through &lt;code&gt;apply_commands&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preflight.&lt;/strong&gt; It ran a headless check of the change.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify.&lt;/strong&gt; It called &lt;code&gt;verify_with_kane&lt;/code&gt; with a check that holds MOVE RIGHT for 45 frames.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The simulator agreed, so Kane ran once in a real browser. The check &lt;strong&gt;PASSED&lt;/strong&gt; at project revision 9, and the simulator and browser agreed on every readout:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Readout&lt;/th&gt;
&lt;th&gt;Before&lt;/th&gt;
&lt;th&gt;After&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SCORE&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;COIN COUNT&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;COLLECTED&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PLAYER X&lt;/td&gt;
&lt;td&gt;240&lt;/td&gt;
&lt;td&gt;473.67&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The table shows the whole mechanic. The player moved right, touched one coin, the coin left the scene and the score rose by exactly one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reviewed test plans
&lt;/h2&gt;

&lt;p&gt;Some goals need more than one check. Clockwork supports that with a test plan that you review before Kane runs anything.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;propose_test_plan&lt;/code&gt;&lt;/strong&gt; drafts a bounded plan for the open project. Each phase uses only the controls and readouts in the game's test profile. Clockwork validates the plan against the profile, the project revision and fixed budgets for phases, steps, wall time and frames. Proposing a plan never runs Kane and never edits the project.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;You approve it.&lt;/strong&gt; The plan appears in the AI Testing review panel, and nothing runs until you approve it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;run_kane_test_phase&lt;/code&gt;&lt;/strong&gt; runs exactly one approved phase through Kane in Test Mode. It returns a typed verdict (passed, failed, inconclusive or cancelled) with the actual value for each assertion, the accepted-input count and an evidence bundle. The verdict goes back to the agent, which reports it against your original goal and decides whether another phase is needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;On Space Shooter, the agent-driven phase &lt;code&gt;b967bbdd&lt;/code&gt; passed in 79.7 s. It recorded shots-fired 3, projectiles 3 and 1 accepted input over 45 frames. Two phases approved with the panel's Approve button, &lt;code&gt;98e21783&lt;/code&gt; and &lt;code&gt;ea1bb3b3&lt;/code&gt;, passed in 94.7 s and 78.1 s, each with a typed verdict per criterion and an evidence bundle.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI Play
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Play&lt;/strong&gt; is for you. &lt;strong&gt;AI Play&lt;/strong&gt; is the second Play button, and it sends Kane in to play the game. The editor saves the project and publishes a snapshot. Kane then plays that snapshot through a visible AI HUD while the panel streams each step.&lt;/p&gt;

&lt;p&gt;If the run fails, Clockwork's repair policy looks for a specific content problem: a collectible whose bounds overlap a solid body, where the player can never reach it. The policy moves the collectible above the body with one &lt;code&gt;object.update&lt;/code&gt; command, which records one undo entry. Clockwork then publishes a new snapshot and runs Kane again with the same seed.&lt;/p&gt;

&lt;p&gt;We tested this with a deliberately broken level: a coin buried inside the ground. Kane caught the broken level and the loop repaired it. The first run (&lt;code&gt;c062a3d4&lt;/code&gt;) failed, the repair moved the coin, and the rerun (&lt;code&gt;159ac555&lt;/code&gt;) passed. On the Neon Runner demo, the second attempt finished with &lt;code&gt;COINS 3&lt;/code&gt; and &lt;code&gt;STATUS WON&lt;/code&gt;. Each repair is a single undo entry, so you can review it and undo it like any other edit.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Source code:&lt;/strong&gt; &lt;a href="https://github.com/tope-olajide/clockwork" rel="noopener noreferrer"&gt;https://github.com/tope-olajide/clockwork&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demo video:&lt;/strong&gt; &lt;a href="https://youtu.be/ybe9e93r4SU" rel="noopener noreferrer"&gt;https://youtu.be/ybe9e93r4SU&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>gamedev</category>
      <category>testing</category>
    </item>
    <item>
      <title>Building Clockwork: An AI-Native 2D Game Engine Verified End-to-End with Kane CLI</title>
      <dc:creator>The Atomic Shift</dc:creator>
      <pubDate>Thu, 26 Nov 2026 17:44:22 +0000</pubDate>
      <link>https://dev.to/theatomicshift/building-clockwork-an-ai-native-2d-game-engine-verified-end-to-end-with-kane-cli-3j2n</link>
      <guid>https://dev.to/theatomicshift/building-clockwork-an-ai-native-2d-game-engine-verified-end-to-end-with-kane-cli-3j2n</guid>
      <description>&lt;p&gt;Making a small 2D game usually means juggling several tools. You lay out the level in one place, tune physics and behaviors in code, build the HUD somewhere else, and playtest by hand. Each hand-off loses context, and "does it still work?" gets answered by clicking around.&lt;/p&gt;

&lt;p&gt;Clockwork is a 2D game engine that runs in the browser and keeps all of that in one app. You build scenes, attach behaviors, write rules, design the HUD, play the game, and share it from the same window. Kane CLI then drives that same app in a real Chrome browser to prove the editor and the games work end to end.&lt;/p&gt;

&lt;p&gt;We built Clockwork during the KaneCLI Online Hackathon. This post covers the engine itself and how Kane CLI tests it. A companion post covers the built-in AI agent and how it uses Kane to verify the games it builds.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbktzn1cqo9u6c1iq2ztf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbktzn1cqo9u6c1iq2ztf.png" alt="The Clockwork Projects page" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inside the engine
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Scenes, layers and parallax
&lt;/h3&gt;

&lt;p&gt;A Clockwork project holds one or more scenes. Each scene has a world size, a background and an ordered stack of layers. Every layer has its own opacity and its own parallax factors on X and Y, so a distant sky can scroll slower than the ground the player runs on.&lt;/p&gt;

&lt;p&gt;Clockwork Meadows, the showcase starter, uses four layers: &lt;strong&gt;Sky&lt;/strong&gt;, &lt;strong&gt;Mountains&lt;/strong&gt;, &lt;strong&gt;Forest&lt;/strong&gt;, and &lt;strong&gt;Meadow and actors&lt;/strong&gt;. Its world is 18,400 × 1,200 pixels and holds 227 objects. Camera follow keeps the player in view across that width. Fixed-screen games shrink to fit instead, so the whole playfield stays visible in a smaller window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxcq6aj1qberef44nsbwo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxcq6aj1qberef44nsbwo.png" alt="The Clockwork Meadows scene in the editor, with the layer stack, hierarchy and the Inspector showing the player's behaviors" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Behaviors
&lt;/h3&gt;

&lt;p&gt;Clockwork ships 27 composable behaviors, defined in &lt;code&gt;src/engine/model/behavior-catalog.ts&lt;/code&gt;. You attach them to objects in the Inspector and tune their parameters, and every parameter shows its default with a Reset button. They include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Movement:&lt;/strong&gt; platformer-controller, top-down-controller, rotate-thrust, flap, mover, snake.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enemies:&lt;/strong&gt; patrol, follow, formation, stompable, melee.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Game objects:&lt;/strong&gt; collectible, hazard, checkpoint, exit-gate, spawner.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Combat:&lt;/strong&gt; health, shooter, projectile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Arcade:&lt;/strong&gt; ball, paddle, ai-paddle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Timing and camera:&lt;/strong&gt; timer, countdown, camera-follow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A behavior is a small, focused unit. The Meadows player, Marlow, combines a platformer controller (speed 340 px/s, a 135 ms jump buffer, a tuned jump cut) with camera follow. A coin is just an object with collectible. You build new mechanics by combining behaviors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rules, variables and HUD widgets
&lt;/h3&gt;

&lt;p&gt;Behaviors cover moment-to-moment play. Rules cover game logic. A rule pairs a list of conditions (overlap, input, timer, scene start, variable) with a list of actions (set, add to or toggle a variable, spawn a prefab, destroy, play a sound, show a message, change scene). That's enough to say "when the player overlaps a coin, add 1 to score and destroy the coin" without code. Variables hold game state such as score, lives or shards, and HUD widgets bind to them so the screen always shows the live value. Rules and variables live in the editor's &lt;strong&gt;Logic&lt;/strong&gt; tab. Look, animation, audio and UI live in &lt;strong&gt;Presentation&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prefabs, undo and redo
&lt;/h3&gt;

&lt;p&gt;Prefabs let you define an object once and stamp out copies. Every edit goes through one command registry. The editor footer states the contract: "One completed gesture = one revision and one undo entry." Dragging an object, changing a field or applying a batch of changes therefore always undoes as a single step.&lt;/p&gt;

&lt;h3&gt;
  
  
  Starters
&lt;/h3&gt;

&lt;p&gt;You can start a project from Blank, from one of three classic templates (Platformer, Top-down, Puzzle), from a written brief, or from one of 14 genre starters:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Space Shooter, Space Invaders, Asteroid Field, Ping Pong, Brick Breaker, Flappy Flyer, Platform Jumper, Clockwork Meadows, Meadow Sandbox, Endless Runner, Arena Survival, Falling Objects, Maze Escape and Snake.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Each starter is built from the same behaviors, rules and HUD widgets you use in your own projects, so you can open any of them and change how it works.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4rrpnaqv92bsxnd5xjla.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4rrpnaqv92bsxnd5xjla.png" alt="The New Project dialog showing game starters, including Clockwork Meadows" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Clockwork Meadows is the largest. You run the meadow, stomp dragons, light checkpoints, collect sun shards and reach the summit camp. Press Play and the four layers scroll at their own rates behind the player.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyigsvhye6f9x4n4nr35g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyigsvhye6f9x4n4nr35g.png" alt="Clockwork Meadows in Play, with the parallax layers, the STAGE, SCORE, LIVES and SHARDS HUD" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Share and ship
&lt;/h2&gt;

&lt;p&gt;When a game is ready, the &lt;strong&gt;Ship&lt;/strong&gt; panel publishes it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Share links.&lt;/strong&gt; Clockwork freezes the current project into a read-only snapshot served at &lt;code&gt;/s/:snapshotId&lt;/code&gt; (&lt;code&gt;src/routes.tsx&lt;/code&gt;). Anyone with the link plays that exact version, and later edits in the editor don't change it. You choose how long the link lives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zip export.&lt;/strong&gt; Clockwork packages the game and its assets as a standalone static build (&lt;code&gt;src/engine/io/build.ts&lt;/code&gt;) that you can host on any static web server.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Project file.&lt;/strong&gt; The whole project also exports as &lt;code&gt;.clockwork.json&lt;/code&gt;, which the New Project dialog can import.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Snapshots also matter for testing. AI Play and the agent's Kane checks run against a snapshot rather than the live editor, so the version under test can't change mid-run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Kane CLI tests the engine end to end
&lt;/h2&gt;

&lt;p&gt;Unit tests cover the engine's logic: &lt;code&gt;pnpm test&lt;/code&gt; runs 176 tests across 27 files, and all 176 pass. Unit tests can't show that a person can open the app, build a game and play it. Kane CLI covers that.&lt;/p&gt;

&lt;p&gt;Clockwork keeps a saved Kane test at &lt;code&gt;.testmuai/tests/engine-template-e2e_test.md&lt;/code&gt;. It is a plain Markdown file with a short front-matter block (&lt;code&gt;mode: testing&lt;/code&gt;, &lt;code&gt;max_steps: 50&lt;/code&gt;, &lt;code&gt;timeout: 480&lt;/code&gt;, &lt;code&gt;target: chrome&lt;/code&gt;) and one step written in plain English. In that step Kane:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Opens Clockwork and creates a project named "Engine E2E Platformer" from the &lt;strong&gt;Platform Jumper&lt;/strong&gt; starter.&lt;/li&gt;
&lt;li&gt;Checks that the scene canvas and the Scene hierarchy are visible.&lt;/li&gt;
&lt;li&gt;Selects the "Jumper" row in the hierarchy and records its &lt;strong&gt;Object Y&lt;/strong&gt; in the Inspector.&lt;/li&gt;
&lt;li&gt;Presses ArrowUp twice to nudge the object, then Control+Z twice, and checks that Object Y is back to the recorded value.&lt;/li&gt;
&lt;li&gt;Presses &lt;strong&gt;Play&lt;/strong&gt; and checks for the game canvas and the CORES and LIVES HUD labels, with LIVES reading 3.&lt;/li&gt;
&lt;li&gt;Presses Space and checks that LIVES still reads 3.&lt;/li&gt;
&lt;li&gt;Presses &lt;strong&gt;R&lt;/strong&gt; to restart and checks the HUD again, with LIVES at 3.&lt;/li&gt;
&lt;li&gt;Returns to the editor and checks that the project is still open with its canvas and hierarchy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One flow covers project creation, the hierarchy, the Inspector, keyboard editing, undo, Play, the HUD, restart and the return to the editor.&lt;/p&gt;

&lt;p&gt;Run it with one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="n"&gt;pnpm&lt;/span&gt; &lt;span class="n"&gt;kane&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;e2e&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;scripts/kane/engine-e2e.mjs&lt;/code&gt; runs the saved test through &lt;code&gt;kane-cli testmd run&lt;/code&gt;. It prints one compact JSON result and keeps the raw NDJSON stream, a result summary and the evidence pack under &lt;code&gt;.testmuai/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The first authored run passed in 286 s. A later run of the one-command variant, &lt;code&gt;pnpm kane:engine-e2e:dev&lt;/code&gt;, started the app from cold, replayed the saved step and passed in 89 s. For this post we ran &lt;code&gt;pnpm kane:engine-e2e&lt;/code&gt; again. It passed 1 of 1 steps, replayed, in 134 s (session &lt;code&gt;c6bc88c1&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6p32skviguylq2optcb7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6p32skviguylq2optcb7.png" alt="Terminal output of pnpm kane:engine-e2e showing status passed, 1/1 steps" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Because the test is a Markdown file in the repo, it is versioned with the code, can be reviewed in a pull request, and runs again with the same command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Layout precision: Clockwork's HUD audit
&lt;/h2&gt;

&lt;p&gt;Kane reads Clockwork's HUDs as page text and clicks their buttons, so those panels have to stay clear of each other. Clockwork has its own layout audit for this, separate from Kane: &lt;code&gt;pnpm test:hud&lt;/code&gt; (&lt;code&gt;scripts/kane/hud-overlap-check.mts&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;The audit connects to Chrome over the DevTools protocol. It builds every template and starter, publishes each one as a snapshot, and opens it in three player modes: real-time play, manual Test Mode, and Test Mode with planned check steps. It opens each mode at two viewport sizes, 1280×800 and 1024×640. On every page it checks two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Every button and input can be clicked.&lt;/strong&gt; It hit-tests each control at its centre and at four inset points, and the element under each point must be the control itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No two HUD panels overlap.&lt;/strong&gt; This covers the AI and Test Mode readouts, control groups, the game's own HUD widgets, the "Made with Clockwork" badge and the PAUSED/Restart pill.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Our run printed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;108/108 layouts clean.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is 18 starting points × 3 modes × 2 viewports. The audit also writes a full report to &lt;code&gt;.data/hud-overlap/report.json&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;Clockwork puts a 2D game engine, its editor and its verification in one browser app. Its runtime, physics, 27 behaviors, rules, HUD widgets and Test Mode are built for that workflow. Kane CLI proves the main editor path in a real browser with a saved test you can rerun anytime. The companion post shows how Clockwork's built-in agent uses Kane to check the games it builds.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Source code:&lt;/strong&gt; &lt;a href="https://github.com/tope-olajide/clockwork" rel="noopener noreferrer"&gt;https://github.com/tope-olajide/clockwork&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Demo video:&lt;/strong&gt; &lt;a href="https://youtu.be/ybe9e93r4SU" rel="noopener noreferrer"&gt;https://youtu.be/ybe9e93r4SU&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>gamedev</category>
      <category>showdev</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
