@jgengine/shell 0.7.0 → 0.8.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 (82) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +26 -1
  3. package/dist/GameHost.d.ts +12 -0
  4. package/dist/GameHost.js +33 -0
  5. package/dist/GamePlayer.d.ts +11 -0
  6. package/dist/GamePlayer.js +24 -0
  7. package/dist/GamePlayerShell.d.ts +33 -1
  8. package/dist/GamePlayerShell.js +439 -28
  9. package/dist/behaviour.d.ts +31 -0
  10. package/dist/behaviour.js +63 -0
  11. package/dist/camera/GameCameraRig.d.ts +8 -3
  12. package/dist/camera/GameCameraRig.js +28 -14
  13. package/dist/camera/GameFirstPersonCamera.js +2 -0
  14. package/dist/camera/GameInspectionCamera.d.ts +6 -0
  15. package/dist/camera/GameInspectionCamera.js +24 -0
  16. package/dist/camera/cameraRigs.d.ts +5 -1
  17. package/dist/camera/cameraRigs.js +43 -6
  18. package/dist/camera/index.d.ts +4 -2
  19. package/dist/camera/index.js +4 -2
  20. package/dist/camera/inspectionCameraMath.d.ts +25 -0
  21. package/dist/camera/inspectionCameraMath.js +44 -0
  22. package/dist/camera/rigMath.d.ts +40 -1
  23. package/dist/camera/rigMath.js +55 -0
  24. package/dist/camera/rigResolve.d.ts +15 -0
  25. package/dist/camera/rigResolve.js +52 -0
  26. package/dist/defineGame.d.ts +16 -0
  27. package/dist/defineGame.js +51 -0
  28. package/dist/devtools/DevtoolsOverlay.d.ts +14 -0
  29. package/dist/devtools/DevtoolsOverlay.js +334 -0
  30. package/dist/environment/Daylight.d.ts +50 -0
  31. package/dist/environment/Daylight.js +100 -0
  32. package/dist/environment/EnvironmentScene.js +18 -26
  33. package/dist/environment/GroundPad.d.ts +7 -0
  34. package/dist/environment/GroundPad.js +12 -0
  35. package/dist/environment/daylightCycle.d.ts +26 -0
  36. package/dist/environment/daylightCycle.js +116 -0
  37. package/dist/environment/groundPadMath.d.ts +13 -0
  38. package/dist/environment/groundPadMath.js +10 -0
  39. package/dist/environment/index.d.ts +2 -0
  40. package/dist/environment/index.js +2 -0
  41. package/dist/materialOverride.d.ts +8 -0
  42. package/dist/materialOverride.js +32 -0
  43. package/dist/multiplayer.d.ts +16 -9
  44. package/dist/multiplayer.js +62 -12
  45. package/dist/pointer/PointerProbe.js +14 -1
  46. package/dist/pointer/pointerService.d.ts +2 -0
  47. package/dist/pointer/pointerService.js +45 -24
  48. package/dist/registry.d.ts +4 -1
  49. package/dist/registry.js +3 -1
  50. package/dist/render/modelRender.d.ts +14 -0
  51. package/dist/render/modelRender.js +79 -0
  52. package/dist/terrain/index.d.ts +1 -1
  53. package/dist/terrain/index.js +1 -1
  54. package/dist/terrain/terrainMath.d.ts +1 -0
  55. package/dist/terrain/terrainMath.js +8 -2
  56. package/dist/touch/TouchControlsOverlay.d.ts +18 -0
  57. package/dist/touch/TouchControlsOverlay.js +173 -0
  58. package/dist/water/OceanShader.d.ts +1 -1
  59. package/dist/water/OceanShader.js +3 -3
  60. package/dist/world/DataObjects.d.ts +44 -0
  61. package/dist/world/DataObjects.js +75 -0
  62. package/dist/world/GridWorldScene.d.ts +10 -0
  63. package/dist/world/GridWorldScene.js +54 -0
  64. package/dist/world/WorldHud.d.ts +5 -1
  65. package/dist/world/WorldHud.js +6 -2
  66. package/dist/world/WorldItems.js +21 -2
  67. package/llms.txt +2382 -0
  68. package/package.json +6 -5
  69. package/dist/demo/builderDemo.d.ts +0 -2
  70. package/dist/demo/builderDemo.js +0 -189
  71. package/dist/demo/demoGame.d.ts +0 -2
  72. package/dist/demo/demoGame.js +0 -208
  73. package/dist/demo/environmentShowcase.d.ts +0 -2
  74. package/dist/demo/environmentShowcase.js +0 -15
  75. package/dist/demo/mapDemo.d.ts +0 -2
  76. package/dist/demo/mapDemo.js +0 -206
  77. package/dist/demo/pointerDemo.d.ts +0 -2
  78. package/dist/demo/pointerDemo.js +0 -151
  79. package/dist/demo/sensorShowcase.d.ts +0 -2
  80. package/dist/demo/sensorShowcase.js +0 -131
  81. package/dist/demo/survivalDemo.d.ts +0 -2
  82. package/dist/demo/survivalDemo.js +0 -291
