@genex-ai/cli-demo 0.47.0-dev.74 → 0.48.0-dev.75

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/dist/index.js CHANGED
@@ -1800,12 +1800,31 @@ async function detectGameStateUsage(cwd = process.cwd()) {
1800
1800
  }
1801
1801
  return false;
1802
1802
  }
1803
+ var UI_PHASE_MARKERS = /data-phase|setPhase/;
1804
+ async function detectUiPhases(cwd = process.cwd()) {
1805
+ try {
1806
+ const html = await fs10.readFile(path11.join(cwd, "index.html"), "utf8").catch(() => "");
1807
+ if (UI_PHASE_MARKERS.test(html)) return true;
1808
+ const srcDir = path11.join(cwd, "src");
1809
+ const entries = await fs10.readdir(srcDir, { recursive: true });
1810
+ for (const rel of entries) {
1811
+ if (rel.includes("node_modules")) continue;
1812
+ if (!/\.(ts|js|mts|mjs|tsx|jsx|html|css)$/.test(rel)) continue;
1813
+ const content = await fs10.readFile(path11.join(srcDir, rel), "utf8").catch(() => "");
1814
+ if (UI_PHASE_MARKERS.test(content)) return true;
1815
+ }
1816
+ return false;
1817
+ } catch {
1818
+ return true;
1819
+ }
1820
+ }
1803
1821
  async function detectFeatures(log, cwd = process.cwd()) {
1804
1822
  return {
1805
1823
  embedSdkVersion: await detectEmbedSdkVersion(cwd),
1806
1824
  multiplayer: await detectMultiplayer(cwd),
1807
1825
  matchmaking: await detectMatchmaking(log, cwd),
1808
- gameStateUsed: await detectGameStateUsage(cwd)
1826
+ gameStateUsed: await detectGameStateUsage(cwd),
1827
+ uiPhases: await detectUiPhases(cwd)
1809
1828
  };
1810
1829
  }
1811
1830
  function advisoryNudges(log, d) {
@@ -1824,6 +1843,11 @@ function advisoryNudges(log, d) {
1824
1843
  "package.json declares genex.matchmaking but @genex-ai/multiplayer is not installed \u2014 matchmaking cannot work. Install the SDK and use matchmake() (see genex-threejs-multiplayer)."
1825
1844
  );
1826
1845
  }
1846
+ if (!d.uiPhases) {
1847
+ log.warn(
1848
+ "No menu/loader screens detected (no data-phase/setPhase) \u2014 players get a bare HUD with no title screen and no styled loading. Run the genex-threejs-game-ui plan (loader, menu, screen tiers); a cinematic menu is two commands away (genex-ai-menu)."
1849
+ );
1850
+ }
1827
1851
  }
1828
1852
  async function firstPreviewNudge(log, cwd = process.cwd()) {
1829
1853
  const meta = await readProject(cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genex-ai/cli-demo",
3
- "version": "0.47.0-dev.74",
3
+ "version": "0.48.0-dev.75",
4
4
  "description": "Set up your ~/.claude workspace, authorize, create a game project, generate AI assets, and publish (genex CLI).",
5
5
  "type": "module",
6
6
  "bin": {
@@ -157,7 +157,8 @@ const _identityMatrix = new THREE.Matrix4();
157
157
  * const physics = await PhysicsWorld.create();
158
158
  * physics.onBeforeStep(() => controller.update(physics.timeStep));
159
159
  * renderer.setAnimationLoop(() => {
160
- * physics.step(clock.getDelta()); // fixed substeps + mesh sync + events
160
+ * physics.step(delta); // fixed substeps + mesh sync + events
161
+ * // delta = capped performance.now() difference — avoid THREE.Clock.getDelta()
161
162
  * // ...camera + render (render-delta code lives OUT here, never inside)
162
163
  * });
163
164
  * ```
@@ -94,9 +94,14 @@ physics.onBeforeStep(() => {
94
94
  });
95
95
 
96
96
  // Render phase: step physics, then camera, then animations.
97
+ // Delta comes from performance.now(), NOT THREE.Clock — Clock.getDelta() has
98
+ // repeatedly frozen at 0 in real games (world renders, nothing moves).
97
99
  const pivot = new THREE.Vector3();
100
+ let lastT = performance.now();
98
101
  renderer.setAnimationLoop(() => {
99
- const delta = clock.getDelta();
102
+ const nowT = performance.now();
103
+ const delta = Math.min((nowT - lastT) / 1000, 0.1);
104
+ lastT = nowT;
100
105
  physics.step(delta); // runs the fixed substeps + world.step() + mesh sync
101
106
 
102
107
  pivot.copy(character.currPos).addScaledVector(character.bodyYAxis, 0.5);
@@ -169,7 +169,11 @@ Per fixed **substep** (inside `physics.onBeforeStep`), in this order:
169
169
  Per **render** frame (inside `renderer.setAnimationLoop`), in this order:
170
170
 
171
171
  ```ts
172
- const delta = clock.getDelta();
172
+ // Delta from performance.now() — THREE.Clock.getDelta() has repeatedly frozen
173
+ // at 0 in real games (world renders, nothing moves).
174
+ const nowT = performance.now();
175
+ const delta = Math.min((nowT - lastT) / 1000, 0.1);
176
+ lastT = nowT;
173
177
  physics.step(delta); // 1. fixed substeps + mesh sync
174
178
 
175
179
  pivot.copy(character.currPos).addScaledVector(character.bodyYAxis, 0.5);
@@ -59,9 +59,11 @@ physics.onBeforeStep(() => {
59
59
  // controller.update(), impulses, kinematic platform poses ...
60
60
  });
61
61
 
62
- const clock = new THREE.Clock();
62
+ let lastT = performance.now(); // NOT THREE.Clock — its getDelta() has frozen at 0 in real games
63
63
  renderer.setAnimationLoop(() => {
64
- physics.step(clock.getDelta()); // fixed substeps + mesh sync + events
64
+ const nowT = performance.now();
65
+ physics.step(Math.min((nowT - lastT) / 1000, 0.1)); // fixed substeps + mesh sync + events
66
+ lastT = nowT;
65
67
  // camera follow, mixers, HUD go HERE (render-delta work, after the step) —
66
68
  // never inside onBeforeStep above
67
69
  renderer.render(scene, camera);
@@ -51,8 +51,11 @@ physics.onBeforeStep(() => {
51
51
  drone.update(dt);
52
52
  }); // 4. world.step() runs after
53
53
 
54
+ let lastT = performance.now();
54
55
  renderer.setAnimationLoop(() => {
55
- physics.step(clock.getDelta()); // fixed substeps + interpolated mesh sync
56
+ const nowT = performance.now();
57
+ physics.step(Math.min((nowT - lastT) / 1000, 0.1)); // fixed substeps + interpolated mesh sync
58
+ lastT = nowT; // performance.now() delta — THREE.Clock.getDelta() freezes at 0 in real games
56
59
  // camera + render here — render-delta code never goes inside onBeforeStep
57
60
  });
58
61
  ```