Game Engine Skill
Build web-based games and game engines using HTML5 Canvas, WebGL, and JavaScript. This skill includes starter templates, reference documentation, and step-by-step workflows for 2D and 3D game development with frameworks such as Phaser, Three.js, Babylon.js, and A-Frame.
When to Use This Skill
- Building a game engine or game from scratch using web technologies
- Implementing game loops, physics, collision detection, or rendering
- Working with HTML5 Canvas, WebGL, or SVG for game graphics
- Adding game controls (keyboard, mouse, touch, gamepad)
- Creating 2D platformers, breakout-style games, maze games, or 3D experiences
- Working with tilemaps, sprites, or animations
- Adding audio to web games
- Implementing multiplayer features with WebRTC or WebSockets
- Optimizing game performance
- Publishing and distributing web games
Prerequisites
- Basic knowledge of HTML, CSS, and JavaScript
- A modern web browser with Canvas/WebGL support
- A text editor or IDE
- Optional: Node.js for build tooling and local development servers
Core Concepts
The following concepts form the foundation of every web-based game engine.
Game Loop
Every game engine revolves around the game loop -- a continuous cycle of:
- Process Input - Read keyboard, mouse, touch, or gamepad input
- Update State - Update game object positions, physics, AI, and logic
- Render - Draw the current game state to the screen
Use requestAnimationFrame for smooth, browser-optimized rendering.
Rendering
- Canvas 2D - Best for 2D games, sprite-based rendering, and tilemaps
- WebGL - Hardware-accelerated 3D and advanced 2D rendering
- SVG - Vector-based graphics, good for UI elements
- CSS - Useful for DOM-based game elements and transitions
Physics and Collision Detection
- 2D Collision Detection - AABB, circle, and SAT-based collision
- 3D Collision Detection - Bounding box, bounding sphere, and raycasting
- Velocity and Acceleration - Basic Newtonian physics for movement
- Gravity - Constant downward acceleration for platformers
Controls
- Keyboard - Arrow keys, WASD, and custom key bindings
- Mouse - Click, move, and pointer lock for FPS-style controls
- Touch - Mobile touch events and virtual joysticks
- Gamepad - Gamepad API for controller support
Audio
- Web Audio API - Programmatic sound generation and spatial audio
- HTML5 Audio - Simple audio playback for music and sound effects
Step-by-Step Workflows
Creating a Basic 2D Game
- Set up an HTML file with a
<canvas> element
- Get the 2D rendering context
- Implement the game loop using
requestAnimationFrame
- Create game objects with position, velocity, and size properties
- Handle keyboard/mouse input for player control
- Implement collision detection between game objects
- Add scoring, lives, and win/lose conditions
- Add sound effects and music
Building a 3D Game
- Choose a framework (Three.js, Babylon.js, A-Frame, or PlayCanvas)
- Set up the scene, camera, and renderer
- Load or create 3D models and textures
- Implement lighting and shaders
- Add physics and collision detection
- Implement player controls and camera movement
- Add audio and visual effects
Publishing a Game
- Optimize assets (compress images, minify code)
- Test across browsers and devices
- Choose distribution platform (web, app stores, game portals)
- Implement monetization if needed
- Promote through game communities and social media
Game Templates
Starter templates are available in the assets/ folder. Each template provides a complete, working example that can be used as a starting point for a new project.
| Template |
Description |
paddle-game-template.md |
2D Breakout-style game with pure JavaScript |
2d-maze-game.md |
Maze game with device orientation controls |
2d-platform-game.md |
Platformer game using Phaser framework |
gameBase-template-repo.md |
Game base template repository structure |
simple-2d-engine.md |
Simple 2D platformer engine with collisions |
Reference Documentation
Detailed reference material is available in the references/ folder. Consult these files for in-depth coverage of specific topics.
| Reference |
Topics Covered |
basics.md |
Game development introduction and anatomy |
web-apis.md |
Canvas, WebGL, Web Audio, Gamepad, and other web APIs |
techniques.md |
Collision detection, tilemaps, async scripts, audio |
3d-web-games.md |
3D theory, frameworks, shaders, WebXR |
game-control-mechanisms.md |
Touch, keyboard, mouse, and gamepad controls |
game-publishing.md |
Distribution, promotion, and monetization |
algorithms.md |
Raycasting, collision, physics, vector math |
terminology.md |
Game development glossary |
game-engine-core-principles.md |
Core design principles for game engines |
Troubleshooting
| Issue |
Solution |
| Canvas is blank |
Check that you are calling drawing methods after getting the context and inside the game loop |
| Game runs at different speeds |
Use delta time in update calculations instead of fixed values |
| Collision detection is inconsistent |
Use continuous collision detection or reduce time steps for fast-moving objects |
| Audio does not play |
Browsers require user interaction before playing audio; trigger playback from a click handler |
| Performance is poor |
Profile with browser dev tools, reduce draw calls, use object pooling, and optimize asset sizes |
| Touch controls are unresponsive |
Prevent default touch behavior and handle touch events separately from mouse events |
| WebGL context lost |
Handle the webglcontextlost event and restore state on webglcontextrestored |
Source: github/awesome-copilot → skills/game-engine/SKILL.md
1---
2name: game-engine
3description: "Expert skill for building web-based game engines and games using HTML5, Canvas, WebGL, and JavaScript. Use when asked to create games, build game engines, implement game physics, handle collision detection, set up game loops, manage sprites, add game controls, or work with 2D/3D rendering. Covers techniques for platformers, breakout-style games, maze games, tilemaps, audio, multiplayer via WebRTC, and publishing games."
4category: media-and-creative
5source_repo: github/awesome-copilot
6source_path: "skills/game-engine/SKILL.md"
7source_url: https://github.com/github/awesome-copilot/blob/HEAD/skills/game-engine/SKILL.md
8metadata:
9 source: https://skillmd.com/skills/thedixitjain/game-engine
10---
11
12# Game Engine Skill
13
14Build web-based games and game engines using HTML5 Canvas, WebGL, and JavaScript. This skill includes starter templates, reference documentation, and step-by-step workflows for 2D and 3D game development with frameworks such as Phaser, Three.js, Babylon.js, and A-Frame.
15
16## When to Use This Skill
17
18- Building a game engine or game from scratch using web technologies
19- Implementing game loops, physics, collision detection, or rendering
20- Working with HTML5 Canvas, WebGL, or SVG for game graphics
21- Adding game controls (keyboard, mouse, touch, gamepad)
22- Creating 2D platformers, breakout-style games, maze games, or 3D experiences
23- Working with tilemaps, sprites, or animations
24- Adding audio to web games
25- Implementing multiplayer features with WebRTC or WebSockets
26- Optimizing game performance
27- Publishing and distributing web games
28
29## Prerequisites
30
31- Basic knowledge of HTML, CSS, and JavaScript
32- A modern web browser with Canvas/WebGL support
33- A text editor or IDE
34- Optional: Node.js for build tooling and local development servers
35
36## Core Concepts
37
38The following concepts form the foundation of every web-based game engine.
39
40### Game Loop
41
42Every game engine revolves around the game loop -- a continuous cycle of:
43
441. **Process Input** - Read keyboard, mouse, touch, or gamepad input
452. **Update State** - Update game object positions, physics, AI, and logic
463. **Render** - Draw the current game state to the screen
47
48Use `requestAnimationFrame` for smooth, browser-optimized rendering.
49
50### Rendering
51
52- **Canvas 2D** - Best for 2D games, sprite-based rendering, and tilemaps
53- **WebGL** - Hardware-accelerated 3D and advanced 2D rendering
54- **SVG** - Vector-based graphics, good for UI elements
55- **CSS** - Useful for DOM-based game elements and transitions
56
57### Physics and Collision Detection
58
59- **2D Collision Detection** - AABB, circle, and SAT-based collision
60- **3D Collision Detection** - Bounding box, bounding sphere, and raycasting
61- **Velocity and Acceleration** - Basic Newtonian physics for movement
62- **Gravity** - Constant downward acceleration for platformers
63
64### Controls
65
66- **Keyboard** - Arrow keys, WASD, and custom key bindings
67- **Mouse** - Click, move, and pointer lock for FPS-style controls
68- **Touch** - Mobile touch events and virtual joysticks
69- **Gamepad** - Gamepad API for controller support
70
71### Audio
72
73- **Web Audio API** - Programmatic sound generation and spatial audio
74- **HTML5 Audio** - Simple audio playback for music and sound effects
75
76## Step-by-Step Workflows
77
78### Creating a Basic 2D Game
79
801. Set up an HTML file with a `<canvas>` element
812. Get the 2D rendering context
823. Implement the game loop using `requestAnimationFrame`
834. Create game objects with position, velocity, and size properties
845. Handle keyboard/mouse input for player control
856. Implement collision detection between game objects
867. Add scoring, lives, and win/lose conditions
878. Add sound effects and music
88
89### Building a 3D Game
90
911. Choose a framework (Three.js, Babylon.js, A-Frame, or PlayCanvas)
922. Set up the scene, camera, and renderer
933. Load or create 3D models and textures
944. Implement lighting and shaders
955. Add physics and collision detection
966. Implement player controls and camera movement
977. Add audio and visual effects
98
99### Publishing a Game
100
1011. Optimize assets (compress images, minify code)
1022. Test across browsers and devices
1033. Choose distribution platform (web, app stores, game portals)
1044. Implement monetization if needed
1055. Promote through game communities and social media
106
107## Game Templates
108
109Starter templates are available in the `assets/` folder. Each template provides a complete, working example that can be used as a starting point for a new project.
110
111| Template | Description |
112|----------|-------------|
113| `paddle-game-template.md` | 2D Breakout-style game with pure JavaScript |
114| `2d-maze-game.md` | Maze game with device orientation controls |
115| `2d-platform-game.md` | Platformer game using Phaser framework |
116| `gameBase-template-repo.md` | Game base template repository structure |
117| `simple-2d-engine.md` | Simple 2D platformer engine with collisions |
118
119## Reference Documentation
120
121Detailed reference material is available in the `references/` folder. Consult these files for in-depth coverage of specific topics.
122
123| Reference | Topics Covered |
124|-----------|---------------|
125| `basics.md` | Game development introduction and anatomy |
126| `web-apis.md` | Canvas, WebGL, Web Audio, Gamepad, and other web APIs |
127| `techniques.md` | Collision detection, tilemaps, async scripts, audio |
128| `3d-web-games.md` | 3D theory, frameworks, shaders, WebXR |
129| `game-control-mechanisms.md` | Touch, keyboard, mouse, and gamepad controls |
130| `game-publishing.md` | Distribution, promotion, and monetization |
131| `algorithms.md` | Raycasting, collision, physics, vector math |
132| `terminology.md` | Game development glossary |
133| `game-engine-core-principles.md` | Core design principles for game engines |
134
135## Troubleshooting
136
137| Issue | Solution |
138|-------|----------|
139| Canvas is blank | Check that you are calling drawing methods after getting the context and inside the game loop |
140| Game runs at different speeds | Use delta time in update calculations instead of fixed values |
141| Collision detection is inconsistent | Use continuous collision detection or reduce time steps for fast-moving objects |
142| Audio does not play | Browsers require user interaction before playing audio; trigger playback from a click handler |
143| Performance is poor | Profile with browser dev tools, reduce draw calls, use object pooling, and optimize asset sizes |
144| Touch controls are unresponsive | Prevent default touch behavior and handle touch events separately from mouse events |
145| WebGL context lost | Handle the `webglcontextlost` event and restore state on `webglcontextrestored` |
146
147---
148
149**Source:** [`github/awesome-copilot`](https://github.com/github/awesome-copilot) → `skills/game-engine/SKILL.md`