@mertdogar/phaser-procedural-walls 0.2.0 → 0.4.0

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/README.md CHANGED
@@ -2,19 +2,28 @@
2
2
 
3
3
  A Phaser 4 scene plugin that draws top-down floorplan walls from a few lines of data. You describe wall centerlines and window positions; the plugin draws thick wall bodies, a front face, see-through windows with sills, and optional Arcade Physics colliders, and it depth-sorts each wall so characters walk in front of and behind walls correctly.
4
4
 
5
- ![Wallcraft editor with a selected wall and geometry inspector](docs/images/wallcraft-editor.png)
5
+ ![Wallcraft editor with a selected wall, layers panel, and docked inspector](docs/images/wallcraft-editor.png)
6
6
 
7
7
  ## Features
8
8
 
9
9
  - Axis-aligned wall segments with automatic corner and T-junction filling
10
10
  - Per-wall style presets: flat colors or tiled textures for the wall top and its face
11
11
  - Windows cut into the face with translucent glass and an opaque sill
12
- - One depth-sorted Container per wall, so `sprite.setDepth(sprite.y)` is all a character needs
13
- - Optional Arcade static bodies: a thin plane under horizontal walls, a full rectangle for vertical ones
12
+ - One depth-sorted Container per wall; use `sprite.setDepth(sprite.y)` with automatic wall depths
13
+ - Optional Arcade static bodies matching each wall's bottom footprint
14
14
  - Pure geometry module with unit tests, no Phaser needed to test it
15
+ - Embeddable `WallEditor` for drawing, selection, endpoint handles, and window dragging in an existing Phaser scene
15
16
  - Wallcraft editor prototype: draw walls, drag endpoints and windows, edit height and drawing order, and manage presets
17
+ - Resizable layers and inspector panels with wall selection, duplication, deletion, and reordering
18
+ - Full-pane canvas with origin axes, two-finger scrolling to pan, and pinching to zoom
19
+ - Map preferences for applying height or thickness to all existing walls
16
20
  - Upload tiled textures, export/import maps with embedded images, and test collisions in a playable preview
17
21
 
