MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Game-Engine

Game-Engine是一款code方向的AI技能,核心价值是Expert skill for building web-based game engines and games using HTML5, Canvas, WebGL, and JavaScript,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

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 dete

Last verified on: 2026-05-30
mkdir -p ./skills/game-engine && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/game-engine/SKILL.md -o ./skills/game-engine/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# 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:


1. **Process Input** - Read keyboard, mouse, touch, or gamepad input

2. **Update State** - Update game object positions, physics, AI, and logic

3. **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


1. Set up an HTML file with a `<canvas>` element

2. Get the 2D rendering context

3. Implement the game loop using `requestAnimationFrame`

4. Create game objects with position, velocity, and size properties

5. Handle keyboard/mouse input for player control

6. Implement collision detection between game objects

7. Add scoring, lives, and win/lose conditions

8. Add sound effects and music


Building a 3D Game


1. Choose a framework (Three.js, Babylon.js, A-Frame, or PlayCanvas)

2. Set up the scene, camera, and renderer

3. Load or create 3D models and textures

4. Implement lighting and shaders

5. Add physics and collision detection

6. Implement player controls and camera movement

7. Add audio and visual effects


Publishing a Game


1. Optimize assets (compress images, minify code)

2. Test across browsers and devices

3. Choose distribution platform (web, app stores, game portals)

4. Implement monetization if needed

5. 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 frame

🎯 Best For

  • UI designers
  • Product designers
  • Claude users
  • GitHub Copilot users
  • Software engineers

💡 Use Cases

  • Generating component mockups
  • Creating design system tokens
  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Game-Engine to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Does this work with Figma?

Some design skills integrate with Figma plugins. Check the Works With section for supported tools.

Is Game-Engine compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Game-Engine?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Game-Engine?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/game-engine/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Skipping usability testing

AI-generated designs should be validated with real users before development.

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills