@genex-ai/cli-demo 0.6.1 → 0.7.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.
Files changed (45) hide show
  1. package/dist/index.js +54 -15
  2. package/package.json +1 -1
  3. package/templates/skills/genex-threejs-atmosphere-aerial-perspective/SKILL.md +30 -18
  4. package/templates/skills/genex-threejs-atmosphere-aerial-perspective/references/atmosphere.md +204 -20
  5. package/templates/skills/genex-threejs-bloom/SKILL.md +29 -18
  6. package/templates/skills/genex-threejs-bloom/references/bloom.md +176 -20
  7. package/templates/skills/genex-threejs-camera-direction/SKILL.md +38 -26
  8. package/templates/skills/genex-threejs-camera-direction/references/camera-rigs.md +359 -27
  9. package/templates/skills/genex-threejs-exposure-color-grading/SKILL.md +27 -18
  10. package/templates/skills/genex-threejs-exposure-color-grading/references/exposure-grading.md +196 -21
  11. package/templates/skills/genex-threejs-image-pipeline/SKILL.md +38 -17
  12. package/templates/skills/genex-threejs-image-pipeline/references/image-pipeline.md +185 -29
  13. package/templates/skills/genex-threejs-procedural-animation/SKILL.md +34 -21
  14. package/templates/skills/genex-threejs-procedural-animation/references/procedural-motion.md +353 -24
  15. package/templates/skills/genex-threejs-procedural-architecture/SKILL.md +36 -17
  16. package/templates/skills/genex-threejs-procedural-architecture/references/architecture-systems.md +500 -22
  17. package/templates/skills/genex-threejs-procedural-fields/SKILL.md +59 -24
  18. package/templates/skills/genex-threejs-procedural-fields/references/field-systems.md +222 -25
  19. package/templates/skills/genex-threejs-procedural-geometry/SKILL.md +34 -20
  20. package/templates/skills/genex-threejs-procedural-geometry/references/mesh-systems.md +192 -26
  21. package/templates/skills/genex-threejs-procedural-materials/SKILL.md +55 -18
  22. package/templates/skills/genex-threejs-procedural-materials/references/material-systems.md +189 -22
  23. package/templates/skills/genex-threejs-procedural-planets/SKILL.md +36 -18
  24. package/templates/skills/genex-threejs-procedural-planets/references/planet-systems.md +489 -21
  25. package/templates/skills/genex-threejs-procedural-vegetation/SKILL.md +35 -25
  26. package/templates/skills/genex-threejs-procedural-vegetation/references/vegetation-systems.md +304 -27
  27. package/templates/skills/genex-threejs-procedural-vfx/SKILL.md +26 -18
  28. package/templates/skills/genex-threejs-procedural-vfx/references/vfx-systems.md +208 -20
  29. package/templates/skills/genex-threejs-raymarched-space-effects/SKILL.md +25 -18
  30. package/templates/skills/genex-threejs-raymarched-space-effects/references/space-effects.md +185 -21
  31. package/templates/skills/genex-threejs-screen-space-ambient-occlusion/SKILL.md +23 -17
  32. package/templates/skills/genex-threejs-screen-space-ambient-occlusion/references/ambient-occlusion.md +430 -20
  33. package/templates/skills/genex-threejs-shadow-systems/SKILL.md +29 -18
  34. package/templates/skills/genex-threejs-shadow-systems/references/shadow-systems.md +420 -21
  35. package/templates/skills/genex-threejs-skill-router/SKILL.md +21 -21
  36. package/templates/skills/genex-threejs-spectral-ocean/SKILL.md +30 -20
  37. package/templates/skills/genex-threejs-spectral-ocean/references/spectral-ocean.md +462 -22
  38. package/templates/skills/genex-threejs-temporal-surfaces/SKILL.md +26 -17
  39. package/templates/skills/genex-threejs-temporal-surfaces/references/temporal-surfaces.md +198 -20
  40. package/templates/skills/genex-threejs-visual-validation/SKILL.md +34 -18
  41. package/templates/skills/genex-threejs-visual-validation/references/visual-validation.md +396 -32
  42. package/templates/skills/genex-threejs-volumetric-clouds/SKILL.md +33 -17
  43. package/templates/skills/genex-threejs-volumetric-clouds/references/volumetric-clouds.md +570 -21
  44. package/templates/skills/genex-threejs-water-optics/SKILL.md +33 -18
  45. package/templates/skills/genex-threejs-water-optics/references/water-optics.md +184 -20
