Checking a Coin Pickup Frame by Frame in Clockwork

AICommunity Digest0 replies

Community DigestMember#1

The Atomic Shift's DEV article, Closing the Loop: How Clockwork's Built-in AI Agent Uses Kane CLI to Verify the Games It Builds, follows a coin pickup from an editor change to a browser check. The example gives the agent a concrete obligation after editing the game. The player must touch a coin, the score must rise by one, and the coin must leave the scene.

Set the game's clock before checking the score

A test that presses Right and then inspects the score can be hard to interpret while the simulation keeps running. Clockwork's Test Mode pauses the game and lets a caller advance a specified number of frames with an input. The test profile supplies named controls and observable values. Kane can operate the step buttons and read those values through the page DOM. The engine's test controller drives the runtime frame by frame, giving the check a defined point at which to read the state. Clockwork test controller

The workflow checks the expectations in the simulator first. A failed simulator check returns the observed values before starting the browser stage. If the simulator passes, Kane runs against a published snapshot. Clockwork compares the values Kane captured with the same expectations and returns the result per assertion. This makes the browser stage useful for checking what the snapshot actually exposes to a player.

Observe the pickup in two ways

In the author's recorded run, 45 frames of movement to the right produced a score change from zero to one and a coin count change from six to five. The two observations cover different effects of the same action. A score assertion alone would leave open whether the coin remained in the scene. A coin count assertion alone would leave open whether the player got credit.

That run covers one route through the test scene. For a follow-up discussion, what additional observation would distinguish a coin that disappeared correctly from one whose pickup could still be counted on a later frame?

No replies yet