22
+ Custom wall drawing orders need matching character-depth handling in your game.
23
+ Wallcraft preview handles player occlusion against wall footprints, but this
24
+ editor-only logic is not included in JSON exports. See the
25
+ [depth convention](docs/api.md#depth-convention).
26
+
18
27
  ## Try Wallcraft
19
28
 
20
29
  With Node 20 or newer, launch the packaged editor:
@@ -25,7 +34,9 @@ npx @mertdogar/phaser-procedural-walls@latest editor
25
34
  pnpx @mertdogar/phaser-procedural-walls@latest editor
26
35
  ```
27
36
 
28
- This command requires a release that includes the editor CLI. For a source checkout, use:
37
+ This command requires a release that includes the editor CLI. This README and
38
+ its screenshots describe the current repository; the published npm release may
39
+ not include the latest editor and geometry changes. To use the repository version:
29
40
 
30
41
  ```bash
31
42
  pnpm install
@@ -88,14 +99,81 @@ player.setDepth(player.y);
88
99
  - [Quick start](docs/quickstart.md). Build a walkable room with a window from an empty folder.
89
100
  - [Wallcraft guide](docs/wallcraft.md). Edit maps, manage presets and textures, test collisions, and export to Phaser.
90
101
  - [API reference](docs/api.md). Every config field, preset option, and method.
91
- - [How it works](docs/how-it-works.md). Corner filling, depth sorting, the collision plane, and window holes.
102
+ - [How it works](docs/how-it-works.md). Corner filling, depth sorting, collision footprints, and window holes.
103
+
104
+ ## Agent skill
105
+
106
+ The repository includes a portable
107
+ [procedural-walls skill](skills/phaser-procedural-walls/SKILL.md) for coding
108
+ agents. It covers library integration, Wallcraft exports, presets, textures,
109
+ depth sorting, and collisions, with self-contained references.
110
+
111
+ Install it from your project's root with the [skills CLI](https://skills.sh/docs):
112
+
113
+ ```bash
114
+ npx skills add mertdogar/phaser-procedural-walls --skill phaser-procedural-walls
115
+ ```
116
+
117
+ Append `--agent codex` to target Codex, or `--global` to install for your user
118
+ instead of the current project. The installation includes the bundled references.
119
+
120
+ To check available skills without installing:
121
+
122
+ ```bash
123
+ npx skills add mertdogar/phaser-procedural-walls --list
124
+ ```
125
+
126
+ Start a new agent session if needed, then ask, for example:
127
+ “Use the phaser-procedural-walls skill to load my Wallcraft export into a Phaser
128
+ scene with player collisions.” The skill is distributed in Git, not in the npm
129
+ package. Its bundled references track the repository, including changes made
130
+ after the original 0.2.0 release.
131
+
132
+ ## 0.4.0 release notes
133
+
134
+ Version 0.4.0 exports `WallEditor`, extracted from Wallcraft's canvas interactions.
135
+ Attach it to your existing Phaser scene to draw snapped walls, select walls,
136
+ drag endpoints, and move windows. Your application owns data, UI, rendering,
137
+ camera navigation, and accepting or refusing edits.
138
+
139
+ The standalone editor now uses this component. Open `/?embedded` in the demo
140
+ or packaged editor for a small Phaser-only example with property controls.
141
+ See the [embedding guide](docs/wallcraft.md#embed-the-wall-editor-in-your-game)
142
+ and [API reference](docs/api.md#walleditor). Existing renderer and geometry APIs
143
+ are unchanged.
144
+
145
+ ## 0.3.0 release notes
146
+
147
+ Version 0.3.0 adds large-map navigation, resizable layers and inspector panels,
148
+ bulk height and thickness settings, window-width controls, and a Help dialog.
149
+ Select and Draw now live in the top bar. Preview handles player occlusion with
150
+ custom wall drawing orders. Documentation, screenshots, and the repository's
151
+ installable agent skill have also been updated.
152
+
153
+ ### Upgrade from 0.2.0
154
+
155
+ Review existing maps before upgrading your game:
156
+
157
+ - **Collision footprints changed.** Colliders now match the wall body's bottom
158
+ footprint, shifted south by its effective face height. Recheck spawn points,
159
+ wall junctions, and doorways. Use matching face heights around aligned gaps.
160
+ - **Default window sills changed.** When `sillHeight` is omitted, it follows wall
161
+ thickness, clipped to the opening height. Explicit values remain unchanged;
162
+ set a value to preserve an older look, or use zero to disable sills.
163
+ - **Preview sorting is editor-only.** Exported custom `depth` values remain
164
+ absolute drawing orders. Consumer games still need character sorting that
165
+ accounts for these values; `setDepth(player.y)` assumes automatic wall depths.
166
+
167
+ Launch this specific version with
168
+ `npx @mertdogar/phaser-procedural-walls@0.3.0 editor` or
169
+ `pnpx @mertdogar/phaser-procedural-walls@0.3.0 editor`.
92
170
 
93
171
  ## Develop
94
172
 
95
173
  ```bash
96
174
  pnpm install
97
175
  pnpm dev # wall editor prototype: draw walls and import/export WallMapConfig JSON
98
- pnpm test # geometry unit tests
176
+ pnpm test # geometry and editor interaction tests
99
177
  pnpm typecheck
100
178
  pnpm lint
101
179
  pnpm build # library in dist/ and bundled app in dist/editor/
@@ -0,0 +1,54 @@
1
+ import Phaser from "phaser";
2
+ import type { WallMapConfig, WallSpec } from "./types";
3
+ export type WallEditorTool = "select" | "wall";
4
+ export interface WallEditorCallbacks {
5
+ onAddWall: (wall: WallSpec) => void;
6
+ onSelectWall: (index: number | null) => void;
7
+ onUpdateWall: (index: number, patch: Partial<WallSpec>) => void;
8
+ }
9
+ export interface WallEditorState {
10
+ config: WallMapConfig;
11
+ selectedIndex: number | null;
12
+ tool: WallEditorTool;
13
+ enabled?: boolean;
14
+ }
15
+ export interface WallEditorOptions extends WallEditorState, WallEditorCallbacks {
16
+ camera?: Phaser.Cameras.Scene2D.Camera;
17
+ gridSize?: number;
18
+ overlayDepth?: number;
19
+ newWall?: Partial<Pick<WallSpec, "thickness" | "height" | "preset">>;
20
+ }
21
+ export declare class WallEditor {
22
+ private readonly scene;
23
+ private configData;
24
+ private selectedIndex;
25
+ private tool;
26
+ private enabled;
27
+ private readonly camera;
28
+ private readonly gridSize;
29
+ private readonly overlay;
30
+ private readonly callbacks;
31
+ private newWall;
32
+ private drawStart;
33
+ private pointerPosition;
34
+ private anchorDrag;
35
+ private windowDrag;
36
+ constructor(scene: Phaser.Scene, options: WallEditorOptions);
37
+ setState(state: WallEditorState): void;
38
+ setNewWall(wall: Partial<Pick<WallSpec, "thickness" | "height" | "preset">>): void;
39
+ get dragging(): boolean;
40
+ cancel(): void;
41
+ destroy(): void;
42
+ private handlePointerDown;
43
+ private handlePointerMove;
44
+ private handlePointerUp;
45
+ refresh(): void;
46
+ private findWall;
47
+ private findAnchor;
48
+ private findWindow;
49
+ private getWindowRects;
50
+ private moveWindow;
51
+ private moveEndpoint;
52
+ private snapPoint;
53
+ private axisLock;
54
+ }