Skip to content
SlashClone
Made by@gameforge

Browser game starter

@gameforge/browser-game-starter

Turn a one-line game idea into a complete, playable single-file HTML5 canvas game: game loop, keyboard and touch input, score, best score, game over, and restart. Ships a template, a working Block Dodge example, and a script that copies either into your project.

SkillOtherv1.0.0 (latest)Tested
Activity
New: be the first to try it
  1. 1---
  2. 2name: browser-game-starter
  3. 3description: Scaffold a complete, playable single-file HTML5 canvas game from a one-line idea, with a game loop, keyboard and touch input, score, best score, game over, and restart. Use when the user says "make me a game", "build a browser game", "prototype this game idea", "a quick HTML5 game", "something playable on my phone", or wants a starting point for a game jam.
  4. 4license: MIT
  5. 5---
  6. 6
  7. 7# Browser game starter
  8. 8
  9. 9Takes a one-line idea ("dodge falling blocks", "catch stars, avoid meteors") and leaves the user with one HTML file they can open in any browser, on desktop or phone, and play. No build step, no dependencies.
  10. 11## Inputs
  11. 13Ask for anything missing, in one message:
  12. 151. **The idea** in one line. If it is vague, propose a concrete version ("You move a paddle left and right; yellow things are points, red things end the run. OK?").
  13. 162. **Title** (default: make one up from the idea, two or three words).
  14. 173. **Controls**: the template does left and right movement with arrows, A and D, mouse drag, and touch drag. Ask only if the idea clearly needs something else (jump, aim, tap to flap).
  15. 19## Steps
  16. 211. **Copy the template** into the project:
  17. 23 ```bash
  18. 24 node scripts/new-game.mjs --title "Star Catcher" --idea "catch stars, dodge meteors" --out game/index.html
  19. 25 ```
  20. 27 The script refuses to overwrite an existing file. Ask the user before adding `--force`.
  21. 28 To show a finished example first, copy Block Dodge: `node scripts/new-game.mjs --from example --out game/dodge.html`.
  22. 302. **Read `game/index.html`** and shape it to the idea. The file has six labeled sections; change them in this order:
  23. 31 - `CONFIG`: speeds, sizes, spawn rate, difficulty ramp. Most ideas are 60% config.
  24. 32 - `STATE` and `reset()`: add any new fields (lives, combo, level, timer).
  25. 33 - `INPUT`: keep keyboard, pointer, and touch in sync. Every action needs a touch version (tap, drag, or an on-screen button drawn on the canvas).
  26. 34 - `UPDATE`: movement, spawning, collisions, scoring. Use `dt` (seconds) for every motion so speed is the same at 60 and 120 fps.
  27. 35 - `DRAW`: shapes and colors only (no image files), so the game stays one file.
  28. 36 - `LOOP`: leave as is. `dt` is capped at 0.05 so a background tab does not teleport things.
  29. 383. **Keep the guarantees.** The finished game must still have: a title screen, a way to lose, a score, a saved best score, restart with Space, Enter, click, or tap, and no console errors.
  30. 394. **Check it by reading**: every new state field is reset in `reset()`, every key action has a touch equivalent, nothing uses a fixed per-frame step instead of `dt`.
  31. 405. **Tell the user** how to play it: open `game/index.html` in a browser, or serve the folder with any static server to try it on a phone on the same Wi-Fi.
  32. 42## Output
  33. 44```markdown
  34. 45Made game/index.html: "Star Catcher"
  35. 46- Goal: catch yellow stars, avoid red meteors. Speeds up with every point.
  36. 47- Controls: arrows or A/D, drag on touch screens. Space or tap to start and restart.
  37. 48- Tune it: CONFIG.fallSpeed (difficulty), CONFIG.hazardChance (how mean), CONFIG.spawnEvery (busyness).
  38. 49- Next ideas: lives instead of one-hit, a combo multiplier, a juice pass (shake, particles, sound).
  39. 50```
  40. 52## Guardrails
  41. 54- One HTML file, no external scripts, fonts, images, or network calls. If the user wants assets, explain the tradeoff and ask first.
  42. 55- Write only inside `game/`. Never overwrite a file without the user's yes.
  43. 56- Keep `localStorage` reads and writes in try/catch (private windows block it).
  44. 57- Small scope first: get the core loop fun before adding menus, levels, or sound. Offer those as next steps.