@@ -1,33 +1,362 @@
1
- # Procedural Motion
1
+ # Procedural motion and docking systems
2
2
 
3
- Use this reference for authored real-time motion in Genex games.
3
+ Use this reference for phase-based launch, staging, docking, spring, rotating-frame, detachment, and debris motion with explicit coordinate frames and terminal states.
4
4
 
5
- ## Analytic timelines
5
+ ## Contents
6
6
 
7
- - Normalize timeline progress to `t` in `[0, 1]`.
8
- - Apply named easing functions per phase.
9
- - Derive all animated properties from the same normalized phase when they must
10
- stay synchronized.
11
- - Record phase names in debug output so screenshots can be interpreted.
7
+ - State contract
8
+ - Piecewise launch kinematics
9
+ - Planet-relative gravity turn
10
+ - Camera-independent shake and roll
11
+ - Stage detachment
12
+ - Spin-docking timeline
13
+ - Docking-frame decomposition
14
+ - Spring convergence and terminal lock
15
+ - Peeling and released debris
16
+ - planet-space implementation response and orientation patterns
17
+ - Failure modes and diagnostics
12
18
 
13
- ## Springs
14
19
 
15
- - Use springs for pursuit, vehicle lag, recoil, camera follow, or UI-like
16
- physical response.
17
- - Keep spring constants in named parameters.
18
- - Clamp extreme `deltaTime` after tab resumes.
19
- - Snap to target when distance and velocity fall below a threshold.
20
+ ## State contract
20
21
 
21
- ## Rotating frames
22
+ Use explicit persistent state:
22
23
 
23
- - For docking, orbit, or planet-relative scenes, define the moving frame first.
24
- - Convert local target axes to world axes each frame.
25
- - Slerp orientation toward the target quaternion.
26
- - Avoid mixing Euler interpolation with quaternion alignment.
24
+ ```ts
25
+ type ProceduralAnimationState = {
26
+ elapsedSeconds: number
27
+ phase: string
28
+ position: THREE.Vector3
29
+ velocity: THREE.Vector3
30
+ baseQuaternion: THREE.Quaternion
31
+ spinAngle: number
32
+ angularVelocity: THREE.Vector3
33
+ eventFlags: Record<string, boolean>
34
+ }
35
+ ```
27
36
 
28
- ## Debris and secondary motion
37
+ Keep scratch vectors/quaternions outside the state. Reset all persistent values
38
+ when restarting the sequence.
29
39
 
