HTML5 Canvas school
Build browser games with JavaScript, using real Supagames code.
This section is a practical workshop, not a glossary. Each lesson takes a working mechanic from Supagames, explains why it exists, then shows how to adapt it for your own game. You will see small arcade loops, mobile controls, collision checks, scoring, enemy behavior and bigger action-game patterns.
Why this guide is useful
Many browser game tutorials stop after drawing a rectangle. That is fine for the first five minutes, but real games need more: a loop that does not fight the browser, inputs that do not break forms, collision checks that are readable, pacing that a human can react to, and clear feedback when the player wins, loses or upgrades.
Supagames contains hundreds of small games and several longer handcrafted projects, so this guide uses the same patterns we use in production pages. The examples are intentionally small enough to understand, but not fake. Every technique below appears in playable games on the site.
For beginners
You can follow the lessons with plain HTML, CSS and JavaScript. No build tools are required for the early chapters.
For improving existing games
The debugging notes explain common mistakes we kept fixing: instant game overs, keyboard scroll, mobile buttons over the play area and enemies that only look alive.
For future big games
The later chapters show how to move from one-screen arcade mechanics into objectives, themed enemies, progression and longer sessions.
Lessons
Canvas Game Loop
Set up a canvas, separate update from render, compare fixed intervals with requestAnimationFrame and avoid browser scroll bugs.
02Flying Bird Breakdown
Gravity, flap input, pipe spawning, scoring, localStorage best score and simple rectangle-circle collision.
03Keyboard, Mouse and Touch
Build inputs that work on desktop and phone, while keeping comment forms and textareas usable.
04Collision Detection
Use bounding boxes, grid blocking, obstacle gaps and readable hitbox helpers instead of hidden magic numbers.
05Enemy AI and Objectives
Turn a static arena into a themed game with enemy roles, projectiles, objectives, bosses and progression.
06Procedural Levels
Use randomness without making unfair maps, add seedable generation and scale hazards gradually.
07Difficulty and Pacing
Balance timers, orders, enemy pressure and upgrades so humans can actually finish the game.
08Save and Load
Use localStorage safely for progress, best scores, settings, versioned saves and reset buttons.
09Performance Debugging
Measure frame time, cap expensive objects and prevent canvas games from melting the browser.
10Publishing Checklist
Prepare a game page with useful text, controls, canonical URLs, sitemap entries and QA checks.
11Audio Feedback
Add Web Audio sound effects, unlock audio on player input and save respectful mute settings.
12Dialogue and Quests
Build dialogue queues, quest objectives, story flags and callbacks that move a game forward.
13Platformer Feel
Tune acceleration, friction, coyote time, jump buffering, double jumps and platform collisions.
14Racing Physics
Make cars steer, accelerate, skid, boost and collide with readable arcade-style handling.
15Automated Testing
Use static checks, syntax checks and smoke tests to catch broken games before players do.
16Tile Maps
Build grid worlds, collision data, path tiles and tiny editor tools for faster level design.
17Pathfinding AI
Move enemies through grids with fixed paths, BFS, A-star ideas and readable debug overlays.
18Boss Fights
Design phases, telegraphed attacks, arena pressure and rewards that feel fair.
19Particles and Juice
Add particle bursts, floating text, trails and screen shake without hurting performance.
20HUD and Menus
Create readable health bars, upgrade panels, pause menus and objective UI for canvas games.
21Procedural Dungeons
Generate rooms, corridors, exits and encounters while validating that maps stay playable.
22Economy and Upgrades
Balance rewards, costs, upgrade effects and save data so purchases create real choices.
23Mobile-First Layout
Plan touch controls, joystick input, responsive canvas sizing and safe UI zones from the start.
24Phaser 2D Basics
Use scenes, sprites, input, generated textures and DOM HUDs when canvas games grow larger.
25Three.js 3D Basics
Create simple 3D browser games with scene, camera, renderer, meshes, lights and collision checks.
26Turn-Based Combat
Design actions, cooldowns, statuses, enemy intent, rewards and readable combat logs.
27Card Mechanics
Build decks, hands, discard piles, shuffling, card costs and effects that stay testable.
28Dialogue Trees
Add branching conversations with conditions, quest flags, rewards and validation checks.
29Stealth Mechanics
Use patrols, vision cones, suspicion meters, noise, hiding spots and alarm states.
30Crafting Systems
Model ingredients, recipes, inventory slots, discovery, item effects and save data.
31AdSense-Friendly Pages
Improve game page value with original content, stable ad zones, SEO structure and QA gates.
Three.js Game Development
Build real 3D browser games, from the first frame to a complete project.
This focused Three.js course uses production patterns from Supagames environments, racers, action games, and asset pipelines. Follow it in order or open the system you need right now.
Scene, Camera, Renderer
Build a responsive renderer lifecycle with pixel-ratio limits, resize handling, and cleanup.
37Geometry and Materials
Shape BufferGeometry, calculate normals, load textures, and manage reusable materials.
38Lighting and Shadows
Create readable light, control shadow budgets, and prevent shader-compilation stutter.
39Reliable Game Loops
Use capped delta time, fixed simulation steps, pause recovery, and deterministic motion.
40Desktop and Mobile Input
Unify keyboard, pointer, touch joystick, and action buttons behind one intent model.
41Game Cameras
Build follow, first-person, and terrain-safe cameras with frame-rate-independent damping.
42Collision Detection
Choose between triggers, AABBs, raycasts, layers, and swept movement.
43Cannon-es Physics
Connect stable physics bodies, impulses, heightfields, and visual mesh synchronization.
44GLB Asset Pipeline
Load, cache, clone, normalize, recover, and dispose GLB and DRACO assets.
45Procedural Worlds
Generate seeded terrain, biome water, horizons, and portable JSON world presets.
46Vegetation and Wind
Scatter instanced plants and animate grass, trees, flowers, and rigid cacti coherently.
47AI and Projectiles
Build enemy states, projectile pools, fair damage, invulnerability, and feedback.
48Performance
Measure draw calls and GPU cost, then scale instancing, LOD, shadows, and mobile quality.
49Complete Three.js Game
Assemble Signal Run Arena with goals, hazards, UI, retry, touch controls, and cleanup.
Devlogs & Design Theory
Why the First Hit Froze
Trace a one-frame combat stutter through shader variants, first-use allocations, pooling, and stable feedback.
Three.js DesignThe Camera Is a Mechanic
Compare racing and platform camera rigs, damping, terrain safety, speed composition, and mobile framing.
Three.js DevlogA 16.67 ms World Budget
Optimize a living 3D world with pixel-ratio caps, instancing, density, LOD, update cadence, and honest measurement.
DevlogHow We Built Chronos Drift
A technical deep-dive into pseudo-3D, time-scaling physics, and parallax on a 2D canvas.
💻 CodeThe Illusion of Difficulty
Learn how hidden tricks like Coyote Time and expanded hitboxes make games feel fairer.
💻 CodeAdding Juice with Particles
Build a high-performance particle system from scratch using Canvas and object pooling.
💻 CodeSimple Enemy AI States
Program robust enemy AI (Patrol, Chase, Attack) using Finite State Machines.
CareerBuilding an HTML5 Portfolio
Why browser games are the best way to prove your JS engineering skills in 2026.
Related Supagames guides
The course is technical, but browser games also need player context, review standards and publishing discipline. These companion guides explain how players choose games, what HTML5 genres work well in the browser, and how Supagames reviews community submissions before they appear publicly.
Browser Games Guide
Use this when designing controls, session length and first-time player instructions.
JavaScript Examples
Read compact patterns for loops, input, collision, objectives and automated checks.
Review Standards
Compare your game against the quality bar for public browser game pages.
Recommended path
- Read the game loop lesson and make a blank canvas scene that updates every frame.
- Build a tiny one-button game like Flying Bird. Do not add menus until the core loop feels good.
- Add desktop and mobile input together, not as an afterthought.
- Write collision helpers early. They make later debugging much easier.
- When one mechanic works, add objectives and enemy roles so the game has a reason to continue.
- Use controlled randomness to create variety without making impossible levels.
- Tune difficulty with readable numbers: time, spawn interval, damage, rewards and recovery windows.
- Save only meaningful progress, then test loading old save versions before publishing.
- Run performance checks on the slowest scene, not only the empty first room.
- Publish with useful descriptions, clear controls, canonical URLs and a sitemap entry.
- Add audio only after the core interaction works, then keep volume and mute settings respectful.
- For longer games, store quests and dialogue as explicit state so progress never gets mysterious.
- When movement is the game, tune feel with coyote time, buffering, friction and readable feedback.
- Before pushing, run automated checks for page quality, script syntax and common gameplay regressions.
- Use tile maps once a game needs multiple rooms, paths, collision zones or reusable level data.
- Add pathfinding only where designed routes are not enough; debug paths visually while tuning AI.
- Turn major encounters into boss fights with clear phases, telegraphs and rewards.
- Polish important actions with particles, floating text and short screen shake, then cap effect counts.
- Design HUD, menus and mobile controls as part of the game, not as decorations after the fact.
- Move to Phaser when scenes, sprites, groups and input plumbing cost more than the framework adds.
- Use Three.js only when depth, camera movement and 3D readability truly improve the idea.
- For RPG or strategy games, make combat, cards, crafting and dialogue data-driven so they can be balanced.
- Before asking ads to support a page, make the page useful even if ads are blocked.
Good small games are usually not complicated. They are clear. The player understands the goal, the controls respond immediately, and every failure teaches something visible.