@codyswann/lisa 2.179.0 → 2.180.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/all/copy-contents/gitignore +206 -0
- package/dist/strategies/copy-contents.d.ts.map +1 -1
- package/dist/strategies/copy-contents.js +27 -8
- package/dist/strategies/copy-contents.js.map +1 -1
- package/harper-fabric/copy-contents/gitignore +8 -0
- package/package.json +1 -1
- package/phaser/copy-contents/gitignore +5 -0
- package/phaser/merge/.claude/settings.json +1 -0
- package/phaser/merge/.mcp.json +8 -0
- package/phaser/package-lisa/package.lisa.json +8 -2
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/rules/phaser.md +25 -2
- package/plugins/lisa-phaser/skills/phaser-accessibility/SKILL.md +1 -1
- package/plugins/lisa-phaser/skills/phaser-asset-pipeline/SKILL.md +4 -4
- package/plugins/lisa-phaser/skills/phaser-i18n/SKILL.md +1 -1
- package/plugins/lisa-phaser/skills/phaser-project-structure/SKILL.md +5 -5
- package/plugins/lisa-phaser/skills/phaser-services/SKILL.md +1 -1
- package/plugins/lisa-phaser/skills/phaser-testing/SKILL.md +2 -2
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/skills/phaser-accessibility/SKILL.md +1 -1
- package/plugins/lisa-phaser-agy/skills/phaser-asset-pipeline/SKILL.md +4 -4
- package/plugins/lisa-phaser-agy/skills/phaser-i18n/SKILL.md +1 -1
- package/plugins/lisa-phaser-agy/skills/phaser-project-structure/SKILL.md +5 -5
- package/plugins/lisa-phaser-agy/skills/phaser-services/SKILL.md +1 -1
- package/plugins/lisa-phaser-agy/skills/phaser-testing/SKILL.md +2 -2
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/rules/phaser.md +25 -2
- package/plugins/lisa-phaser-copilot/skills/phaser-accessibility/SKILL.md +1 -1
- package/plugins/lisa-phaser-copilot/skills/phaser-asset-pipeline/SKILL.md +4 -4
- package/plugins/lisa-phaser-copilot/skills/phaser-i18n/SKILL.md +1 -1
- package/plugins/lisa-phaser-copilot/skills/phaser-project-structure/SKILL.md +5 -5
- package/plugins/lisa-phaser-copilot/skills/phaser-services/SKILL.md +1 -1
- package/plugins/lisa-phaser-copilot/skills/phaser-testing/SKILL.md +2 -2
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/rules/phaser.mdc +25 -2
- package/plugins/lisa-phaser-cursor/skills/phaser-accessibility/SKILL.md +1 -1
- package/plugins/lisa-phaser-cursor/skills/phaser-asset-pipeline/SKILL.md +4 -4
- package/plugins/lisa-phaser-cursor/skills/phaser-i18n/SKILL.md +1 -1
- package/plugins/lisa-phaser-cursor/skills/phaser-project-structure/SKILL.md +5 -5
- package/plugins/lisa-phaser-cursor/skills/phaser-services/SKILL.md +1 -1
- package/plugins/lisa-phaser-cursor/skills/phaser-testing/SKILL.md +2 -2
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/src/phaser/rules/phaser.md +25 -2
- package/plugins/src/phaser/skills/phaser-accessibility/SKILL.md +1 -1
- package/plugins/src/phaser/skills/phaser-asset-pipeline/SKILL.md +4 -4
- package/plugins/src/phaser/skills/phaser-i18n/SKILL.md +1 -1
- package/plugins/src/phaser/skills/phaser-project-structure/SKILL.md +5 -5
- package/plugins/src/phaser/skills/phaser-services/SKILL.md +1 -1
- package/plugins/src/phaser/skills/phaser-testing/SKILL.md +2 -2
- package/plugins/lisa-phaser/skills/phaser-assets/SKILL.md +0 -96
- package/plugins/lisa-phaser/skills/phaser-assets/agents/openai.yaml +0 -4
- package/plugins/lisa-phaser/skills/phaser-gameobjects/SKILL.md +0 -94
- package/plugins/lisa-phaser/skills/phaser-gameobjects/agents/openai.yaml +0 -4
- package/plugins/lisa-phaser/skills/phaser-physics/SKILL.md +0 -86
- package/plugins/lisa-phaser/skills/phaser-physics/agents/openai.yaml +0 -4
- package/plugins/lisa-phaser/skills/phaser-rendering/SKILL.md +0 -89
- package/plugins/lisa-phaser/skills/phaser-rendering/agents/openai.yaml +0 -4
- package/plugins/lisa-phaser/skills/phaser-scenes/SKILL.md +0 -86
- package/plugins/lisa-phaser/skills/phaser-scenes/agents/openai.yaml +0 -4
- package/plugins/lisa-phaser/skills/phaser-v3-migration/SKILL.md +0 -81
- package/plugins/lisa-phaser/skills/phaser-v3-migration/agents/openai.yaml +0 -4
- package/plugins/lisa-phaser-agy/skills/phaser-assets/SKILL.md +0 -96
- package/plugins/lisa-phaser-agy/skills/phaser-gameobjects/SKILL.md +0 -94
- package/plugins/lisa-phaser-agy/skills/phaser-physics/SKILL.md +0 -86
- package/plugins/lisa-phaser-agy/skills/phaser-rendering/SKILL.md +0 -89
- package/plugins/lisa-phaser-agy/skills/phaser-scenes/SKILL.md +0 -86
- package/plugins/lisa-phaser-agy/skills/phaser-v3-migration/SKILL.md +0 -81
- package/plugins/lisa-phaser-copilot/skills/phaser-assets/SKILL.md +0 -96
- package/plugins/lisa-phaser-copilot/skills/phaser-gameobjects/SKILL.md +0 -94
- package/plugins/lisa-phaser-copilot/skills/phaser-physics/SKILL.md +0 -86
- package/plugins/lisa-phaser-copilot/skills/phaser-rendering/SKILL.md +0 -89
- package/plugins/lisa-phaser-copilot/skills/phaser-scenes/SKILL.md +0 -86
- package/plugins/lisa-phaser-copilot/skills/phaser-v3-migration/SKILL.md +0 -81
- package/plugins/lisa-phaser-cursor/skills/phaser-assets/SKILL.md +0 -96
- package/plugins/lisa-phaser-cursor/skills/phaser-gameobjects/SKILL.md +0 -94
- package/plugins/lisa-phaser-cursor/skills/phaser-physics/SKILL.md +0 -86
- package/plugins/lisa-phaser-cursor/skills/phaser-rendering/SKILL.md +0 -89
- package/plugins/lisa-phaser-cursor/skills/phaser-scenes/SKILL.md +0 -86
- package/plugins/lisa-phaser-cursor/skills/phaser-v3-migration/SKILL.md +0 -81
- package/plugins/src/phaser/skills/phaser-assets/SKILL.md +0 -96
- package/plugins/src/phaser/skills/phaser-gameobjects/SKILL.md +0 -94
- package/plugins/src/phaser/skills/phaser-physics/SKILL.md +0 -86
- package/plugins/src/phaser/skills/phaser-rendering/SKILL.md +0 -89
- package/plugins/src/phaser/skills/phaser-scenes/SKILL.md +0 -86
- package/plugins/src/phaser/skills/phaser-v3-migration/SKILL.md +0 -81
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phaser-project-structure
|
|
3
|
-
description: This skill should be used when creating, restructuring, or reasoning about a Phaser 4 game project — the game config, the Vite + TypeScript layout, the Boot → Preloader → MainMenu → Game scene flow, scale/resolution setup for desktop and mobile, and where code and assets belong. Use it before scaffolding a project, adding a major subsystem, or deciding where a file should live. Pairs with
|
|
3
|
+
description: This skill should be used when creating, restructuring, or reasoning about a Phaser 4 game project — the game config, the Vite + TypeScript layout, the Boot → Preloader → MainMenu → Game scene flow, scale/resolution setup for desktop and mobile, and where code and assets belong. Use it before scaffolding a project, adding a major subsystem, or deciding where a file should live. Pairs with the official scenes skill, the official loading-assets skill, the official filters-and-postfx skill, and phaser-testing.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Phaser 4 Project Structure
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
This stack targets **Phaser 4** (v4.
|
|
10
|
+
This stack targets **Phaser 4** (v4.2+, npm package `phaser@^4.2.0`), built
|
|
11
11
|
with **Vite + TypeScript** — the layout the official `phaserjs/template-vite-ts`
|
|
12
12
|
template and `npm create @phaserjs/game@latest` scaffold. Phaser 4 ships its own
|
|
13
13
|
type definitions (`types/phaser.d.ts`); do not add `@types/phaser`.
|
|
@@ -55,17 +55,17 @@ v4-specific config facts:
|
|
|
55
55
|
- Pixel-art games: `pixelArt: true` (nearest-neighbor + roundPixels), or the new
|
|
56
56
|
**`render.smoothPixelArt: true`** (WebGL-only) for pixel art that rotates or
|
|
57
57
|
scales smoothly. Pick one per project and record the choice.
|
|
58
|
-
- Custom render nodes register under `render.renderNodes` — see
|
|
58
|
+
- Custom render nodes register under `render.renderNodes` — see the official `filters-and-postfx` skill.
|
|
59
59
|
- `Phaser.HEADLESS` exists for logic-only boots (tests) — see [[phaser-testing]].
|
|
60
60
|
|
|
61
61
|
## Scene flow
|
|
62
62
|
|
|
63
|
-
Four-stage boot, in order (see
|
|
63
|
+
Four-stage boot, in order (see the official `scenes` skill for lifecycle detail):
|
|
64
64
|
|
|
65
65
|
1. **Boot** — loads only the handful of assets the Preloader's loading screen
|
|
66
66
|
needs (logo, progress-bar art). No game assets here.
|
|
67
67
|
2. **Preloader** — renders the loading UI and loads everything else, preferably
|
|
68
|
-
via a single asset-pack manifest (see
|
|
68
|
+
via a single asset-pack manifest (see the official `loading-assets` skill), then starts MainMenu.
|
|
69
69
|
3. **MainMenu** — entry UI; starts Game.
|
|
70
70
|
4. **Game** (+ overlay scenes like `HUD`, `Pause` run in parallel) — gameplay.
|
|
71
71
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phaser-services
|
|
3
|
-
description: This skill should be used when wiring cross-cutting services and shared state in a Phaser 4 game — the typed registry wrapper for global state, a single dedicated EventsCenter bus (never game.events), the .on()/.off() listener discipline enforced in scene shutdown, SoundService (mobile audio unlock on first gesture), InputService (semantic actions instead of raw keys), and SaveService (versioned localStorage with a migration chain). Use it when adding global state, an event bus, audio/input/save plumbing, or fixing listener leaks and lost saves. Pairs with
|
|
3
|
+
description: This skill should be used when wiring cross-cutting services and shared state in a Phaser 4 game — the typed registry wrapper for global state, a single dedicated EventsCenter bus (never game.events), the .on()/.off() listener discipline enforced in scene shutdown, SoundService (mobile audio unlock on first gesture), InputService (semantic actions instead of raw keys), and SaveService (versioned localStorage with a migration chain). Use it when adding global state, an event bus, audio/input/save plumbing, or fixing listener leaks and lost saves. Pairs with the official scenes skill, phaser-testing, and phaser-i18n.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Phaser 4 Services and Shared State
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phaser-testing
|
|
3
|
-
description: This skill should be used when writing or designing tests for a Phaser 4 game — unit-testing pure game logic with Vitest, keeping logic Phaser-free so it tests without a browser, the Phaser.HEADLESS renderer for logic-only boots, asset-manifest coverage tests, and the CI runtime gates (boot smoke, allocation/perf budget, leak gate, determinism gate, deterministic Playwright visual regression, bundle-size budget) that verify scenes and entities that are excluded from unit coverage. Use it when adding tests, setting up CI verification, or deciding what is testable at which level. Pairs with phaser-project-structure,
|
|
3
|
+
description: This skill should be used when writing or designing tests for a Phaser 4 game — unit-testing pure game logic with Vitest, keeping logic Phaser-free so it tests without a browser, the Phaser.HEADLESS renderer for logic-only boots, asset-manifest coverage tests, and the CI runtime gates (boot smoke, allocation/perf budget, leak gate, determinism gate, deterministic Playwright visual regression, bundle-size budget) that verify scenes and entities that are excluded from unit coverage. Use it when adding tests, setting up CI verification, or deciding what is testable at which level. Pairs with phaser-project-structure, the official loading-assets skill, and phaser-services.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Phaser 4 Testing
|
|
@@ -56,7 +56,7 @@ Cheap tests that catch the silent runtime failures Phaser is famous for:
|
|
|
56
56
|
|
|
57
57
|
- **Asset coverage**: every key constant in `src/assets.ts` appears in
|
|
58
58
|
`public/assets/pack.json` (and optionally vice versa). A missing pack entry
|
|
59
|
-
otherwise ships as a green-square texture (
|
|
59
|
+
otherwise ships as a green-square texture (the official `loading-assets` skill).
|
|
60
60
|
- **Scene registry**: every `SceneKeys` constant has a scene class registered in
|
|
61
61
|
the game config's `scene` array.
|
|
62
62
|
- These are plain Vitest tests reading JSON/TS — no Phaser instance needed.
|
|
@@ -5,6 +5,29 @@ on the official `template-vite-ts` layout (Vite + TypeScript 6). Phaser 4 is the
|
|
|
5
5
|
only supported target — never introduce Phaser 3 idioms. These decisions are
|
|
6
6
|
**locked** and most are **lint-enforced**; do not disable a rule, fix the code.
|
|
7
7
|
|
|
8
|
+
## Official Phaser skills — use these for API knowledge
|
|
9
|
+
|
|
10
|
+
Phaser ships **28 official, authoritative agent skills** inside the installed
|
|
11
|
+
package at **`node_modules/phaser/skills/<topic>/SKILL.md`** — e.g. `scenes`,
|
|
12
|
+
`sprites-and-images`, `physics-arcade`, `physics-matter`, `tweens`, `particles`,
|
|
13
|
+
`filters-and-postfx`, `loading-assets`, `animations`, `tilemaps`, `cameras`,
|
|
14
|
+
`input-keyboard-mouse-touch`, `audio-and-sound`, `game-object-components`,
|
|
15
|
+
`v3-to-v4-migration`, `v4-new-features`, and more. The Phaser team maintains them
|
|
16
|
+
in lockstep with the engine, and they cite exact `src/...` source paths.
|
|
17
|
+
|
|
18
|
+
**For any Phaser API or subsystem question, read the matching official skill
|
|
19
|
+
first.** Do not rely on memory, and do not expect Lisa to duplicate that
|
|
20
|
+
knowledge — the `lisa-phaser` skills intentionally cover only the opinionated,
|
|
21
|
+
project-specific, and lint-enforced layer (project structure, services, asset
|
|
22
|
+
pipeline, i18n, accessibility, build/deploy, testing gates) that the official
|
|
23
|
+
skills do not. When this file points at a Phaser subsystem (physics, rendering,
|
|
24
|
+
scenes, …) the authority is the official skill of that name.
|
|
25
|
+
|
|
26
|
+
An optional **Phaser Editor MCP server** (`@phaserjs/editor-mcp-server`, 40+
|
|
27
|
+
tools for scenes/assets/tilemaps) is defined for this project type but
|
|
28
|
+
**disabled by default** — enable it only when working with Phaser Editor v5. See
|
|
29
|
+
`.mcp.json` and `disabledMcpjsonServers` in `.claude/settings.json`.
|
|
30
|
+
|
|
8
31
|
## Locked architecture decisions
|
|
9
32
|
|
|
10
33
|
1. **Thin scenes over a pure-logic core.** Scenes and GameObjects are thin
|
|
@@ -18,7 +41,7 @@ only supported target — never introduce Phaser 3 idioms. These decisions are
|
|
|
18
41
|
as an upgrade path — it is not the default and is not added unless required.
|
|
19
42
|
3. **Arcade physics by default; Matter is opt-in.** Matter is heavier and does
|
|
20
43
|
not interop with Arcade. Switching is a one-line config swap. See
|
|
21
|
-
`
|
|
44
|
+
the official `physics-arcade` skill.
|
|
22
45
|
4. **Determinism.** No `Math.random()`, `Date.now()`, or `performance.now()` in
|
|
23
46
|
game code. Use the seeded `Phaser.Math.RandomDataGenerator` (`Phaser.Math.RND`
|
|
24
47
|
or a local instance seeded from one place) so replays and tests reproduce.
|
|
@@ -31,7 +54,7 @@ only supported target — never introduce Phaser 3 idioms. These decisions are
|
|
|
31
54
|
6. **Performance.** Pool transient objects via `Group`s; make **no allocations
|
|
32
55
|
and create no objects/tweens/timers inside `update()`**; atlas everything; use
|
|
33
56
|
`BitmapText` for high-churn text; use `SpriteGPULayer` / `TilemapGPULayer` for
|
|
34
|
-
mass rendering. See `
|
|
57
|
+
mass rendering. See the official `game-object-components` skill.
|
|
35
58
|
7. **Baked-in asset pipeline.** Raw art in `assets/src` is packed at build time
|
|
36
59
|
(free-tex-packer-core atlases, audiosprite, BMFont) into `public/assets`, and
|
|
37
60
|
a codegen step emits typed keys to `src/assets.ts` so a missing or renamed key
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phaser-accessibility
|
|
3
|
-
description: This skill should be used when making a Phaser 4 game accessible — honoring prefers-reduced-motion, pausing on window/tab blur, keyboard navigation and visible focus for menus, colorblind-safe palettes, and a screen-reader live region that announces game state through the DOM. Use it when building menus, settings, HUD, or any player-facing UI, or when an accessibility requirement comes up. Pairs with phaser-services, phaser-i18n, and
|
|
3
|
+
description: This skill should be used when making a Phaser 4 game accessible — honoring prefers-reduced-motion, pausing on window/tab blur, keyboard navigation and visible focus for menus, colorblind-safe palettes, and a screen-reader live region that announces game state through the DOM. Use it when building menus, settings, HUD, or any player-facing UI, or when an accessibility requirement comes up. Pairs with phaser-services, phaser-i18n, and the official scenes skill.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Phaser 4 Accessibility
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phaser-asset-pipeline
|
|
3
|
-
description: This skill should be used when setting up or changing the build-time asset pipeline of a Phaser 4 game — packing raw art in assets/src into public/assets (free-tex-packer-core texture atlases, audiosprite audio sprites, BMFont bitmap fonts) and the codegen step that emits typed keys to src/assets.ts so a missing or renamed key is a compile error. Use it when adding source art, wiring packing into the build, regenerating typed keys, or eliminating raw string asset keys. Pairs with
|
|
3
|
+
description: This skill should be used when setting up or changing the build-time asset pipeline of a Phaser 4 game — packing raw art in assets/src into public/assets (free-tex-packer-core texture atlases, audiosprite audio sprites, BMFont bitmap fonts) and the codegen step that emits typed keys to src/assets.ts so a missing or renamed key is a compile error. Use it when adding source art, wiring packing into the build, regenerating typed keys, or eliminating raw string asset keys. Pairs with the official loading-assets skill, phaser-build-deploy, and phaser-services.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Phaser 4 Asset Pipeline
|
|
@@ -13,7 +13,7 @@ Runtime assets are **generated, not hand-placed**. Raw source art lives in
|
|
|
13
13
|
key constants into `src/assets.ts`**. The payoff: a missing or renamed asset is a
|
|
14
14
|
**compile error**, not a green square or silent-missing audio at runtime. No raw
|
|
15
15
|
string asset / scene / event keys anywhere — they all come from the generated
|
|
16
|
-
module (
|
|
16
|
+
module (the official `loading-assets` skill covers loading those keys at runtime).
|
|
17
17
|
|
|
18
18
|
## Layout
|
|
19
19
|
|
|
@@ -52,7 +52,7 @@ for (const f of files) await writeFile(`public/assets/atlases/${f.name}`, f.buff
|
|
|
52
52
|
|
|
53
53
|
The frame names in the manifest become the atlas frame keys you reference as
|
|
54
54
|
generated constants. Atlas everything that renders together — loose images break
|
|
55
|
-
sprite batching (
|
|
55
|
+
sprite batching (the official `loading-assets` skill).
|
|
56
56
|
|
|
57
57
|
## Step 2: audio sprites with audiosprite
|
|
58
58
|
|
|
@@ -70,7 +70,7 @@ with `this.load.audioSprite(Audio.Sfx, "audio/sfx.json")` and play by sprite key
|
|
|
70
70
|
## Step 3: bitmap fonts with BMFont
|
|
71
71
|
|
|
72
72
|
`BitmapText` is the performant choice for high-churn text (scores, timers) —
|
|
73
|
-
|
|
73
|
+
the official `loading-assets` skill / [[phaser-i18n]]. Generate the `.fnt` (XML/JSON) + PNG page
|
|
74
74
|
from a font source with a BMFont tool (`msdf-bmfont-xml` or the `bmfont` CLI) in
|
|
75
75
|
the same script:
|
|
76
76
|
|
|
@@ -86,7 +86,7 @@ Persist the chosen locale via SaveService and apply it on boot; default from
|
|
|
86
86
|
|
|
87
87
|
## BitmapText vs Text — the localization trade-off
|
|
88
88
|
|
|
89
|
-
The performance advice "use BitmapText for hot text" (
|
|
89
|
+
The performance advice "use BitmapText for hot text" (the official `game-object-components` skill)
|
|
90
90
|
collides with i18n: a bitmap font only contains the glyphs it was generated with.
|
|
91
91
|
|
|
92
92
|
- **BitmapText** — fastest, but the BMFont must include every glyph the locale
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phaser-project-structure
|
|
3
|
-
description: This skill should be used when creating, restructuring, or reasoning about a Phaser 4 game project — the game config, the Vite + TypeScript layout, the Boot → Preloader → MainMenu → Game scene flow, scale/resolution setup for desktop and mobile, and where code and assets belong. Use it before scaffolding a project, adding a major subsystem, or deciding where a file should live. Pairs with
|
|
3
|
+
description: This skill should be used when creating, restructuring, or reasoning about a Phaser 4 game project — the game config, the Vite + TypeScript layout, the Boot → Preloader → MainMenu → Game scene flow, scale/resolution setup for desktop and mobile, and where code and assets belong. Use it before scaffolding a project, adding a major subsystem, or deciding where a file should live. Pairs with the official scenes skill, the official loading-assets skill, the official filters-and-postfx skill, and phaser-testing.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Phaser 4 Project Structure
|
|
7
7
|
|
|
8
8
|
## Overview
|
|
9
9
|
|
|
10
|
-
This stack targets **Phaser 4** (v4.
|
|
10
|
+
This stack targets **Phaser 4** (v4.2+, npm package `phaser@^4.2.0`), built
|
|
11
11
|
with **Vite + TypeScript** — the layout the official `phaserjs/template-vite-ts`
|
|
12
12
|
template and `npm create @phaserjs/game@latest` scaffold. Phaser 4 ships its own
|
|
13
13
|
type definitions (`types/phaser.d.ts`); do not add `@types/phaser`.
|
|
@@ -55,17 +55,17 @@ v4-specific config facts:
|
|
|
55
55
|
- Pixel-art games: `pixelArt: true` (nearest-neighbor + roundPixels), or the new
|
|
56
56
|
**`render.smoothPixelArt: true`** (WebGL-only) for pixel art that rotates or
|
|
57
57
|
scales smoothly. Pick one per project and record the choice.
|
|
58
|
-
- Custom render nodes register under `render.renderNodes` — see
|
|
58
|
+
- Custom render nodes register under `render.renderNodes` — see the official `filters-and-postfx` skill.
|
|
59
59
|
- `Phaser.HEADLESS` exists for logic-only boots (tests) — see [[phaser-testing]].
|
|
60
60
|
|
|
61
61
|
## Scene flow
|
|
62
62
|
|
|
63
|
-
Four-stage boot, in order (see
|
|
63
|
+
Four-stage boot, in order (see the official `scenes` skill for lifecycle detail):
|
|
64
64
|
|
|
65
65
|
1. **Boot** — loads only the handful of assets the Preloader's loading screen
|
|
66
66
|
needs (logo, progress-bar art). No game assets here.
|
|
67
67
|
2. **Preloader** — renders the loading UI and loads everything else, preferably
|
|
68
|
-
via a single asset-pack manifest (see
|
|
68
|
+
via a single asset-pack manifest (see the official `loading-assets` skill), then starts MainMenu.
|
|
69
69
|
3. **MainMenu** — entry UI; starts Game.
|
|
70
70
|
4. **Game** (+ overlay scenes like `HUD`, `Pause` run in parallel) — gameplay.
|
|
71
71
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phaser-services
|
|
3
|
-
description: This skill should be used when wiring cross-cutting services and shared state in a Phaser 4 game — the typed registry wrapper for global state, a single dedicated EventsCenter bus (never game.events), the .on()/.off() listener discipline enforced in scene shutdown, SoundService (mobile audio unlock on first gesture), InputService (semantic actions instead of raw keys), and SaveService (versioned localStorage with a migration chain). Use it when adding global state, an event bus, audio/input/save plumbing, or fixing listener leaks and lost saves. Pairs with
|
|
3
|
+
description: This skill should be used when wiring cross-cutting services and shared state in a Phaser 4 game — the typed registry wrapper for global state, a single dedicated EventsCenter bus (never game.events), the .on()/.off() listener discipline enforced in scene shutdown, SoundService (mobile audio unlock on first gesture), InputService (semantic actions instead of raw keys), and SaveService (versioned localStorage with a migration chain). Use it when adding global state, an event bus, audio/input/save plumbing, or fixing listener leaks and lost saves. Pairs with the official scenes skill, phaser-testing, and phaser-i18n.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Phaser 4 Services and Shared State
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: phaser-testing
|
|
3
|
-
description: This skill should be used when writing or designing tests for a Phaser 4 game — unit-testing pure game logic with Vitest, keeping logic Phaser-free so it tests without a browser, the Phaser.HEADLESS renderer for logic-only boots, asset-manifest coverage tests, and the CI runtime gates (boot smoke, allocation/perf budget, leak gate, determinism gate, deterministic Playwright visual regression, bundle-size budget) that verify scenes and entities that are excluded from unit coverage. Use it when adding tests, setting up CI verification, or deciding what is testable at which level. Pairs with phaser-project-structure,
|
|
3
|
+
description: This skill should be used when writing or designing tests for a Phaser 4 game — unit-testing pure game logic with Vitest, keeping logic Phaser-free so it tests without a browser, the Phaser.HEADLESS renderer for logic-only boots, asset-manifest coverage tests, and the CI runtime gates (boot smoke, allocation/perf budget, leak gate, determinism gate, deterministic Playwright visual regression, bundle-size budget) that verify scenes and entities that are excluded from unit coverage. Use it when adding tests, setting up CI verification, or deciding what is testable at which level. Pairs with phaser-project-structure, the official loading-assets skill, and phaser-services.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Phaser 4 Testing
|
|
@@ -56,7 +56,7 @@ Cheap tests that catch the silent runtime failures Phaser is famous for:
|
|
|
56
56
|
|
|
57
57
|
- **Asset coverage**: every key constant in `src/assets.ts` appears in
|
|
58
58
|
`public/assets/pack.json` (and optionally vice versa). A missing pack entry
|
|
59
|
-
otherwise ships as a green-square texture (
|
|
59
|
+
otherwise ships as a green-square texture (the official `loading-assets` skill).
|
|
60
60
|
- **Scene registry**: every `SceneKeys` constant has a scene class registered in
|
|
61
61
|
the game config's `scene` array.
|
|
62
62
|
- These are plain Vitest tests reading JSON/TS — no Phaser instance needed.
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: phaser-assets
|
|
3
|
-
description: This skill should be used when loading or organizing assets in a Phaser 4 game — the Loader (images, texture atlases, spritesheets, audio, fonts), asset-pack manifests via this.load.pack, the new PCT compact atlas format (load.atlasPCT), typed asset keys, and where files live in the Vite project. Use it when adding any asset, restructuring loading, fixing a missing-texture/green-square bug, or optimizing load size. Pairs with phaser-project-structure, phaser-scenes, and phaser-gameobjects.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Phaser 4 Assets and Loading
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
All runtime assets live under `public/assets/` (served verbatim by Vite — never
|
|
11
|
-
`import` game assets through the bundler) and are loaded by Phaser's Loader in a
|
|
12
|
-
scene's `preload()`. The opinionated pattern: **one asset-pack manifest, loaded
|
|
13
|
-
by the Preloader, with every key defined as a typed constant.**
|
|
14
|
-
|
|
15
|
-
## Asset packs (the default loading strategy)
|
|
16
|
-
|
|
17
|
-
A pack is a JSON manifest the Loader consumes wholesale:
|
|
18
|
-
|
|
19
|
-
```json
|
|
20
|
-
{
|
|
21
|
-
"main": {
|
|
22
|
-
"files": [
|
|
23
|
-
{ "type": "atlasPCT", "key": "game-atlas", "url": "atlases/game.pct" },
|
|
24
|
-
{ "type": "image", "key": "background", "url": "images/background.png" },
|
|
25
|
-
{ "type": "audio", "key": "sfx-jump", "url": ["audio/jump.ogg", "audio/jump.m4a"] },
|
|
26
|
-
{ "type": "spritesheet", "key": "explosion", "url": "sheets/explosion.png",
|
|
27
|
-
"frameConfig": { "frameWidth": 64, "frameHeight": 64 } }
|
|
28
|
-
]
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
```ts
|
|
34
|
-
// Preloader.preload()
|
|
35
|
-
this.load.pack("game-pack", "assets/pack.json");
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Why packs: loading is declared in one reviewable file instead of scattered
|
|
39
|
-
`load.*` calls; adding an asset never touches scene code beyond using the key.
|
|
40
|
-
|
|
41
|
-
## Texture atlases — the rule, not the suggestion
|
|
42
|
-
|
|
43
|
-
Individual images break sprite batching. Everything that renders together ships
|
|
44
|
-
in an atlas:
|
|
45
|
-
|
|
46
|
-
- **PCT (Phaser Compact Texture)** is the preferred v4 atlas format —
|
|
47
|
-
`this.load.atlasPCT(key, url)` — its manifests are 90–95% smaller than the
|
|
48
|
-
JSON-hash equivalent. JSON/XML/Unity/multi-atlas loaders still exist for
|
|
49
|
-
third-party toolchains.
|
|
50
|
-
- Spritesheets (`load.spritesheet`) are acceptable only for uniform-grid
|
|
51
|
-
animation strips; anything else is an atlas.
|
|
52
|
-
|
|
53
|
-
## Audio
|
|
54
|
-
|
|
55
|
-
- Provide at least two encodings (`.ogg` + `.m4a`) in the url array; Phaser
|
|
56
|
-
picks the first the browser can play.
|
|
57
|
-
- Web Audio is the default manager; it unlocks on first user gesture — never
|
|
58
|
-
autoplay sound before input (it will silently fail and "work on my machine").
|
|
59
|
-
- Use audio sprites (`load.audioSprite`) for large sets of short SFX.
|
|
60
|
-
|
|
61
|
-
## Typed keys
|
|
62
|
-
|
|
63
|
-
Every key lives in `src/assets.ts`:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
export const Tex = { GameAtlas: "game-atlas", Background: "background" } as const;
|
|
67
|
-
export const Sfx = { Jump: "sfx-jump" } as const;
|
|
68
|
-
export const SceneKeys = { Boot: "Boot", Preloader: "Preloader", Game: "Game" } as const;
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Scenes use `Tex.GameAtlas`, never `"game-atlas"` inline. A bad inline key fails
|
|
72
|
-
at runtime as a green square or silent missing audio; a bad constant fails in
|
|
73
|
-
review and in tests that assert the pack manifest covers every constant.
|
|
74
|
-
|
|
75
|
-
## Loading UX and failure handling
|
|
76
|
-
|
|
77
|
-
- The Preloader binds `this.load.on("progress", …)` to a progress bar built from
|
|
78
|
-
Boot-loaded art ([[phaser-project-structure]]).
|
|
79
|
-
- Handle `loaderror`: `this.load.on(Phaser.Loader.Events.FILE_LOAD_ERROR, …)` —
|
|
80
|
-
log the key and URL; a missing asset must fail loudly in dev, not render as a
|
|
81
|
-
placeholder in production.
|
|
82
|
-
|
|
83
|
-
## Project conventions
|
|
84
|
-
|
|
85
|
-
- `public/assets/` subdirs: `atlases/`, `images/`, `audio/`, `sheets/`, `fonts/`,
|
|
86
|
-
plus `pack.json` at the root of `assets/`.
|
|
87
|
-
- Generated atlas files (PCT/JSON + PNG pages) are build inputs, committed to the
|
|
88
|
-
repo; their source art lives wherever the art pipeline keeps it.
|
|
89
|
-
- A test should assert that every key constant in `src/assets.ts` appears in
|
|
90
|
-
`pack.json` (cheap manifest-coverage check; see [[phaser-testing]]).
|
|
91
|
-
|
|
92
|
-
## Verification
|
|
93
|
-
|
|
94
|
-
Asset changes are verified by booting the game and watching the network panel /
|
|
95
|
-
console: every file 200s, no `FILE_LOAD_ERROR`, and the new asset visibly renders
|
|
96
|
-
or audibly plays in the scene that uses it.
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
display_name: "Phaser Assets"
|
|
2
|
-
short_description: "loading or organizing assets in a Phaser 4 game — the Loader (images, texture atlases, spritesheets, audio, fonts), asset-pack manifests…"
|
|
3
|
-
default_prompt:
|
|
4
|
-
- "Use $phaser-assets: loading or organizing assets in a Phaser 4 game — the Loader (images, texture atlases, spritesheets, audio, fonts), asset-pack manifests…."
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: phaser-gameobjects
|
|
3
|
-
description: This skill should be used when creating or managing Phaser 4 GameObjects — sprites, images, text, containers, groups and object pooling, animations (anims), tweens, particles, and the v4 GPU layers (SpriteGPULayer, TilemapGPULayer) for massive object counts. Use it when adding entities, fixing per-frame allocation/GC issues, pooling projectiles, or choosing between a Container and a Group. Pairs with phaser-scenes, phaser-physics, phaser-rendering, and phaser-assets.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Phaser 4 GameObjects
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
GameObjects carry over from Phaser 3 largely unchanged: `Sprite`, `Image`,
|
|
11
|
-
`Text`, `BitmapText`, `Container`, `Group`, `Graphics`, the Shape objects, and
|
|
12
|
-
the particle system. v4 adds `Gradient`, `Stamp`, `CaptureFrame`, the Noise
|
|
13
|
-
objects, NineSlice tiling (`tileX`/`tileY`), and — the headline — the GPU
|
|
14
|
-
layers. Removed: `Mesh`, `Plane`, the OBJ loader, `Camera3D`/`Layer3D`
|
|
15
|
-
([[phaser-v3-migration]]).
|
|
16
|
-
|
|
17
|
-
## Choosing the right object
|
|
18
|
-
|
|
19
|
-
- **Image** for static visuals (cheaper than Sprite — no animation component).
|
|
20
|
-
- **Sprite** only when it animates.
|
|
21
|
-
- **Container** for transform-grouping a small, fixed set of children (a unit +
|
|
22
|
-
its health bar). Containers are not free — don't nest deeply or use them as
|
|
23
|
-
ad-hoc layers. In v4.1+, `Layer` is a true GameObject and is the right tool
|
|
24
|
-
for z-grouping with filters.
|
|
25
|
-
- **Group** for managing many homogeneous objects — and for pooling (below).
|
|
26
|
-
- **Text** uses Canvas rasterization per change; for score counters and other
|
|
27
|
-
hot text use `BitmapText`.
|
|
28
|
-
|
|
29
|
-
## Object pooling (mandatory for spawn-heavy entities)
|
|
30
|
-
|
|
31
|
-
Bullets, enemies, particles, pickups: never `new`/`destroy` per spawn — pool
|
|
32
|
-
through a Group:
|
|
33
|
-
|
|
34
|
-
```ts
|
|
35
|
-
this.bullets = this.add.group({ classType: Bullet, maxSize: 64, runChildUpdate: true });
|
|
36
|
-
// spawn
|
|
37
|
-
const b = this.bullets.get(x, y, Tex.GameAtlas, "bullet") as Bullet | null;
|
|
38
|
-
if (b) { b.setActive(true).setVisible(true); b.fire(dir); }
|
|
39
|
-
// despawn (inside Bullet when off-screen/expired)
|
|
40
|
-
this.bullets.killAndHide(this); this.body.enable = false;
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
`maxSize` caps the pool; `get()` returns `null` when exhausted — handle it
|
|
44
|
-
(drop the spawn) rather than growing unbounded.
|
|
45
|
-
|
|
46
|
-
## Per-frame discipline
|
|
47
|
-
|
|
48
|
-
In `update()` paths: no object literals, no array spreads, no `.map/.filter`
|
|
49
|
-
chains, no closures. Hoist scratch `Vector2`s and reuse them. The GC pause from
|
|
50
|
-
per-frame garbage is the most common cause of stutter that profilers get blamed
|
|
51
|
-
for.
|
|
52
|
-
|
|
53
|
-
## Animations and tweens
|
|
54
|
-
|
|
55
|
-
- Define animations once (Preloader `create` or a dedicated module) on the
|
|
56
|
-
global `this.anims`; play by key constant: `sprite.play(Anim.Run)`.
|
|
57
|
-
- Tweens (`this.tweens.add`) and Timelines carry over from v3 unchanged. Kill
|
|
58
|
-
tweens that target objects you pool/despawn — a tween holding a pooled object
|
|
59
|
-
alive is a classic leak.
|
|
60
|
-
|
|
61
|
-
## Massive counts: the GPU layers
|
|
62
|
-
|
|
63
|
-
New in v4 — reach for these instead of "thousands of sprites":
|
|
64
|
-
|
|
65
|
-
- **SpriteGPULayer** — on the order of a million static-ish sprites in a single
|
|
66
|
-
draw call, with per-member GPU-driven animation, easing, and parallax. Use for
|
|
67
|
-
starfields, crowds, debris, background fauna.
|
|
68
|
-
- **TilemapGPULayer** — renders a whole tile layer as one quad with per-pixel
|
|
69
|
-
cost, up to 4096×4096 tiles. Use for large maps, especially on mobile.
|
|
70
|
-
|
|
71
|
-
Regular Sprites + Groups remain correct for interactive entities (things with
|
|
72
|
-
bodies, input, per-entity logic).
|
|
73
|
-
|
|
74
|
-
## Particles
|
|
75
|
-
|
|
76
|
-
The particle API is the v3.60-style `this.add.particles(x, y, texture, config)`
|
|
77
|
-
emitter manager. v4 additions: particles respect the lighting system. Pool
|
|
78
|
-
explosion-style one-shot emitters or use `emitter.explode()` rather than
|
|
79
|
-
creating emitters per event.
|
|
80
|
-
|
|
81
|
-
## Project conventions
|
|
82
|
-
|
|
83
|
-
- Entity classes (`Bullet extends Phaser.Physics.Arcade.Sprite`) live in
|
|
84
|
-
`src/entities/`, take their tunables from `src/logic/` config objects, and use
|
|
85
|
-
asset-key constants ([[phaser-assets]]).
|
|
86
|
-
- Depth management: named depth constants (`Depth.World`, `Depth.FX`,
|
|
87
|
-
`Depth.UI`), not scattered magic numbers.
|
|
88
|
-
|
|
89
|
-
## Verification
|
|
90
|
-
|
|
91
|
-
Object-lifecycle changes are verified in the running game: spawn/despawn the
|
|
92
|
-
entity repeatedly and watch the object count (`this.children.length`,
|
|
93
|
-
`group.getLength()`) stay bounded, and the FPS meter stay flat — an unbounded
|
|
94
|
-
count or sawtooth memory profile means the pool or tween cleanup is wrong.
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
display_name: "Phaser Gameobjects"
|
|
2
|
-
short_description: "creating or managing Phaser 4 GameObjects — sprites, images, text, containers, groups and object pooling, animations (anims), tweens…"
|
|
3
|
-
default_prompt:
|
|
4
|
-
- "Use $phaser-gameobjects: creating or managing Phaser 4 GameObjects — sprites, images, text, containers, groups and object pooling, animations (anims), tweens…."
|