30
- - Generate seeded velocity, angular velocity, lifetime, and drag.
31
- - Use object pools for many particles or fragments.
32
- - Remove or recycle expired fragments deterministically.
33
- - Keep collision or damage state separate from decorative debris.
40
+ ## Piecewise launch kinematics
41
+
42
+ cinematic implementation’s launch sequence uses:
43
+
44
+ ```text
45
+ ignition hold = 1.2 s
46
+ ascent = 24 s
47
+ slow phase = 5 s
48
+ acceleration phase = 11 s
49
+ deceleration phase = 8 s
50
+ slow distance fraction = 0.00035
51
+ coast linear = 1.2 s
52
+ terminal deceleration = 4 s
53
+ ```
54
+
55
+ `computeAscentKinematics()` solves a normalized distance curve whose position
56
+ and speed remain continuous across all three ascent phases.
57
+
58
+ For slow phase:
59
+
60
+ ```text
61
+ speed = slowDistance / slowDuration
62
+ distance = speed * t
63
+ ```
64
+
65
+ Solve acceleration so total normalized distance reaches one after the
66
+ acceleration and deceleration phases:
67
+
68
+ ```text
69
+ remaining = 1 - slowDistance
70
+ accel =
71
+ (
72
+ remaining
73
+ - slowSpeed * (accelDuration + 0.5 * decelDuration)
74
+ )
75
+ /
76
+ (
77
+ 0.5 * accelDuration * (accelDuration + decelDuration)
78
+ )
79
+
80
+ peakSpeed = slowSpeed + accel * accelDuration
81
+ decel = peakSpeed / decelDuration
82
+ ```
83
+
84
+ Then integrate each phase analytically. Do not approximate this authored
85
+ timeline by repeatedly lerping position toward an endpoint.
86
+
87
+ ## Planet-relative gravity turn
88
+
89
+ The launch maps normalized distance to:
90
+
91
+ ```text
92
+ altitude = ascentProgress * targetOrbitAltitude + coastDistance * coastRate
93
+
94
+ groundArcDistance =
95
+ ascentProgress^1.22 * maxGroundArcDistance * turnBlend
96
+ + coastDistance * groundTrackRate
97
+
98
+ arcAngle = groundArcDistance / planetRadius
99
+ ```
100
+
101
+ Motion constants:
102
+
103
+ ```text
104
+ target altitude = 420 km in scene scale
105
+ max ground arc = 2200 km
106
+ max crossrange = 26 km
107
+ ```
108
+
109
+ Construct:
110
+
111
+ ```text
112
+ radial = normalize(0, cos(arcAngle), -sin(arcAngle))
113
+ tangent = normalize(0, -sin(arcAngle), -cos(arcAngle))
114
+ position = planetCenter + radial * (planetRadius + altitude)
115
+ position.x += crossrange
116
+ ```
117
+
118
+ Orientation:
119
+
120
+ ```text
121
+ flightDirection = normalize(lerp(radial, tangent, gravityTurn * 0.9))
122
+ base = quaternionFromUnitVectors(rocketLocalUp, flightDirection)
123
+ roll = quaternionAround(flightDirection, rollAmount)
124
+ orientation = base * roll
125
+ ```
126
+
127
+ This separates trajectory direction from authored roll/vibration.
128
+
129
+ ## Camera-independent shake and roll
130
+
131
+ Rocket roll:
132
+
133
+ ```text
134
+ shake envelope = 1 - smoothstep(0.05, 0.9, ascentProgress)
135
+ vibration =
136
+ (
137
+ sin(time * 52)
138
+ + sin(time * 31 + 0.7)
139
+ )
140
+ * 0.0024
141
+ * envelope
142
+
143
+ roll =
144
+ sin(time * 2.5) * 0.008 * envelope
145
+ + vibration
146
+ ```
147
+
148
+ The camera has a separate early launch shake envelope and offset. Keep object
149
+ vibration and camera shake separate so either can be disabled for diagnostics.
150
+
151
+ ## Stage detachment
152
+
153
+ Before reparenting stage one:
154
+
155
+ ```text
156
+ capture world position
157
+ capture world quaternion
158
+ capture world scale
159
+ remove from rocket
160
+ add to scene
161
+ restore captured world transform
162
+ ```
163
+
164
+ The detached stage immediately receives readable separation:
165
+
166
+ ```text
167
+ along offset = -3.4 m
168
+ side offset = 4.2 m
169
+ earthward offset = 1.2 m
170
+
171
+ along speed = -5.2 m/s
172
+ side speed = 5.8 m/s
173
+ earthward speed = 4.2 m/s
174
+ ```
175
+
176
+ It then integrates separate along, side, and earthward scalar velocities. A
177
+ short kick phase blends into growing lag accelerations.
178
+
179
+ For the first `2 s`, orientation slerps from the captured quaternion to a
180
+ random `10–30°` tilt. Afterward, it integrates a bounded spin rate
181
+ `0.06–0.15 rad/s`.
182
+
183
+ The side direction is chosen relative to the camera so separation reads in the
184
+ shot. That is a presentation-aware choice, not a physical rule.
185
+
186
+ ## Spin-docking timeline
187
+
188
+ Docking phases:
189
+
190
+ ```text
191
+ Endurance spin = 3.15 rad/s
192
+ Ranger spin-up = 6.5 s
193
+ approach starts = 4.0 s
194
+ approach duration = 14.5 s
195
+ dock settle = 3.0 s
196
+ post-dock spin-down = 3.0 s
197
+ dock axial clearance = 4.1
198
+ dock radial offset = 0.35
199
+ ```
200
+
201
+ Every phase uses a named `smoothstepRange(start, end, time)`. The sequence does
202
+ not hide all timing in one normalized zero-to-one value.
203
+
204
+ Endurance:
205
+
206
+ ```text
207
+ currentSpinRate = lerp(3.15, 0, spinDownT)
208
+ spinAngle += currentSpinRate * dt
209
+ orientation = baseOrientation * rotation(localForward, spinAngle)
210
+ ```
211
+
212
+ The docking frame is recomputed from the newly rotated Endurance every frame.
213
+
214
+ ## Docking-frame decomposition
215
+
216
+ At approach start:
217
+
218
+ ```text
219
+ offset = rangerPosition - dockPort
220
+ parallel = dot(offset, dockAxis)
221
+ radialVector = offset - dockAxis * parallel
222
+ radialDistance = length(radialVector)
223
+ radialDirection = normalize(radialVector)
224
+ ```
225
+
226
+ Target during approach:
227
+
228
+ ```text
229
+ parallelApproach =
230
+ lerp(startParallel, dockClearance, approachT)
231
+
232
+ parallel =
233
+ lerp(parallelApproach, dockClearance, dockT)
234
+
235
+ radialApproach =
236
+ lerp(startRadial, dockRadialOffset, approachT)
237
+
238
+ radial =
239
+ lerp(radialApproach, 0, dockT)
240
+ radial = lerp(radial, 0, spinDownT)
241
+
242
+ target =
243
+ dockPort
244
+ + dockAxis * parallel
245
+ + radialDirection * radial
246
+ ```
247
+
248
+ This preserves a readable approach corridor while progressively removing
249
+ lateral error.
250
+
251
+ ## Spring convergence and terminal lock
252
+
253
+ Ranger position follows target through a vector spring:
254
+
255
+ ```text
256
+ acceleration =
257
+ (target - current) * stiffness
258
+ - velocity * damping
259
+
260
+ velocity += acceleration * dt
261
+ current += velocity * dt
262
+ ```
263
+
264
+ Stiffness increases from `5.0` to `9.8`; damping from `4.6` to `7.4` as docking
265
+ settles.
266
+
267
+ Orientation aligns local up to negative docking axis, then applies spin around
268
+ the docking axis:
269
+
270
+ ```text
271
+ alignment = quaternionFromUnitVectors(localUp, -dockAxis)
272
+ spin = quaternionAround(dockAxis, rangerSpinAngle)
273
+ orientation = spin * alignment
274
+ ```
275
+
276
+ Near completed docking, position receives a final `lerp` toward target. After
277
+ spin-down reaches `0.995`, copy target exactly and zero velocity. A spring alone
278
+ can retain imperceptible but destabilizing residual motion.
279
+
280
+ ## Peeling and released debris
281
+
282
+ Endurance debris has two states.
283
+
284
+ Attached peel:
285
+
286
+ ```text
287
+ peelT = smoothstep(peelStart, detachTime, sequenceTime)
288
+ peelDistance = maxDistance * peelT^2
289
+ position = shipTransform(localAnchor + outward * peelDistance)
290
+ orientation = shipOrientation * localBase * peelTwist
291
+ ```
292
+
293
+ At release, velocity inherits rotating-frame tangential velocity:
294
+
295
+ ```text
296
+ angularVelocityOfShip =
297
+ dockAxis * currentSpinRate
298
+
299
+ tangentialVelocity =
300
+ cross(angularVelocityOfShip, worldOffsetFromShip)
301
+
302
+ velocity =
303
+ tangentialVelocity
304
+ + outward * outwardSpeed
305
+ + axis * axialSpeed
306
+ ```
307
+
308
+ Released debris then integrates linear velocity and quaternion rotation from
309
+ its angular-velocity vector. Speed is capped at `95`.
310
+
311
+ This rotating-frame inheritance is the defining mechanism. Random outward
312
+ velocity alone would not match the spinning hull.
313
+
314
+ ## planet-space implementation response and orientation patterns
315
+
316
+ planet-space implementation uses frame-rate-independent exponential response:
317
+
318
+ ```text
319
+ alpha = 1 - exp(-lambda * dt)
320
+ value = lerp(value, target, alpha)
321
+ ```
322
+
323
+ It uses this for camera blends, side-camera forward, effect intensities, color
324
+ response, and control state.
325
+
326
+ Ship orientation control separates desired forward/up from angular physics.
327
+ Quaternion targets are converted to angular error; damping acts on angular
328
+ velocity. This keeps user control and rigid-body response distinct.
329
+
330
+ For bounded camera lag, planet-space implementation uses a second-order spring with critical-like
331
+ damping ratios rather than exponential interpolation. Choose exponential
332
+ response for perceptual parameter smoothing and a spring when velocity/inertia
333
+ is part of the motion.
334
+
335
+ ## Failure modes and diagnostics
336
+
337
+ Observed boundaries:
338
+
339
+ - cinematic implementation detachment randomness uses `Math.random`; seed it for replay and
340
+ regression.
341
+ - Semi-implicit springs need a clamped `dt`, especially after tab suspension.
342
+ - The launch path is authored for one planet scale and shot duration.
343
+ - Camera-relative separation is intentionally cinematic rather than physical.
344
+ - Repeated quaternion multiplication should normalize periodically.
345
+ - Timeline phase constants are coupled; changing one duration requires
346
+ recomputing later event boundaries.
347
+
348
+ Expose:
349
+
350
+ ```text
351
+ sequence time and current phase
352
+ analytic position/speed curve
353
+ radial, tangent, and flight-direction vectors
354
+ base orientation, roll, and final orientation
355
+ stage world transform before/after reparent
356
+ detached scalar offsets/velocities
357
+ dock port, axis, parallel error, and radial error
358
+ spring target, velocity, stiffness, and damping
359
+ spin rates and accumulated angles
360
+ debris inherited tangential/outward/axial velocity
361
+ terminal lock state
362
+ ```
@@ -5,26 +5,45 @@ description: Create procedural architecture for Genex Three.js games. Use for bu
5
5
 