package/CHANGELOG.md CHANGED
@@ -11,6 +11,53 @@ Agents building on the published SDK can also read this programmatically:
11
11
  same data as typed values, so an updater can diff its installed version against
12
12
  the latest and surface the migration steps.
13
13
 
14
+ ## 0.8.0
15
+
16
+ Transport-agnostic multiplayer (socket.io, WebRTC p2p, LAN/Fly adapters) plus grid/voxel
17
+ and puzzle primitives, HUD-only presentation, cumulative leveling, and a round of
18
+ controller/camera/sensor additions. **Breaking:** the `gameui` component kit moved out of
19
+ `@jgengine/react` onto the shadcn registry.
20
+
21
+ ### Migrate
22
+
23
+ - Bump every `@jgengine/*` dependency to `^0.8.0` (the eight packages version in lockstep).
24
+ - Additive only, except for `gameui` — every other 0.7.0 API is unchanged; opt into any of the below by importing it directly.
25
+ - **Breaking:** replace any `@jgengine/react/gameui` import with the equivalent registry component (`npx shadcn@latest add https://jgengine.com/r/<name>.json`), and swap `GameUiThemeProvider` for `--jg-*` CSS variables on a wrapper element. `GameIcon` and friends moved to `@jgengine/react/gameIcons`.
26
+ - `leveling({ thresholdMode: 'cumulative' })` is opt-in; the default `perLevel` behavior is unchanged.
27
+ - `defineGame.physics.gravity`/`jumpVelocity` are now read by the built-in kinematics controller every frame — if a game already set them expecting a no-op, jump/fall now actually reflects them; omit both to keep the previous defaults.
28
+
29
+ ### Added
30
+
31
+ - Cumulative leveling — `leveling({ thresholdMode: 'cumulative' })` tracks xp as a lifetime total that resolves upward across levels and clamps at the max-level threshold once capped (#12).
32
+ - Direction-aware pool depletion — `EffectSystem.canReceive(instanceId, effect, magnitude?)` takes an optional signed magnitude; negative checks the opposite direction and returns `pools-depleted` only when every stat in the receive order is already at max, so heals reach fully-depleted targets (#168).
33
+ - Puzzle primitives — `puzzle/cellGrid` (uniform-cell boards: line-clear, match-3 cascade, run detection) and `puzzle/fallingPiece` (rotation-state shapes, ghost drop, lock delay, classic gravity/level/score curves) for Tetris/match-3 games (#166).
34
+ - Voxel field — `world/voxelField` (`createVoxelField`, chunked block lattice, neighbors/exposedFaces, 3D DDA raycast, dirty-tracked `chunkVersion`) for voxel games and instanced renderers; assert on `field.summary()` the way environment worlds assert on `summarizeEnvironment` (#166).
35
+ - `defineGame` games may omit `assets` (an empty catalog is injected); `PlayableGame.presentation: 'hud'` mounts no 3D canvas/camera/pointer for board/card/menu games; an `environment()` world auto-renders as the shell's backdrop when `PlayableGame.environment` is unset (#166).
36
+ - Declared-action intent board — `turn/intent` `createIntentBoard` for one-turn-ahead intents (Slay-the-Spire style): declare/peek/all/consume/clear (#168).
37
+ - `turnLoop` lifecycle hooks — `config.onTurnStart`/`onTurnEnd` fire on every `advanceTurn()`; `ctx.game.turn.loop(id, config)` lazily creates/returns a notify-wrapped `TurnLoop` so every mutation (`advanceTurn`/`advancePhase`/`advanceRound`/`spend`/`gain`/`refill`/`setOrder`/...) auto-bumps `ctx.version()` with no manual wiring (#163/#168).
38
+ - `ctx.game.store` — a reactive per-game keyed store (`set`/`delete`/`get`/`has`/`subscribe`/`mapSnapshot`/`arraySnapshot`) plus `@jgengine/react`'s `useGameStore` selector hook, replacing hand-rolled module-level stores for ad-hoc reactive game state; `ctx.game.cards.pile(id, config?)` lazily creates/returns a notify-wrapped `CardPile` the same way; `createCardPile` gained an `onChange` hook for headless use; `CommandDefinition.apply` may return void for side-effect-only commands (#163).
39
+ - Camera — `sideScroll` rig (fixed lateral follow for 2.5D platformers/beat-'em-ups), a `none` rig (no camera mounted; pairs with `PlayableGame.presentation: 'hud'`), `rts.pan: false` (static backdrop camera: no pan/edge-scroll/rotate/zoom, still re-centers on the follow target), and the `observer` rig now defaults to the local player when `bind` is unset (#167).
40
+ - Sensors + session — `sensor/concealment` (`colorDistance`/`concealmentScore`/`createConcealmentSensor`), `sensor/freezeMonitor` (`createFreezeMonitor`), `session/roles` (`assignRoles`); `createRoundState`'s `RoundConfig.teams` accepts per-team roles and an optional `winCondition` that `evaluate()` checks each tick, and takes an optional `phaseOrder` for arbitrary named phase cycles (`concludeRound`/`evaluate` settle only while the current phase is neither the first nor the last entry) (#151).
41
+ - Appearance replication — presence rows carry an optional per-slot appearance channel (cosmetic ids, hex tints, model keys) alongside pose, riding the existing pose message with no protocol bump; wire `ctx.player.cosmetics.get(userId)` into the outgoing pose (#151).
42
+ - `ctx.input` — a per-frame held-action snapshot (`publish(held)`/`isDown(action)`/`held()`) without bumping `ctx.version()`; action bindings gained `repeatMs` (repeat-fire while held); every command resolved from a bound action now carries `aim`; `pointer.secondaryCommand` runs a command on right-click off the same raycast as move/ping (#164).
43
+ - Object spatial queries + entity patching — `ctx.scene.object.at`/`inBox`/`raycast`/`raycastAll` over unit-box objects; `ctx.scene.entity.update(id, patch)` for name/position/rotation/role/movement/behaviors/meta; per-instance `renderObject`/`objectStyles` overrides; `pointerService.worldHitCenter()` + pointer-lock center-ray aiming (#165).
44
+ - Controller movement config — `PlayerMovementConfig` (`mode`: free/axis/grid, `axis`, `cellSize`, `collideObjects`, `beforeCommit` pre-commit hook) for the shell-driven walk controller; `defineGame.physics.gravity`/`jumpVelocity` are honored by the built-in walk controller (distinct from the standalone `physics/physicsWorld` rigid-body sim); `ctx.player.motion.impulse`/`setVerticalVelocity`/`setY`/`takePending` (`MotionIntents`); `entity.spawnPoseOf`/`resetToSpawn`/`resetAllToSpawn` (#162).
45
+ - Model material/animation + paint — `ModelConfig.tint`/`metalness`/`roughness`/`animation` (GLTF clip playback, paused pose holds); `PointerHit.uv` + `pointerService.sampleSurface()` for material-aware picking; `ctx.scene.entity.paint` runtime paint layer, auto-rendered via a per-instance canvas texture with no per-game wiring; remote-player appearance tint recolors the shell's default capsule (#151).
46
+ - **Transport pipe seam** (`@jgengine/ws/pipe`) — `createWsBackend` runs over any bidirectional string channel, not just a raw `WebSocket`: `TransportPipe`/`TransportPipeHandlers`/`TransportPipeFactory`, with `webSocketPipe(url, webSocketFactory?)` as the default. `createWsBackend({ userId, url?, pipe? })` — `url` stays the common case, `pipe` opens the seam to socket.io, WebRTC, and in-process loopback below.
47
+ - **Browser-safe authoritative host** — `createGameHost` and `memoryPersistence` moved from `@jgengine/node` to `@jgengine/ws/host` (zero Node dependencies; `@jgengine/node` re-exports both unchanged from `@jgengine/node/host` / `@jgengine/node/persistence`, so existing imports keep working). `@jgengine/ws/hostRouter`'s `createHostRouter({ host, authenticate?, poseRules?, positionHistoryMs?, chatRateLimit?, chatHistoryLimit?, chatMaxBodyLength?, now? })` extracts the ws wire-protocol session logic out of `createGameWsServer` into a transport-agnostic `HostRouter` (`connect(transport) → { handleRaw, close }`, `rewind`, `close`); `@jgengine/node`'s `createGameWsServer` is now a thin binding of this router onto the `ws` npm package, same public API. `loopbackPipe(router): TransportPipeFactory` connects a `createWsBackend` straight into an in-process router.
48
+ - **Socket.IO transport** — `@jgengine/ws/socketIoPipe` (`SocketIoLikeSocket` structural type, `socketIoPipe(socket)`, `createSocketIoBackend({ socket, userId, … })`) and `@jgengine/node/socketIoServer` (`attachGameSocketIoServer({ io, host, …router options }): { rewind, close }`, structural `SocketIoLikeServer`/`SocketIoLikeServerSocket`) ride the existing ws JSON protocol over socket.io's `send`/`message` frames — no socket.io dependency in either package's types. New `socketIo({ topology?, url? })` adapter in `@jgengine/core/runtime/adapter`.
49
+ - **WebRTC peer-to-peer** (`@jgengine/ws/peer`) — one browser tab hosts, authoritatively, with no server process. `createPeerHost({ userId, host?, runtimes?, persistence?, tickMs?, router?, rtc? })` runs a `GameHost` + `HostRouter` in the host tab (`backend` is the host player's own loopback connection, `accept(offerCode) → Promise<answerCode>` per guest); `createPeerGuest({ userId, token?, rtc? })` offers/connects from the joining side. `encodePeerSignal`/`decodePeerSignal` turn SDP into copy-pasteable base64url codes for manual cross-machine signaling; `broadcastChannelSignaling(room)` automates it for same-origin multi-tab play, with `announcePeerHost`/`joinPeerSession` wiring host/guest to a `PeerSignaling` in one call. New `p2p({ topology?, room? })` adapter (topology defaults `"private"`).
50
+ - **LAN adapter + Fly sugar** — `lan({ topology?, port?, path? })` in `@jgengine/core/runtime/adapter` resolves through `@jgengine/shell/multiplayer`'s `resolveShellMultiplayer` to `ws(s)://<page hostname>:<port ?? 8080><path ?? /ws>` derived from `window.location`, so any browser on the LAN auto-connects to whichever machine served the page — no URL configuration. `fly({ app, topology?, path? })` is `ws` sugar for a Fly.io deploy: resolves to `wss://<app>.fly.dev<path ?? "/ws">`. `apps/dev`'s Vite server now listens on the network (`server: { host: true }`) and exposes `?p2p=host` / `?p2p=join` query params wired through the new `resolvePeerShellMultiplayer({ gameId, role, room?, userId?, feedActions? })`.
51
+ - `ws()` (`@jgengine/core/runtime/adapter`) gained an optional `url` field, carried through by `resolveShellMultiplayer` (`args.url ?? adapter.url ?? default`).
52
+
53
+ ### Removed
54
+
55
+ - **The `gameui` component kit** (`@jgengine/react/gameui`) — the themed HUD kit (bars, slots, feedback, meters, panels, screens, reticles, icons) and its `GameUiThemeProvider`/`useGameUiTheme` theming have been removed. **Breaking** for anyone importing `@jgengine/react/gameui` (or its subpaths/barrel). The components now ship as installable shadcn registry items at `https://jgengine.com/r/<name>.json` (`npx shadcn@latest add https://jgengine.com/r/<name>.json`), styled with Tailwind + `--jg-*` CSS variables instead of a theme object. The icon catalog (`GameIcon`, `iconForAction`, `iconForItemId`, `isGameIconName`, `GameIconName`) moved to `@jgengine/react/gameIcons`. To theme, set the `--jg-*` variables on a wrapper element (the registry's `jg-theme` presets mirror the old `ember`/`synthwave`/`fieldkit` palettes) instead of wrapping in `GameUiThemeProvider`.
56
+
57
+ ### Docs
58
+
59
+ - Added [CREDITS.md](CREDITS.md) crediting [achrefelouafi](https://github.com/achrefelouafi) for the MIT Three.js reference projects behind the procedural building, water, rain, and snow renderers, with links from the root, `@jgengine/core`, and `@jgengine/shell` READMEs.
60
+
14
61
  ## 0.7.0
15
62
 
16
63
  The engine-gaps release — 22 system-level additions across turn/tactics, cards & boards,
package/README.md CHANGED
@@ -24,7 +24,32 @@ import { WeatherLayer, LightningStrike } from "@jgengine/shell/weather";
24
24
  <LightningStrike origin={[0, 22, 0]} target={[4, 0, -6]} strikeKey={stormTick} />;
25
25
  ```
26
26
 
27
- `RainField` and `SnowField` can also be mounted directly. The primitives use camera-following instanced volumes, prop-driven density controls, shared time/wind uniforms under `WeatherLayer`, and explicit Three resource disposal. They were shaped from ideas in achrefelouafi's MIT RainSystemThreeJS and SnowSystemThreeJS references without bringing over GUI, audio, postprocessing, or app-specific scene setup.
27
+ `RainField` and `SnowField` can also be mounted directly. The primitives use camera-following instanced volumes, prop-driven density controls, shared time/wind uniforms under `WeatherLayer`, and explicit Three resource disposal. They were shaped from ideas in achrefelouafi's MIT [RainSystemThreeJS](https://github.com/achrefelouafi/RainSystemThreeJS) and [SnowSystemThreeJS](https://github.com/achrefelouafi/SnowSystemThreeJS) references (see [CREDITS.md](../../CREDITS.md)) without bringing over GUI, audio, postprocessing, or app-specific scene setup.
28
+
29
+ ## Water
30
+
31
+ `@jgengine/shell/water` renders the Gerstner ocean surface from `@jgengine/core`:
32
+
33
+ ```tsx
34
+ import { Ocean } from "@jgengine/shell/water";
35
+
36
+ <Ocean />;
37
+ ```
38
+
39
+ Summed Gerstner waves, crest-driven foam, and Fresnel water color were shaped from achrefelouafi's MIT [OceanThreejs](https://github.com/achrefelouafi/OceanThreejs) reference (see [CREDITS.md](../../CREDITS.md)).
40
+
41
+ ## Structures
42
+
43
+ `GeneratedBuilding` renders the seeded facade/roof kit produced by `generateBuilding` in `@jgengine/core`:
44
+
45
+ ```tsx
46
+ import { GeneratedBuilding } from "@jgengine/shell/structures/GeneratedBuilding";
47
+ import { generateBuilding } from "@jgengine/core/world/buildings";
48
+
49
+ <GeneratedBuilding building={generateBuilding({ seed: "block-a", floors: 6 })} />;
50
+ ```
51
+
52
+ The component vocabulary (windows, awnings, AC units, clotheslines, storefronts, shutters, store signs, roof props, guardrails) and placement logic follow achrefelouafi's MIT [BuildingGeneratorThreeJS](https://github.com/achrefelouafi/BuildingGeneratorThreeJS) (see [CREDITS.md](../../CREDITS.md)).
28
53
 
29
54
  ## Terrain primitives
30
55
 
@@ -0,0 +1,12 @@
1
+ import { type ResolveShellMultiplayerArgs, type ShellMultiplayer } from "./multiplayer.js";
2
+ import type { PlayableGame } from "./registry.js";
3
+ export interface GameHostProps {
4
+ playable: PlayableGame;
5
+ gameId?: string;
6
+ wsUrl?: string;
7
+ /** Prebuilt multiplayer session. When present (including `null`), it is used as-is and no resolution is attempted. */
8
+ multiplayer?: ShellMultiplayer | null;
9
+ /** Tried before the built-in {@link resolveShellMultiplayer}; falls back to it when this returns `null`. */
10
+ resolveMultiplayer?: (args: ResolveShellMultiplayerArgs) => ShellMultiplayer | null;
11
+ }
12
+ export declare function GameHost({ playable, gameId, wsUrl, multiplayer, resolveMultiplayer }: GameHostProps): import("react").JSX.Element;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { multiplayerAdapterKind } from "@jgengine/core/runtime/adapter";
4
+ import { GamePlayerShell } from "./GamePlayerShell.js";
5
+ import { resolveShellMultiplayer } from "./multiplayer.js";
6
+ const warnedAdapterKinds = new Set();
7
+ function warnUndrivenAdapter(kind) {
8
+ if (warnedAdapterKinds.has(kind))
9
+ return;
10
+ warnedAdapterKinds.add(kind);
11
+ console.warn(`GameHost: game declares multiplayer adapter "${kind}", which the built-in shell resolver cannot drive. ` +
12
+ "Running offline. Pass a prebuilt session via the multiplayer prop, or a resolveMultiplayer prop, to GameHost.");
13
+ }
14
+ export function GameHost({ playable, gameId, wsUrl, multiplayer, resolveMultiplayer }) {
15
+ const resolved = useMemo(() => {
16
+ if (multiplayer !== undefined)
17
+ return multiplayer;
18
+ const args = {
19
+ game: playable.game,
20
+ gameId: gameId ?? playable.game.name,
21
+ url: wsUrl,
22
+ force: wsUrl !== undefined,
23
+ };
24
+ const session = resolveMultiplayer?.(args) ?? resolveShellMultiplayer(args);
25
+ if (session === null) {
26
+ const kind = multiplayerAdapterKind(playable.game.multiplayer);
27
+ if (kind !== null && kind !== "offline")
28
+ warnUndrivenAdapter(kind);
29
+ }
30
+ return session;
31
+ }, [playable, gameId, wsUrl, multiplayer, resolveMultiplayer]);
32
+ return _jsx(GamePlayerShell, { playable: playable, multiplayer: resolved });
33
+ }
@@ -0,0 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ import type { ShellMultiplayer } from "./multiplayer.js";
3
+ import type { GameRegistry } from "./registry.js";
4
+ export type GamePlayerProps = {
5
+ gameId: string;
6
+ registry: GameRegistry;
7
+ fallbackGameId?: string;
8
+ loading?: ReactNode;
9
+ multiplayer?: ShellMultiplayer | null;
10
+ };
11
+ export declare function GamePlayer({ gameId, registry, fallbackGameId, loading, multiplayer }: GamePlayerProps): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { GamePlayerShell } from "./GamePlayerShell.js";
4
+ import { resolveGameLoader } from "./registry.js";
5
+ export function GamePlayer({ gameId, registry, fallbackGameId, loading = null, multiplayer = null }) {
6
+ const [playable, setPlayable] = useState(null);
7
+ useEffect(() => {
8
+ let cancelled = false;
9
+ setPlayable(null);
10
+ const load = resolveGameLoader(registry, gameId, fallbackGameId);
11
+ if (load !== undefined) {
12
+ void load().then((game) => {
13
+ if (!cancelled)
14
+ setPlayable(game);
15
+ });
16
+ }
17
+ return () => {
18
+ cancelled = true;
19
+ };
20
+ }, [gameId, fallbackGameId]);
21
+ if (playable === null)
22
+ return _jsx(_Fragment, { children: loading });
23
+ return _jsx(GamePlayerShell, { playable: playable, multiplayer: multiplayer });
24
+ }
@@ -1,6 +1,38 @@
1
+ import { type ActionStateTracker } from "@jgengine/core/input/actionBindings";
2
+ import type { Aim } from "@jgengine/core/scene/spatial";
3
+ import { type CollisionObstacle, type MovementTuningOverrides } from "@jgengine/core/movement/movementModel";
4
+ import type { PhysicsConfig } from "@jgengine/core/game/defineGame";
5
+ import { type GameContext } from "@jgengine/core/runtime/gameContext";
6
+ import type { MotionIntentBatch } from "@jgengine/core/runtime/motionIntents";
7
+ import type { SkyEnvironmentDescriptor, WorldFeature } from "@jgengine/core/world/features";
8
+ import { type SceneObject } from "@jgengine/core/scene/objectStore";
1
9
  import type { ShellMultiplayer } from "./multiplayer.js";
2
10
  import type { PlayableGame } from "./registry.js";
3
- export declare function GamePlayerShell({ playable, multiplayer, }: {
11
+ /** Actions from `input` currently held down, for `ctx.input.publish` (#164.1); includes reserved movement/jump actions. */
12
+ export declare function heldActionsFor(tracker: Pick<ActionStateTracker<string>, "isDown">, actions: readonly string[]): string[];
13
+ /** Whether a bound action should fire this frame: on press, or on repeat interval while held (shared by `FrameDriver` and `HudOnlyDriver`). */
14
+ export declare function shouldFireBoundAction(tracker: Pick<ActionStateTracker<string>, "isDown" | "wasPressed">, action: string, input: PlayableGame["game"]["input"], repeatFiredAt: ReadonlyMap<string, number>, now: number): boolean;
15
+ /** Resolves and runs the command bound to `action` via the shell's action→command convention (shared by `FrameDriver` and `HudOnlyDriver`). */
16
+ export declare function dispatchBoundAction(ctx: GameContext, action: string, yaw: number, pitch: number, aim: Aim): void;
17
+ /** Placed scene objects within `radius` of `center`, as `CollisionObstacle`s for `resolveObstacleStep` (#162.1). */
18
+ export declare function nearbyObstacles(objects: readonly SceneObject[], center: readonly [number, number, number], radius?: number): CollisionObstacle[];
19
+ /** Applies a pending `MotionIntentBatch` to a vertical velocity: impulses add, then `verticalVelocity` replaces the result outright (#162.4). */
20
+ export declare function applyMotionImpulses(currentVelocity: number, batch: MotionIntentBatch | null): number;
21
+ /** The world's declared sky, when its world feature is an environment with one (#196.1). */
22
+ export declare function resolveWorldSky(world: WorldFeature | undefined): SkyEnvironmentDescriptor | undefined;
23
+ /**
24
+ * Maps the game's declared `physics` onto the movement controllers' tuning
25
+ * overrides. `PhysicsConfig.gravity` is a signed world acceleration (negative
26
+ * points down, matching every game's config and the Y-up convention), but the
27
+ * controllers integrate `velocityY -= gravityAcceleration * dt` and so expect a
28
+ * positive downward magnitude. Negating here is what keeps a down-pointing
29
+ * gravity pulling the player *down*; passing the signed value straight through
30
+ * flipped the sign and launched airborne players upward instead.
31
+ */
32
+ export declare function resolvePhysicsTuning(physics: PhysicsConfig | undefined): MovementTuningOverrides | undefined;
33
+ /** True when the world is an environment feature with terrain, so the voxel controller should sample its height. */
34
+ export declare function hasEnvironmentTerrain(world: WorldFeature | undefined): boolean;
35
+ export declare function GamePlayerShell({ playable, multiplayer: rawMultiplayer, }: {
4
36
  playable: PlayableGame;
5
37
  multiplayer?: ShellMultiplayer | null;
6
38
  }): import("react").JSX.Element;