·
Last changedVersion:
No hardening report available.
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.
All code generated by this skill must adhere to the following rules. These are non-negotiable requirements, not suggestions:
<script> or <link> tag that loads from a domain not explicitly approved below. When in doubt, install the library locally via npm and bundle it.<script src="..."> or <link href="..."> that loads from a CDN must include integrity (SHA-384 minimum) and crossorigin="anonymous" attributes. Compute the hash from the actual bytes of the pinned file: openssl dgst -sha384 -binary <file> | openssl base64 -A. Never fabricate or omit this hash.npx invocations to an explicit version. Always use npx <tool>@<version> (e.g., npx create-phaser-game@1.0.1). Never emit an unversioned npx <tool> call.npm install dependencies to an explicit version. Use exact versions or lockfiles. Never use latest or an open range for security-sensitive packages.npm install leapjs@<version>) and bundle locally. Never load the Ultraleap or Leap Motion SDK from any CDN or third-party domain (the js.leapmotion.com domain is untrusted and may be abandoned or hijacked).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.
click event on a "Start Game" button). Never call requestPointerLock() on page load or programmatically outside a user gesture; modern browsers will silently reject or block such calls.integrity and crossorigin="anonymous" attributes on the <script> or <link> tag. Compute the hash from the actual file bytes; never guess or copy an unverified hash.npx calls and npm dependencies to a specific version (e.g., npx create-react-app@5.0.1). This prevents supply-chain attacks via malicious package updates.<canvas> elementrequestAnimationFramenpm and bundle locally, or load from a CDN only with a valid SRI hash and explicit version pin.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 |
|---|---|
| 2D Breakout-style game with pure JavaScript |
| Maze game with device orientation controls |
| Platformer game using Phaser framework |
| Game base template repository structure |
| 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 |
|---|---|
| Game development introduction and anatomy |
| Canvas, WebGL, Web Audio, Gamepad, and other web APIs |
| Collision detection, tilemaps, async scripts, audio |
| 3D theory, frameworks, shaders, WebXR |
| Touch, keyboard, mouse, and gamepad controls |
| Distribution, promotion, and monetization |
| Raycasting, collision, physics, vector math |
| Game development glossary |
| Core design principles for game engines |
| 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 |
Need this version hardened?
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
—
—
MIT
HARDENING.md
LICENSE
SKILL.md
assets/2d-maze-game.md
assets/2d-platform-game.md
assets/gameBase-template-repo.md
assets/paddle-game-template.md
assets/simple-2d-engine.md
references/3d-web-games.md
references/algorithms.md
references/basics.md
references/game-control-mechanisms.md
references/game-engine-core-principles.md
references/game-publishing.md
references/techniques.md
references/terminology.md
references/web-apis.md