6
6
  # Genex Three.js Procedural Architecture
7
7
 
8
- Architecture should communicate function, scale, traversal, and affordance. Use
9
- grammars that emit semantic parts rather than arbitrary boxes.
8
+ Separate design planning from mesh emission. A building generator should produce an inspectable plan before it produces triangles.
10
9
 
11
- Read [references/architecture-systems.md](references/architecture-systems.md)
12
- for massing, facade rules, module compilation, and gameplay checks.
10
+ ## Required architecture
13
11
 
14
- ## Build order
12
+ ```text
13
+ settings
14
+ → mass grammar
15
+ → exposed-surface graph
16
+ → façade/roof placements
17
+ → module registry
18
+ → material-slot mesh writer
19
+ → geometries
20
+ ```
15
21
 
16
- 1. Define gameplay role: backdrop, obstacle, climbable surface, interior shell,
17
- landmark, cover, or arena boundary.
18
- 2. Build massing volumes and exposed edges.
19
- 3. Apply facade grammar by face orientation, floor band, corner, and entrance.
20
- 4. Emit material slots and collision proxies separately from decorative meshes.
21
- 5. Add detail only where camera distance supports it.
22
- 6. Expose debug views for modules, floors, entrances, collision, and LOD.
22
+ Read [references/architecture-systems.md](references/architecture-systems.md) before implementing the generator.
23
23
 
