@jgengine/shell 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -2
- package/LICENSE +203 -661
- package/README.md +1 -1
- package/dist/CombatPresentation.d.ts +5 -0
- package/dist/CombatPresentation.js +8 -0
- package/dist/GameHost.d.ts +25 -1
- package/dist/GameHost.js +60 -4
- package/dist/GamePhaseStamp.d.ts +1 -0
- package/dist/GamePhaseStamp.js +9 -0
- package/dist/GamePlayer.d.ts +5 -0
- package/dist/GamePlayer.js +5 -0
- package/dist/GamePlayerShell.d.ts +5 -12
- package/dist/GamePlayerShell.js +67 -1332
- package/dist/GameUiPreview.js +3 -2
- package/dist/Shell3dPresentation.d.ts +63 -0
- package/dist/Shell3dPresentation.js +302 -0
- package/dist/ShellChrome.d.ts +51 -0
- package/dist/ShellChrome.js +51 -0
- package/dist/ShellHudPresentation.d.ts +41 -0
- package/dist/ShellHudPresentation.js +22 -0
- package/dist/audio/audioEngine.d.ts +4 -0
- package/dist/audio/audioEngine.js +128 -21
- package/dist/audio/audioWire.d.ts +40 -0
- package/dist/audio/audioWire.js +62 -0
- package/dist/audio/loopParams.d.ts +20 -0
- package/dist/audio/loopParams.js +28 -0
- package/dist/behaviour.d.ts +2 -1
- package/dist/behaviour.js +2 -1
- package/dist/behaviourAttach.d.ts +1 -0
- package/dist/behaviourAttach.js +1 -0
- package/dist/behaviourDriver.d.ts +1 -0
- package/dist/behaviourDriver.js +1 -0
- package/dist/boundActionDispatch.d.ts +13 -0
- package/dist/boundActionDispatch.js +37 -0
- package/dist/camera/GameCameraRig.d.ts +5 -2
- package/dist/camera/GameCameraRig.js +8 -3
- package/dist/camera/GameFirstPersonCamera.d.ts +9 -2
- package/dist/camera/GameFirstPersonCamera.js +8 -3
- package/dist/camera/GameInspectionCamera.d.ts +1 -1
- package/dist/camera/GameInspectionCamera.js +2 -2
- package/dist/camera/GameOrbitCamera.js +24 -9
- package/dist/camera/cameraBlendMath.d.ts +3 -0
- package/dist/camera/cameraBlendMath.js +3 -0
- package/dist/camera/cameraRigs.d.ts +3 -1
- package/dist/camera/cameraRigs.js +21 -3
- package/dist/camera/fovPreference.d.ts +6 -1
- package/dist/camera/fovPreference.js +6 -1
- package/dist/camera/index.d.ts +4 -7
- package/dist/camera/index.js +4 -7
- package/dist/camera/inspectionCameraMath.d.ts +7 -2
- package/dist/camera/inspectionCameraMath.js +7 -2
- package/dist/camera/orbitCameraMath.d.ts +36 -6
- package/dist/camera/orbitCameraMath.js +56 -6
- package/dist/camera/rigMath.d.ts +114 -24
- package/dist/camera/rigMath.js +129 -24
- package/dist/camera/rigResolve.d.ts +4 -2
- package/dist/camera/rigResolve.js +4 -2
- package/dist/camera/shakeChannel.d.ts +6 -2
- package/dist/camera/shakeChannel.js +6 -2
- package/dist/camera/shakeChannelMath.d.ts +1 -0
- package/dist/camera/shakeChannelMath.js +1 -0
- package/dist/commandSink.d.ts +8 -3
- package/dist/commandSink.js +8 -3
- package/dist/defineGame.d.ts +15 -1
- package/dist/defineGame.js +50 -9
- package/dist/devtools/ColPanel.d.ts +1 -0
- package/dist/devtools/ColPanel.js +14 -0
- package/dist/devtools/DevtoolsOverlay.d.ts +11 -7
- package/dist/devtools/DevtoolsOverlay.js +47 -462
- package/dist/devtools/KeysPanel.d.ts +4 -0
- package/dist/devtools/KeysPanel.js +31 -0
- package/dist/devtools/LogsPanel.d.ts +1 -0
- package/dist/devtools/LogsPanel.js +12 -0
- package/dist/devtools/NetPanel.d.ts +4 -0
- package/dist/devtools/NetPanel.js +10 -0
- package/dist/devtools/PerfPanel.d.ts +4 -0
- package/dist/devtools/PerfPanel.js +53 -0
- package/dist/devtools/TunePanel.d.ts +3 -0
- package/dist/devtools/TunePanel.js +309 -0
- package/dist/devtools/agentBridge.d.ts +41 -0
- package/dist/devtools/agentBridge.js +266 -0
- package/dist/devtools/collisionDebug.d.ts +6 -0
- package/dist/devtools/collisionDebug.js +6 -0
- package/dist/devtools/collisionDebugMath.d.ts +8 -2
- package/dist/devtools/collisionDebugMath.js +24 -5
- package/dist/devtools/devtoolsOverrides.d.ts +6 -0
- package/dist/devtools/devtoolsOverrides.js +48 -0
- package/dist/devtools/panelAtoms.d.ts +9 -0
- package/dist/devtools/panelAtoms.js +10 -0
- package/dist/devtools/perfDiagnose.d.ts +2 -0
- package/dist/devtools/perfDiagnose.js +43 -0
- package/dist/diagnostics/RuntimeDiagnostics.d.ts +36 -0
- package/dist/diagnostics/RuntimeDiagnostics.js +80 -0
- package/dist/drivers/FrameDriver.d.ts +37 -0
- package/dist/drivers/FrameDriver.js +232 -0
- package/dist/drivers/HudOnlyDriver.d.ts +16 -0
- package/dist/drivers/HudOnlyDriver.js +60 -0
- package/dist/environment/Daylight.d.ts +23 -7
- package/dist/environment/Daylight.js +106 -13
- package/dist/environment/EnvironmentScene.js +44 -9
- package/dist/environment/VolumetricClouds.d.ts +17 -0
- package/dist/environment/VolumetricClouds.js +202 -0
- package/dist/environment/daylightCycle.d.ts +3 -1
- package/dist/environment/daylightCycle.js +3 -1
- package/dist/environment/groundPadMath.d.ts +3 -0
- package/dist/environment/groundPadMath.js +3 -0
- package/dist/environment/index.d.ts +1 -0
- package/dist/environment/index.js +1 -0
- package/dist/environment/skyLightingPolicy.d.ts +2 -0
- package/dist/environment/skyLightingPolicy.js +2 -0
- package/dist/environment/terrainGroundColor.d.ts +9 -0
- package/dist/environment/terrainGroundColor.js +22 -0
- package/dist/gameKit.d.ts +27 -0
- package/dist/gameKit.js +29 -0
- package/dist/hotbarActions.d.ts +26 -0
- package/dist/hotbarActions.js +27 -0
- package/dist/inputSink.d.ts +16 -4
- package/dist/inputSink.js +57 -7
- package/dist/map/MapMarkerBeacons.d.ts +3 -2
- package/dist/materialOverride.d.ts +10 -0
- package/dist/materialOverride.js +15 -3
- package/dist/multiplayer.js +8 -2
- package/dist/postfx/PostProcessing.d.ts +9 -1
- package/dist/postfx/PostProcessing.js +56 -11
- package/dist/postfx/gradeShader.js +9 -1
- package/dist/presentationResolve.d.ts +35 -0
- package/dist/presentationResolve.js +51 -0
- package/dist/registry.d.ts +4 -2
- package/dist/render/EnvironmentLighting.d.ts +10 -0
- package/dist/render/EnvironmentLighting.js +34 -0
- package/dist/render/SceneLighting.d.ts +7 -0
- package/dist/render/SceneLighting.js +18 -0
- package/dist/render/SceneModels.d.ts +14 -0
- package/dist/render/SceneModels.js +337 -0
- package/dist/render/assetBase.d.ts +17 -0
- package/dist/render/assetBase.js +35 -0
- package/dist/render/defaultSurface.d.ts +29 -0
- package/dist/render/defaultSurface.js +101 -0
- package/dist/render/modelLoad.d.ts +24 -0
- package/dist/render/modelLoad.js +76 -0
- package/dist/render/modelRender.d.ts +11 -0
- package/dist/render/modelRender.js +15 -0
- package/dist/render/resolveModel.d.ts +54 -3
- package/dist/render/resolveModel.js +116 -4
- package/dist/render/useEntityRenderCues.d.ts +13 -0
- package/dist/render/useEntityRenderCues.js +62 -0
- package/dist/scatter/InstancedScatter.d.ts +24 -0
- package/dist/scatter/InstancedScatter.js +135 -0
- package/dist/scatter/scatterModels.d.ts +25 -0
- package/dist/scatter/scatterModels.js +61 -0
- package/dist/scatter/scatterProxies.d.ts +6 -0
- package/dist/scatter/scatterProxies.js +118 -0
- package/dist/scatter.d.ts +1 -0
- package/dist/scatter.js +1 -0
- package/dist/scene/AuthoredScene.d.ts +84 -0
- package/dist/scene/AuthoredScene.js +178 -0
- package/dist/scene/CityRenderer.d.ts +2 -0
- package/dist/scene/CityRenderer.js +1031 -0
- package/dist/scene/GeneratedAssetRenderer.d.ts +14 -0
- package/dist/scene/GeneratedAssetRenderer.js +59 -0
- package/dist/scene/GrassFieldRenderer.d.ts +2 -0
- package/dist/scene/GrassFieldRenderer.js +73 -0
- package/dist/scene/PoleLineRenderer.d.ts +2 -0
- package/dist/scene/PoleLineRenderer.js +287 -0
- package/dist/scene/SoilPatchRenderer.d.ts +2 -0
- package/dist/scene/SoilPatchRenderer.js +84 -0
- package/dist/scene/StudioStage.d.ts +37 -0
- package/dist/scene/StudioStage.js +42 -0
- package/dist/scene/WaterRenderer.d.ts +2 -0
- package/dist/scene/WaterRenderer.js +61 -0
- package/dist/scene/builtinSceneKindRenderers.d.ts +2 -0
- package/dist/scene/builtinSceneKindRenderers.js +26 -0
- package/dist/scene/cityWindowMaterial.d.ts +16 -0
- package/dist/scene/cityWindowMaterial.js +81 -0
- package/dist/scene/sceneKindRenderers.d.ts +30 -0
- package/dist/scene/sceneKindRenderers.js +17 -0
- package/dist/scene.d.ts +1 -0
- package/dist/scene.js +1 -0
- package/dist/settings/appliedSettings.d.ts +7 -1
- package/dist/settings/appliedSettings.js +13 -2
- package/dist/settings/settingsController.d.ts +2 -0
- package/dist/settings/settingsController.js +22 -1
- package/dist/shellConstants.d.ts +4 -0
- package/dist/shellConstants.js +4 -0
- package/dist/shellMovement.d.ts +8 -0
- package/dist/shellMovement.js +11 -0
- package/dist/shellPointer.d.ts +20 -0
- package/dist/shellPointer.js +28 -0
- package/dist/structures/PlacementGhost.d.ts +4 -0
- package/dist/structures/PlacementGhost.js +4 -0
- package/dist/structures/TransformGizmo.d.ts +53 -0
- package/dist/structures/TransformGizmo.js +59 -0
- package/dist/structures/index.d.ts +1 -0
- package/dist/structures/index.js +1 -0
- package/dist/terrain/GrassField.d.ts +11 -3
- package/dist/terrain/GrassField.js +16 -6
- package/dist/terrain/TerraformBrushCursor.js +3 -0
- package/dist/terrain/grassBudget.d.ts +11 -2
- package/dist/terrain/grassBudget.js +20 -4
- package/dist/terrain/grassGeometry.d.ts +35 -0
- package/dist/terrain/grassGeometry.js +85 -20
- package/dist/terrain/grassMaterial.d.ts +20 -0
- package/dist/terrain/grassMaterial.js +68 -13
- package/dist/terrain/heightfieldGeometry.d.ts +34 -0
- package/dist/terrain/heightfieldGeometry.js +109 -0
- package/dist/terrain/index.d.ts +1 -0
- package/dist/terrain/index.js +1 -0
- package/dist/terrain/random.d.ts +3 -0
- package/dist/terrain/random.js +3 -0
- package/dist/terrain/soilPatchMaterial.d.ts +23 -0
- package/dist/terrain/soilPatchMaterial.js +147 -0
- package/dist/terrain/terrainDetailMaterial.d.ts +19 -2
- package/dist/terrain/terrainDetailMaterial.js +87 -7
- package/dist/terrain/terrainMath.d.ts +8 -1
- package/dist/terrain/terrainMath.js +8 -1
- package/dist/touch/TouchControlsOverlay.d.ts +9 -5
- package/dist/touch/TouchControlsOverlay.js +201 -22
- package/dist/useShellMultiplayerSync.d.ts +9 -0
- package/dist/useShellMultiplayerSync.js +98 -0
- package/dist/visibility/CullingProvider.js +1 -1
- package/dist/water/Ocean.d.ts +7 -1
- package/dist/water/Ocean.js +16 -3
- package/dist/water/OceanConfig.d.ts +11 -0
- package/dist/water/OceanConfig.js +8 -0
- package/dist/water/OceanMaterial.d.ts +12 -0
- package/dist/water/OceanMaterial.js +9 -0
- package/dist/water/OceanShader.d.ts +2 -2
- package/dist/water/OceanShader.js +78 -10
- package/dist/weather/fireSpreadPose.d.ts +1 -0
- package/dist/weather/fireSpreadPose.js +1 -0
- package/dist/weather/weatherGeometry.d.ts +1 -0
- package/dist/weather/weatherGeometry.js +1 -0
- package/dist/weather/weatherMath.d.ts +3 -0
- package/dist/weather/weatherMath.js +3 -0
- package/dist/weather/weatherUniforms.d.ts +3 -0
- package/dist/weather/weatherUniforms.js +3 -0
- package/dist/world/PlaceScene.d.ts +11 -0
- package/dist/world/PlaceScene.js +27 -0
- package/dist/world/RetainedVfx.d.ts +10 -0
- package/dist/world/RetainedVfx.js +136 -0
- package/dist/world/WorldHud.d.ts +49 -2
- package/dist/world/WorldHud.js +87 -2
- package/dist/world/WorldScene.d.ts +21 -0
- package/dist/world/WorldScene.js +186 -0
- package/dist/world/WorldVfx.d.ts +9 -0
- package/dist/world/WorldVfx.js +184 -0
- package/dist/world/entityPose.d.ts +2 -0
- package/dist/world/entityPose.js +2 -0
- package/dist/world/floatTextStyle.d.ts +1 -0
- package/dist/world/floatTextStyle.js +1 -0
- package/dist/world/telegraphPulse.d.ts +1 -0
- package/dist/world/telegraphPulse.js +1 -0
- package/dist/world/worldBarSamples.d.ts +25 -0
- package/dist/world/worldBarSamples.js +38 -0
- package/dist/worldSky.d.ts +11 -0
- package/dist/worldSky.js +21 -0
- package/dist/worldSync.d.ts +2 -1
- package/dist/worldSync.js +2 -1
- package/package.json +6 -6
- package/skills/game-design/SKILL.md +28 -0
- package/skills/game-design/agents/openai.yaml +4 -0
- package/skills/game-design/references/application-playbook.md +170 -0
- package/skills/game-design/references/field-guide.md +288 -0
- package/skills/jgengine/SKILL.md +54 -0
- package/skills/jgengine/api.md +527 -0
- package/skills/jgengine/capabilities.md +131 -0
- package/skills/jgengine/recipes/minimal-game.md +88 -0
- package/skills/jgengine-ui/SKILL.md +41 -0
- package/skills/jgengine-ui/api.md +2007 -0
- package/skills/jgengine-ui/capabilities.md +211 -0
- package/skills/jgengine-ui/recipes/portable-minimap.md +150 -0
- package/skills/jgengine-ui/reference.md +513 -0
- package/skills/jgengine-ui/references/visual-scorecard.md +73 -0
- package/skills/jgengine-world/SKILL.md +51 -0
- package/skills/jgengine-world/api.md +3056 -0
- package/skills/jgengine-world/capabilities.md +476 -0
- package/skills/jgengine-world/recipes/commanding-entities.md +128 -0
- package/skills/jgengine-world/reference.md +261 -0
- package/skills/level-design/SKILL.md +54 -0
- package/skills/level-design/agents/openai.yaml +4 -0
- package/skills/level-design/references/application-playbook.md +192 -0
- package/skills/level-design/references/field-guide.md +337 -0
- package/skills/level-design/references/live-editor-loop.md +179 -0
- package/dist/cartridge.d.ts +0 -145
- package/dist/cartridge.js +0 -246
- package/llms.txt +0 -2761
package/dist/commandSink.d.ts
CHANGED
|
@@ -4,15 +4,20 @@ import type { LiveGameBackend } from "@jgengine/core/runtime/transport";
|
|
|
4
4
|
export interface CommandSink {
|
|
5
5
|
run(name: string, input: unknown): void;
|
|
6
6
|
}
|
|
7
|
-
/** Runs commands on the local `ctx` — the default, client-authoritative path.
|
|
7
|
+
/** Runs commands on the local `ctx` — the default, client-authoritative path.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
8
10
|
export declare function localCommandSink(ctx: GameContext): CommandSink;
|
|
9
|
-
/** Sends commands to the authoritative host over the transport; the result replicates back through world sync.
|
|
11
|
+
/** Sends commands to the authoritative host over the transport; the result replicates back through world sync.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
10
14
|
export declare function remoteCommandSink(backend: Pick<LiveGameBackend, "transport">, serverId: string): CommandSink;
|
|
11
15
|
/**
|
|
12
16
|
* The sink a server-authoritative shell should dispatch gameplay commands through: remote when the game opts into
|
|
13
17
|
* `authority: "server"` and a server is joined, local otherwise. Client-only UI commands (targeting, hotbar
|
|
14
18
|
* scroll) keep calling `ctx.game.commands.run` directly — only authoritative gameplay verbs route to the host.
|
|
15
|
-
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
16
21
|
export declare function resolveCommandSink(ctx: GameContext, opts: {
|
|
17
22
|
serverAuthoritative: boolean;
|
|
18
23
|
backend: Pick<LiveGameBackend, "transport"> | null;
|
package/dist/commandSink.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
/** Runs commands on the local `ctx` — the default, client-authoritative path.
|
|
1
|
+
/** Runs commands on the local `ctx` — the default, client-authoritative path.
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
2
4
|
export function localCommandSink(ctx) {
|
|
3
5
|
return {
|
|
4
6
|
run(name, input) {
|
|
@@ -6,7 +8,9 @@ export function localCommandSink(ctx) {
|
|
|
6
8
|
},
|
|
7
9
|
};
|
|
8
10
|
}
|
|
9
|
-
/** Sends commands to the authoritative host over the transport; the result replicates back through world sync.
|
|
11
|
+
/** Sends commands to the authoritative host over the transport; the result replicates back through world sync.
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
10
14
|
export function remoteCommandSink(backend, serverId) {
|
|
11
15
|
return {
|
|
12
16
|
run(name, input) {
|
|
@@ -18,7 +22,8 @@ export function remoteCommandSink(backend, serverId) {
|
|
|
18
22
|
* The sink a server-authoritative shell should dispatch gameplay commands through: remote when the game opts into
|
|
19
23
|
* `authority: "server"` and a server is joined, local otherwise. Client-only UI commands (targeting, hotbar
|
|
20
24
|
* scroll) keep calling `ctx.game.commands.run` directly — only authoritative gameplay verbs route to the host.
|
|
21
|
-
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
22
27
|
export function resolveCommandSink(ctx, opts) {
|
|
23
28
|
if (opts.serverAuthoritative && opts.backend !== null && opts.serverId !== null) {
|
|
24
29
|
return remoteCommandSink(opts.backend, opts.serverId);
|
package/dist/defineGame.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentType } from "react";
|
|
2
2
|
import { type GameDefinitionConfig, type GameLoop } from "@jgengine/core/game/defineGame";
|
|
3
3
|
import type { GameContext, GameContextContent } from "@jgengine/core/runtime/gameContext";
|
|
4
4
|
import type { ModelAssetRef } from "@jgengine/core/scene/assetCatalog";
|
|
5
|
+
import type { ModelConfig } from "@jgengine/core/game/playableGame";
|
|
5
6
|
import type { PlayableGame } from "./registry.js";
|
|
6
7
|
type EngineFields<TAssetRef extends ModelAssetRef> = Omit<GameDefinitionConfig<TAssetRef>, "loop" | "ui" | "multiplayer"> & {
|
|
7
8
|
multiplayer?: GameDefinitionConfig<TAssetRef>["multiplayer"];
|
|
@@ -10,7 +11,20 @@ type PresentationFields = Omit<PlayableGame, "game" | "content" | "loop" | "Game
|
|
|
10
11
|
content?: GameContextContent;
|
|
11
12
|
loop?: Partial<GameLoop<GameContext>>;
|
|
12
13
|
GameUI?: ComponentType;
|
|
14
|
+
/** Tunes how the auto-mounted `AuthoredScene` places the document's catalog-id markers into the object store. Default `true`; pass `false` when the game spawns its placed content as entities itself (`placeAuthoredObjects`) to avoid a double render. */
|
|
15
|
+
scenePlacement?: boolean | {
|
|
16
|
+
verticalOffset?: number;
|
|
17
|
+
};
|
|
18
|
+
/** GLB models for the auto-mounted scene's scatter palette items, keyed by palette item id; string ids resolve through the game's asset catalog. Unmatched items keep the built-in proxy meshes. */
|
|
19
|
+
sceneScatterModels?: Record<string, string | ModelConfig>;
|
|
13
20
|
};
|
|
14
21
|
export type GameConfig<TAssetRef extends ModelAssetRef = ModelAssetRef> = EngineFields<TAssetRef> & PresentationFields;
|
|
22
|
+
/**
|
|
23
|
+
* The one public authoring entry point: compose engine fields (systems, world, physics, input) and
|
|
24
|
+
* presentation fields (camera, HUD, audio, authored scene) into a `PlayableGame` ready for `GameHost`.
|
|
25
|
+
* Defaults to solo/offline multiplayer; `editorLayers` auto-mounts the authored scene document.
|
|
26
|
+
*
|
|
27
|
+
* @capability define-game single public game-authoring path — compose systems, world, presentation, and authored scene in one definition
|
|
28
|
+
*/
|
|
15
29
|
export declare function defineGame<TAssetRef extends ModelAssetRef = ModelAssetRef>(config: GameConfig<TAssetRef>): PlayableGame;
|
|
16
30
|
export {};
|
package/dist/defineGame.js
CHANGED
|
@@ -1,31 +1,67 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { defineGameDefinition as defineEngineGame, } from "@jgengine/core/game/defineGame";
|
|
4
|
+
import { syncLifecyclePhase } from "@jgengine/core/game/gamePhase";
|
|
3
5
|
import { offline } from "@jgengine/core/runtime/adapter";
|
|
4
6
|
import { EnvironmentScene } from "./environment.js";
|
|
7
|
+
import { terrainGroundColorSampler } from "./environment/terrainGroundColor.js";
|
|
8
|
+
import { AuthoredScene } from "./scene/AuthoredScene.js";
|
|
5
9
|
const noop = () => { };
|
|
6
10
|
function worldBackdrop(feature) {
|
|
7
11
|
return function WorldBackdrop() {
|
|
8
12
|
return _jsx(EnvironmentScene, { feature: feature });
|
|
9
13
|
};
|
|
10
14
|
}
|
|
15
|
+
function authoredSceneOverlay(document, placement, scatterModels, assets, world, Vfx) {
|
|
16
|
+
const terrain = world !== undefined && world.kind === "environment" ? world.terrain : undefined;
|
|
17
|
+
return function AuthoredSceneOverlay(props) {
|
|
18
|
+
const groundColorAt = useMemo(() => terrainGroundColorSampler(terrain, props.ctx.world.ground), [props.ctx.world.ground]);
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx(AuthoredScene, { document: document, field: props.ctx.world.ground, placeObjects: placement, ...(scatterModels === undefined ? {} : { scatterModels, assets }), ...(groundColorAt === undefined ? {} : { groundColorAt }) }), Vfx === undefined ? null : _jsx(Vfx, { ...props })] }));
|
|
20
|
+
};
|
|
21
|
+
}
|
|
11
22
|
const emptyUi = () => null;
|
|
23
|
+
/**
|
|
24
|
+
* The one public authoring entry point: compose engine fields (systems, world, physics, input) and
|
|
25
|
+
* presentation fields (camera, HUD, audio, authored scene) into a `PlayableGame` ready for `GameHost`.
|
|
26
|
+
* Defaults to solo/offline multiplayer; `editorLayers` auto-mounts the authored scene document.
|
|
27
|
+
*
|
|
28
|
+
* @capability define-game single public game-authoring path — compose systems, world, presentation, and authored scene in one definition
|
|
29
|
+
*/
|
|
12
30
|
export function defineGame(config) {
|
|
13
|
-
const { content, loop, GameUI, environment, camera, multiplayer, WorldOverlay, renderEntity, renderObject, entitySprites, entityModels, objectModels, hotbarSelection, prompts, pointer, touch, orientation, worldHealthBars, audio, entitySounds, objectSounds, worldItem, collision, movement, lighting, backdrop, postProcessing, shadows, presentation, objectStyles, devtools, ...engineFields } = config;
|
|
14
|
-
const game = defineEngineGame({
|
|
31
|
+
const { content, loop, GameUI, environment, camera, multiplayer, editorLayers, editorCatalogs, scenePlacement, sceneScatterModels, WorldOverlay, viewmodel, renderEntity, renderObject, entitySprites, entityModels, objectModels, hotbarSelection, prompts, pointer, touch, orientation, worldHealthBars, nameplates, presentationEffects, audio, entitySounds, objectSounds, worldItem, collision, movement, lighting, backdrop, postProcessing, shadows, presentation, objectStyles, devtools, capture, platforms, hudFit, ...engineFields } = config;
|
|
32
|
+
const game = defineEngineGame({
|
|
33
|
+
...engineFields,
|
|
34
|
+
multiplayer: multiplayer ?? offline(),
|
|
35
|
+
loop,
|
|
36
|
+
});
|
|
37
|
+
function withPhaseSync(inner) {
|
|
38
|
+
return (ctx, ...args) => {
|
|
39
|
+
inner?.(ctx, ...args);
|
|
40
|
+
syncLifecyclePhase(ctx, game.lifecycle);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
const composed = game.loop;
|
|
15
44
|
return {
|
|
16
45
|
game,
|
|
17
46
|
content: content ?? {},
|
|
18
47
|
loop: {
|
|
19
|
-
onInit:
|
|
20
|
-
onNewPlayer:
|
|
21
|
-
onTick:
|
|
22
|
-
onPlayerLeave:
|
|
48
|
+
onInit: withPhaseSync(composed?.onInit),
|
|
49
|
+
onNewPlayer: withPhaseSync(composed?.onNewPlayer),
|
|
50
|
+
onTick: withPhaseSync(composed?.onTick),
|
|
51
|
+
onPlayerLeave: composed?.onPlayerLeave ?? noop,
|
|
52
|
+
onReset: composed?.onReset?.bind(composed) ?? noop,
|
|
53
|
+
onDispose: composed?.onDispose?.bind(composed) ?? noop,
|
|
23
54
|
},
|
|
24
55
|
GameUI: GameUI ?? emptyUi,
|
|
25
56
|
environment: environment ??
|
|
26
57
|
(game.world?.kind === "environment" ? worldBackdrop(game.world) : undefined),
|
|
27
58
|
camera: camera ?? { perspective: "third" },
|
|
28
|
-
|
|
59
|
+
editorLayers,
|
|
60
|
+
editorCatalogs,
|
|
61
|
+
WorldOverlay: editorLayers === undefined
|
|
62
|
+
? WorldOverlay
|
|
63
|
+
: authoredSceneOverlay(editorLayers, scenePlacement ?? true, sceneScatterModels, game.assets, game.world, WorldOverlay),
|
|
64
|
+
viewmodel,
|
|
29
65
|
renderEntity,
|
|
30
66
|
renderObject,
|
|
31
67
|
entitySprites,
|
|
@@ -37,6 +73,8 @@ export function defineGame(config) {
|
|
|
37
73
|
touch,
|
|
38
74
|
orientation,
|
|
39
75
|
worldHealthBars,
|
|
76
|
+
nameplates,
|
|
77
|
+
presentationEffects,
|
|
40
78
|
audio,
|
|
41
79
|
entitySounds,
|
|
42
80
|
objectSounds,
|
|
@@ -50,5 +88,8 @@ export function defineGame(config) {
|
|
|
50
88
|
presentation,
|
|
51
89
|
objectStyles,
|
|
52
90
|
devtools,
|
|
91
|
+
capture,
|
|
92
|
+
platforms,
|
|
93
|
+
hudFit,
|
|
53
94
|
};
|
|
54
95
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ColPanel(): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
import { COLLISION_DEBUG_LAYERS, collisionDebug } from "./collisionDebug.js";
|
|
4
|
+
const LAYER_LABELS = {
|
|
5
|
+
hitboxes: "Damage hitboxes",
|
|
6
|
+
bodies: "Physical bodies",
|
|
7
|
+
projectiles: "Projectile paths",
|
|
8
|
+
muzzles: "Muzzle / shot origins",
|
|
9
|
+
aimLaser: "Aim laser (authoritative)",
|
|
10
|
+
};
|
|
11
|
+
export function ColPanel() {
|
|
12
|
+
const state = useSyncExternalStore(collisionDebug.subscribe, () => collisionDebug.getState(), () => collisionDebug.getState());
|
|
13
|
+
return (_jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "text-[10px] text-neutral-500", children: "F2+D world collision debugger \u00B7 layers stay on when panel closes \u00B7 zero cost when all off" }), _jsxs("div", { className: "flex gap-1", children: [_jsx("button", { type: "button", className: "rounded-md bg-white/[0.04] px-2 py-0.5 text-neutral-300 ring-1 ring-inset ring-white/[0.08] transition-colors hover:bg-white/10", onClick: () => collisionDebug.setAllLayers(true), children: "All on" }), _jsx("button", { type: "button", className: "rounded-md bg-white/[0.04] px-2 py-0.5 text-neutral-300 ring-1 ring-inset ring-white/[0.08] transition-colors hover:bg-white/10", onClick: () => collisionDebug.setAllLayers(false), children: "All off" })] }), _jsx("div", { className: "space-y-1", children: COLLISION_DEBUG_LAYERS.map((layer) => (_jsxs("label", { className: "flex cursor-pointer items-center gap-2 text-neutral-200", children: [_jsx("input", { type: "checkbox", checked: state.layers[layer], onChange: (event) => collisionDebug.setLayer(layer, event.target.checked) }), _jsx("span", { children: LAYER_LABELS[layer] })] }, layer))) }), _jsx("div", { className: "border-t border-neutral-800 pt-1.5 font-mono text-[9px] text-neutral-500", children: "hitbox pink \u00B7 body cyan \u00B7 muzzle red \u00B7 laser lime \u00B7 X damage \u00B7 \u25CB solid \u00B7 \u00B7 miss" })] }));
|
|
14
|
+
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type DevtoolsSnapshot } from "@jgengine/core/devtools/devtools";
|
|
2
2
|
import type { GameContext } from "@jgengine/core/runtime/gameContext";
|
|
3
3
|
import type { ShellMultiplayer } from "../multiplayer.js";
|
|
4
4
|
import type { PlayableGame } from "../registry.js";
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export { applyStoredDevtoolsOverrides, persistDevtoolsOverrides } from "./devtoolsOverrides.js";
|
|
6
|
+
/** @internal */
|
|
7
7
|
export declare function withDevtoolsLatency(multiplayer: ShellMultiplayer): ShellMultiplayer;
|
|
8
|
+
/** @internal */
|
|
8
9
|
export declare function DevtoolsRendererProbe(): null;
|
|
10
|
+
/** @internal */
|
|
9
11
|
export declare function buildLeanReport(playable: PlayableGame): {
|
|
10
12
|
game: string;
|
|
11
13
|
at: number;
|
|
@@ -28,8 +30,8 @@ export declare function buildLeanReport(playable: PlayableGame): {
|
|
|
28
30
|
pctOfSim: number;
|
|
29
31
|
}[];
|
|
30
32
|
} | null;
|
|
31
|
-
render: import("@jgengine/core/devtools/
|
|
32
|
-
latency: import("@jgengine/core/devtools/
|
|
33
|
+
render: import("@jgengine/core/devtools/types").RenderSample | null;
|
|
34
|
+
latency: import("@jgengine/core/devtools/types").LatencyStats | null;
|
|
33
35
|
longFrameSummary: {
|
|
34
36
|
count: number;
|
|
35
37
|
culprits: {
|
|
@@ -52,10 +54,10 @@ export declare function buildLeanReport(playable: PlayableGame): {
|
|
|
52
54
|
ms: number;
|
|
53
55
|
}[];
|
|
54
56
|
probes: Record<string, unknown>;
|
|
55
|
-
render: import("@jgengine/core/devtools/
|
|
57
|
+
render: import("@jgengine/core/devtools/types").RenderSample | null;
|
|
56
58
|
}[];
|
|
57
59
|
probes: Record<string, unknown>;
|
|
58
|
-
logs: import("@jgengine/core/devtools/
|
|
60
|
+
logs: import("@jgengine/core/devtools/types").DevtoolsLogEntry[] | undefined;
|
|
59
61
|
controls: {
|
|
60
62
|
name: string;
|
|
61
63
|
value: unknown;
|
|
@@ -67,9 +69,11 @@ export declare function buildLeanReport(playable: PlayableGame): {
|
|
|
67
69
|
}[] | undefined;
|
|
68
70
|
discoveredCount: number;
|
|
69
71
|
};
|
|
72
|
+
/** @internal */
|
|
70
73
|
export declare function buildFullReport(playable: PlayableGame): DevtoolsSnapshot & {
|
|
71
74
|
game: string;
|
|
72
75
|
};
|
|
76
|
+
/** @internal */
|
|
73
77
|
export declare function DevtoolsOverlay({ open, ctx, playable, multiplayer, }: {
|
|
74
78
|
open: boolean;
|
|
75
79
|
ctx: GameContext;
|