John Haugabook

Game Engine

开发编程v1.0.0
作者:John Haugabook更新于 2026-05-11game-engine@clawhub_jhauga/game-engine
代码生成前端开发#Game#Javascript#Audio

据 AlphaMoat 统计,截至 2026-09,Game Engine 累计下载 2,617 次、获 4 个星标,在全部 5,078 个 AI 技能中排名第 4,008 位,在「开发编程」分类(577 个)中排名第 500 位。

累计安装
103
累计下载
2,617
星标
4
全站排名
#4,008
全站前 79% · 「开发编程」前 87%
平台累计安装累计下载星标评论
ClawHub ↗672,3952-
SkillHub ↗1032,6174—

各平台的计数口径不同,统计时间不一致。

这个技能是做什么的

它涵盖游戏循环、渲染、输入控制、物理与碰撞检测、音频和多人功能,并提供 2D/3D 开发、测试与发布的工作步骤;文档还列出模板和参考资料。实际实现需根据目标浏览器、设备能力及所选框架验证兼容性和性能。

资料发布于 2026-10-29

可以用来做什么

  • 搭建游戏主循环、输入处理与渲染流程。
  • 选择 Canvas、WebGL 或 SVG 等绘图技术。
  • 规划碰撞检测、音效、设备控制和发布测试。

什么时候用

  • 需要使用网页技术创建或扩展 2D/3D 游戏时。
  • 需要排查渲染、碰撞、音频或触控输入问题时。
  • 准备面向多浏览器或设备发布游戏时,需要执行兼容性和性能测试时。

示例提示词

以下是根据技能文档生成的示例,不代表实际运行结果。

为一个简单的平台游戏列出主循环、输入、碰撞和渲染模块,不生成或发布文件。
根据目标设备比较 Canvas 与 WebGL 的实现考量。

月度数据趋势

累计下载2,617
6441,7042,7632026-03 · 累计下载 7902026-05 · 累计下载 1,4742026-06 · 累计下载 1,6882026-07 · 累计下载 2,0192026-08 · 累计下载 2,2282026-09 · 累计下载 2,61726-0326-09
星标4
2342026-03 · 星标 22026-05 · 星标 32026-06 · 星标 32026-07 · 星标 42026-08 · 星标 42026-09 · 星标 426-0326-09

2026-09 起统计方法调整:同名技能按作者分别统计,并覆盖全部技能。图中虚线为调整前的月份,与之后的数据不直接比较,也不计算跨越调整的增长。

月份累计下载环比星标
2026-092,617—4
2026-082,228+10.4%4
2026-072,019+19.6%4
2026-061,688+14.5%3
2026-051,474—3
2026-03790—2

SKILL.md 原文

以下是作者发布的原始文件,按纯文本显示,本站未做修改或审核;其中的链接不可点击,命令请核实后再运行。抓取于 2026-10-23。

6.2 KB · ClawHub v1.0.0
---
name: game-engine
description: '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.'
---

# 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
展开全部(共 140 行)

- 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 framework |
| `gameBase-template-reop.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-principals.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` |

「开发编程」分类下的热门技能

John Haugabook 的其他技能

数据月份:2026-09 · 下载/星标/安装数聚合自公开技能注册库(ClawHub、SkillHub),按月更新。口径说明见数据方法。