24
24
  ## Rules
25
25
 
26
- - Keep doors, ledges, stairs, and openings aligned with player scale.
27
- - Use repeated modules deliberately; break repetition with semantic variation.
28
- - Do not spend triangle budget on invisible internal faces.
29
- - Keep material slots stable so generated variants can share assets.
30
- - Validate collision and navigation against the visual promise.
26
+ - Massing, façade rhythm, and detail modules are separate layers.
27
+ - Resolve exposed edges before façade placement. Do not decorate hidden internal faces.
28
+ - Modules own semantic anchors and construction depth, not global building coordinates.
29
+ - Compile by material slot to reduce draw calls without destroying material separation.
30
+ - Preserve real dimensions for floor height, bay width, trim projection, and texture density.
31
+ - Randomness may select among valid designs; it must not repair invalid geometry.
32
+ - Provide topology, placement, material-slot, and UV-density debug modes.
33
+
34
+ ## Acceptance
35
+
36
+ The generated building must survive:
37
+
38
+ - silhouette-only view;
39
+ - flat untextured material;
40
+ - grazing light;
41
+ - close inspection of corners and roof transitions;
42
+ - seed variation without broken bays, overlapping ownership, or floating ornament;
43
+ - triangle and module-count reporting.
44
+
45
+ ## Routing boundary
46
+
47
+ Use `$genex-threejs-procedural-geometry` for a reusable profile, sweep, ring, or mesh
48
+ writer without a building grammar. This skill owns massing, façade semantics,
49
+ architectural modules, and building-plan compilation.