One-shot a retro game with GLM 5.2
One prompt to OpenCode, a terminal coding agent pointed at Venice's GLM, writes a playable game core in a single HTML file. A few more prompts finish it. The whole thing runs private on an open-weight model and stays on your own machine, so your code never leaves your disk and nobody can take the model offline.
Who this is for
You like to build and you care about owning what you make. By the end you'll have a playable retro game in one HTML file: a core one-shot from a single prompt, then leveled up into a finished game, all in OpenCode pointed at Venice's GLM.
Pick the brain: GLM 5.2 on Venice
On Venice, GLM is the family the platform reaches for by default for "smartest" and for tool use, so you don't have to guess. The newest is GLM 5.2 (zai-org-glm-5-2), an open-weight model under an MIT license that excels at agentic and long-horizon coding. Venice runs it private with zero data retention, so your prompt and your code aren't logged or used to train anything.
GLM 5.2 can handle up to a 1M-token context upstream. On Venice it runs with a 200K context, which is plenty for one HTML file and the level-up loop.
The steps
- Point OpenCode at Venice. OpenCode is a terminal agent that writes the file, runs it, and fixes its own bugs. Install it (
npm i -g opencode-ai), add the Venice provider inopencode.json(below), set your key, and launch in a new project folder. - One-shot the core. Give OpenCode the prompt (below); it writes
game.html. Open it and play. Ask for the core only (controls, the core rule, score, lives, restart), because a tight core is reliable and easy to verify. You'll add the rest next. - Level it up, one step at a time. Add the start and win screens, then a level, a power-up, sound, a saved high score, and finally wrap it in a retro CRT shell. Run after each change and let OpenCode fix anything that breaks.
- Ship it. It's one HTML file: open it offline, host it anywhere (Netlify Drop, itch.io, GitHub Pages), or send it to a friend.
Point OpenCode at Venice
Put this in opencode.json in your project folder (or ~/.config/opencode/opencode.json):
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"venice": {
"npm": "@ai-sdk/openai-compatible",
"name": "Venice",
"options": {
"baseURL": "https://api.venice.ai/api/v1",
"apiKey": "{env:VENICE_API_KEY}"
},
"models": {
"zai-org-glm-5-2": { "name": "GLM 5.2", "limit": { "context": 200000 } }
}
}
},
"model": "venice/zai-org-glm-5-2"
}
Get a key at Venice under API settings, then export it, move into a new project folder, and launch:
export VENICE_API_KEY=your_key_here
mkdir my-game && cd my-game
opencode
Any OpenAI-compatible tool (Aider, Cline, an SDK) works the same way with that base URL, model, and key. OpenCode is just the one shown here.
The one-shot prompt (core only)
Give this to OpenCode. Swap the bracketed parts for your game:
Build the CORE of a playable [GAME TYPE] as ONE self-contained HTML file named game.html.
Core only (we'll add more later; no menus, levels, or sound yet):
- [CONTROLS]. [CORE RULE]. A live score, [N] lives, and "press space to restart" when lives run out.
Hard constraints:
- A single .html file. No external libraries, CDNs, fonts, images, or audio files. Everything inline (HTML + CSS + vanilla JS, <canvas> for the game).
- It must run by just opening the file in a browser. No build step, no server.
Look and feel (retro arcade):
- A single [PHOSPHOR COLOR] on near-black palette. No other colors.
- A blocky monospace font feel (CSS monospace stack, no web fonts).
- Center the game on a plain dark background.
Then open the file and confirm it runs.
Level it up
Stay in the same OpenCode session and give it one instruction at a time. Open the file and play after each. Start by adding back what the core left out:
For a bigger change (a boss, multi-ball, a new mode), just say so in one clear instruction and let OpenCode run and fix it.
Tips and common pitfalls
- Scope plus constraints beats clever wording. "Just the core, one file, nothing external" does the heavy lifting.
- If it won't run, let OpenCode run it and fix the error. That's the point of using an agent. Still stuck? Drop to a simpler game; Snake and Pong are easier than a brick-breaker.
- Iterate in small steps. One change, run it, keep what works, then the next. That beats asking for the whole game at once.
- It's yours. OpenCode works on a local file and GLM 5.2 runs private on Venice, so the game and the code stay on your machine the whole time.
It's an open-weight model built for agentic, long-horizon coding: it holds the whole file in context, plans multi-step changes, and works through a tool loop. Open weights mean no vendor can pull it offline, and on Venice it runs fully private.