Skip to content

Code Lab

OpenGame Explained: Remix a Game Template and Test What Still Works

By Miles Park·
GitHub preview of nexu-io/opengame

CODE LAB · PROJECT SPOTLIGHT

OpenGame TypeScript · Apache-2.0

Remix a playable template and use repeatable tests to check the changes.

Preview: GitHub · nexu-io/opengame

OpenGame gives coding agents a library of playable browser templates. Pick a template with the controls and rules you want, change its art or settings, then use repeatable inputs to check whether the game still behaves as intended. The distinction matters when a new asset changes how a player reads a screen while the old controls still feed the game the same events.

OpenGame Studio showing the template gallery beside a playable Harbor Skirmish preview
OpenGame contributors’ Game Studio screenshot. The left panel lets you pick a template. The right panel shows the selected title and its on-screen controls before editing. Original project image.

Choose what the remix should preserve

Open the Game Studio gallery from the URL printed by the local setup. Rooftop Roast is a useful starting point because the template already specifies a goal: collect five coffee beans and land on the café roof. Its metadata lists separate keyboard and mobile controls. For a café rebrand, ask the agent to change the shop name and palette and leave the controls and win condition intact. Try movement, collection, and landing before and after the edit. The template ships an HTML entry point and separate metadata. Pinned Rooftop Roast metadata.

Read the simulation route validator

OpenGame’s simulator can use an idle route, a template’s reference route, or an explicit action sequence. The validator below checks action intervals and object shape before the simulator consumes the route. At each starting tick it adds one active action, then subtracts it on the tick after the action ends. That makes the ending tick inclusive and catches too many actions that overlap.

nexu-io / opengameTypeScript · source excerpt
TS  game-projects.ts
export function validateSimulationRoute(value: unknown): GameSimulationStep[] {  if(!Array.isArray(value)||value.length>1000)throw new GameError('Simulation route must contain at most 1000 steps', 400, 'GAME_SCRIPT_INVALID', false);  for(const step of value){    if(!step||!Number.isInteger(step.fromTick)||!Number.isInteger(step.toTick)||step.fromTick<1||step.toTick<step.fromTick||step.toTick>10000)throw new GameError('Route ticks must be inclusive integers within 1–10000', 400, 'GAME_SCRIPT_INVALID', false);    if(!step.action||typeof step.action!=='object'||Array.isArray(step.action))throw new GameError('Simulation action must be a JSON object', 400, 'GAME_SCRIPT_INVALID', false);    const json=JSON.stringify(step.action);if(!json||json.length>8192)throw new GameError('Simulation actions must be JSON objects under 8 KiB', 400, 'GAME_SCRIPT_INVALID', false);  }  const edges=new Map<number,number>();for(const step of value){edges.set(step.fromTick,(edges.get(step.fromTick)??0)+1);edges.set(step.toTick+1,(edges.get(step.toTick+1)??0)-1);}  let active=0;for(const [,delta] of [...edges].sort((a,b)=>a[0]-b[0])){active+=delta;if(active>16)throw new GameError('At most 16 simulation actions per player per tick', 400, 'GAME_SCRIPT_INVALID', false);}  return JSON.parse(JSON.stringify(value));}
Lines 645–655 · commit c71618fView original on GitHub ↗

Source credit: OpenGame contributors. Apache-2.0 license.

Run one valid route and two malformed routes

For a generic platformer, use a route that contains one jump at tick 12. The exact action fields still belong to that game’s runtime. We ran the pinned validator in Node.js 24 with a minimal stand-in for its error class. We then moved the ending tick before the starting tick and supplied 17 actions on the same tick.

[{"fromTick":12,"toTick":12,"action":{"jump":true}}]
Route ticks must be inclusive integers within 1–10000
At most 16 simulation actions per player per tick

The first result means the route can proceed to a simulator. The failed cases were rejected before a game started. To check the finished remix, also run openmotion_game_playtest and try the documented controls in the browser. Verify the start screen, mobile layout, and a complete win condition. Our local run covered route validation only. Project tool reference.

What you need for a full playtest

The pinned setup guide lists Git with Git LFS, npm, and modern Node.js. The browser playtest needs the project’s supported browser setup. Generated images, music, or public cloud sharing may require a provider account or API key. The project’s local catalog publish action and public sharing are separate steps. Official setup guide.

For a broader workflow built around specialized design and review roles, see our Claude Code Game Studios walkthrough.

Discovery source from MINDUNG. Watch the original video on YouTube.

Join the discussion

Your email address will not be published. Required fields are marked *