Browser Game logo

Browser Game

Community
0xBakeer
browser-game

Building a 2D browser game (platformer, shooter, puzzle) - game loop with fixed timestep, keyboard input, tile collisions, camera, HUD, lives and win state.

Overview

Publisher0xBakeer
RepositoryTandemLLM
Skill namebrowser-game
Stars
75
Forks
14
Bundled files
Instructions only
LicenseAGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by 0xBakeer on GitHub. Read the source before you install it.

Installation

Install the Browser Game AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/0xBakeer/TandemLLM/tree/main/packages/library/browser-game
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/0xBakeer/TandemLLM.git /tmp/TandemLLM
mkdir -p .claude/skills
cp -r /tmp/TandemLLM/packages/library/browser-game .claude/skills/browser-game
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Browser Game in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Browser Game on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Browser Game is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Browser game

Rules:

  • Build in this order, running after each: tile grid rendered; player drawn; input moves it; gravity and ground collision; camera; one enemy; pit death and respawn; goal; HUD. Never all at once.
  • Fixed timestep: accumulate real time, step physics at 1/60 s, render once per frame.
  • Input is a set of keys from keydown/keyup on window; read the set in the update, never in the handler.
  • Collide per axis: move x, resolve against tiles, then move y, resolve. Set onGround only from the y resolve.

What goes wrong:

  • Player sinks or tunnels: velocity larger than a tile per step, or both axes resolved at once. Cap speed and resolve per axis.
  • Lives lost at start: spawn inside a tile, an enemy on the spawn, or death checked before the first step.
  • Jump never fires: onGround reset before the check, or the key handler consumed the press.

Check: play it through the browser tool: press Right for 1 s, read the state (x grew, y stable, onGround true), jump, read the state at 3 points, walk to the goal with inputs only, screenshot start, middle, end.

Done when:

  • A playthrough from spawn to goal with real key events, with the state read at least 4 times.
  • Lives after 2 s of standing still: unchanged (read from the state).
  • Screenshots at 1280 and 390 attached; console 0 errors.

Reference

Loop with a fixed step:

js
const STEP = 1 / 60; let acc = 0, last = performance.now();
function frame(now) {
  acc += Math.min((now - last) / 1000, 0.1); last = now;
  while (acc >= STEP) { update(STEP); acc -= STEP; }
  render(); requestAnimationFrame(frame);
}

Input:

js
const keys = new Set();
addEventListener('keydown', e => { keys.add(e.code); if (e.code.startsWith('Arrow') || e.code === 'Space') e.preventDefault(); });
addEventListener('keyup', e => keys.delete(e.code));

Per-axis tile collision (tiles T px, solid(cx, cy)):

js
function moveX(p, dx) {
  p.x += dx;
  const top = Math.floor(p.y / T), bottom = Math.floor((p.y + p.h - 1) / T);
  if (dx > 0) { const cx = Math.floor((p.x + p.w - 1) / T); for (let cy = top; cy <= bottom; cy++) if (solid(cx, cy)) { p.x = cx * T - p.w; p.vx = 0; } }
  else if (dx < 0) { const cx = Math.floor(p.x / T); for (let cy = top; cy <= bottom; cy++) if (solid(cx, cy)) { p.x = (cx + 1) * T; p.vx = 0; } }
}
function moveY(p, dy) {
  p.y += dy; p.onGround = false;
  const left = Math.floor(p.x / T), right = Math.floor((p.x + p.w - 1) / T);
  if (dy > 0) { const cy = Math.floor((p.y + p.h - 1) / T); for (let cx = left; cx <= right; cx++) if (solid(cx, cy)) { p.y = cy * T - p.h; p.vy = 0; p.onGround = true; } }
  else if (dy < 0) { const cy = Math.floor(p.y / T); for (let cx = left; cx <= right; cx++) if (solid(cx, cy)) { p.y = (cy + 1) * T; p.vy = 0; } }
}

Cap |vy| at T - 1 per step. Camera: cam.x = clamp(p.x - W/2, 0, levelW - W). Test through the tool: press_key ArrowRight hold 1000 ms, sleep 300, evaluate_script window.__state().

More rules:

  • Camera clamps to the level bounds. Spawn point is on solid ground with 2 free tiles above.
  • State dump: window.__state() with player x/y/vx/vy, onGround, lives, score, camera, level, status.

More pitfalls:

  • Enemy spawns on the player; a win triggered by proximity on frame 1.
  • Camera shows outside the level or jitters: no clamp, no rounding.

Frequently asked questions

What does the Browser Game AI skill do?

Building a 2D browser game (platformer, shooter, puzzle) - game loop with fixed timestep, keyboard input, tile collisions, camera, HUD, lives and win state.

Why use Browser Game on TypingMind?

Because you install it once and use it with any model. Browser Game is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Browser Game in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/0xBakeer/TandemLLM/tree/main/packages/library/browser-game. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Browser Game?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Browser Game?

As many as you like. As long as a model supports skills, you can use Browser Game with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Browser Game AI skill free?

Yes. It is published on GitHub by 0xBakeer under the AGPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