@zylem/behaviors 0.4.1 → 0.5.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/README.md +13 -1
- package/dist/{behavior-system-y8SGrGWy.d.ts → behavior-system-CeJXzNvr.d.ts} +305 -17
- package/dist/{chunk-GFARAJV2.js → chunk-2PAHQZZD.js} +44 -73
- package/dist/chunk-2PAHQZZD.js.map +1 -0
- package/dist/chunk-52FJIDGL.js +30 -0
- package/dist/chunk-52FJIDGL.js.map +1 -0
- package/dist/{chunk-UYFOLI2X.js → chunk-5A5AYP2C.js} +1 -1
- package/dist/{chunk-UYFOLI2X.js.map → chunk-5A5AYP2C.js.map} +1 -1
- package/dist/{chunk-A4CA35DQ.js → chunk-5EBIIYZD.js} +25 -45
- package/dist/chunk-5EBIIYZD.js.map +1 -0
- package/dist/{chunk-4L36OPY2.js → chunk-5NJGASUJ.js} +81 -135
- package/dist/chunk-5NJGASUJ.js.map +1 -0
- package/dist/{chunk-27UPCP5B.js → chunk-5UMCWV5A.js} +22 -13
- package/dist/chunk-5UMCWV5A.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-5WRI5ZAA.js.map +1 -0
- package/dist/{chunk-5SM5SH5O.js → chunk-7JLWZXPA.js} +2 -2
- package/dist/{chunk-Z72F2ENM.js → chunk-AEBDZWCP.js} +17 -26
- package/dist/chunk-AEBDZWCP.js.map +1 -0
- package/dist/chunk-AS3HR7AS.js +188 -0
- package/dist/chunk-AS3HR7AS.js.map +1 -0
- package/dist/chunk-E4X4YJZB.js +841 -0
- package/dist/chunk-E4X4YJZB.js.map +1 -0
- package/dist/{chunk-VMQHNJJI.js → chunk-F6ESSHQK.js} +17 -23
- package/dist/chunk-F6ESSHQK.js.map +1 -0
- package/dist/chunk-GQAPBNGT.js +210 -0
- package/dist/chunk-GQAPBNGT.js.map +1 -0
- package/dist/chunk-JGXRQUTC.js +191 -0
- package/dist/chunk-JGXRQUTC.js.map +1 -0
- package/dist/{chunk-BXP4K7RF.js → chunk-JVADRLWX.js} +57 -186
- package/dist/chunk-JVADRLWX.js.map +1 -0
- package/dist/{chunk-ZA43LPRM.js → chunk-KIYUUSPK.js} +2 -2
- package/dist/{chunk-QDCJLJUV.js → chunk-KOWGILCN.js} +22 -13
- package/dist/chunk-KOWGILCN.js.map +1 -0
- package/dist/{chunk-WWVD5DR5.js → chunk-M3QDKKDF.js} +2 -8
- package/dist/chunk-M3QDKKDF.js.map +1 -0
- package/dist/{chunk-FTDZAKZW.js → chunk-NQPYMUDF.js} +7 -5
- package/dist/{chunk-FTDZAKZW.js.map → chunk-NQPYMUDF.js.map} +1 -1
- package/dist/{chunk-XP3ASVGJ.js → chunk-NW4SE5XW.js} +2 -2
- package/dist/{chunk-KDY5N6J4.js → chunk-OPZ2LVS2.js} +1 -22
- package/dist/{chunk-KDY5N6J4.js.map → chunk-OPZ2LVS2.js.map} +1 -1
- package/dist/{chunk-5XZWTFGF.js → chunk-PLIXVF7B.js} +3 -3
- package/dist/chunk-PLIXVF7B.js.map +1 -0
- package/dist/{chunk-Y7YIAWPW.js → chunk-SGHIGTVZ.js} +1 -11
- package/dist/{chunk-Y7YIAWPW.js.map → chunk-SGHIGTVZ.js.map} +1 -1
- package/dist/{chunk-UL6Q5HDP.js → chunk-TBUKJKY6.js} +3 -25
- package/dist/chunk-TBUKJKY6.js.map +1 -0
- package/dist/chunk-VFDUKGRZ.js +155 -0
- package/dist/chunk-VFDUKGRZ.js.map +1 -0
- package/dist/chunk-VT3H43QA.js +288 -0
- package/dist/chunk-VT3H43QA.js.map +1 -0
- package/dist/chunk-W26PHBME.js +309 -0
- package/dist/chunk-W26PHBME.js.map +1 -0
- package/dist/components-BANNjAZP.d.ts +30 -0
- package/dist/cooldown.d.ts +2 -2
- package/dist/cooldown.js +1 -0
- package/dist/coordinators/boundary-ricochet-3d.d.ts +4 -4
- package/dist/coordinators/boundary-ricochet-3d.js +1 -0
- package/dist/coordinators/boundary-ricochet.d.ts +4 -4
- package/dist/coordinators/boundary-ricochet.js +3 -2
- package/dist/coordinators/first-person-shooter.js +1 -0
- package/dist/coordinators/multidirectional-space-shooter.d.ts +3 -3
- package/dist/coordinators/multidirectional-space-shooter.js +5 -3
- package/dist/coordinators/top-down-shooter.d.ts +3 -3
- package/dist/coordinators/top-down-shooter.js +5 -3
- package/dist/core.d.ts +288 -8
- package/dist/core.js +480 -13
- package/dist/core.js.map +1 -1
- package/dist/destructible-3d.d.ts +32 -4
- package/dist/destructible-3d.js +2 -1
- package/dist/destructible-prebake.js +1 -0
- package/dist/{entity-types-CmtQ-IBp.d.ts → entity-types-DhfsZbSK.d.ts} +5 -3
- package/dist/first-person.d.ts +27 -38
- package/dist/first-person.js +8 -8
- package/dist/index.d.ts +14 -15
- package/dist/index.js +37 -52
- package/dist/jumper-2d.d.ts +3 -17
- package/dist/jumper-2d.js +4 -9
- package/dist/jumper-3d.d.ts +5 -39
- package/dist/jumper-3d.js +5 -10
- package/dist/{moveable-Cl9h-_w7.d.ts → moveable-XhzWPAw5.d.ts} +21 -4
- package/dist/particle-emitter/presets.js +1 -0
- package/dist/particle-emitter.d.ts +3 -3
- package/dist/particle-emitter.js +3 -2
- package/dist/platformer-2d.d.ts +13 -82
- package/dist/platformer-2d.js +4 -5
- package/dist/platformer-3d.d.ts +13 -78
- package/dist/platformer-3d.js +4 -5
- package/dist/ricochet-2d.d.ts +3 -3
- package/dist/ricochet-2d.js +4 -3
- package/dist/ricochet-3d.d.ts +3 -3
- package/dist/ricochet-3d.js +4 -3
- package/dist/runtime-2d.d.ts +2 -2
- package/dist/runtime-2d.js +1 -0
- package/dist/runtime-2d.js.map +1 -1
- package/dist/screen-visibility.d.ts +2 -2
- package/dist/screen-visibility.js +1 -0
- package/dist/screen-wrap.d.ts +2 -2
- package/dist/screen-wrap.js +4 -3
- package/dist/shooter-2d.d.ts +3 -3
- package/dist/shooter-2d.js +4 -3
- package/dist/thruster.d.ts +5 -34
- package/dist/thruster.js +4 -6
- package/dist/top-down-movement.d.ts +9 -27
- package/dist/top-down-movement.js +6 -6
- package/dist/{vector-Bm65-FOG.d.ts → vector-DjhLUrak.d.ts} +2 -4
- package/dist/world-boundary-2d.d.ts +2 -2
- package/dist/world-boundary-2d.js +5 -4
- package/dist/world-boundary-3d.d.ts +2 -2
- package/dist/world-boundary-3d.js +4 -3
- package/package.json +2 -3
- package/dist/chunk-27UPCP5B.js.map +0 -1
- package/dist/chunk-4L36OPY2.js.map +0 -1
- package/dist/chunk-4URF65BR.js +0 -44
- package/dist/chunk-4URF65BR.js.map +0 -1
- package/dist/chunk-5XZWTFGF.js.map +0 -1
- package/dist/chunk-67XLJ26X.js +0 -536
- package/dist/chunk-67XLJ26X.js.map +0 -1
- package/dist/chunk-75FJIUIG.js +0 -240
- package/dist/chunk-75FJIUIG.js.map +0 -1
- package/dist/chunk-A4CA35DQ.js.map +0 -1
- package/dist/chunk-BXP4K7RF.js.map +0 -1
- package/dist/chunk-F72WX4MH.js +0 -422
- package/dist/chunk-F72WX4MH.js.map +0 -1
- package/dist/chunk-GFARAJV2.js.map +0 -1
- package/dist/chunk-JXMF4NUI.js +0 -309
- package/dist/chunk-JXMF4NUI.js.map +0 -1
- package/dist/chunk-OTLSUYQQ.js +0 -29
- package/dist/chunk-OTLSUYQQ.js.map +0 -1
- package/dist/chunk-Q75LKHDF.js +0 -56
- package/dist/chunk-Q75LKHDF.js.map +0 -1
- package/dist/chunk-QDCJLJUV.js.map +0 -1
- package/dist/chunk-RDHSHEZM.js +0 -479
- package/dist/chunk-RDHSHEZM.js.map +0 -1
- package/dist/chunk-UIG7MWS2.js +0 -518
- package/dist/chunk-UIG7MWS2.js.map +0 -1
- package/dist/chunk-UL6Q5HDP.js.map +0 -1
- package/dist/chunk-VMQHNJJI.js.map +0 -1
- package/dist/chunk-WWVD5DR5.js.map +0 -1
- package/dist/chunk-Z72F2ENM.js.map +0 -1
- package/dist/components-BWG1GkZA.d.ts +0 -20
- package/dist/use-behavior-B85d5u7-.d.ts +0 -13
- /package/dist/{chunk-5SM5SH5O.js.map → chunk-7JLWZXPA.js.map} +0 -0
- /package/dist/{chunk-ZA43LPRM.js.map → chunk-KIYUUSPK.js.map} +0 -0
- /package/dist/{chunk-XP3ASVGJ.js.map → chunk-NW4SE5XW.js.map} +0 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SyncStateMachine,
|
|
3
|
+
import_typescript_fsm
|
|
4
|
+
} from "./chunk-AS3HR7AS.js";
|
|
5
|
+
import {
|
|
6
|
+
STAGE_INPUT_BUTTON_JUMP,
|
|
7
|
+
STAGE_INPUT_BUTTON_RUN,
|
|
8
|
+
readBehaviorSnapshot
|
|
9
|
+
} from "./chunk-E4X4YJZB.js";
|
|
10
|
+
import {
|
|
11
|
+
defineBehavior
|
|
12
|
+
} from "./chunk-EZNCCO4L.js";
|
|
13
|
+
|
|
14
|
+
// src/lib/behaviors/platformer-3d/components.ts
|
|
15
|
+
function createPlatformer3DMovementComponent(options = {}) {
|
|
16
|
+
return {
|
|
17
|
+
walkSpeed: options.walkSpeed ?? 12,
|
|
18
|
+
runSpeed: options.runSpeed ?? 24,
|
|
19
|
+
jumpForce: options.jumpForce ?? 12,
|
|
20
|
+
maxJumps: options.maxJumps ?? 1,
|
|
21
|
+
gravity: options.gravity ?? 9.82,
|
|
22
|
+
coyoteTime: options.coyoteTime ?? 0.1,
|
|
23
|
+
jumpBufferTime: options.jumpBufferTime ?? 0.1,
|
|
24
|
+
jumpCutMultiplier: options.jumpCutMultiplier ?? 0.5,
|
|
25
|
+
multiJumpWindowTime: options.multiJumpWindowTime ?? 0.15,
|
|
26
|
+
// 150ms default
|
|
27
|
+
slopeClimbAngle: options.slopeClimbAngle ?? 50,
|
|
28
|
+
slopeSlideAngle: options.slopeSlideAngle ?? 40,
|
|
29
|
+
autostep: options.autostep ?? { maxHeight: 0.3, minWidth: 0.1 },
|
|
30
|
+
snapToGroundDistance: options.snapToGroundDistance ?? 0.3,
|
|
31
|
+
characterOffset: options.characterOffset ?? 0.05
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function createPlatformer3DInputComponent() {
|
|
35
|
+
return {
|
|
36
|
+
moveX: 0,
|
|
37
|
+
moveZ: 0,
|
|
38
|
+
jump: false,
|
|
39
|
+
run: false
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function createPlatformer3DStateComponent() {
|
|
43
|
+
return {
|
|
44
|
+
grounded: false,
|
|
45
|
+
jumping: false,
|
|
46
|
+
falling: false,
|
|
47
|
+
jumpCount: 0,
|
|
48
|
+
jumpStartHeight: 0,
|
|
49
|
+
currentSpeed: 0,
|
|
50
|
+
lastGroundedY: 0,
|
|
51
|
+
jumpPressedLastFrame: false,
|
|
52
|
+
collisionGrounded: false,
|
|
53
|
+
groundedCollisionTime: 0,
|
|
54
|
+
timeSinceGrounded: 0,
|
|
55
|
+
jumpBuffered: false,
|
|
56
|
+
jumpBufferTimer: 0,
|
|
57
|
+
jumpHeld: false,
|
|
58
|
+
jumpCutApplied: false,
|
|
59
|
+
jumpReleasedSinceLastJump: true,
|
|
60
|
+
timeSinceJump: 0,
|
|
61
|
+
jumpedThisFrame: false,
|
|
62
|
+
jumpCutRampTimer: 0,
|
|
63
|
+
verticalVelocity: 0
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// src/lib/behaviors/platformer-3d/platformer-3d-fsm.ts
|
|
68
|
+
var Platformer3DState = /* @__PURE__ */ ((Platformer3DState2) => {
|
|
69
|
+
Platformer3DState2["Idle"] = "idle";
|
|
70
|
+
Platformer3DState2["Walking"] = "walking";
|
|
71
|
+
Platformer3DState2["Running"] = "running";
|
|
72
|
+
Platformer3DState2["Jumping"] = "jumping";
|
|
73
|
+
Platformer3DState2["Falling"] = "falling";
|
|
74
|
+
Platformer3DState2["Landing"] = "landing";
|
|
75
|
+
return Platformer3DState2;
|
|
76
|
+
})(Platformer3DState || {});
|
|
77
|
+
var Platformer3DEvent = /* @__PURE__ */ ((Platformer3DEvent2) => {
|
|
78
|
+
Platformer3DEvent2["Walk"] = "walk";
|
|
79
|
+
Platformer3DEvent2["Run"] = "run";
|
|
80
|
+
Platformer3DEvent2["Jump"] = "jump";
|
|
81
|
+
Platformer3DEvent2["Fall"] = "fall";
|
|
82
|
+
Platformer3DEvent2["Land"] = "land";
|
|
83
|
+
Platformer3DEvent2["Stop"] = "stop";
|
|
84
|
+
return Platformer3DEvent2;
|
|
85
|
+
})(Platformer3DEvent || {});
|
|
86
|
+
var Platformer3DFSM = class {
|
|
87
|
+
constructor(ctx) {
|
|
88
|
+
this.ctx = ctx;
|
|
89
|
+
this.machine = new SyncStateMachine(
|
|
90
|
+
"idle" /* Idle */,
|
|
91
|
+
[
|
|
92
|
+
// Idle transitions
|
|
93
|
+
(0, import_typescript_fsm.t)("idle" /* Idle */, "walk" /* Walk */, "walking" /* Walking */),
|
|
94
|
+
(0, import_typescript_fsm.t)("idle" /* Idle */, "run" /* Run */, "running" /* Running */),
|
|
95
|
+
(0, import_typescript_fsm.t)("idle" /* Idle */, "jump" /* Jump */, "jumping" /* Jumping */),
|
|
96
|
+
(0, import_typescript_fsm.t)("idle" /* Idle */, "fall" /* Fall */, "falling" /* Falling */),
|
|
97
|
+
// Walking transitions
|
|
98
|
+
(0, import_typescript_fsm.t)("walking" /* Walking */, "run" /* Run */, "running" /* Running */),
|
|
99
|
+
(0, import_typescript_fsm.t)("walking" /* Walking */, "jump" /* Jump */, "jumping" /* Jumping */),
|
|
100
|
+
(0, import_typescript_fsm.t)("walking" /* Walking */, "stop" /* Stop */, "idle" /* Idle */),
|
|
101
|
+
(0, import_typescript_fsm.t)("walking" /* Walking */, "fall" /* Fall */, "falling" /* Falling */),
|
|
102
|
+
// Running transitions
|
|
103
|
+
(0, import_typescript_fsm.t)("running" /* Running */, "walk" /* Walk */, "walking" /* Walking */),
|
|
104
|
+
(0, import_typescript_fsm.t)("running" /* Running */, "jump" /* Jump */, "jumping" /* Jumping */),
|
|
105
|
+
(0, import_typescript_fsm.t)("running" /* Running */, "stop" /* Stop */, "idle" /* Idle */),
|
|
106
|
+
(0, import_typescript_fsm.t)("running" /* Running */, "fall" /* Fall */, "falling" /* Falling */),
|
|
107
|
+
// Jumping transitions
|
|
108
|
+
(0, import_typescript_fsm.t)("jumping" /* Jumping */, "fall" /* Fall */, "falling" /* Falling */),
|
|
109
|
+
(0, import_typescript_fsm.t)("jumping" /* Jumping */, "land" /* Land */, "landing" /* Landing */),
|
|
110
|
+
(0, import_typescript_fsm.t)("jumping" /* Jumping */, "jump" /* Jump */, "jumping" /* Jumping */),
|
|
111
|
+
// Multi-jump
|
|
112
|
+
// Falling transitions
|
|
113
|
+
(0, import_typescript_fsm.t)("falling" /* Falling */, "land" /* Land */, "landing" /* Landing */),
|
|
114
|
+
// Landing transitions
|
|
115
|
+
(0, import_typescript_fsm.t)("landing" /* Landing */, "walk" /* Walk */, "walking" /* Walking */),
|
|
116
|
+
(0, import_typescript_fsm.t)("landing" /* Landing */, "run" /* Run */, "running" /* Running */),
|
|
117
|
+
(0, import_typescript_fsm.t)("landing" /* Landing */, "stop" /* Stop */, "idle" /* Idle */),
|
|
118
|
+
// Self-transitions (no-ops)
|
|
119
|
+
(0, import_typescript_fsm.t)("idle" /* Idle */, "stop" /* Stop */, "idle" /* Idle */)
|
|
120
|
+
]
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
ctx;
|
|
124
|
+
machine;
|
|
125
|
+
/**
|
|
126
|
+
* Get the current state
|
|
127
|
+
*/
|
|
128
|
+
getState() {
|
|
129
|
+
return this.machine.getState();
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Dispatch an event to the FSM
|
|
133
|
+
*/
|
|
134
|
+
dispatch(event) {
|
|
135
|
+
if (this.machine.can(event)) {
|
|
136
|
+
this.machine.syncDispatch(event);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Check if grounded
|
|
141
|
+
*/
|
|
142
|
+
isGrounded() {
|
|
143
|
+
const state = this.getState();
|
|
144
|
+
return state === "idle" /* Idle */ || state === "walking" /* Walking */ || state === "running" /* Running */ || state === "landing" /* Landing */;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get current jump count from context
|
|
148
|
+
*/
|
|
149
|
+
getJumpCount() {
|
|
150
|
+
return this.ctx.state.jumpCount;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Handle collision event to update ground state
|
|
154
|
+
*/
|
|
155
|
+
handleCollision(ctx) {
|
|
156
|
+
if (ctx.contact.normal.y > 0.5) {
|
|
157
|
+
this.ctx.state.collisionGrounded = true;
|
|
158
|
+
this.ctx.state.groundedCollisionTime = performance.now();
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Update FSM based on current state
|
|
163
|
+
*/
|
|
164
|
+
update(input, state) {
|
|
165
|
+
this.ctx.input = input;
|
|
166
|
+
this.ctx.state = state;
|
|
167
|
+
const currentState = this.getState();
|
|
168
|
+
const hasInput = Math.abs(input.moveX) > 0.1 || Math.abs(input.moveZ) > 0.1;
|
|
169
|
+
const isRunning = input.run;
|
|
170
|
+
if (currentState === "falling" /* Falling */ && state.grounded) {
|
|
171
|
+
this.dispatch("land" /* Land */);
|
|
172
|
+
}
|
|
173
|
+
if (state.grounded) {
|
|
174
|
+
if (hasInput) {
|
|
175
|
+
if (isRunning) {
|
|
176
|
+
this.dispatch("run" /* Run */);
|
|
177
|
+
} else {
|
|
178
|
+
this.dispatch("walk" /* Walk */);
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
this.dispatch("stop" /* Stop */);
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
if (state.falling) {
|
|
185
|
+
this.dispatch("fall" /* Fall */);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (input.jump && !state.jumpPressedLastFrame) {
|
|
189
|
+
this.dispatch("jump" /* Jump */);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// src/lib/behaviors/platformer-3d/platformer-3d.descriptor.ts
|
|
195
|
+
var FSM_STATE_BY_INDEX = [
|
|
196
|
+
"idle" /* Idle */,
|
|
197
|
+
"walking" /* Walking */,
|
|
198
|
+
"running" /* Running */,
|
|
199
|
+
"jumping" /* Jumping */,
|
|
200
|
+
"falling" /* Falling */,
|
|
201
|
+
"landing" /* Landing */
|
|
202
|
+
];
|
|
203
|
+
var defaultOptions = {
|
|
204
|
+
walkSpeed: 12,
|
|
205
|
+
runSpeed: 24,
|
|
206
|
+
jumpForce: 12,
|
|
207
|
+
maxJumps: 1,
|
|
208
|
+
gravity: 9.82,
|
|
209
|
+
slopeClimbAngle: 50,
|
|
210
|
+
slopeSlideAngle: 40,
|
|
211
|
+
autostep: { maxHeight: 0.3, minWidth: 0.1 },
|
|
212
|
+
snapToGroundDistance: 0.3,
|
|
213
|
+
characterOffset: 0.05
|
|
214
|
+
};
|
|
215
|
+
var PLATFORMER_BEHAVIOR_KEY = /* @__PURE__ */ Symbol.for("zylem:behavior:platformer-3d");
|
|
216
|
+
var Platformer3DBehaviorSystem = class {
|
|
217
|
+
constructor(wasmStage, getBehaviorLinks) {
|
|
218
|
+
this.wasmStage = wasmStage;
|
|
219
|
+
this.getBehaviorLinks = getBehaviorLinks;
|
|
220
|
+
}
|
|
221
|
+
wasmStage;
|
|
222
|
+
getBehaviorLinks;
|
|
223
|
+
attachedRuntimeSlots = /* @__PURE__ */ new Set();
|
|
224
|
+
update(_ecs, _delta) {
|
|
225
|
+
const links = this.getBehaviorLinks?.(PLATFORMER_BEHAVIOR_KEY);
|
|
226
|
+
if (!links) return;
|
|
227
|
+
for (const link of links) {
|
|
228
|
+
const gameEntity = link.entity;
|
|
229
|
+
const platformerRef = link.ref;
|
|
230
|
+
const options = platformerRef.options;
|
|
231
|
+
if (!gameEntity.platformer) {
|
|
232
|
+
gameEntity.platformer = createPlatformer3DMovementComponent(options);
|
|
233
|
+
}
|
|
234
|
+
if (!gameEntity.$platformer) {
|
|
235
|
+
gameEntity.$platformer = createPlatformer3DInputComponent();
|
|
236
|
+
}
|
|
237
|
+
if (!gameEntity.platformerState) {
|
|
238
|
+
gameEntity.platformerState = createPlatformer3DStateComponent();
|
|
239
|
+
}
|
|
240
|
+
const handle = gameEntity.runtimeHandle ?? -1;
|
|
241
|
+
if (!this.wasmStage || handle < 0) continue;
|
|
242
|
+
this.ensureWasmAttached(handle, options);
|
|
243
|
+
platformerRef.__wasmStage = this.wasmStage;
|
|
244
|
+
platformerRef.__entity = gameEntity;
|
|
245
|
+
const input = gameEntity.$platformer;
|
|
246
|
+
if (input) {
|
|
247
|
+
this.wasmStage.writeInputAxes(handle, input.moveX ?? 0, input.moveZ ?? 0);
|
|
248
|
+
this.wasmStage.writeInputButton(handle, STAGE_INPUT_BUTTON_JUMP, !!input.jump);
|
|
249
|
+
this.wasmStage.writeInputButton(handle, STAGE_INPUT_BUTTON_RUN, !!input.run);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
ensureWasmAttached(handle, options) {
|
|
254
|
+
if (!this.wasmStage || this.attachedRuntimeSlots.has(handle)) return;
|
|
255
|
+
const autostep = options.autostep ?? defaultOptions.autostep;
|
|
256
|
+
this.wasmStage.attachPlatformer3D(handle, {
|
|
257
|
+
halfHeight: 0.9,
|
|
258
|
+
radius: 0.4,
|
|
259
|
+
walkSpeed: options.walkSpeed ?? defaultOptions.walkSpeed,
|
|
260
|
+
runSpeed: options.runSpeed ?? defaultOptions.runSpeed,
|
|
261
|
+
jumpForce: options.jumpForce ?? defaultOptions.jumpForce,
|
|
262
|
+
maxJumps: options.maxJumps ?? defaultOptions.maxJumps,
|
|
263
|
+
gravity: options.gravity ?? defaultOptions.gravity,
|
|
264
|
+
slopeClimbAngle: options.slopeClimbAngle ?? defaultOptions.slopeClimbAngle,
|
|
265
|
+
slopeSlideAngle: options.slopeSlideAngle ?? defaultOptions.slopeSlideAngle,
|
|
266
|
+
autostepHeight: autostep ? autostep.maxHeight : 0,
|
|
267
|
+
autostepMinWidth: autostep ? autostep.minWidth : 0.1,
|
|
268
|
+
snapToGroundDistance: options.snapToGroundDistance ?? defaultOptions.snapToGroundDistance,
|
|
269
|
+
characterOffset: options.characterOffset ?? defaultOptions.characterOffset
|
|
270
|
+
});
|
|
271
|
+
this.attachedRuntimeSlots.add(handle);
|
|
272
|
+
}
|
|
273
|
+
destroy(_ecs) {
|
|
274
|
+
this.attachedRuntimeSlots.clear();
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
var Platformer3DBehavior = defineBehavior({
|
|
278
|
+
name: "platformer-3d",
|
|
279
|
+
defaultOptions,
|
|
280
|
+
systemFactory: (ctx) => new Platformer3DBehaviorSystem(
|
|
281
|
+
ctx.wasmStage ?? null,
|
|
282
|
+
ctx.getBehaviorLinks
|
|
283
|
+
),
|
|
284
|
+
// Handles read the runtime snapshot buffer (values are from the end of
|
|
285
|
+
// the previous step — one-frame lag). The Rust FSM is the single source
|
|
286
|
+
// of truth.
|
|
287
|
+
createHandle: (ref) => ({
|
|
288
|
+
getState: () => {
|
|
289
|
+
const snapshot = readBehaviorSnapshot(ref);
|
|
290
|
+
if (snapshot) return FSM_STATE_BY_INDEX[snapshot.fsmState] ?? "idle" /* Idle */;
|
|
291
|
+
return "idle" /* Idle */;
|
|
292
|
+
},
|
|
293
|
+
isGrounded: () => readBehaviorSnapshot(ref)?.grounded ?? false,
|
|
294
|
+
getJumpCount: () => readBehaviorSnapshot(ref)?.jumpCount ?? 0,
|
|
295
|
+
onPlatformCollision: (_ctx) => {
|
|
296
|
+
}
|
|
297
|
+
})
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
export {
|
|
301
|
+
createPlatformer3DMovementComponent,
|
|
302
|
+
createPlatformer3DInputComponent,
|
|
303
|
+
createPlatformer3DStateComponent,
|
|
304
|
+
Platformer3DState,
|
|
305
|
+
Platformer3DEvent,
|
|
306
|
+
Platformer3DFSM,
|
|
307
|
+
Platformer3DBehavior
|
|
308
|
+
};
|
|
309
|
+
//# sourceMappingURL=chunk-W26PHBME.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/behaviors/platformer-3d/components.ts","../src/lib/behaviors/platformer-3d/platformer-3d-fsm.ts","../src/lib/behaviors/platformer-3d/platformer-3d.descriptor.ts"],"sourcesContent":["/**\n * Platformer 3D ECS Components\n * \n * Components for 3D platformer movement system including walking, running,\n * jumping with multi-jump support, and falling/landing states.\n */\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Platformer3DMovementComponent (capability / configuration)\n// Defines the movement capabilities and physics parameters\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface Platformer3DMovementComponent {\n\t/** Base walking speed */\n\twalkSpeed: number;\n\t/** Sprint/run speed */\n\trunSpeed: number;\n\t/** Initial jump force/velocity */\n\tjumpForce: number;\n\t/** Maximum number of jumps (1 = single jump, 2 = double jump, etc.) */\n\tmaxJumps: number;\n\t/** Gravity force (optional override) */\n\tgravity: number;\n\t/** Coyote time in seconds (grace period after leaving ground) */\n\tcoyoteTime: number;\n\t/** Jump buffer time in seconds (queue jump input before landing) */\n\tjumpBufferTime: number;\n\t/** Velocity multiplier when releasing jump button early (0-1) */\n\tjumpCutMultiplier: number;\n\t/** Time in seconds before multi-jump becomes available (0 = after button release) */\n\tmultiJumpWindowTime: number;\n\t/** Maximum slope angle (degrees) the character can walk up */\n\tslopeClimbAngle: number;\n\t/** Slope angle (degrees) past which the character slides down */\n\tslopeSlideAngle: number;\n\t/** Autostep configuration for small ledges, or false to disable */\n\tautostep: { maxHeight: number; minWidth: number } | false;\n\t/** Snap-to-ground distance (keeps the character glued going downhill) */\n\tsnapToGroundDistance: number;\n\t/** Character controller offset (small gap kept between collider and environment) */\n\tcharacterOffset: number;\n}\n\nexport function createPlatformer3DMovementComponent(\n\toptions: Partial<Platformer3DMovementComponent> = {}\n): Platformer3DMovementComponent {\n\treturn {\n\t\twalkSpeed: options.walkSpeed ?? 12,\n\t\trunSpeed: options.runSpeed ?? 24,\n\t\tjumpForce: options.jumpForce ?? 12,\n\t\tmaxJumps: options.maxJumps ?? 1,\n\t\tgravity: options.gravity ?? 9.82,\n\t\tcoyoteTime: options.coyoteTime ?? 0.1,\n\t\tjumpBufferTime: options.jumpBufferTime ?? 0.1,\n\t\tjumpCutMultiplier: options.jumpCutMultiplier ?? 0.5,\n\t\tmultiJumpWindowTime: options.multiJumpWindowTime ?? 0.15, // 150ms default\n\t\tslopeClimbAngle: options.slopeClimbAngle ?? 50,\n\t\tslopeSlideAngle: options.slopeSlideAngle ?? 40,\n\t\tautostep: options.autostep ?? { maxHeight: 0.3, minWidth: 0.1 },\n\t\tsnapToGroundDistance: options.snapToGroundDistance ?? 0.3,\n\t\tcharacterOffset: options.characterOffset ?? 0.05,\n\t};\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Platformer3DInputComponent (intent)\n// Written by: Player controller, AI controller\n// Read by: Platformer3DBehavior\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface Platformer3DInputComponent {\n\t/** Horizontal movement input (-1 to 1) */\n\tmoveX: number;\n\t/** Forward/backward movement input (-1 to 1) */\n\tmoveZ: number;\n\t/** Jump button pressed */\n\tjump: boolean;\n\t/** Run/sprint button held */\n\trun: boolean;\n}\n\nexport function createPlatformer3DInputComponent(): Platformer3DInputComponent {\n\treturn {\n\t\tmoveX: 0,\n\t\tmoveZ: 0,\n\t\tjump: false,\n\t\trun: false,\n\t};\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n// Platformer3DStateComponent (runtime state)\n// Tracks the current state of the platformer entity\n// ─────────────────────────────────────────────────────────────────────────────\n\nexport interface Platformer3DStateComponent {\n\t/** Is the entity on the ground */\n\tgrounded: boolean;\n\t/** Is currently in a jump arc */\n\tjumping: boolean;\n\t/** Is falling (not jumping) */\n\tfalling: boolean;\n\t/** Current jump count (for multi-jump) */\n\tjumpCount: number;\n\t/** Y position when jump started */\n\tjumpStartHeight: number;\n\t/** Current movement speed being applied */\n\tcurrentSpeed: number;\n\t/** Last known ground Y position */\n\tlastGroundedY: number;\n\t/** Was jump button pressed last frame (for edge detection) */\n\tjumpPressedLastFrame: boolean;\n\t\n\t// -- New fields --\n\t/** Is currently colliding with ground (from physics collision callback) */\n\tcollisionGrounded: boolean;\n\t/** Timestamp of last ground collision */\n\tgroundedCollisionTime: number;\n\t/** Time in seconds since last grounded */\n\ttimeSinceGrounded: number;\n\t/** Is a jump allowed due to buffer? */\n\tjumpBuffered: boolean;\n\t/** Time remaining in jump buffer */\n\tjumpBufferTimer: number;\n\t/** Is jump button currently held */\n\tjumpHeld: boolean;\n\t/** Has the jump cut been applied for this jump? */\n\tjumpCutApplied: boolean;\n\t/** Has jump button been released since last jump (required for multi-jump) */\n\tjumpReleasedSinceLastJump: boolean;\n\t/** Time since current jump started (for multi-jump window) */\n\ttimeSinceJump: number;\n\t/** True for the single frame on which a jump impulse was applied; prevents gravity from clobbering jump velocity. */\n\tjumpedThisFrame: boolean;\n\t/** Remaining seconds of jump-cut velocity ramp; while > 0, verticalVelocity lerps toward verticalVelocity * jumpCutMultiplier. */\n\tjumpCutRampTimer: number;\n\t/**\n\t * Controller-owned vertical velocity (units/second).\n\t * The body is kinematic, so `linvel()` is meaningless — this field is the\n\t * single source of truth for jump/gravity motion on the Y axis.\n\t */\n\tverticalVelocity: number;\n}\n\nexport function createPlatformer3DStateComponent(): Platformer3DStateComponent {\n\treturn {\n\t\tgrounded: false,\n\t\tjumping: false,\n\t\tfalling: false,\n\t\tjumpCount: 0,\n\t\tjumpStartHeight: 0,\n\t\tcurrentSpeed: 0,\n\t\tlastGroundedY: 0,\n\t\tjumpPressedLastFrame: false,\n\t\tcollisionGrounded: false,\n\t\tgroundedCollisionTime: 0,\n\t\ttimeSinceGrounded: 0,\n\t\tjumpBuffered: false,\n\t\tjumpBufferTimer: 0,\n\t\tjumpHeld: false,\n\t\tjumpCutApplied: false,\n\t\tjumpReleasedSinceLastJump: true,\n\t\ttimeSinceJump: 0,\n\t\tjumpedThisFrame: false,\n\t\tjumpCutRampTimer: 0,\n\t\tverticalVelocity: 0,\n\t};\n}\n","/**\n * Platformer 3D Finite State Machine\n * \n * Manages state transitions for 3D platformer movement:\n * - Idle: Standing still on ground\n * - Walking: Moving on ground (slow)\n * - Running: Moving on ground (fast)\n * - Jumping: Ascending from jump\n * - Falling: Descending (gravity)\n * - Landing: Just touched ground\n */\n\nimport { SyncStateMachine, t } from '../../core/utility/sync-state-machine';\nimport type { Platformer3DInputComponent, Platformer3DStateComponent } from './components';\n\n/**\n * Simplified Collision Context interface\n */\nexport interface PlatformerCollisionContext {\n\tcontact: {\n\t\tnormal: { x: number; y: number; z?: number };\n\t};\n}\n\n/**\n * Platformer states\n */\nexport enum Platformer3DState {\n\tIdle = 'idle',\n\tWalking = 'walking',\n\tRunning = 'running',\n\tJumping = 'jumping',\n\tFalling = 'falling',\n\tLanding = 'landing',\n}\n\n/**\n * Events that trigger state transitions\n */\nexport enum Platformer3DEvent {\n\tWalk = 'walk',\n\tRun = 'run',\n\tJump = 'jump',\n\tFall = 'fall',\n\tLand = 'land',\n\tStop = 'stop',\n}\n\n/**\n * Context for the FSM\n */\nexport interface Platformer3DContext {\n\tinput: Platformer3DInputComponent;\n\tstate: Platformer3DStateComponent;\n}\n\n/**\n * Platformer 3D FSM\n */\nexport class Platformer3DFSM {\n\tmachine: SyncStateMachine<Platformer3DState, Platformer3DEvent, never>;\n\n\tconstructor(private ctx: Platformer3DContext) {\n\t\tthis.machine = new SyncStateMachine<Platformer3DState, Platformer3DEvent, never>(\n\t\t\tPlatformer3DState.Idle,\n\t\t\t[\n\t\t\t\t// Idle transitions\n\t\t\t\tt(Platformer3DState.Idle, Platformer3DEvent.Walk, Platformer3DState.Walking),\n\t\t\t\tt(Platformer3DState.Idle, Platformer3DEvent.Run, Platformer3DState.Running),\n\t\t\t\tt(Platformer3DState.Idle, Platformer3DEvent.Jump, Platformer3DState.Jumping),\n\t\t\t\tt(Platformer3DState.Idle, Platformer3DEvent.Fall, Platformer3DState.Falling),\n\t\t\t\t\n\t\t\t\t// Walking transitions\n\t\t\t\tt(Platformer3DState.Walking, Platformer3DEvent.Run, Platformer3DState.Running),\n\t\t\t\tt(Platformer3DState.Walking, Platformer3DEvent.Jump, Platformer3DState.Jumping),\n\t\t\t\tt(Platformer3DState.Walking, Platformer3DEvent.Stop, Platformer3DState.Idle),\n\t\t\t\tt(Platformer3DState.Walking, Platformer3DEvent.Fall, Platformer3DState.Falling),\n\t\t\t\t\n\t\t\t\t// Running transitions\n\t\t\t\tt(Platformer3DState.Running, Platformer3DEvent.Walk, Platformer3DState.Walking),\n\t\t\t\tt(Platformer3DState.Running, Platformer3DEvent.Jump, Platformer3DState.Jumping),\n\t\t\t\tt(Platformer3DState.Running, Platformer3DEvent.Stop, Platformer3DState.Idle),\n\t\t\t\tt(Platformer3DState.Running, Platformer3DEvent.Fall, Platformer3DState.Falling),\n\t\t\t\t\n\t\t\t\t// Jumping transitions\n\t\t\t\tt(Platformer3DState.Jumping, Platformer3DEvent.Fall, Platformer3DState.Falling),\n\t\t\t\tt(Platformer3DState.Jumping, Platformer3DEvent.Land, Platformer3DState.Landing),\n\t\t\t\tt(Platformer3DState.Jumping, Platformer3DEvent.Jump, Platformer3DState.Jumping), // Multi-jump\n\t\t\t\t\n\t\t\t\t// Falling transitions\n\t\t\t\tt(Platformer3DState.Falling, Platformer3DEvent.Land, Platformer3DState.Landing),\n\t\t\t\t\n\t\t\t\t// Landing transitions\n\t\t\t\tt(Platformer3DState.Landing, Platformer3DEvent.Walk, Platformer3DState.Walking),\n\t\t\t\tt(Platformer3DState.Landing, Platformer3DEvent.Run, Platformer3DState.Running),\n\t\t\t\tt(Platformer3DState.Landing, Platformer3DEvent.Stop, Platformer3DState.Idle),\n\t\t\t\t\n\t\t\t\t// Self-transitions (no-ops)\n\t\t\t\tt(Platformer3DState.Idle, Platformer3DEvent.Stop, Platformer3DState.Idle),\n\t\t\t]\n\t\t);\n\t}\n\n\t/**\n\t * Get the current state\n\t */\n\tgetState(): Platformer3DState {\n\t\treturn this.machine.getState();\n\t}\n\n\t/**\n\t * Dispatch an event to the FSM\n\t */\n\tdispatch(event: Platformer3DEvent): void {\n\t\tif (this.machine.can(event)) {\n\t\t\tthis.machine.syncDispatch(event);\n\t\t}\n\t}\n\n\t/**\n\t * Check if grounded\n\t */\n\tisGrounded(): boolean {\n\t\tconst state = this.getState();\n\t\treturn state === Platformer3DState.Idle || \n\t\t state === Platformer3DState.Walking || \n\t\t state === Platformer3DState.Running || \n\t\t state === Platformer3DState.Landing;\n\t}\n\n\t/**\n\t * Get current jump count from context\n\t */\n\tgetJumpCount(): number {\n\t\treturn this.ctx.state.jumpCount;\n\t}\n\n\t/**\n\t * Handle collision event to update ground state\n\t */\n\thandleCollision(ctx: PlatformerCollisionContext): void {\n\t\t// Check if collision is ground (normal pointing up)\n\t\t// Y normal > 0.5 means roughly within 60 degrees of up\n\t\tif (ctx.contact.normal.y > 0.5) {\n\t\t\tthis.ctx.state.collisionGrounded = true;\n\t\t\tthis.ctx.state.groundedCollisionTime = performance.now();\n\t\t}\n\t}\n\n\t/**\n\t * Update FSM based on current state\n\t */\n\tupdate(input: Platformer3DInputComponent, state: Platformer3DStateComponent): void {\n\t\t// Update context\n\t\tthis.ctx.input = input;\n\t\tthis.ctx.state = state;\n\n\t\t// Get current FSM state\n\t\tconst currentState = this.getState();\n\n\t\t// Determine movement state\n\t\tconst hasInput = Math.abs(input.moveX) > 0.1 || Math.abs(input.moveZ) > 0.1;\n\t\tconst isRunning = input.run;\n\n\t\t// Handle landing: if we're in falling state and now grounded, land\n\t\tif (currentState === Platformer3DState.Falling && state.grounded) {\n\t\t\tthis.dispatch(Platformer3DEvent.Land);\n\t\t\t// Don't return - allow immediate transition to movement state\n\t\t}\n\n\t\t// Send appropriate events based on state\n\t\tif (state.grounded) {\n\t\t\tif (hasInput) {\n\t\t\t\tif (isRunning) {\n\t\t\t\t\tthis.dispatch(Platformer3DEvent.Run);\n\t\t\t\t} else {\n\t\t\t\t\tthis.dispatch(Platformer3DEvent.Walk);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.dispatch(Platformer3DEvent.Stop);\n\t\t\t}\n\t\t} else {\n\t\t\t// Not grounded - check if we should be falling\n\t\t\t// Transition to falling if: We're in jumping state and now falling, \n\t\t\t// OR we walked off a ledge (idle/walking/running and now falling)\n\t\t\tif (state.falling) {\n\t\t\t\tthis.dispatch(Platformer3DEvent.Fall);\n\t\t\t}\n\t\t}\n\n\t\t// Handle jump input (edge detection handled in behavior)\n\t\tif (input.jump && !state.jumpPressedLastFrame) {\n\t\t\tthis.dispatch(Platformer3DEvent.Jump);\n\t\t}\n\t}\n}\n","/**\n * Platformer 3D Behavior Descriptor\n * \n * Type-safe descriptor for the platformer 3D behavior system.\n * Provides entity.use() API for 3D platformer movement.\n */\n\nimport { defineBehavior } from '../behavior-descriptor';\nimport type { BehaviorEntityLink, BehaviorSystem } from '../behavior-system';\nimport { Platformer3DState, PlatformerCollisionContext } from './platformer-3d-fsm';\nimport {\n\tcreatePlatformer3DMovementComponent,\n\tcreatePlatformer3DInputComponent,\n\tcreatePlatformer3DStateComponent,\n\ttype Platformer3DMovementComponent,\n\ttype Platformer3DInputComponent,\n\ttype Platformer3DStateComponent,\n} from './components';\nimport {\n\tSTAGE_INPUT_BUTTON_JUMP,\n\tSTAGE_INPUT_BUTTON_RUN,\n\treadBehaviorSnapshot,\n\ttype BehaviorRuntime,\n} from '../../runtime/wasm-stage-runtime';\n\n/** Rust `Platformer3DFsmState` index → TS state (see `platformer_3d/fsm.rs`). */\nconst FSM_STATE_BY_INDEX: readonly Platformer3DState[] = [\n\tPlatformer3DState.Idle,\n\tPlatformer3DState.Walking,\n\tPlatformer3DState.Running,\n\tPlatformer3DState.Jumping,\n\tPlatformer3DState.Falling,\n\tPlatformer3DState.Landing,\n];\n\n/**\n * Platformer behavior options (typed for entity.use() autocomplete)\n */\nexport interface Platformer3DBehaviorOptions {\n\t/** Base walking speed (default: 12) */\n\twalkSpeed?: number;\n\t/** Sprint/run speed (default: 24) */\n\trunSpeed?: number;\n\t/** Initial jump force (default: 12) */\n\tjumpForce?: number;\n\t/** Maximum number of jumps (default: 1) */\n\tmaxJumps?: number;\n\t/** Gravity force (default: 9.82) */\n\tgravity?: number;\n\t/** Maximum slope angle in degrees the character can walk up (default: 50) */\n\tslopeClimbAngle?: number;\n\t/** Slope angle in degrees past which the character slides (default: 40) */\n\tslopeSlideAngle?: number;\n\t/** Autostep over small ledges, or false to disable (default: { maxHeight: 0.3, minWidth: 0.1 }) */\n\tautostep?: { maxHeight: number; minWidth: number } | false;\n\t/** Snap-to-ground distance for downhill/step-down stability (default: 0.3) */\n\tsnapToGroundDistance?: number;\n\t/** Character controller collision offset (default: 0.05) */\n\tcharacterOffset?: number;\n}\n\nconst defaultOptions: Platformer3DBehaviorOptions = {\n\twalkSpeed: 12,\n\trunSpeed: 24,\n\tjumpForce: 12,\n\tmaxJumps: 1,\n\tgravity: 9.82,\n\tslopeClimbAngle: 50,\n\tslopeSlideAngle: 40,\n\tautostep: { maxHeight: 0.3, minWidth: 0.1 },\n\tsnapToGroundDistance: 0.3,\n\tcharacterOffset: 0.05,\n};\n\nconst PLATFORMER_BEHAVIOR_KEY = Symbol.for('zylem:behavior:platformer-3d');\n\n/**\n * Entity with platformer components (input written by the game; the wasm\n * runtime owns the kinematic character controller and FSM).\n */\nexport interface Platformer3DEntity {\n\tuuid: string;\n\tplatformer: Platformer3DMovementComponent;\n\t$platformer: Platformer3DInputComponent;\n\tplatformerState: Platformer3DStateComponent;\n}\n\n/**\n * Forwards platformer input into the wasm runtime. The Rust `platformer_3d`\n * Stage behavior (KCC + jump FSM) is the single simulation path; handles\n * read its state back via the snapshot buffer.\n */\nclass Platformer3DBehaviorSystem implements BehaviorSystem {\n\tprivate attachedRuntimeSlots = new Set<number>();\n\n\tconstructor(\n\t\tprivate wasmStage: BehaviorRuntime | null,\n\t\tprivate getBehaviorLinks?: (key: symbol) => Iterable<BehaviorEntityLink>,\n\t) {}\n\n\tupdate(_ecs: unknown, _delta: number): void {\n\t\tconst links = this.getBehaviorLinks?.(PLATFORMER_BEHAVIOR_KEY);\n\t\tif (!links) return;\n\n\t\tfor (const link of links) {\n\t\t\tconst gameEntity = link.entity as any;\n\t\t\tconst platformerRef = link.ref as any;\n\n\t\t\tconst options = platformerRef.options as Platformer3DBehaviorOptions;\n\n\t\t\tif (!gameEntity.platformer) {\n\t\t\t\tgameEntity.platformer = createPlatformer3DMovementComponent(options);\n\t\t\t}\n\t\t\tif (!gameEntity.$platformer) {\n\t\t\t\tgameEntity.$platformer = createPlatformer3DInputComponent();\n\t\t\t}\n\t\t\tif (!gameEntity.platformerState) {\n\t\t\t\tgameEntity.platformerState = createPlatformer3DStateComponent();\n\t\t\t}\n\n\t\t\tconst handle = (gameEntity.runtimeHandle ?? -1) as number;\n\t\t\tif (!this.wasmStage || handle < 0) continue;\n\n\t\t\tthis.ensureWasmAttached(handle, options);\n\t\t\tplatformerRef.__wasmStage = this.wasmStage;\n\t\t\tplatformerRef.__entity = gameEntity;\n\t\t\tconst input = gameEntity.$platformer;\n\t\t\tif (input) {\n\t\t\t\tthis.wasmStage.writeInputAxes(handle, input.moveX ?? 0, input.moveZ ?? 0);\n\t\t\t\tthis.wasmStage.writeInputButton(handle, STAGE_INPUT_BUTTON_JUMP, !!input.jump);\n\t\t\t\tthis.wasmStage.writeInputButton(handle, STAGE_INPUT_BUTTON_RUN, !!input.run);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate ensureWasmAttached(handle: number, options: Platformer3DBehaviorOptions): void {\n\t\tif (!this.wasmStage || this.attachedRuntimeSlots.has(handle)) return;\n\t\tconst autostep = options.autostep ?? defaultOptions.autostep!;\n\t\tthis.wasmStage.attachPlatformer3D(handle, {\n\t\t\thalfHeight: 0.9,\n\t\t\tradius: 0.4,\n\t\t\twalkSpeed: options.walkSpeed ?? defaultOptions.walkSpeed!,\n\t\t\trunSpeed: options.runSpeed ?? defaultOptions.runSpeed!,\n\t\t\tjumpForce: options.jumpForce ?? defaultOptions.jumpForce!,\n\t\t\tmaxJumps: options.maxJumps ?? defaultOptions.maxJumps!,\n\t\t\tgravity: options.gravity ?? defaultOptions.gravity!,\n\t\t\tslopeClimbAngle: options.slopeClimbAngle ?? defaultOptions.slopeClimbAngle!,\n\t\t\tslopeSlideAngle: options.slopeSlideAngle ?? defaultOptions.slopeSlideAngle!,\n\t\t\tautostepHeight: autostep ? autostep.maxHeight : 0,\n\t\t\tautostepMinWidth: autostep ? autostep.minWidth : 0.1,\n\t\t\tsnapToGroundDistance: options.snapToGroundDistance ?? defaultOptions.snapToGroundDistance!,\n\t\t\tcharacterOffset: options.characterOffset ?? defaultOptions.characterOffset!,\n\t\t});\n\t\tthis.attachedRuntimeSlots.add(handle);\n\t}\n\n\tdestroy(_ecs: unknown): void {\n\t\tthis.attachedRuntimeSlots.clear();\n\t}\n}\n\n/**\n * Platformer3DBehavior - typed descriptor for 3D platformer movement\n * \n * Provides complete 3D platformer physics including:\n * - Walking and running\n * - Jumping with multi-jump support\n * - Gravity and falling\n * - Ground detection\n * \n * @example\n * ```typescript\n * import { Platformer3DBehavior } from \"@zylem/game-lib/behavior\";\n * \n * const player = await playgroundActor('player');\n * const platformer = player.use(Platformer3DBehavior, {\n * walkSpeed: 12,\n * runSpeed: 24,\n * jumpForce: 12,\n * maxJumps: 2, // Double jump!\n * });\n * \n * // In update loop\n * player.onUpdate(({ inputs }) => {\n * player.$platformer.moveX = inputs.p1.axes.Horizontal.value;\n * player.$platformer.moveZ = inputs.p1.axes.Vertical.value;\n * player.$platformer.jump = inputs.p1.buttons.A.held > 0;\n * player.$platformer.run = inputs.p1.shoulders.LTrigger.held > 0;\n * \n * const state = platformer.getState();\n * const grounded = platformer.isGrounded();\n * });\n * ```\n */\nexport const Platformer3DBehavior = defineBehavior<\n\tPlatformer3DBehaviorOptions,\n\t{\n\t\tgetState: () => Platformer3DState;\n\t\tisGrounded: () => boolean;\n\t\tgetJumpCount: () => number;\n\t\tonPlatformCollision: (ctx: PlatformerCollisionContext) => void;\n\t},\n\tPlatformer3DEntity\n>({\n\tname: 'platformer-3d',\n\tdefaultOptions,\n\tsystemFactory: (ctx) =>\n\t\tnew Platformer3DBehaviorSystem(\n\t\t\tctx.wasmStage ?? null,\n\t\t\tctx.getBehaviorLinks,\n\t\t),\n\t// Handles read the runtime snapshot buffer (values are from the end of\n\t// the previous step — one-frame lag). The Rust FSM is the single source\n\t// of truth.\n\tcreateHandle: (ref) => ({\n\t\tgetState: () => {\n\t\t\tconst snapshot = readBehaviorSnapshot(ref);\n\t\t\tif (snapshot) return FSM_STATE_BY_INDEX[snapshot.fsmState] ?? Platformer3DState.Idle;\n\t\t\treturn Platformer3DState.Idle;\n\t\t},\n\t\tisGrounded: () => readBehaviorSnapshot(ref)?.grounded ?? false,\n\t\tgetJumpCount: () => readBehaviorSnapshot(ref)?.jumpCount ?? 0,\n\t\tonPlatformCollision: (_ctx) => {},\n\t}),\n});\n"],"mappings":";;;;;;;;;;;;;;AA2CO,SAAS,oCACf,UAAkD,CAAC,GACnB;AAChC,SAAO;AAAA,IACN,WAAW,QAAQ,aAAa;AAAA,IAChC,UAAU,QAAQ,YAAY;AAAA,IAC9B,WAAW,QAAQ,aAAa;AAAA,IAChC,UAAU,QAAQ,YAAY;AAAA,IAC9B,SAAS,QAAQ,WAAW;AAAA,IAC5B,YAAY,QAAQ,cAAc;AAAA,IAClC,gBAAgB,QAAQ,kBAAkB;AAAA,IAC1C,mBAAmB,QAAQ,qBAAqB;AAAA,IAChD,qBAAqB,QAAQ,uBAAuB;AAAA;AAAA,IACpD,iBAAiB,QAAQ,mBAAmB;AAAA,IAC5C,iBAAiB,QAAQ,mBAAmB;AAAA,IAC5C,UAAU,QAAQ,YAAY,EAAE,WAAW,KAAK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3DState","Platformer3DEvent"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { G as GameEntity, a as BehaviorDescriptor } from './behavior-system-CeJXzNvr.js';
|
|
2
|
+
import { Vector3, Quaternion } from 'three';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Type-safe helper to apply a behavior to an entity and return the entity cast to the behavior's interface.
|
|
6
|
+
*
|
|
7
|
+
* @param entity The entity to apply the behavior to
|
|
8
|
+
* @param descriptor The behavior descriptor
|
|
9
|
+
* @param options Behavior options
|
|
10
|
+
* @returns The entity, cast to E & I (where I is the behavior's interface)
|
|
11
|
+
*/
|
|
12
|
+
declare function useBehavior<E extends GameEntity<any>, O extends Record<string, any>, H extends Record<string, any>, I>(entity: E, descriptor: BehaviorDescriptor<O, H, I>, options?: Partial<O>): E & I;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Core behavior helper types
|
|
16
|
+
*
|
|
17
|
+
* Plain data interfaces shared by movement behaviors and coordinators.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
interface TransformComponent {
|
|
21
|
+
position: Vector3;
|
|
22
|
+
rotation: Quaternion;
|
|
23
|
+
}
|
|
24
|
+
declare function createTransformComponent(): TransformComponent;
|
|
25
|
+
interface PhysicsBodyComponent {
|
|
26
|
+
body: unknown;
|
|
27
|
+
}
|
|
28
|
+
declare function createPhysicsBodyComponent(body: unknown): PhysicsBodyComponent;
|
|
29
|
+
|
|
30
|
+
export { type PhysicsBodyComponent as P, type TransformComponent as T, createTransformComponent as a, createPhysicsBodyComponent as c, useBehavior as u };
|
package/dist/cooldown.d.ts
CHANGED
package/dist/cooldown.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as BaseEntityInterface } from '../entity-types-
|
|
1
|
+
import { a as MoveableEntity } from '../moveable-XhzWPAw5.js';
|
|
2
|
+
import { B as BaseEntityInterface } from '../entity-types-DhfsZbSK.js';
|
|
3
3
|
import { Ricochet3DHandle } from '../ricochet-3d.js';
|
|
4
4
|
import { WorldBoundary3DHandle } from '../world-boundary-3d.js';
|
|
5
5
|
import 'three';
|
|
6
|
-
import '
|
|
7
|
-
import '
|
|
6
|
+
import '../behavior-system-CeJXzNvr.js';
|
|
7
|
+
import '@zylem/runtime';
|
|
8
8
|
import '../sync-state-machine-CZyspBpj.js';
|
|
9
9
|
import 'typescript-fsm';
|
|
10
10
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Ricochet2DHandle } from '../ricochet-2d.js';
|
|
2
2
|
import { WorldBoundary2DHandle } from '../world-boundary-2d.js';
|
|
3
|
-
import {
|
|
4
|
-
import { B as BaseEntityInterface } from '../entity-types-
|
|
3
|
+
import { a as MoveableEntity } from '../moveable-XhzWPAw5.js';
|
|
4
|
+
import { B as BaseEntityInterface } from '../entity-types-DhfsZbSK.js';
|
|
5
5
|
import '../sync-state-machine-CZyspBpj.js';
|
|
6
6
|
import 'typescript-fsm';
|
|
7
|
-
import '../behavior-system-
|
|
8
|
-
import '@
|
|
7
|
+
import '../behavior-system-CeJXzNvr.js';
|
|
8
|
+
import '@zylem/runtime';
|
|
9
9
|
import 'three';
|
|
10
10
|
|
|
11
11
|
/** Entity shape required by the 2D boundary-ricochet coordinator. */
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BoundaryRicochetCoordinator
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-NW4SE5XW.js";
|
|
4
|
+
import "../chunk-OPZ2LVS2.js";
|
|
5
5
|
import "../chunk-LL4FLHIY.js";
|
|
6
|
+
import "../chunk-5WRI5ZAA.js";
|
|
6
7
|
export {
|
|
7
8
|
BoundaryRicochetCoordinator
|
|
8
9
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { T as ThrusterInputComponent } from '../components-B29WHGQN.js';
|
|
2
2
|
import { Shooter2DSourceEntity, Shooter2DHandle, Shooter2DStageLike } from '../shooter-2d.js';
|
|
3
3
|
import { S as Shooter2DAimFireInput } from '../shooter-fire-DGripl0z.js';
|
|
4
|
-
import '../behavior-system-
|
|
5
|
-
import '@
|
|
6
|
-
import '../vector-
|
|
4
|
+
import '../behavior-system-CeJXzNvr.js';
|
|
5
|
+
import '@zylem/runtime';
|
|
6
|
+
import '../vector-DjhLUrak.js';
|
|
7
7
|
import 'three';
|
|
8
8
|
|
|
9
9
|
interface MultidirectionalSpaceShooterInput extends Shooter2DAimFireInput {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MultidirectionalSpaceShooterCoordinator
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-NQPYMUDF.js";
|
|
4
|
+
import "../chunk-52FJIDGL.js";
|
|
5
5
|
import "../chunk-IZJFUAXB.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-TBUKJKY6.js";
|
|
7
|
+
import "../chunk-SGHIGTVZ.js";
|
|
8
|
+
import "../chunk-5WRI5ZAA.js";
|
|
7
9
|
export {
|
|
8
10
|
MultidirectionalSpaceShooterCoordinator
|
|
9
11
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as TopDownMovementInputComponent } from '../components-XCpL6IYt.js';
|
|
2
2
|
import { Shooter2DSourceEntity, Shooter2DHandle, Shooter2DStageLike } from '../shooter-2d.js';
|
|
3
3
|
import { S as Shooter2DAimFireInput } from '../shooter-fire-DGripl0z.js';
|
|
4
|
-
import '../behavior-system-
|
|
5
|
-
import '@
|
|
6
|
-
import '../vector-
|
|
4
|
+
import '../behavior-system-CeJXzNvr.js';
|
|
5
|
+
import '@zylem/runtime';
|
|
6
|
+
import '../vector-DjhLUrak.js';
|
|
7
7
|
import 'three';
|
|
8
8
|
|
|
9
9
|
interface TopDownShooterInput extends Shooter2DAimFireInput {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TopDownShooterCoordinator
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-KIYUUSPK.js";
|
|
4
|
+
import "../chunk-52FJIDGL.js";
|
|
5
5
|
import "../chunk-EIWQM6U3.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-TBUKJKY6.js";
|
|
7
|
+
import "../chunk-SGHIGTVZ.js";
|
|
8
|
+
import "../chunk-5WRI5ZAA.js";
|
|
7
9
|
export {
|
|
8
10
|
TopDownShooterCoordinator
|
|
9
11
|
};
|