game-engine by github/awesome-copilot
npx skills add https://github.com/github/awesome-copilot --skill game-engine使用 HTML5 Canvas、WebGL 和 JavaScript 构建基于网页的游戏和游戏引擎。此技能包含入门模板、参考文档以及使用 Phaser、Three.js、Babylon.js 和 A-Frame 等框架进行 2D 和 3D 游戏开发的逐步工作流程。
以下概念构成了每个基于网页的游戏引擎的基础。
每个游戏引擎都围绕游戏循环展开——一个连续的循环,包括:
使用 requestAnimationFrame 以实现流畅、浏览器优化的渲染。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
<canvas> 元素的 HTML 文件requestAnimationFrame 实现游戏循环入门模板可在 assets/ 文件夹中找到。每个模板都提供了一个完整、可运行的示例,可作为新项目的起点。
| 模板 | 描述 |
|---|---|
paddle-game-template.md | 使用纯 JavaScript 的 2D 打砖块风格游戏 |
2d-maze-game.md | 带有设备方向控制的迷宫游戏 |
2d-platform-game.md | 使用 Phaser 框架的平台游戏 |
gameBase-template-repo.md | 游戏基础模板仓库结构 |
simple-2d-engine.md | 带有碰撞检测的简单 2D 平台游戏引擎 |
详细的参考资料可在 references/ 文件夹中找到。查阅这些文件以深入了解特定主题。
| 参考文档 | 涵盖主题 |
|---|---|
basics.md | 游戏开发介绍和解剖 |
web-apis.md | Canvas、WebGL、Web Audio、Gamepad 及其他 Web API |
techniques.md | 碰撞检测、瓦片地图、异步脚本、音频 |
3d-web-games.md | 3D 理论、框架、着色器、WebXR |
game-control-mechanisms.md | 触摸、键盘、鼠标和游戏手柄控制 |
game-publishing.md | 分发、推广和盈利 |
algorithms.md | 光线投射、碰撞、物理、向量数学 |
terminology.md | 游戏开发术语表 |
game-engine-core-principles.md | 游戏引擎核心设计原则 |
| 问题 | 解决方案 |
|---|---|
| Canvas 空白 | 检查是否在获取上下文后且在游戏循环内调用绘图方法 |
| 游戏运行速度不一致 | 在更新计算中使用增量时间而非固定值 |
| 碰撞检测不一致 | 使用连续碰撞检测或为快速移动的对象减少时间步长 |
| 音频不播放 | 浏览器需要用户交互后才能播放音频;通过点击处理程序触发播放 |
| 性能差 | 使用浏览器开发者工具进行分析,减少绘制调用,使用对象池,优化资源大小 |
| 触摸控制无响应 | 阻止默认触摸行为,并单独处理触摸事件(与鼠标事件分开) |
| WebGL 上下文丢失 | 处理 webglcontextlost 事件,并在 webglcontextrestored 时恢复状态 |
每周安装量
7.8K
仓库
GitHub 星标数
26.9K
首次出现
2026年2月25日
安全审计
安装于
codex7.7K
gemini-cli7.7K
opencode7.7K
cursor7.7K
github-copilot7.7K
kimi-cli7.7K
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.
The following concepts form the foundation of every web-based game engine.
Every game engine revolves around the game loop -- a continuous cycle of:
Use requestAnimationFrame for smooth, browser-optimized rendering.
<canvas> elementrequestAnimationFrameStarter 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 |
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 |
| 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 |
Weekly Installs
7.8K
Repository
GitHub Stars
26.9K
First Seen
Feb 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex7.7K
gemini-cli7.7K
opencode7.7K
cursor7.7K
github-copilot7.7K
kimi-cli7.7K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装
| 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 |