Bash.tv → GitHub → itch.io

General know-how for making games that run in the browser with HTML5, JavaScript, Canvas 2D and WebGL. Choosing the tech (Canvas, WebGL, DOM, Phaser, PixiJS, three.js, Kaplay), the game loop, rendering performance, input for keyboard / mouse / touch / gamepad, Web Audio, asset loading, saving, screen scaling, mobile and Safari quirks, accessibility, profiling, and shipping a build. Use when bui...

Download skill (.zip) Files on GitHub

HTML5 game development

Related skills, if installed: game-scaffolding (a ready project), game-architecture, game-state-management, game-mechanics, bash-web-game-checkup (finds problems + snippet fixes), bash-tv-development (Bash specifics).

1. Pick the tech

Game Use Why
Board, card, puzzle, quiz, UI-heavy DOM + CSS (or React) Text, layout and accessibility for free
Simple 2D, up to ~1,000 sprites Canvas 2D (plain JS) No dependencies, easy to reason about
2D with physics, tilemaps, animation, cameras Phaser 3 Batteries included, huge example library
Many 2D sprites / effects, own game logic PixiJS Fast WebGL renderer only
Tiny 2D jam games Kaplay (Kaboom successor) Very little code
3D three.js (+ Rapier or cannon-es for physics) Most examples, flexible
3D with built-in editor tools Babylon.js Physics, GUI, inspector included

Don’t switch engines mid-project without a reason. Match the existing code. In Bash spaces with a game kit, use the kit’s engine.

2. The loop

3. Rendering performance

Canvas 2D

WebGL / three.js

Everywhere

4. Input

5. Audio

6. Assets and loading

7. Screen and devices

8. Saving

localStorage inside try/catch (it can be blocked), with keys prefixed by the game name, JSON with a version, and a migration step for old saves. Never trust saved data. Check shapes and defaults on load.

9. Accessibility and comfort

Remappable or alternative keys, no essential info by color alone, readable text (≥16 px at the game’s size), reduced flashing and shake (respect prefers-reduced-motion), pause anytime, volume control, and subtitles for spoken lines.

10. Browser quirks worth knowing

Symptom Usual cause
Blurry canvas Canvas pixel size ≠ CSS size × devicePixelRatio
Runs double speed on 120 Hz screens Movement per frame instead of per second
No sound until refresh AudioContext never resumed after a gesture
Works locally, blank on itch.io Absolute paths, wrong file-name case, index.html not at the top of the ZIP
ES modules fail locally Opened via file://. Use a static server
Page scrolls while playing Missing preventDefault / touch-action: none
Stutter every few seconds Garbage collection: pool objects, stop allocating per frame
Popups don’t appear alert/confirm/prompt are blocked in embeds. Use in-game UI

11. Shipping

Run a checkup (bash-web-game-checkup), shrink assets, remove debug code, set a version, and test the exported build in an iframe at its embed size, then on a phone. Then publish (bash-itch-export, bash-web-deploy-anywhere).