Atomis Development Blog

I Rewrite the Game While It Is Still Running

Three changes to a running game in about a minute. No restart, no rebuild, no lost state. Same process the whole time.

What happens

The game loop has one extra line. F6 hits STOP. The jdBasic VM parks at the next safe opcode, the last frame stays on screen, every variable stays in memory.

Claude gets that parked VM over MCP. Not the source on disk.

Two kinds of change

"Turn the ship red and give me 100 lives" is one jdb_eval against the live VM:

g_palette{"player"} = [255, 80, 80] : lives = 100

"Move the shield bar 20 pixels up" is a source edit, then jdb_recompile:

 SUB draw_shield_bar()
     DIM bw AS INTEGER = 200
     DIM bxs AS INTEGER = 16
-    DIM bys AS INTEGER = SCR_H - 24
+    DIM bys AS INTEGER = SCR_H - 44

1952 lines re-parsed, FUNC and SUB bodies swapped into the live VM, module-level DIMs deliberately not re-executed. Score 8051, level 4, wave 3 of 5, same enemies on the same trajectories, shield bar 20 pixels higher.

"Let me shoot rainbow bullets" is the same again.

Not hot reload

Hot reload keeps the process and drops the state, or keeps the state because you wrote serialisers for it. Nothing is serialised here. Nothing leaves memory. Merge the code, leave the data.

VB6 did this

I had a VB6 phase. Stop the program, edit the code, carry on. Edit and Continue. Coding on the open heart.

Microsoft dropped it and everyone went back to edit-build-run.

jdBasic was always meant to be a small dirty language that still does it. MCP only changes who types.

The integration

IMPORT CLAUDE_LIVE, 154 lines, one branch in the loop:

IF CLAUDE_LIVE.pause_pressed() = 1 THEN
    draw_paused_frame() : SCREENFLIP
    STOP                              ' Claude takes over via MCP
    CLAUDE_LIVE.refocus()             ' focus snaps back to the game
    DO
        draw_paused_frame() : SCREENFLIP : SLEEP 30
    LOOP UNTIL CLAUDE_LIVE.unpause_held() = 1
ENDIF

F6 or gamepad Start trips it. Space resumes. About 700 lines of C++ underneath carry the pause, swap and resume.

Try it

The Vibe-Game Pack on the releases page ships the shooter and the harness, nothing to install. doc/MCP.md wires the server into Claude Code, Claude Desktop, Cursor or anything else that speaks MCP.

Recorded on Windows. The focus grab on resume is Win32, the rest is not.

jdbasic.org, source at github.com/AtomiJD/jdBasic.

← Back to all posts