threedog 0.5.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.
- package/CHANGELOG.md +276 -1
- package/README.md +18 -13
- package/core/{Animator.js → assets/Animator.js} +28 -18
- package/core/{Assets.js → assets/Assets.js} +116 -61
- package/core/{Baked.js → assets/Baked.js} +16 -25
- package/core/assets/assetEntry.js +237 -0
- package/core/{assetHot.js → assets/assetHot.js} +7 -6
- package/core/{assetLoad.js → assets/assetLoad.js} +66 -29
- package/core/assets/assetLod.js +113 -0
- package/core/{assetManifest.js → assets/assetManifest.js} +23 -12
- package/core/{assetReport.js → assets/assetReport.js} +9 -15
- package/core/{namedModel.js → assets/namedModel.js} +24 -16
- package/core/{Audio.js → audio/Audio.js} +27 -24
- package/core/{audioRules.js → audio/audioRules.js} +8 -5
- package/core/{audioVoice.js → audio/audioVoice.js} +17 -30
- package/core/{Events.js → base/Events.js} +3 -3
- package/core/{I18n.js → base/I18n.js} +10 -10
- package/core/{Random.js → base/Random.js} +5 -4
- package/core/{easing.js → base/easing.js} +1 -1
- package/core/{errorCodes.js → base/errorCodes.js} +154 -139
- package/core/{errorHints.js → base/errorHints.js} +9 -10
- package/core/{errors.js → base/errors.js} +9 -9
- package/core/{events.generated.js → base/events.generated.js} +2 -0
- package/core/{math.js → base/math.js} +22 -4
- package/core/{params.js → base/params.js} +3 -4
- package/core/base/util.js +32 -0
- package/core/{validate.js → base/validate.js} +29 -8
- package/core/{Engine.js → engine/Engine.js} +112 -105
- package/core/{Loading.js → engine/Loading.js} +4 -2
- package/core/{copies.js → engine/copies.js} +4 -4
- package/core/{headlessLoad.js → engine/headlessLoad.js} +4 -4
- package/core/{lifecycle.js → engine/lifecycle.js} +16 -16
- package/core/{loop.js → engine/loop.js} +80 -52
- package/core/{moduleSlots.js → engine/moduleSlots.js} +35 -10
- package/core/{moduleTypes.js → engine/moduleTypes.js} +30 -18
- package/core/{modules.js → engine/modules.js} +20 -17
- package/core/engine/page.js +125 -0
- package/core/{plugins.js → engine/plugins.js} +68 -103
- package/core/{services.js → engine/services.js} +47 -40
- package/core/{startup.js → engine/startup.js} +35 -35
- package/core/{Input.js → input/Input.js} +41 -27
- package/core/{inputContext.js → input/inputContext.js} +14 -5
- package/core/{inputPad.js → input/inputPad.js} +1 -1
- package/core/{inputPointer.js → input/inputPointer.js} +8 -2
- package/core/{inputTouch.js → input/inputTouch.js} +1 -1
- package/core/{Budget.js → inspect/Budget.js} +23 -22
- package/core/{DebugOverrides.js → inspect/DebugOverrides.js} +60 -31
- package/core/{Describe.js → inspect/Describe.js} +33 -30
- package/core/{Inspect.js → inspect/Inspect.js} +14 -9
- package/core/{InspectMaterials.js → inspect/InspectMaterials.js} +8 -10
- package/core/{InspectPerf.js → inspect/InspectPerf.js} +29 -16
- package/core/{InspectScene.js → inspect/InspectScene.js} +8 -5
- package/core/{MaterialInfo.js → inspect/MaterialInfo.js} +9 -6
- package/core/inspect/UrlState.js +182 -0
- package/core/{catalog.js → inspect/catalog.js} +18 -5
- package/core/{checks.js → inspect/checks.js} +7 -5
- package/core/{debugView.js → inspect/debugView.js} +8 -8
- package/core/inspect/describeRender.js +148 -0
- package/core/{describeText.js → inspect/describeText.js} +17 -12
- package/core/inspect/geometryWatch.js +38 -0
- package/core/{lightWatch.js → inspect/lightWatch.js} +11 -9
- package/core/inspect/pictureWriters.js +342 -0
- package/core/{shaderCost.js → inspect/shaderCost.js} +1 -1
- package/core/{Ops.js → ops/Ops.js} +16 -11
- package/core/{control.js → ops/control.js} +13 -12
- package/core/ops/holds.js +139 -0
- package/core/{opsAtomic.js → ops/opsAtomic.js} +2 -1
- package/core/{opsCheck.js → ops/opsCheck.js} +4 -5
- package/core/{opsGuard.js → ops/opsGuard.js} +3 -3
- package/core/{opsRun.js → ops/opsRun.js} +7 -4
- package/core/{owned.js → ops/owned.js} +37 -37
- package/core/{sharedPoint.js → ops/sharedPoint.js} +13 -27
- package/core/{stackFrames.js → ops/stackFrames.js} +17 -6
- package/core/{stacks.js → ops/stacks.js} +18 -20
- package/core/{wrap.js → ops/wrap.js} +8 -6
- package/core/{SaveStore.js → saves/SaveStore.js} +1 -1
- package/core/{Saves.js → saves/Saves.js} +58 -36
- package/core/{saveApply.js → saves/saveApply.js} +13 -9
- package/core/{saveFiles.js → saves/saveFiles.js} +17 -15
- package/core/{saveValues.js → saves/saveValues.js} +20 -3
- package/core/{saveVersions.js → saves/saveVersions.js} +4 -17
- package/core/{session.js → saves/session.js} +31 -17
- package/core/{Rays.js → scene/Rays.js} +27 -24
- package/core/{Views.js → scene/Views.js} +15 -6
- package/core/{adaptive.js → scene/adaptive.js} +15 -8
- package/core/{canvasBox.js → scene/canvasBox.js} +2 -3
- package/core/{engineCamera.js → scene/engineCamera.js} +1 -1
- package/core/{gameLights.js → scene/gameLights.js} +24 -7
- package/core/{grayMap.js → scene/grayMap.js} +8 -2
- package/core/{grid.js → scene/grid.js} +4 -4
- package/core/{gridLoad.js → scene/gridLoad.js} +1 -1
- package/core/{ground.js → scene/ground.js} +9 -9
- package/core/{movement.js → scene/movement.js} +3 -3
- package/core/scene/pictureSlots.js +33 -0
- package/core/{sceneDelta.js → scene/sceneDelta.js} +14 -6
- package/core/{sceneMethods.js → scene/sceneMethods.js} +36 -20
- package/core/scene/stepPoses.js +55 -0
- package/core/{targeting.js → scene/targeting.js} +4 -5
- package/core/{thingExplain.js → scene/thingExplain.js} +7 -6
- package/core/{thingOps.js → scene/thingOps.js} +4 -3
- package/core/{things.js → scene/things.js} +19 -6
- package/core/{threePatches.js → scene/threePatches.js} +1 -1
- package/core/{tier.js → scene/tier.js} +1 -1
- package/core/scene/view.js +44 -0
- package/core/{Batching.js → stream/Batching.js} +85 -27
- package/core/{Stream.js → stream/Stream.js} +62 -33
- package/core/{batchGroups.js → stream/batchGroups.js} +18 -9
- package/core/{chunkStream.js → stream/chunkStream.js} +41 -1
- package/core/{scatter.js → stream/scatter.js} +2 -2
- package/core/{streamSources.js → stream/streamSources.js} +12 -7
- package/core/{Commits.js → threads/Commits.js} +6 -5
- package/core/{Jobs.js → threads/Jobs.js} +12 -10
- package/core/{Threads.js → threads/Threads.js} +16 -16
- package/core/{threadPure.js → threads/threadPure.js} +7 -5
- package/core/{threadServe.js → threads/threadServe.js} +3 -3
- package/core/{Clock.js → time/Clock.js} +17 -10
- package/core/{dayTime.js → time/dayTime.js} +5 -1
- package/core/{skip.js → time/skip.js} +18 -17
- package/core/{time.js → time/time.js} +18 -12
- package/core/{uiClock.js → time/uiClock.js} +4 -4
- package/docs/AI.md +70 -63
- package/docs/API.md +30 -29
- package/docs/CODEMAP.md +98 -223
- package/docs/COMMANDS.md +80 -69
- package/docs/CONVENTIONS.md +87 -41
- package/docs/MIGRATING-0.7.md +39 -0
- package/docs/MIGRATING-0.8.md +169 -0
- package/docs/THREE.md +100 -49
- package/docs/api/assets.md +17 -16
- package/docs/api/audio.md +8 -7
- package/docs/api/budget.md +8 -4
- package/docs/api/calendar.md +10 -11
- package/docs/api/cameraRig.md +29 -29
- package/docs/api/characters.md +26 -19
- package/docs/api/clock.md +1 -1
- package/docs/api/collision.md +14 -11
- package/docs/api/content.md +6 -6
- package/docs/api/dialogue.md +3 -3
- package/docs/api/engine.md +82 -53
- package/docs/api/events.md +5 -3
- package/docs/api/flow.md +1 -1
- package/docs/api/grids.md +9 -2
- package/docs/api/ground.md +4 -5
- package/docs/api/hud.md +4 -1
- package/docs/api/i18n.md +6 -6
- package/docs/api/input.md +10 -9
- package/docs/api/interactions.md +6 -4
- package/docs/api/inventory.md +10 -11
- package/docs/api/jobs.md +5 -5
- package/docs/api/level.md +7 -8
- package/docs/api/lightPool.md +2 -7
- package/docs/api/music.md +3 -3
- package/docs/api/nav.md +10 -10
- package/docs/api/occlusion.md +5 -0
- package/docs/api/openWorld.md +1 -1
- package/docs/api/particles.md +8 -5
- package/docs/api/photo.md +4 -2
- package/docs/api/pickups.md +7 -1
- package/docs/api/post.md +24 -5
- package/docs/api/quests.md +3 -3
- package/docs/api/rays.md +5 -7
- package/docs/api/rigid.md +27 -18
- package/docs/api/saves.md +8 -7
- package/docs/api/settings.md +9 -8
- package/docs/api/sky.md +17 -14
- package/docs/api/stream.md +7 -7
- package/docs/api/swarm.md +34 -0
- package/docs/api/terrain.md +17 -12
- package/docs/api/terrainDraw.md +12 -0
- package/docs/api/timeline.md +2 -2
- package/docs/api/tools.md +30 -26
- package/docs/api/triggers.md +2 -0
- package/docs/api/vars.md +1 -1
- package/docs/api/vegetation.md +11 -5
- package/docs/api/vegetationDraw.md +10 -0
- package/docs/api/water.md +7 -3
- package/docs/api/weather.md +11 -6
- package/docs/api/weatherDraw.md +10 -0
- package/docs/api/world.md +6 -6
- package/docs/recipes/01-new-game.md +38 -57
- package/docs/recipes/02-npc.md +19 -20
- package/docs/recipes/03-items-pickups.md +47 -42
- package/docs/recipes/04-quests.md +3 -4
- package/docs/recipes/05-props-bake.md +72 -66
- package/docs/recipes/06-clock-events.md +30 -21
- package/docs/recipes/07-flow-scenes-pause.md +21 -17
- package/docs/recipes/08-weather-sky.md +117 -75
- package/docs/recipes/09-materials-lights-models.md +171 -0
- package/docs/recipes/10-blender-level.md +6 -7
- package/docs/recipes/11-vehicles.md +33 -25
- package/docs/recipes/12-navmesh.md +9 -8
- package/docs/recipes/13-animation.md +50 -22
- package/docs/recipes/14-custom-module.md +20 -17
- package/docs/recipes/15-perf.md +52 -29
- package/docs/recipes/16-dev-bridge.md +47 -57
- package/docs/recipes/18-world.md +45 -30
- package/docs/recipes/19-shooting-picking.md +11 -7
- package/docs/recipes/20-content-actions-save.md +36 -37
- package/docs/recipes/21-camera.md +41 -8
- package/docs/recipes/22-shop-gold.md +0 -4
- package/docs/recipes/23-ops.md +11 -11
- package/docs/recipes/26-ui-parts.md +56 -22
- package/docs/recipes/27-net.md +0 -2
- package/docs/recipes/28-terrain.md +126 -30
- package/docs/recipes/29-grid.md +16 -7
- package/docs/recipes/30-templates.md +62 -21
- package/docs/recipes/31-audio.md +9 -9
- package/docs/recipes/32-action-game.md +32 -9
- package/docs/recipes/33-stream-sources.md +2 -2
- package/docs/recipes/34-environment-lighting.md +164 -52
- package/docs/recipes/35-picture-from-reference.md +140 -0
- package/docs/recipes/36-ground-plants.md +105 -0
- package/docs/recipes/40-scene.md +105 -30
- package/docs/recipes/{43-shader-patches-surface-looks.md → 43-shader-patches-surfaces.md} +74 -106
- package/docs/recipes/44-water-weather-hooks.md +196 -0
- package/docs/recipes/45-cascaded-shadows.md +145 -25
- package/docs/recipes/46-blender-art-route.md +21 -25
- package/docs/recipes/49-game-module-contract.md +5 -5
- package/docs/recipes/50-own-renderer.md +3 -3
- package/docs/recipes/52-around-the-picture.md +137 -0
- package/docs/recipes/53-ground-up-close.md +65 -28
- package/docs/recipes/55-mods-time-wrap.md +25 -17
- package/docs/recipes/56-webgpu-tsl.md +73 -28
- package/docs/recipes/57-control.md +47 -1
- package/docs/recipes/58-input.md +3 -0
- package/docs/recipes/59-depth-post-effects.md +5 -5
- package/docs/recipes/60-judge-the-picture.md +47 -27
- package/docs/recipes/61-deploy.md +27 -0
- package/docs/recipes/62-picture-code.md +276 -0
- package/docs/recipes/63-third-person-start.md +90 -0
- package/docs/recipes/64-particles.md +35 -0
- package/docs/recipes/65-swarm.md +140 -0
- package/examples/action/.threedog/content-index.json +1 -1
- package/examples/action/GAMEMAP.md +9 -7
- package/examples/action/main.js +5 -4
- package/examples/action/models.js +12 -14
- package/examples/action/picture/index.js +13 -0
- package/examples/action/picture/lights.js +35 -0
- package/examples/action/picture/materials.js +8 -0
- package/examples/action/picture/palette.js +33 -0
- package/examples/perf-island/.threedog/content-index.json +1 -0
- package/examples/{sheepisland → perf-island}/GAMEMAP.md +18 -14
- package/examples/{sheepisland → perf-island}/assets.js +2 -2
- package/examples/{sheepisland → perf-island}/content/templates.js +1 -1
- package/examples/{sheepisland → perf-island}/content/vegetation.js +3 -1
- package/examples/{sheepisland → perf-island}/main.js +22 -16
- package/examples/{sheepisland/style → perf-island}/models.js +13 -24
- package/examples/{sheepisland → perf-island}/params.js +1 -1
- package/examples/perf-island/picture/index.js +20 -0
- package/examples/perf-island/picture/lights.js +34 -0
- package/examples/perf-island/picture/materials.js +61 -0
- package/examples/perf-island/picture/palette.js +60 -0
- package/examples/perf-island/picture/sky.js +20 -0
- package/examples/{sheepisland → perf-island}/views.js +1 -1
- package/examples/plain-picture/.threedog/content-index.json +1 -0
- package/examples/plain-picture/GAMEMAP.md +91 -0
- package/examples/plain-picture/main.js +48 -0
- package/examples/plain-picture/picture/index.js +21 -0
- package/examples/plain-picture/picture/lights.js +54 -0
- package/examples/plain-picture/picture/materials.js +24 -0
- package/examples/plain-picture/picture/palette.js +16 -0
- package/examples/plain-picture/picture/sky.js +37 -0
- package/examples/pullable.json +31 -9
- package/examples/rc2d/GAMEMAP.md +10 -4
- package/examples/rc2d/README.md +11 -6
- package/examples/rc2d/main.js +26 -36
- package/examples/rc2d/picture/index.js +18 -0
- package/examples/rc2d/picture/lights.js +11 -0
- package/examples/rc2d/picture/materials.js +18 -0
- package/examples/rc2d/picture/palette.js +15 -0
- package/examples/rc2d/picture/post.js +11 -0
- package/examples/rc2d/rc2d.js +18 -28
- package/examples/styletest/.threedog/content-index.json +1 -1
- package/examples/styletest/GAMEMAP.md +15 -10
- package/examples/styletest/main.js +20 -30
- package/examples/styletest/models.js +29 -29
- package/examples/styletest/params.js +1 -4
- package/examples/styletest/picture/env.js +38 -0
- package/examples/styletest/picture/index.js +16 -0
- package/examples/styletest/picture/lights.js +9 -0
- package/examples/styletest/picture/materials.js +28 -0
- package/examples/styletest/picture/palette.js +22 -0
- package/examples/techniques/contact-shadows/README.md +22 -23
- package/examples/techniques/contact-shadows/contactShadows.js +32 -16
- package/examples/techniques/contact-shadows/main.js +20 -18
- package/examples/techniques/contact-shadows/picture/index.js +14 -0
- package/examples/techniques/contact-shadows/picture/lights.js +34 -0
- package/examples/techniques/contact-shadows/picture/materials.js +12 -0
- package/examples/techniques/contact-shadows/picture/palette.js +17 -0
- package/examples/techniques/day-night-grade/README.md +13 -16
- package/examples/techniques/day-night-grade/main.js +15 -25
- package/examples/techniques/day-night-grade/picture/index.js +20 -0
- package/examples/techniques/day-night-grade/picture/lights.js +45 -0
- package/examples/techniques/day-night-grade/picture/materials.js +15 -0
- package/examples/techniques/day-night-grade/picture/palette.js +59 -0
- package/examples/techniques/day-night-grade/picture/post.js +25 -0
- package/examples/techniques/day-night-grade/picture/sky.js +33 -0
- package/examples/techniques/interior-light/README.md +16 -13
- package/examples/techniques/interior-light/interiorLight.js +19 -17
- package/examples/techniques/interior-light/main.js +31 -68
- package/examples/techniques/interior-light/picture/index.js +24 -0
- package/examples/techniques/interior-light/picture/lights.js +52 -0
- package/examples/techniques/interior-light/picture/materials.js +13 -0
- package/examples/techniques/interior-light/picture/palette.js +32 -0
- package/examples/techniques/interior-light/picture/sky.js +40 -0
- package/examples/techniques/modular-building/README.md +8 -6
- package/examples/techniques/modular-building/kit.js +2 -2
- package/examples/techniques/modular-building/main.js +9 -17
- package/examples/techniques/modular-building/picture/index.js +17 -0
- package/examples/techniques/modular-building/picture/lights.js +26 -0
- package/examples/techniques/modular-building/picture/materials.js +13 -0
- package/examples/techniques/modular-building/picture/palette.js +23 -0
- package/examples/techniques/night-lights/README.md +15 -14
- package/examples/techniques/night-lights/main.js +20 -43
- package/examples/techniques/night-lights/nightLights.js +25 -21
- package/examples/techniques/night-lights/picture/index.js +18 -0
- package/examples/techniques/night-lights/picture/lights.js +44 -0
- package/examples/techniques/night-lights/picture/materials.js +15 -0
- package/examples/techniques/night-lights/picture/palette.js +34 -0
- package/examples/techniques/night-lights/picture/post.js +9 -0
- package/examples/techniques/night-lights/picture/sky.js +36 -0
- package/examples/techniques/outlines-and-rim/README.md +2 -2
- package/examples/techniques/outlines-and-rim/main.js +15 -38
- package/examples/techniques/outlines-and-rim/outlines.js +3 -3
- package/examples/techniques/outlines-and-rim/picture/index.js +16 -0
- package/examples/techniques/outlines-and-rim/picture/lights.js +18 -0
- package/examples/techniques/outlines-and-rim/picture/materials.js +11 -0
- package/examples/techniques/outlines-and-rim/picture/palette.js +16 -0
- package/examples/techniques/outlines-and-rim/picture/post.js +10 -0
- package/examples/techniques/procedural-animation/README.md +6 -4
- package/examples/techniques/procedural-animation/main.js +9 -7
- package/examples/techniques/procedural-animation/picture/index.js +15 -0
- package/examples/techniques/procedural-animation/picture/lights.js +35 -0
- package/examples/techniques/procedural-animation/picture/materials.js +10 -0
- package/examples/techniques/procedural-animation/picture/palette.js +16 -0
- package/examples/techniques/procedural-animation/picture/sky.js +31 -0
- package/examples/techniques/procedural-animation/proceduralAnim.js +1 -1
- package/examples/techniques/procedural-surface/README.md +2 -0
- package/examples/techniques/procedural-surface/main.js +17 -55
- package/examples/techniques/procedural-surface/picture/index.js +14 -0
- package/examples/techniques/procedural-surface/picture/lights.js +18 -0
- package/examples/techniques/procedural-surface/picture/materials.js +34 -0
- package/examples/techniques/procedural-surface/picture/palette.js +15 -0
- package/examples/techniques/stylized-shading/README.md +13 -14
- package/examples/techniques/stylized-shading/main.js +11 -42
- package/examples/techniques/stylized-shading/picture/index.js +14 -0
- package/examples/techniques/stylized-shading/picture/lights.js +23 -0
- package/examples/techniques/stylized-shading/picture/materials.js +18 -0
- package/examples/techniques/stylized-shading/picture/palette.js +19 -0
- package/examples/techniques/stylized-shading/shading.js +2 -2
- package/examples/techniques/sun-and-key-light/README.md +20 -22
- package/examples/techniques/sun-and-key-light/keyLight.js +47 -29
- package/examples/techniques/sun-and-key-light/main.js +19 -63
- package/examples/techniques/sun-and-key-light/picture/index.js +13 -0
- package/examples/techniques/sun-and-key-light/picture/lights.js +33 -0
- package/examples/techniques/sun-and-key-light/picture/materials.js +9 -0
- package/examples/techniques/sun-and-key-light/picture/palette.js +29 -0
- package/examples/techniques/sun-and-key-light/picture/sky.js +16 -0
- package/examples/techniques/three-looks/README.md +21 -0
- package/examples/techniques/three-looks/main.js +58 -0
- package/examples/techniques/three-looks/picture/cartoon.js +23 -0
- package/examples/techniques/three-looks/picture/cinematic.js +27 -0
- package/examples/techniques/three-looks/picture/comic.js +27 -0
- package/examples/techniques/three-looks/picture/index.js +14 -0
- package/examples/techniques/three-looks/picture/sun.js +23 -0
- package/examples/techniques/wet-road/README.md +7 -4
- package/examples/techniques/wet-road/main.js +18 -38
- package/examples/techniques/wet-road/picture/index.js +17 -0
- package/examples/techniques/wet-road/picture/lights.js +57 -0
- package/examples/techniques/wet-road/picture/materials.js +16 -0
- package/examples/techniques/wet-road/picture/palette.js +24 -0
- package/examples/techniques/wet-road/picture/sky.js +46 -0
- package/examples/webgpu-tsl/GAMEMAP.md +10 -4
- package/examples/webgpu-tsl/README.md +13 -10
- package/examples/webgpu-tsl/main.js +30 -7
- package/examples/webgpu-tsl/picture/index.js +18 -0
- package/examples/webgpu-tsl/picture/lights.js +25 -0
- package/examples/webgpu-tsl/picture/materials.js +36 -0
- package/examples/webgpu-tsl/picture/palette.js +23 -0
- package/examples/webgpu-tsl/picture/post.js +16 -0
- package/examples/webgpu-tsl/picture/sky.js +30 -0
- package/examples/world/.threedog/content-index.json +1 -1
- package/examples/world/GAMEMAP.md +16 -12
- package/examples/world/art/humanoid.js +9 -13
- package/examples/world/art/index.js +2 -2
- package/examples/world/art/models.js +3 -4
- package/examples/world/art/shapes.js +2 -2
- package/examples/world/assets.js +2 -2
- package/examples/world/content/audio.js +1 -1
- package/examples/world/content/items.js +1 -1
- package/examples/world/content/props.js +1 -1
- package/examples/world/content/templates.js +1 -1
- package/examples/world/content/vegetation.js +1 -1
- package/examples/world/main.js +10 -10
- package/examples/world/models.js +17 -7
- package/examples/world/picture/index.js +20 -0
- package/examples/world/picture/lights.js +41 -0
- package/examples/world/picture/materials.js +34 -0
- package/examples/world/picture/palette.js +74 -0
- package/examples/world/picture/post.js +9 -0
- package/examples/world/picture/sky.js +39 -0
- package/index.d.ts +14 -22
- package/index.js +36 -36
- package/llms.txt +19 -21
- package/modules/ambience/Ambience.js +12 -9
- package/modules/calendar/Calendar.js +20 -20
- package/modules/calendar/index.js +14 -13
- package/modules/calendar/schedule.js +11 -6
- package/modules/calendar/seasons.js +7 -7
- package/modules/camera/FirstPersonCamera.js +2 -2
- package/modules/camera/FixedCamera.js +14 -15
- package/modules/camera/FollowCamera.js +4 -4
- package/modules/camera/RtsCamera.js +11 -11
- package/modules/camera/common.js +51 -25
- package/modules/camera/contract.js +1 -0
- package/modules/camera/projection.js +2 -2
- package/modules/characters/Character.js +47 -39
- package/modules/characters/NPC.js +30 -22
- package/modules/characters/assetModel.js +18 -13
- package/modules/characters/astar.js +7 -5
- package/modules/characters/behaviors.js +4 -5
- package/modules/characters/contract.js +2 -2
- package/modules/characters/index.js +172 -193
- package/modules/characters/moveHelpers.js +14 -3
- package/modules/characters/movers/common.js +22 -15
- package/modules/characters/movers/manual.js +4 -1
- package/modules/characters/movers/rapier.js +7 -6
- package/modules/characters/movers/simple.js +3 -3
- package/modules/characters/movers/support.js +32 -18
- package/modules/characters/npcAvoid.js +4 -4
- package/modules/characters/npcSim.js +28 -18
- package/modules/characters/npcView.js +6 -5
- package/modules/characters/pathAsync.js +12 -10
- package/modules/characters/pathWorker.js +1 -1
- package/modules/characters/player.js +108 -0
- package/modules/characters/playerStrings.js +2 -2
- package/modules/characters/proceduralRig.js +19 -5
- package/modules/characters/useModel.js +5 -5
- package/modules/characters/walkTo.js +11 -17
- package/modules/collision/Collision.js +30 -22
- package/modules/collision/contract.js +15 -0
- package/modules/content/explain.js +1 -2
- package/modules/content/fields.js +24 -3
- package/modules/content/ids.js +2 -2
- package/modules/content/index.js +68 -98
- package/modules/content/loader.js +14 -17
- package/modules/content/markers.js +25 -0
- package/modules/content/models.js +66 -18
- package/modules/content/packs.js +3 -3
- package/modules/content/parts.js +2 -2
- package/modules/content/places.js +35 -0
- package/modules/content/props.js +19 -14
- package/modules/content/rules.js +34 -22
- package/modules/content/stages.js +7 -7
- package/modules/content/templates.js +24 -22
- package/modules/content/words.js +34 -0
- package/modules/debug/DebugPanel.js +10 -43
- package/modules/flow/contract.js +1 -1
- package/modules/flow/index.js +11 -7
- package/modules/gameplay/Container.js +12 -11
- package/modules/gameplay/Containers.js +14 -5
- package/modules/gameplay/Dialogue.js +13 -11
- package/modules/gameplay/Interactions.js +115 -27
- package/modules/gameplay/Inventory.js +11 -12
- package/modules/gameplay/Quests.js +16 -9
- package/modules/gameplay/boxOps.js +1 -1
- package/modules/gameplay/dialogueBox.js +1 -1
- package/modules/gameplay/dialogueBubbles.js +4 -5
- package/modules/gameplay/interactionPrompt.js +1 -1
- package/modules/gameplay/interactions.contract.js +1 -1
- package/modules/gameplay/inventoryOps.js +2 -3
- package/modules/gameplay/pickups.js +81 -44
- package/modules/gameplay/questLog.js +2 -2
- package/modules/gameplay/questSave.js +3 -3
- package/modules/grid/Grid.js +1 -1
- package/modules/grid/Layer.js +16 -3
- package/modules/grid/index.js +47 -19
- package/modules/grid/preview.js +29 -20
- package/modules/grid/tiles.js +19 -23
- package/modules/hlod/index.js +38 -55
- package/modules/hud/index.js +27 -8
- package/modules/hud/parts.js +13 -11
- package/modules/level/contract.js +16 -0
- package/modules/level/heightfield.js +12 -10
- package/modules/level/index.js +48 -152
- package/modules/level/load.js +79 -0
- package/modules/level/meshes.js +65 -0
- package/modules/level/nodes.js +6 -7
- package/modules/lights/index.js +34 -183
- package/modules/lights/slots.js +93 -0
- package/modules/lights/sources.js +88 -0
- package/modules/music/Music.js +31 -27
- package/modules/music/rules.js +1 -1
- package/modules/nav/contract.js +14 -0
- package/modules/nav/index.js +11 -10
- package/modules/net/Client.js +7 -7
- package/modules/net/Host.js +7 -7
- package/modules/net/Net.js +1 -1
- package/modules/net/index.js +5 -4
- package/modules/net/sync.js +2 -2
- package/modules/net/transports.js +2 -2
- package/modules/particles/Particles.js +49 -25
- package/modules/particles/effect.js +27 -10
- package/modules/particles/shaders.js +2 -1
- package/modules/photo/Photo.js +26 -27
- package/modules/rigid/RigidBodies.js +66 -43
- package/modules/rigid/Vehicles.js +2 -3
- package/modules/rigid/ragdoll.js +287 -0
- package/modules/rigid/ragdollBones.js +159 -0
- package/modules/rigid/sync.js +6 -6
- package/modules/settings/Settings.js +114 -45
- package/modules/settings/apply.js +10 -10
- package/modules/settings/sections.js +16 -14
- package/modules/settings/strings.js +1 -1
- package/modules/settings/view.js +3 -3
- package/modules/sky/Sky.js +125 -103
- package/modules/sky/clouds.js +22 -23
- package/modules/sky/dome.js +113 -0
- package/modules/sky/domeLayers.js +13 -13
- package/modules/sky/environment.js +47 -171
- package/modules/sky/fog.js +5 -180
- package/modules/sky/frame.js +42 -97
- package/modules/sky/season.js +9 -3
- package/modules/sky/shader.js +49 -44
- package/modules/sky/skyModule.js +25 -35
- package/modules/sky/tint.js +9 -11
- package/modules/swarm/Swarm.js +346 -0
- package/modules/swarm/draw.js +68 -0
- package/modules/swarm/grid.js +63 -0
- package/modules/terrain/ChunkManager.js +97 -62
- package/modules/terrain/chunkQueries.js +7 -24
- package/modules/terrain/chunkWorker.js +1 -1
- package/modules/terrain/draw.js +157 -0
- package/modules/terrain/index.js +60 -88
- package/modules/terrain/terrainColorMap.js +6 -3
- package/modules/terrain/terrainDefaults.js +4 -3
- package/modules/terrain/terrainEdit.js +32 -27
- package/modules/terrain/terrainGen.js +19 -14
- package/modules/terrain/terrainIsland.js +2 -2
- package/modules/terrain/terrainMesh.js +7 -6
- package/modules/terrain/terrainShape.js +8 -10
- package/modules/terrain/terrainShapeMain.js +3 -3
- package/modules/timeline/Timeline.js +27 -19
- package/modules/timeline/Tween.js +6 -6
- package/modules/timeline/shots.js +5 -7
- package/modules/triggers/index.js +19 -15
- package/modules/vegetation/Vegetation.js +87 -39
- package/modules/vegetation/densityMap.js +4 -7
- package/modules/vegetation/draw.js +196 -0
- package/modules/vegetation/groundChunks.js +11 -31
- package/modules/vegetation/index.js +18 -16
- package/modules/vegetation/modelGeometry.js +3 -6
- package/modules/vegetation/nearFade.js +1 -1
- package/modules/water/Water.js +140 -93
- package/modules/water/surface.js +56 -56
- package/modules/weather/Weather.js +84 -38
- package/modules/weather/particles.js +18 -10
- package/modules/weather/shaders.js +1 -1
- package/modules/weather/weatherDraw.js +145 -0
- package/modules/world/World.js +10 -10
- package/modules/world/explain.js +1 -1
- package/modules/world/index.js +18 -12
- package/modules/world/persist.js +73 -25
- package/modules/world/pos.js +4 -4
- package/modules/world/records.js +28 -8
- package/modules/world/sim.js +4 -4
- package/modules/world/state.js +12 -5
- package/modules/world/thingSource.js +4 -2
- package/modules/world/views.js +12 -10
- package/package.json +44 -8
- package/presets.js +3 -5
- package/render/PostFX.js +233 -63
- package/render/backend.js +72 -32
- package/render/cascades.js +200 -0
- package/render/cascades.tsl.js +93 -0
- package/render/daylight.js +56 -0
- package/render/detail.js +13 -12
- package/render/effects.js +60 -42
- package/render/fuse.js +3 -3
- package/render/fx/cel.tsl.js +42 -0
- package/render/fx/cloudShadow.tsl.js +3 -3
- package/render/fx/detail.tsl.js +1 -1
- package/render/fx/index.js +10 -13
- package/render/fx/library.tsl.js +11 -0
- package/render/fx/lighting.tsl.js +2 -1
- package/render/fx/nodeErrors.tsl.js +2 -2
- package/render/fx/objectOrigin.tsl.js +1 -2
- package/render/fx/patchNodes.tsl.js +6 -16
- package/render/fx/postWebGPU.tsl.js +55 -28
- package/render/fx/sky.tsl.js +34 -109
- package/render/fx/uniforms.tsl.js +4 -4
- package/render/fx/water.tsl.js +1 -1
- package/render/fx/wind.tsl.js +1 -1
- package/render/fxNumbers.js +3 -0
- package/render/layers.js +14 -0
- package/render/lighting.js +11 -8
- package/render/lightmap.js +142 -0
- package/render/lights.js +26 -204
- package/render/lit.js +24 -0
- package/render/materials.js +47 -162
- package/render/mergeCommon.js +22 -0
- package/render/modeling.js +2 -2
- package/render/neutral.js +23 -0
- package/render/occlusion.js +200 -0
- package/render/ownFrame.js +5 -5
- package/render/patches.js +46 -41
- package/render/postWebGL.js +19 -9
- package/render/probes.js +182 -128
- package/render/recordSweep.js +117 -0
- package/render/shaderErrors.js +10 -9
- package/render/shadowCache.tsl.js +107 -0
- package/render/shadowTypes.js +9 -0
- package/render/shadows.js +451 -0
- package/render/slots.js +11 -11
- package/render/terms.js +63 -113
- package/render/uniformDecl.js +2 -2
- package/types/core.d.ts +489 -405
- package/types/gameplay.d.ts +225 -114
- package/types/generated/core/{Audio.d.ts → audio/Audio.d.ts} +23 -8
- package/types/generated/core/{audioVoice.d.ts → audio/audioVoice.d.ts} +2 -2
- package/types/generated/core/{Events.d.ts → base/Events.d.ts} +4 -4
- package/types/generated/core/{I18n.d.ts → base/I18n.d.ts} +7 -15
- package/types/generated/core/{Random.d.ts → base/Random.d.ts} +4 -3
- package/types/generated/core/engine/page.d.ts +24 -0
- package/types/generated/core/{Input.d.ts → input/Input.d.ts} +21 -10
- package/types/generated/core/{Budget.d.ts → inspect/Budget.d.ts} +36 -26
- package/types/generated/core/{DebugOverrides.d.ts → inspect/DebugOverrides.d.ts} +16 -8
- package/types/generated/core/{Ops.d.ts → ops/Ops.d.ts} +4 -3
- package/types/generated/core/{control.d.ts → ops/control.d.ts} +4 -10
- package/types/generated/core/{Saves.d.ts → saves/Saves.d.ts} +37 -13
- package/types/generated/core/{session.d.ts → saves/session.d.ts} +2 -1
- package/types/generated/core/{Rays.d.ts → scene/Rays.d.ts} +8 -27
- package/types/generated/core/{Views.d.ts → scene/Views.d.ts} +1 -1
- package/types/generated/core/{Batching.d.ts → stream/Batching.d.ts} +7 -7
- package/types/generated/core/{Stream.d.ts → stream/Stream.d.ts} +18 -16
- package/types/generated/core/{Commits.d.ts → threads/Commits.d.ts} +1 -1
- package/types/generated/core/{Jobs.d.ts → threads/Jobs.d.ts} +6 -6
- package/types/generated/core/{Threads.d.ts → threads/Threads.d.ts} +4 -4
- package/types/generated/modules/calendar/Calendar.d.ts +10 -11
- package/types/generated/modules/debug/DebugPanel.d.ts +1 -9
- package/types/generated/modules/grid/Layer.d.ts +9 -1
- package/types/generated/modules/grid/index.d.ts +32 -8
- package/types/generated/modules/music/Music.d.ts +7 -5
- package/types/generated/modules/particles/Particles.d.ts +14 -7
- package/types/generated/modules/sky/Sky.d.ts +101 -23
- package/types/generated/modules/sky/skyModule.d.ts +1 -1
- package/types/generated/modules/swarm/Swarm.d.ts +80 -0
- package/types/generated/modules/timeline/Timeline.d.ts +2 -1
- package/types/generated/modules/water/Water.d.ts +51 -3
- package/types/generated/modules/weather/Weather.d.ts +44 -10
- package/types/generated/modules/weather/weatherDraw.d.ts +11 -0
- package/types/generated/modules/world/World.d.ts +7 -5
- package/types/generated/render/PostFX.d.ts +69 -20
- package/types/generated/render/lighting.d.ts +29 -0
- package/types/generated/render/materials.d.ts +20 -44
- package/types/generated/render/occlusion.d.ts +22 -0
- package/types/generated/render/patches.d.ts +1 -0
- package/types/generated/ui/Focus.d.ts +1 -0
- package/types/generated/ui/UI.d.ts +1 -0
- package/types/nav.d.ts +11 -11
- package/types/physics.d.ts +104 -73
- package/types/tsl.d.ts +45 -4
- package/types/world.d.ts +372 -86
- package/ui/Focus.js +21 -10
- package/ui/LoadingScreen.js +2 -2
- package/ui/Parts.js +12 -7
- package/ui/UI.js +17 -17
- package/ui/cursor.js +1 -1
- package/ui/defaults.js +3 -2
- package/ui/theme.js +36 -28
- package/ui/touchPart.js +1 -1
- package/core/UrlState.js +0 -110
- package/core/assetEntry.js +0 -106
- package/core/describeRender.js +0 -71
- package/core/holds.js +0 -134
- package/core/look/coreParts.js +0 -219
- package/core/look/part.js +0 -253
- package/core/look/points.js +0 -255
- package/core/look/report.js +0 -96
- package/core/look/shadowPart.js +0 -63
- package/core/look/state.js +0 -45
- package/core/look/write.js +0 -70
- package/core/page.js +0 -79
- package/core/shadowTypes.js +0 -16
- package/core/styleParts.js +0 -114
- package/core/util.js +0 -17
- package/docs/MIGRATING-0.3.md +0 -248
- package/docs/MIGRATING-0.4.md +0 -228
- package/docs/MIGRATING-0.5.md +0 -68
- package/docs/PERF.md +0 -245
- package/docs/api/style.md +0 -136
- package/docs/api/terrainLook.md +0 -10
- package/docs/api/vegetationLook.md +0 -10
- package/docs/api/weatherLook.md +0 -10
- package/docs/recipes/09-style.md +0 -218
- package/docs/recipes/35-style-from-reference.md +0 -153
- package/docs/recipes/36-sky-ground-plant-looks.md +0 -118
- package/docs/recipes/37-terrain-look-hooks.md +0 -119
- package/docs/recipes/38-environment-look-hooks.md +0 -99
- package/docs/recipes/41-thing-registry.md +0 -97
- package/docs/recipes/42-terrain-shape.md +0 -64
- package/docs/recipes/44-water-weather-look-hooks.md +0 -144
- package/docs/recipes/47-island-snow-backdrop.md +0 -45
- package/docs/recipes/48-make-material.md +0 -75
- package/docs/recipes/52-look.md +0 -282
- package/docs/recipes/54-three-idioms.md +0 -88
- package/examples/action/look.js +0 -5
- package/examples/sheepisland/.threedog/content-index.json +0 -1
- package/examples/sheepisland/style/index.js +0 -79
- package/examples/styletest/look.js +0 -11
- package/examples/techniques/day-night-grade/dayNightGrade.js +0 -76
- package/examples/webgpu-tsl/tslScene.js +0 -75
- package/examples/world/style/index.js +0 -61
- package/examples/world/style/plugins/10-bloom.js +0 -5
- package/modules/sky/cascades.js +0 -186
- package/modules/sky/cascades.tsl.js +0 -82
- package/modules/sky/look.js +0 -54
- package/modules/sky/lookFog.js +0 -76
- package/modules/sky/lookShadow.js +0 -62
- package/modules/sky/lookSky.js +0 -169
- package/modules/sky/shadow.js +0 -98
- package/modules/terrain/look.js +0 -83
- package/modules/terrain/lookGround.js +0 -66
- package/modules/vegetation/look.js +0 -119
- package/modules/vegetation/lookWind.js +0 -98
- package/modules/water/look.js +0 -91
- package/modules/water/surfaceDefaults.js +0 -3
- package/modules/weather/look.js +0 -74
- package/modules/weather/weatherLook.js +0 -135
- package/render/lookGlow.js +0 -139
- package/render/lookSurface.js +0 -224
- package/render/postLook.js +0 -164
- package/render/surface.js +0 -105
- package/types/generated/core/page.d.ts +0 -18
- package/types/generated/modules/weather/weatherLook.d.ts +0 -12
- package/types/style.d.ts +0 -671
- /package/core/{Vars.js → base/Vars.js} +0 -0
- /package/core/{mulberry32.js → base/mulberry32.js} +0 -0
- /package/core/{inputDefaults.js → input/inputDefaults.js} +0 -0
- /package/core/{textureBytes.js → inspect/textureBytes.js} +0 -0
- /package/core/{actor.js → ops/actor.js} +0 -0
- /package/core/{opsFail.js → ops/opsFail.js} +0 -0
- /package/core/{opsHistory.js → ops/opsHistory.js} +0 -0
- /package/core/{saveIds.js → saves/saveIds.js} +0 -0
- /package/core/{screenToGround.js → scene/screenToGround.js} +0 -0
- /package/core/{cells.js → stream/cells.js} +0 -0
- /package/core/{streamCells.js → stream/streamCells.js} +0 -0
- /package/core/{pureWorker.js → threads/pureWorker.js} +0 -0
- /package/examples/{sheepisland → perf-island}/content/index.js +0 -0
- /package/examples/{sheepisland → perf-island}/content/props.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Audio.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/audio/Audio.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.audio: buses, sounds by name, ducking. Sfx play by name from the game's audio.sounds (file, variants or synth). */
|
|
3
3
|
export class Audio {
|
|
4
4
|
/** The browser AudioContext (exists only after the first click) @type {any} */
|
|
@@ -11,7 +11,7 @@ export class Audio {
|
|
|
11
11
|
music: any;
|
|
12
12
|
footsteps: any;
|
|
13
13
|
};
|
|
14
|
-
/** Bus input GainNodes by name (connect your own nodes here); empty until audio unlocks @type {Record<string, any>} */
|
|
14
|
+
/** Bus input GainNodes by name, 'master' included (connect your own nodes here); empty until audio unlocks. A name that is no bus warns and gives master: node.connect(undefined) would throw, and in dev a throw freezes gameplay @type {Record<string, any>} */
|
|
15
15
|
buses: Record<string, any>;
|
|
16
16
|
/** The game's current mode for rule lists, e.g. 'combat' / 'explore' (condition `state` in music and ambience rules) @type {string | null} */
|
|
17
17
|
state: string | null;
|
|
@@ -19,7 +19,7 @@ export class Audio {
|
|
|
19
19
|
master: any;
|
|
20
20
|
/** 2 s of white noise, reused by synthesized sounds @type {any} */
|
|
21
21
|
noise: any;
|
|
22
|
-
/** Is audio usable (the player has clicked/pressed a key)? @returns {boolean} */
|
|
22
|
+
/** Is audio usable (the player has clicked/pressed a key)? @returns {boolean} @experimental */
|
|
23
23
|
get running(): boolean;
|
|
24
24
|
/**
|
|
25
25
|
* Add a bus of your own (routed to master). It gets a settings slider like the others (label key settings.vol.<name>)
|
|
@@ -75,7 +75,7 @@ export class Audio {
|
|
|
75
75
|
* @param {(e: any) => number} fn
|
|
76
76
|
* @returns {{ remove(): void }}
|
|
77
77
|
* @example engine.audio.measure('danger', e => e.vars.counter('alarm') / 10); // data: when: { danger: { gt: 0.5 } }
|
|
78
|
-
* Measures are not only for sound: render/
|
|
78
|
+
* Measures are not only for sound: render/daylight.js reads 'daylight' for night glow, so the calendar (or the sky without one) registers it once
|
|
79
79
|
* and nothing else has to know which module tells day from night. remove() drops only this registration (a later one under the name stays).
|
|
80
80
|
*/
|
|
81
81
|
measure(name: string, fn: (e: any) => number): {
|
|
@@ -94,6 +94,7 @@ export class Audio {
|
|
|
94
94
|
* @param {...any} extra
|
|
95
95
|
* @returns {boolean}
|
|
96
96
|
* @example engine.audio.matches({ time: 'night', zone: 'forest', rain: { lt: 0.2 } });
|
|
97
|
+
* @experimental
|
|
97
98
|
*/
|
|
98
99
|
matches(when: AudioCondition | undefined, ...extra: any[]): boolean;
|
|
99
100
|
/**
|
|
@@ -102,6 +103,7 @@ export class Audio {
|
|
|
102
103
|
* @param {...any} extra
|
|
103
104
|
* @returns {number}
|
|
104
105
|
* @example engine.audio.volumeOf({ base: 0, add: { rain: 0.22 } }); // 0.22 in full rain
|
|
106
|
+
* @experimental
|
|
105
107
|
*/
|
|
106
108
|
volumeOf(volume: AudioVolume | undefined, ...extra: any[]): number;
|
|
107
109
|
/**
|
|
@@ -123,6 +125,19 @@ export class Audio {
|
|
|
123
125
|
params?: Record<string, any>;
|
|
124
126
|
fadeIn?: number;
|
|
125
127
|
}): SoundHandle | null;
|
|
128
|
+
/**
|
|
129
|
+
* What is playing (describe().audio shows it while something is ducked or playing): bus levels, the duck multiplier per bus, live voices per sound name.
|
|
130
|
+
* ducks is the level the active ducks ask for (1 = not lowered), read at once even while a fade is still ramping or the audio clock does not run (headless page).
|
|
131
|
+
* @returns {{ running: boolean, state: string | null, levels: Record<string, number>, ducks: Record<string, number>, voices: Record<string, number> }}
|
|
132
|
+
* @example engine.audio.duck({ music: 0.3 }); engine.audio.info.ducks.music // 0.3
|
|
133
|
+
*/
|
|
134
|
+
get info(): {
|
|
135
|
+
running: boolean;
|
|
136
|
+
state: string | null;
|
|
137
|
+
levels: Record<string, number>;
|
|
138
|
+
ducks: Record<string, number>;
|
|
139
|
+
voices: Record<string, number>;
|
|
140
|
+
};
|
|
126
141
|
/**
|
|
127
142
|
* Synth building block: a burst of filtered noise (footsteps, shutter, rain, thunder). dur seconds, freq Hz, vol 0-1; out: the node to
|
|
128
143
|
* connect to (a synth's `out`), else the named bus
|
|
@@ -157,8 +172,8 @@ export class Audio {
|
|
|
157
172
|
pan?: number;
|
|
158
173
|
}): void;
|
|
159
174
|
/**
|
|
160
|
-
* Download and decode an audio file
|
|
161
|
-
* engine.
|
|
175
|
+
* Download and decode an audio file, as an engine.loading task: a path or a sound name from an asset pack (manifest sounds), so sounds entries and music
|
|
176
|
+
* tracks may name assets instead of paths. engine.assets caches it: short effects stay; long sounds go with assets.release / trim or over a memory budget, and load again on next use
|
|
162
177
|
* @param {string} url a file path or an asset pack sound name
|
|
163
178
|
* @returns {Promise<any>}
|
|
164
179
|
*/
|
|
@@ -179,6 +194,6 @@ export class Audio {
|
|
|
179
194
|
at?: any;
|
|
180
195
|
}): Promise<SoundHandle | null>;
|
|
181
196
|
}
|
|
182
|
-
import type { AudioCondition } from '
|
|
183
|
-
import type { AudioVolume } from '
|
|
197
|
+
import type { AudioCondition } from '../../../core';
|
|
198
|
+
import type { AudioVolume } from '../../../core';
|
|
184
199
|
import { SoundHandle } from './audioVoice.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/audioVoice.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/audio/audioVoice.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
|
|
3
3
|
/** Point the Web Audio listener where the camera is (only called while positional voices exist: zero cost otherwise) */
|
|
4
4
|
export function placeListener(ctx: any, camera: any): void;
|
|
@@ -6,7 +6,7 @@ export function placeListener(ctx: any, camera: any): void;
|
|
|
6
6
|
export function synthNoise(audio: any, opts: any): void;
|
|
7
7
|
/** Synth building block behind audio.tone: a short enveloped tone */
|
|
8
8
|
export function synthTone(audio: any, opts: any): void;
|
|
9
|
-
/** audio.load body:
|
|
9
|
+
/** audio.load body: a file sound is an engine.assets entry, by name or by path (a path gets an entry of its own, like a model path), so release, trim and dispose reach it */
|
|
10
10
|
export function loadSound(audio: any, url: any): Promise<any>;
|
|
11
11
|
/** audio.play body: a file by path or asset name, no sounds entry needed */
|
|
12
12
|
export function playFile(audio: any, url: any, opts: any): Promise<SoundHandle>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Events.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/base/Events.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.events: the event bus; modules "shout" and whoever cares listens */
|
|
3
3
|
export class Events {
|
|
4
4
|
/** How many history entries to keep, default 200; 0 records nothing */
|
|
@@ -84,6 +84,6 @@ export class Events {
|
|
|
84
84
|
*/
|
|
85
85
|
emit<K extends EventName>(name: K, ...args: EventArgs<K & string>): void;
|
|
86
86
|
}
|
|
87
|
-
import type { EventName } from '
|
|
88
|
-
import type { EventArgs } from '
|
|
89
|
-
import type { Handle } from '
|
|
87
|
+
import type { EventName } from '../../../core';
|
|
88
|
+
import type { EventArgs } from '../../../core';
|
|
89
|
+
import type { Handle } from '../../../common';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/I18n.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
-
/** engine.i18n: string tables; t(key, params) fetches text and replaces {name} with params */
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/base/I18n.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.i18n: string tables; engine.t(key, params) fetches text and replaces {name} with params */
|
|
3
3
|
export class I18n {
|
|
4
|
-
/** Language used when a key is missing in the current one (default 'en') */
|
|
4
|
+
/** Language used when a key is missing in the current one (default 'en') @experimental */
|
|
5
5
|
fallback: string;
|
|
6
|
-
/** Current language, e.g. 'zh-CN' ('zh' and 'zh-Hans' resolve to it, 'en-US' to 'en') */
|
|
6
|
+
/** Current language, e.g. 'zh-CN' ('zh' and 'zh-Hans' resolve to it, 'en-US' to 'en') @experimental */
|
|
7
7
|
locale: any;
|
|
8
8
|
/**
|
|
9
9
|
* Register string tables (never overrides text the game gave)
|
|
@@ -12,19 +12,11 @@ export class I18n {
|
|
|
12
12
|
* @example engine.i18n.add({ 'zh-CN': { 'shop.buy': '购买 {name}' }, en: { 'shop.buy': 'Buy {name}' } });
|
|
13
13
|
*/
|
|
14
14
|
add(tables: StringTables): this;
|
|
15
|
-
/** Switch language ('auto' picks from the browser like createEngine) @param {string} l */
|
|
15
|
+
/** Switch language ('auto' picks from the browser like createEngine) @param {string} l @experimental */
|
|
16
16
|
setLocale(l: string): void;
|
|
17
|
-
/** All available languages @returns {string[]} */
|
|
17
|
+
/** All available languages @returns {string[]} @experimental */
|
|
18
18
|
get languages(): string[];
|
|
19
19
|
/** Whether the key exists @param {string} key @returns {boolean} */
|
|
20
20
|
has(key: string): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Fetch text; params replace {name}, {key:action} shows the key label
|
|
23
|
-
* @param {string} key
|
|
24
|
-
* @param {Record<string, any>} [params]
|
|
25
|
-
* @returns {string}
|
|
26
|
-
* @example engine.i18n.t('shop.buy', { name: '鱼' });
|
|
27
|
-
*/
|
|
28
|
-
t(key: string, params?: Record<string, any>): string;
|
|
29
21
|
}
|
|
30
|
-
import type { StringTables } from '
|
|
22
|
+
import type { StringTables } from '../../../core';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Random.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/base/Random.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.random is the seeded random generator. Gameplay randomness (auto weather, lightning, drops, spawning) uses it so step / tests are reproducible and the state is saved with the save. */
|
|
3
3
|
export class Random {
|
|
4
4
|
/** @param {number} [seed] Seed, default 1 */
|
|
@@ -8,6 +8,7 @@ export class Random {
|
|
|
8
8
|
* @param {number} seed
|
|
9
9
|
* @returns {this}
|
|
10
10
|
* @example engine.random.setSeed(42);
|
|
11
|
+
* @experimental
|
|
11
12
|
*/
|
|
12
13
|
setSeed(seed: number): this;
|
|
13
14
|
seed: any;
|
|
@@ -16,7 +17,7 @@ export class Random {
|
|
|
16
17
|
next(): number;
|
|
17
18
|
/** A decimal between a and b @param {number} a @param {number} b @returns {number} */
|
|
18
19
|
range(a: number, b: number): number;
|
|
19
|
-
/** An integer between a and b (inclusive) @param {number} a @param {number} b @returns {number} @example const dice = engine.random.int(1, 6); */
|
|
20
|
+
/** An integer between a and b (inclusive) @param {number} a @param {number} b @returns {number} @example const dice = engine.random.int(1, 6); @experimental */
|
|
20
21
|
int(a: number, b: number): number;
|
|
21
22
|
/**
|
|
22
23
|
* Pick one element of the array at random (undefined for an empty array).
|
|
@@ -41,7 +42,7 @@ export class Random {
|
|
|
41
42
|
seed: number;
|
|
42
43
|
state: number;
|
|
43
44
|
};
|
|
44
|
-
/** For loading @param {{ seed: number, state: number } | null | undefined} d */
|
|
45
|
+
/** For loading @param {{ seed: number, state: number } | null | undefined} d @experimental */
|
|
45
46
|
fromJSON(d: {
|
|
46
47
|
seed: number;
|
|
47
48
|
state: number;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/engine/page.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
+
/** engine.page: window focus, tab visibility, mouse lock and WebGL context, all handled here. */
|
|
3
|
+
export class Page {
|
|
4
|
+
/** The window has keyboard focus @type {boolean} @experimental */
|
|
5
|
+
focused: boolean;
|
|
6
|
+
/** The tab is visible @type {boolean} */
|
|
7
|
+
visible: boolean;
|
|
8
|
+
/** The mouse is locked to the canvas (first-person / shoulder cameras lock on click) @type {boolean} @experimental */
|
|
9
|
+
pointerLocked: boolean;
|
|
10
|
+
/** The WebGL context is lost and not yet restored, or the WebGPU device is lost @type {boolean} @experimental */
|
|
11
|
+
contextLost: boolean;
|
|
12
|
+
set pauseOnBlur(v: boolean);
|
|
13
|
+
/** Freeze gameplay while the page is away; default true. Settable at runtime @type {boolean} */
|
|
14
|
+
get pauseOnBlur(): boolean;
|
|
15
|
+
/** The page is away: the window lost focus or the tab is hidden @type {boolean} @experimental */
|
|
16
|
+
get away(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Let go of the mouse (a game's own screen, a click-driven moment). Not read as the player's Esc, so the pause menu stays shut. Does nothing without a lock; the next
|
|
19
|
+
* click on the view locks again.
|
|
20
|
+
* @returns {void}
|
|
21
|
+
* @example engine.page.releaseLock(); showMyMap();
|
|
22
|
+
*/
|
|
23
|
+
releaseLock(): void;
|
|
24
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Input.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/input/Input.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** Input: read by "action", not by "key". Key names are the browser's KeyboardEvent.code, e.g. 'KeyE', 'Space', 'ShiftLeft'; gamepad keys are 'PadA' etc. */
|
|
3
3
|
export class Input {
|
|
4
4
|
/** This frame's look-drag amount (pixels) and wheel notches */
|
|
@@ -9,7 +9,7 @@ export class Input {
|
|
|
9
9
|
};
|
|
10
10
|
/** Mouse/touch pointer @type {Pointer} */
|
|
11
11
|
pointer: Pointer;
|
|
12
|
-
/** On-screen stick (touch) */
|
|
12
|
+
/** On-screen stick (touch) @experimental */
|
|
13
13
|
stick: {
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
@@ -24,9 +24,9 @@ export class Input {
|
|
|
24
24
|
optional: boolean;
|
|
25
25
|
by: string | null;
|
|
26
26
|
}>;
|
|
27
|
-
/** Most recently used device: UI key hints follow it @type {'keyboard' | 'pad' | 'touch'} */
|
|
27
|
+
/** Most recently used device: UI key hints follow it @type {'keyboard' | 'pad' | 'touch'} @experimental */
|
|
28
28
|
lastDevice: "keyboard" | "pad" | "touch";
|
|
29
|
-
/** Is this a touch device? */
|
|
29
|
+
/** Is this a touch device? @experimental */
|
|
30
30
|
touch: boolean;
|
|
31
31
|
/**
|
|
32
32
|
* Declare an action: its context and display name, never its keys (the game binds those). Modules call ctx.input.action (owned by the module,
|
|
@@ -93,8 +93,16 @@ export class Input {
|
|
|
93
93
|
/**
|
|
94
94
|
* All keys bound to an action: the player's rebinding, else the game's bind, else the default preset (basics only); plus its touch button
|
|
95
95
|
* @param {string} action @returns {readonly string[]}
|
|
96
|
+
* @experimental
|
|
96
97
|
*/
|
|
97
98
|
keysOf(action: string): readonly string[];
|
|
99
|
+
/**
|
|
100
|
+
* True when an action needs a key and has none, so no player input can fire it. Not for an optional action, and not for one bound to [] on purpose
|
|
101
|
+
* (a mouse-only game): "no key at all" is the fault, whichever key the game or the player chose is not.
|
|
102
|
+
* @param {string} action @returns {boolean}
|
|
103
|
+
* @example if (engine.input.isUnbound('interact')) engine.input.bind(presets.bindings.interact);
|
|
104
|
+
*/
|
|
105
|
+
isUnbound(action: string): boolean;
|
|
98
106
|
/** Key name shown in the UI, e.g. "E" @param {string} action @returns {string} */
|
|
99
107
|
label(action: string): string;
|
|
100
108
|
/** Held (a snapshot of this step in fixed, the latest state in frame) @param {string} action @returns {boolean} */
|
|
@@ -110,6 +118,7 @@ export class Input {
|
|
|
110
118
|
/**
|
|
111
119
|
* Just released (which copy is read is the same as pressed; for things like release-to-fire after charging) @param {string} action @returns {boolean}
|
|
112
120
|
* @example if (engine.input.released('fire')) shoot(charge);
|
|
121
|
+
* @experimental
|
|
113
122
|
*/
|
|
114
123
|
released(action: string): boolean;
|
|
115
124
|
/**
|
|
@@ -137,7 +146,7 @@ export class Input {
|
|
|
137
146
|
remove(): void;
|
|
138
147
|
};
|
|
139
148
|
/**
|
|
140
|
-
* describe().input: the context stack, declared actions nobody bound (unbound
|
|
149
|
+
* describe().input: the context stack, declared actions nobody bound (unbound: isUnbound) and the player's rebindings
|
|
141
150
|
* @returns {{ stack: string[], unbound: string[], rebound: Record<string, string[]> }}
|
|
142
151
|
*/
|
|
143
152
|
describe(): {
|
|
@@ -145,11 +154,13 @@ export class Input {
|
|
|
145
154
|
unbound: string[];
|
|
146
155
|
rebound: Record<string, string[]>;
|
|
147
156
|
};
|
|
148
|
-
/** Names of the active contexts, bottom to top (pending switches apply at the next fixed step) @returns {string[]} */
|
|
157
|
+
/** Names of the active contexts, bottom to top (pending switches apply at the next fixed step) @returns {string[]} @experimental */
|
|
149
158
|
get contexts(): string[];
|
|
150
159
|
/**
|
|
151
|
-
* Who holds input, bottom to top above the base context: [{ context, owner, pass }] (pass: unrelated gameplay actions still read)
|
|
160
|
+
* Who holds input, bottom to top above the base context: [{ context, owner, pass }] (pass: unrelated gameplay actions still read).
|
|
161
|
+
* Pushes and removes count at once, before the next fixed step applies them: on a halted page a closed window is not a holder any more
|
|
152
162
|
* @returns {{ context: string, owner: string, pass: boolean }[]}
|
|
163
|
+
* @experimental
|
|
153
164
|
*/
|
|
154
165
|
get holders(): {
|
|
155
166
|
context: string;
|
|
@@ -173,7 +184,7 @@ export class Input {
|
|
|
173
184
|
remove(): void;
|
|
174
185
|
};
|
|
175
186
|
/**
|
|
176
|
-
* False while an opaque context (menu, dialogue, cutscene...) covers gameplay: no game action can be read, and cameras ignore
|
|
187
|
+
* False while an opaque context (menu, dialogue, cutscene...) covers gameplay: no game action can be read, and cameras ignore picture/zoom @returns {boolean}
|
|
177
188
|
*/
|
|
178
189
|
get enabled(): boolean;
|
|
179
190
|
/**
|
|
@@ -185,5 +196,5 @@ export class Input {
|
|
|
185
196
|
y: number;
|
|
186
197
|
};
|
|
187
198
|
}
|
|
188
|
-
import type { Pointer } from '
|
|
189
|
-
import type { Autopilot } from '
|
|
199
|
+
import type { Pointer } from '../../../core';
|
|
200
|
+
import type { Autopilot } from '../../../core';
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Budget.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
-
export class ApplyCost {
|
|
3
|
-
/** Frames in which three.js compiled new shader programs (the last COMPILES_KEPT): { at (page time s), programs (new), ms (render ms of that frame over the usual) } */
|
|
4
|
-
compiles: any[];
|
|
5
|
-
/**
|
|
6
|
-
* Per stage: n results, totalMs, maxMs of one result, frameMs (smoothed ms per frame), bytes (transit only)
|
|
7
|
-
* @returns {Record<string, { n: number, totalMs: number, maxMs: number, frameMs: number, bytes: number }>}
|
|
8
|
-
* @example engine.budget.cost.report().build // { n: 12, totalMs: 9.4, maxMs: 1.8, frameMs: 0.2, bytes: 0 }
|
|
9
|
-
*/
|
|
10
|
-
report(): Record<string, {
|
|
11
|
-
n: number;
|
|
12
|
-
totalMs: number;
|
|
13
|
-
maxMs: number;
|
|
14
|
-
frameMs: number;
|
|
15
|
-
bytes: number;
|
|
16
|
-
}>;
|
|
17
|
-
/** Forget what was counted so far (to measure one scene on its own) */
|
|
18
|
-
reset(): void;
|
|
19
|
-
}
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/inspect/Budget.js (edit the JSDoc in the source, then run npm run map)
|
|
20
2
|
/** engine.budget: performance budget (turned on by createEngine({ budget }) or enable(); off by default, costs nothing). */
|
|
21
3
|
export class Budget {
|
|
22
4
|
/** Is it on? */
|
|
23
5
|
enabled: boolean;
|
|
24
|
-
/** Current limits @type {BudgetLimits} */
|
|
6
|
+
/** Current limits @type {BudgetLimits} @experimental */
|
|
25
7
|
limits: BudgetLimits;
|
|
26
8
|
/** Cost of applying background results, split in stages (see ApplyCost) */
|
|
27
9
|
cost: ApplyCost;
|
|
@@ -32,7 +14,7 @@ export class Budget {
|
|
|
32
14
|
* @example engine.budget.enable({ drawCalls: 250, fps: 55 });
|
|
33
15
|
*/
|
|
34
16
|
enable(limits?: BudgetLimits): this;
|
|
35
|
-
/** Turn off */
|
|
17
|
+
/** Turn off @experimental */
|
|
36
18
|
disable(): void;
|
|
37
19
|
/**
|
|
38
20
|
* Module-defined category: read() returns the current value, opts.limit is the limit (the game's enable() takes precedence). Returns a handle { remove() }
|
|
@@ -44,7 +26,7 @@ export class Budget {
|
|
|
44
26
|
metric(name: string, read: () => number, opts?: {
|
|
45
27
|
limit?: number;
|
|
46
28
|
}): Handle;
|
|
47
|
-
/** Limit of a category; undefined if none was given (not checked) @param {string} name @returns {number | undefined} */
|
|
29
|
+
/** Limit of a category; undefined if none was given (not checked) @param {string} name @returns {number | undefined} @experimental */
|
|
48
30
|
limitOf(name: string): number | undefined;
|
|
49
31
|
/** Budget report; null when off. In the real-time loop it returns the last second's result; in step() mode it is computed on demand @returns {BudgetReport | null} */
|
|
50
32
|
report(): BudgetReport | null;
|
|
@@ -52,6 +34,7 @@ export class Budget {
|
|
|
52
34
|
* Called by the engine when startup finishes: warns if startupMs / moduleMs is exceeded and returns the offenders (empty array if none)
|
|
53
35
|
* @param {{ totalMs: number, modules: Record<string, { init?: number, ready?: number }> }} s
|
|
54
36
|
* @returns {{ category: 'startupMs' | 'moduleMs', value: number, limit: number, top: { tag: string, ms: number }[] }[]}
|
|
37
|
+
* @experimental
|
|
55
38
|
*/
|
|
56
39
|
checkStartup(s: {
|
|
57
40
|
totalMs: number;
|
|
@@ -77,8 +60,35 @@ export class Budget {
|
|
|
77
60
|
*/
|
|
78
61
|
byTag(): BudgetTagStat[];
|
|
79
62
|
}
|
|
80
|
-
import type { BudgetLimits } from '
|
|
63
|
+
import type { BudgetLimits } from '../../../world';
|
|
64
|
+
/**
|
|
65
|
+
* engine.budget.cost: where the main thread pays for background results (terrain chunks, vegetation, colliders, stream builds), split in stages.
|
|
66
|
+
* Always on (a few performance.now() calls per applied result). Stages: transit = worker round trip minus the worker's own compute (queueing,
|
|
67
|
+
* structured clone, waiting for a busy main thread: an async wait, not main-thread blocking, so it is an approximation); build = creating the
|
|
68
|
+
* three.js objects (geometry, meshes, instanced meshes); collider = physics colliders; upload = GPU upload and shader compile, approximated as the
|
|
69
|
+
* extra render time of frames that first draw new objects over the average render time of other frames; stream = the synchronous part of a stream
|
|
70
|
+
* build() callback.
|
|
71
|
+
*/
|
|
72
|
+
declare class ApplyCost {
|
|
73
|
+
/** Frames in which three.js compiled new shader programs (the last COMPILES_KEPT): { at (page time s), programs (new), ms (render ms of that frame over the usual) } */
|
|
74
|
+
compiles: any[];
|
|
75
|
+
/**
|
|
76
|
+
* Per stage: n results, totalMs, maxMs of one result, frameMs (smoothed ms per frame), bytes (transit only)
|
|
77
|
+
* @returns {Record<string, { n: number, totalMs: number, maxMs: number, frameMs: number, bytes: number }>}
|
|
78
|
+
* @example engine.budget.cost.report().build // { n: 12, totalMs: 9.4, maxMs: 1.8, frameMs: 0.2, bytes: 0 }
|
|
79
|
+
*/
|
|
80
|
+
report(): Record<string, {
|
|
81
|
+
n: number;
|
|
82
|
+
totalMs: number;
|
|
83
|
+
maxMs: number;
|
|
84
|
+
frameMs: number;
|
|
85
|
+
bytes: number;
|
|
86
|
+
}>;
|
|
87
|
+
/** Forget what was counted so far (to measure one scene on its own) */
|
|
88
|
+
reset(): void;
|
|
89
|
+
}
|
|
81
90
|
import * as THREE from 'three';
|
|
82
|
-
import type { Handle } from '
|
|
83
|
-
import type { BudgetReport } from '
|
|
84
|
-
import type { BudgetTagStat } from '
|
|
91
|
+
import type { Handle } from '../../../common';
|
|
92
|
+
import type { BudgetReport } from '../../../world';
|
|
93
|
+
import type { BudgetTagStat } from '../../../world';
|
|
94
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/DebugOverrides.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/inspect/DebugOverrides.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
export class DebugOverrides {
|
|
3
3
|
/** The F3 debug panel (the debug() module), or null when it is not installed @type {any} */
|
|
4
4
|
panel: any;
|
|
@@ -6,7 +6,7 @@ export class DebugOverrides {
|
|
|
6
6
|
* Diagnostic view: 'albedo' | 'lighting' | 'shadow' | 'normals' to look at one part of the render, 'overdraw' (bright = many layers on a pixel),
|
|
7
7
|
* 'shaderCost' (materials green -> red by compiled program cost, approximate), 'off' to restore; modules add their own (triggers: 'triggers' draws
|
|
8
8
|
* the trigger zones), viewModes() lists them all. Temporary and owner-scoped; never saved
|
|
9
|
-
* (describe().render says which view is active, so it is not mistaken for the real
|
|
9
|
+
* (describe().render says which view is active, so it is not mistaken for the real picture). While one owner's view is on, another owner can neither switch it
|
|
10
10
|
* nor turn it off without force: true; engine.debug.clear(owner) turns that owner's view off too.
|
|
11
11
|
* @example engine.debug.view('normals'); // look at the screenshot, then engine.debug.view('off')
|
|
12
12
|
* @param {'albedo' | 'lighting' | 'shadow' | 'normals' | 'overdraw' | 'shaderCost' | 'off' | string} mode @param {{ owner?: string, force?: boolean }} [opts]
|
|
@@ -50,7 +50,7 @@ export class DebugOverrides {
|
|
|
50
50
|
* Asset hot swap: register the asset packs again (the new module of an edited assets.js) and build what changed (a new generator function,
|
|
51
51
|
* url or params schema); every live copy swaps geometry and material in place, the page, player, clock and world state stay. The vite preset
|
|
52
52
|
* calls it when an art module imported by the game's assets.js is saved; returns what was swapped (also in describe().assetSwaps).
|
|
53
|
-
* @example import packs from '
|
|
53
|
+
* @example import packs from '../../../../core/assets'; if (import.meta.hot) import.meta.hot.accept('./assets.js', m => engine.debug.reloadAssets(m.default));
|
|
54
54
|
* @param {any} packs @returns {Promise<{ why: string, names: string[], copies: Record<string, number>, ms: number, partsChanged?: string[] }>}
|
|
55
55
|
*/
|
|
56
56
|
reloadAssets(packs: any): Promise<{
|
|
@@ -69,18 +69,26 @@ export class DebugOverrides {
|
|
|
69
69
|
/**
|
|
70
70
|
* Change how an object looks for diagnosis, owned by `owner`. Returns { remove() }. Never saved, never part of the game state; listed in
|
|
71
71
|
* describe().scene.overrides while active. A thing id is remembered as the id: when that thing is removed, or a load replaces it, the override is dropped.
|
|
72
|
+
* Any three.js value: override(owner, object, key, value) writes object[key] and keeps it there every frame, above picture code that writes it in
|
|
73
|
+
* onRender, so "show me this with exposure 3" holds; remove() puts the old value back.
|
|
72
74
|
* @param {string} owner who sets it (a tool or session name); engine.debug.clear(owner) removes all of that owner's overrides
|
|
73
|
-
* @param {
|
|
74
|
-
* @param {{ visible?: boolean, material?: 'flat' | 'wire', apply?: (obj: any) => (() => void) | void }} patch flat = unlit base colour, wire = wireframe, apply = your own change (return its undo)
|
|
75
|
+
* @param {any} target a thing id (engine.thing), an object name or any Object3D; with a key, any three.js object (renderer, scene, a light, a material) is that part's set() values, written on its debug layer above every game owner
|
|
76
|
+
* @param {string | { visible?: boolean, material?: 'flat' | 'wire', apply?: (obj: any) => (() => void) | void }} patch flat = unlit base colour, wire = wireframe, apply = your own change (return its undo); a string: the property to write
|
|
77
|
+
* @param {any} [value] with a property name: its value, of the type the property holds (null works: scene.fog off)
|
|
75
78
|
* @example const h = engine.debug.override('ai-session', 'windmill', { material: 'flat' }); h.remove(); // or engine.debug.clear('ai-session')
|
|
79
|
+
* @example engine.debug.override('ai-session', engine.renderer, 'toneMappingExposure', 3);
|
|
80
|
+
* engine.debug.override('ai-session', engine.scene, 'fog', null); // the same picture with no fog
|
|
81
|
+
* @returns {{ remove(): void }}
|
|
76
82
|
*/
|
|
77
|
-
override(owner: string, target:
|
|
83
|
+
override(owner: string, target: any, patch: string | {
|
|
78
84
|
visible?: boolean;
|
|
79
85
|
material?: "flat" | "wire";
|
|
80
86
|
apply?: (obj: any) => (() => void) | void;
|
|
81
|
-
}):
|
|
87
|
+
}, value?: any): {
|
|
88
|
+
remove(): void;
|
|
89
|
+
};
|
|
82
90
|
/**
|
|
83
|
-
* Remove every override of one owner (nothing else),
|
|
91
|
+
* Remove every override of one owner (nothing else), and its view; returns how many were removed
|
|
84
92
|
* @param {string} owner
|
|
85
93
|
*/
|
|
86
94
|
clear(owner: string): number;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Ops.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/ops/Ops.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/**
|
|
3
3
|
* engine.ops: one entry point for the discrete things players and NPCs decide to do. define registers, run executes (sync, logged), can only asks, list says what exists / what is possible now, recent reads the log.
|
|
4
4
|
* Inside an op use ctx.actor (world record id, default engine.actor = 'player'), never engine.player: NPCs and network peers run the same op as themselves.
|
|
5
5
|
*/
|
|
6
6
|
export class Ops {
|
|
7
|
-
/** Counter
|
|
7
|
+
/** Counter that only goes up: each committed op, undo, load and rollback bumps it (a failed op that changed nothing does not); every run result carries it, so "did anything change since I looked" is one compare */
|
|
8
8
|
revision: number;
|
|
9
9
|
set historySize(n: number);
|
|
10
10
|
/** History entries kept (ring, default 256); setting it clears the history */
|
|
@@ -77,7 +77,7 @@ export class Ops {
|
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* Run an op now (synchronously): checks args (dev), calls can, then run, and logs it. Returns { ok: true, value, revision } or { ok: false, code, facts, nextActions, revision } (revision = ops.revision, counts committed ops); can may also return { code, facts?, nextActions? }.
|
|
80
|
-
* Pass a fresh args object each call (it is kept in the history; in dev it is frozen). opts.source: 'player' | 'game' | 'bridge' | 'test' | 'replay' | 'net'
|
|
80
|
+
* Pass a fresh args object each call (it is kept in the history; in dev it is frozen). opts.source: 'player' | 'game' | 'bridge' | 'test' | 'replay' | 'net' | 'editor'
|
|
81
81
|
* (default: 'game' inside a fixed step, 'player' between steps); opts.actor: who does it (world record id, default engine.actor, which is 'player' unless the game hands control elsewhere).
|
|
82
82
|
* @param {string} name
|
|
83
83
|
* @param {object} [args]
|
|
@@ -210,6 +210,7 @@ export class Ops {
|
|
|
210
210
|
* @param {any} args
|
|
211
211
|
* @param {{ reason: string, actor?: string, source?: string }} why source defaults to 'net'
|
|
212
212
|
* @returns {void}
|
|
213
|
+
* @experimental
|
|
213
214
|
*/
|
|
214
215
|
refused(name: string, args: any, { reason, actor, source }: {
|
|
215
216
|
reason: string;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/control.js (edit the JSDoc in the source, then run npm run map)
|
|
2
|
-
export namespace CONTROL_LAYERS {
|
|
3
|
-
let base: number;
|
|
4
|
-
let script: number;
|
|
5
|
-
let cutscene: number;
|
|
6
|
-
let net: number;
|
|
7
|
-
}
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/ops/control.js (edit the JSDoc in the source, then run npm run map)
|
|
8
2
|
/** engine.control (made for every engine in services.js; the characters module tells it how to find a character by id) */
|
|
9
3
|
export class Control {
|
|
10
4
|
constructor(engine: any);
|
|
@@ -13,13 +7,13 @@ export class Control {
|
|
|
13
7
|
* charge (dt on the character's time channel): a direction moves it, null stands still (gravity and the idle pose go on), false skips the
|
|
14
8
|
* move this step (you placed it yourself). Without step, move it with handle.move(x, z, run, dt), which does nothing while paused.
|
|
15
9
|
* @param {any} who a Character, an NPC handle or a character id ('player', an NPC id)
|
|
16
|
-
* @param {{ owner: string, layer?: 'base' | 'script' | 'cutscene' | 'net', step?: (dt: number, ch: any) => ({ x: number, z: number, run?: boolean } | null | false | void) }} o
|
|
10
|
+
* @param {{ owner: string, layer?: 'base' | 'script' | 'cutscene' | 'physics' | 'net', step?: (dt: number, ch: any) => ({ x: number, z: number, run?: boolean } | null | false | void) }} o
|
|
17
11
|
* @returns {{ owner: string, layer: string, id: string, readonly active: boolean, move(x: number, z: number, run?: boolean, dt?: number): boolean, remove(): void }}
|
|
18
12
|
* @example const h = engine.control.take(player, { owner: 'tutorial', layer: 'script', step: () => ({ x: 0, z: 1 }) }); ... h.remove();
|
|
19
13
|
*/
|
|
20
14
|
take(who: any, o?: {
|
|
21
15
|
owner: string;
|
|
22
|
-
layer?: "base" | "script" | "cutscene" | "net";
|
|
16
|
+
layer?: "base" | "script" | "cutscene" | "physics" | "net";
|
|
23
17
|
step?: (dt: number, ch: any) => ({
|
|
24
18
|
x: number;
|
|
25
19
|
z: number;
|
|
@@ -50,6 +44,6 @@ export class Control {
|
|
|
50
44
|
has(who: any, owner: string): boolean;
|
|
51
45
|
/** describe().control: every held character by id, as of() */
|
|
52
46
|
describe(): {};
|
|
53
|
-
/** Drop every hold on a character (its record left the world, or a record-less character was disposed) @param {string} id */
|
|
47
|
+
/** Drop every hold on a character (its record left the world, or a record-less character was disposed) @param {string} id @experimental */
|
|
54
48
|
forget(id: string): void;
|
|
55
49
|
}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/Saves.js (edit the JSDoc in the source, then run npm run map)
|
|
1
|
+
// Generated by npm run map, do not edit by hand. Source: packages/engine/core/saves/Saves.js (edit the JSDoc in the source, then run npm run map)
|
|
2
2
|
/** engine.saves handles saving. Each module registers "how to save and load"; supports multiple slots, autosave and export / import. */
|
|
3
3
|
export class Saves {
|
|
4
|
-
/** Save name prefix (start of the key names in the localStorage fallback, and of the IndexedDB database name) */
|
|
5
|
-
prefix: string;
|
|
6
4
|
/**
|
|
7
5
|
* Storage layer: saves in the IndexedDB slots store, attachments (by group, e.g. 'photo') in the blobs store; mode 'localStorage' without IndexedDB.
|
|
8
6
|
* @type {{ mode: 'idb' | 'localStorage', blobs(group?: string): Promise<{ group: string, id: string, at: number, blob: Blob, meta: any }[]>,
|
|
9
7
|
* putBlob(group: string, id: string, blob: Blob, meta?: any, at?: number): Promise<void>, deleteBlob(group: string, id: string): Promise<void> }}
|
|
8
|
+
* @experimental
|
|
10
9
|
*/
|
|
11
10
|
store: {
|
|
12
11
|
mode: "idb" | "localStorage";
|
|
@@ -31,9 +30,6 @@ export class Saves {
|
|
|
31
30
|
* shape.
|
|
32
31
|
* A save whose part is newer than this build's version is refused as a whole (load returns false, the save is kept).
|
|
33
32
|
* A part registered after a save was loaded (a module installed later) is handed its data from that save at once.
|
|
34
|
-
* movedFrom: { oldPart: data => newData } when this part's data used to be saved under another part's name (a module split in two: the calendar's
|
|
35
|
-
* time and day were part 'sky'); an old save without this part but with oldPart hands that data, converted, to this part, and oldPart is dropped
|
|
36
|
-
* (unless a registered part still owns that name).
|
|
37
33
|
* atomic: true joins this part to atomic ops: it is copied before an atomic op runs and put back if the op fails (plain data only; afterLoad does not run on rollback).
|
|
38
34
|
* checkNewGame(data): dev only, called once start() finished with this part's data in the new-game state, to warn about what should not be there yet
|
|
39
35
|
* (world: records placed by code instead of content). The part knows its own format; core only hands the data over.
|
|
@@ -51,12 +47,39 @@ export class Saves {
|
|
|
51
47
|
*/
|
|
52
48
|
get versions(): Record<string, number>;
|
|
53
49
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
* @
|
|
57
|
-
* @
|
|
50
|
+
* Store a binary attachment outside the world save (a photo, a replay). It rides in the queue of save writes, so flush() waits for it, and exportFile() carries it.
|
|
51
|
+
* Pass a function to make the bytes when the write runs: flush() then waits for that too. Without IndexedDB it is not kept.
|
|
52
|
+
* @example await engine.saves.putAttachment('replay', 'run-1', blob, { score: 12 });
|
|
53
|
+
* @param {string} group what the attachment is for
|
|
54
|
+
* @param {string} id unique inside the group; the same id replaces
|
|
55
|
+
* @param {Blob | (() => Promise<Blob>)} blob
|
|
56
|
+
* @param {any} [meta] plain data kept with it
|
|
57
|
+
* @returns {Promise<void>}
|
|
58
|
+
* @experimental
|
|
58
59
|
*/
|
|
59
|
-
|
|
60
|
+
putAttachment(group: string, id: string, blob: Blob | (() => Promise<Blob>), meta?: any): Promise<void>;
|
|
61
|
+
/** Delete an attachment; no such id is fine @param {string} group @param {string} id @returns {Promise<void>} @experimental */
|
|
62
|
+
removeAttachment(group: string, id: string): Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* The attachments of a group, once storage is ready. Empty without IndexedDB.
|
|
65
|
+
* @param {string} group
|
|
66
|
+
* @returns {Promise<{ group: string, id: string, at: number, blob: Blob, meta: any }[]>}
|
|
67
|
+
* @experimental
|
|
68
|
+
*/
|
|
69
|
+
attachments(group: string): Promise<{
|
|
70
|
+
group: string;
|
|
71
|
+
id: string;
|
|
72
|
+
at: number;
|
|
73
|
+
blob: Blob;
|
|
74
|
+
meta: any;
|
|
75
|
+
}[]>;
|
|
76
|
+
/**
|
|
77
|
+
* A localStorage key for what belongs to this game but is not a save (settings, a last-used tab): it shares the game's name, so two games on one site stay apart, and stays out of list().
|
|
78
|
+
* @example localStorage.setItem(engine.saves.storageKey('lastTab'), 'map');
|
|
79
|
+
* @param {string} name
|
|
80
|
+
* @returns {string}
|
|
81
|
+
*/
|
|
82
|
+
storageKey(name: string): string;
|
|
60
83
|
/** Wait for all queued disk writes to finish (for tests and before the page closes) @returns {Promise<void>} */
|
|
61
84
|
flush(): Promise<void>;
|
|
62
85
|
/**
|
|
@@ -123,7 +146,7 @@ export class Saves {
|
|
|
123
146
|
}[];
|
|
124
147
|
/** Delete a slot. Returns a Promise (disk write done); awaiting is optional @param {string} slot @returns {Promise<void>} */
|
|
125
148
|
remove(slot: string): Promise<void>;
|
|
126
|
-
/** Export as a piece of text (can be copied as a backup; synchronous, without binary attachments) @param {string} [slot] @returns {string} */
|
|
149
|
+
/** Export as a piece of text (can be copied as a backup; synchronous, without binary attachments) @param {string} [slot] @returns {string} @experimental */
|
|
127
150
|
export(slot?: string): string;
|
|
128
151
|
/**
|
|
129
152
|
* Import text from export() into a slot (default 'imported'); checked like importFile and written before it resolves.
|
|
@@ -140,6 +163,7 @@ export class Saves {
|
|
|
140
163
|
* @param {{ files?: boolean }} [opts]
|
|
141
164
|
* @returns {Promise<boolean>}
|
|
142
165
|
* @example engine.saves.exportFile('slot1');
|
|
166
|
+
* @experimental
|
|
143
167
|
*/
|
|
144
168
|
exportFile(slot?: string, opts?: {
|
|
145
169
|
files?: boolean;
|
|
@@ -167,4 +191,4 @@ export class Saves {
|
|
|
167
191
|
remove(): void;
|
|
168
192
|
};
|
|
169
193
|
}
|
|
170
|
-
import type { SaveProvider } from '
|
|
194
|
+
import type { SaveProvider } from '../../../core';
|