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
package/docs/api/events.md
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
- `day:start` [day: number] A new day (the argument is the day number, starting at 1; needs the calendar module)
|
|
30
30
|
- `season:change` [season: string] Season changed (the argument is the season name, e.g. 'autumn')
|
|
31
31
|
- `mod:end` [{ target: string; owner: string; id: string | null }] A mod with `for` ran out (engine.mod(target, { owner, for })): target is the quantity's name, id the record for per-record ones
|
|
32
|
-
- `time:skip` [{ seconds: number }] engine.skip jumped game time forward (seconds =
|
|
32
|
+
- `time:skip` [{ seconds: number }] engine.skip jumped game time forward (seconds = calendar seconds skipped); timers and world catch-up already ran
|
|
33
33
|
- `weather:lightning` [] Lightning strike (weather module)
|
|
34
34
|
- `weather:change` [change: { from: string; to: string }] engine.weather.set switched to another weather name (once, when the blend starts; setting the same name again does not fire)
|
|
35
35
|
- `camera:shot` [CameraShotEvent] The fixed-shot camera switched shots
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
- `character:launch` [{ character: Character; speed: number; owner: string }]
|
|
39
39
|
- `character:fall` [{ character: Character; safe: Vector3 | null; preventDefault(): void…
|
|
40
40
|
- `character:model` [{ character: Character; model: Object3D }] A character's model named by asset finished loading and replaced the placeholder body (same root; anim is now set)
|
|
41
|
+
- `character:step` [{ character: Character }] A foot of a walking character came down; character.groundType() is what it stepped on
|
|
41
42
|
- `character:land` [{ character: Character; impact: number }] A character landed; impact is the landing speed (m/s), the larger the harder the fall
|
|
42
43
|
- `character:water` [{ character: Character; in: boolean; mode: string; depth: number }] A character went into or out of deep water (water option): in true on entering, mode what the water option did there ('swim' / 'block' / 'wade', or what the function returned)
|
|
43
44
|
- `dialogue:start` [speaker: string] Dialogue started; the argument is the dialogue script name
|
|
@@ -70,8 +71,9 @@
|
|
|
70
71
|
- `vegetation:remove` [VegetationRemoveEvent] A vegetation instance was chopped / removed
|
|
71
72
|
- `vegetation:restore` [VegetationRemoveEvent] A vegetation instance was restored
|
|
72
73
|
- `music:change` [MusicChangeEvent] Background music changed track (null means silence)
|
|
73
|
-
- `music:stinger` [{ name: string }] A stinger was played
|
|
74
|
+
- `music:stinger` [{ name: string; played: boolean }] A stinger was played
|
|
74
75
|
- `state:applied` [StateParams] Scenario parameters were applied (URL parameters or engine.applyState)
|
|
76
|
+
- `state:placed` [{ x: number; z: number }] A scenario (at, pos) moved the player: a camera or view that eases jumps there
|
|
75
77
|
- `anim:end` [{ root: Object3D; state: string }] A one-shot action of the animation state machine finished
|
|
76
78
|
- `world:add` [{ id: string; kind: string }] A record was added to world
|
|
77
79
|
- `world:change` [{ id: string; kind: string; keys: string[] }] world.set changed fields (keys lists which)
|
|
@@ -84,7 +86,7 @@
|
|
|
84
86
|
- `net:sync` [{ tick: number; full: boolean }] Client (net): host state applied (full: a whole snapshot, else a diff); redraw UI from state here
|
|
85
87
|
- `net:result` [{ seq: number; name: string; ok: boolean; code: string | null; value… Client (net): the host's answer to an op request (seq from ops.run's return value; tick is the host's), sent after the state it caused
|
|
86
88
|
- `engine:error` [EngineError] A gameplay error in development / testing; gameplay is frozen (error severity levels, see engine.error)
|
|
87
|
-
- `module:disabled` [{ name: string; message: string }] A
|
|
89
|
+
- `module:disabled` [{ name: string; message: string }] A picture or ui module errored and was disabled (the game continues)
|
|
88
90
|
- `vehicle:enter` [{ character: Character; vehicle: Rideable }] A character boarded a vehicle
|
|
89
91
|
- `vehicle:exit` [{ character: Character; vehicle: Rideable }] A character exited a vehicle
|
|
90
92
|
- `flow:change` [{ from: string; to: string }] Game flow state changed
|
package/docs/api/flow.md
CHANGED
|
@@ -11,7 +11,7 @@ Game flow and scene transitions (flow() module)
|
|
|
11
11
|
- `flow.transition(fn: () => any, opts?: FlowTransitionOptions) → Promise<void>` — Scene transition: lock input -> fade to black -> fade out music -> autosave -> fn() -> wait for modules to be ready -> fade in -> unlock; multiple calls queue up
|
|
12
12
|
- Properties:
|
|
13
13
|
- `state: string` Current state name
|
|
14
|
-
- `transitioning: boolean` A scene transition is in progress
|
|
14
|
+
- `transitioning: boolean` (experimental) A scene transition is in progress
|
|
15
15
|
|
|
16
16
|
## Data structures
|
|
17
17
|
- **FlowStateDef** A flow state (title, playing, paused, game over...)
|
package/docs/api/grids.md
CHANGED
|
@@ -5,7 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
## Methods and properties
|
|
7
7
|
- `grids.add(name: string, opts?: { cell?, origin?, size?, zone?, flat?, y?, … }) → Grid` — Create a grid. cell: edge length (m, default 1); origin: world [x, z] of the min corner of cell [0, 0]; size: [cells wide, cells deep] (omit = unbounded); zone: level name (tiles only show there); flat: max height difference under a footprint (m, default 0.5); y: height of level 0 (m; default the ground under each cell), levelHeight: meters per level (default 3; level n is at y + n * levelHeight); mapping: { toCell(x, z) => [i, j], center([i, j]) => [x, z] } replaces the square cell <-> world math (one place: toCell, toWorld, tiles, flatness); layers: authored cells { zone: [[i, j, { buildable: true }], ...] } (content/grids.js): the baseline a save diffs against, so a save keeps only changed cells. Example: `const room = engine.grids.add('room', { cell: 0.5, origin: [-3, -3], size: [12, 12], zone: 'house' })`
|
|
8
|
-
- `grids.get(name: string) → Grid |
|
|
8
|
+
- `grids.get(name: string) → Grid | undefined` — A grid by name, or undefined when there is none
|
|
9
9
|
- `grids.list() → Grid[]` — All grids (a new array)
|
|
10
10
|
- `grids.define(name: string, rule: import("./Grid.js").GridRule)` — Register what can be placed and its rules. size [w, d] in cells (default [1, 1]); kind of the world record (default the item name); occupy: the occupancy layer it takes (default 'main'): things in different layers share a cell ('floor' tile, 'main' table, 'wall' lamp), two in one layer do not; ground: allowed engine.groundType values; layer: { layerName: field } that must be truthy on every cell (reason 'not' + Field, e.g. notBuildable); flat: max height difference (overrides the grid's); fields: copied into the record; can(e, { grid, cell, rotation, cells, level }): your own rule. Example: `engine.grids.define('tower', { size: [2, 2], layer: { zone: 'buildable' }, fields: { range: 6 } }) // tower defense`
|
|
11
|
-
- `grids.preview(opts: { grid, item, from?, rotate?, rotation?,
|
|
11
|
+
- `grids.preview(opts: { grid, item, from?, rotate?, rotation?, draw? }) → { cell, rotation, ok, code, rotate, place, … }` — Show where an item would go: the target cell under the pointer ('pointer', default), in front of the player ('front') or from your function, turned by the input action rotate (default name 'rotate'; the game binds it, e.g. presets.bindings.gridRotate; the engine binds no key itself), light when can() passes, dark otherwise (neutral tool colors; grids({ ok, bad }) override them). draw: false = no visual; (engine) => ({ update(view), hide(), dispose() }) = your own; pv.material is the default box's three.js material. place() runs grid.place with what is shown. Example: `engine.input.bind({ place: ['Mouse0'], ...presets.bindings.gridRotate }); // the game's own bindings const pv = engine.grids.preview({ grid: 'field', item: 'tower' }); engine.onFrame(() => { if (engine.input.pressed('place')) { const r = pv.place(); if (!r.ok) toast(engine, engine.t('grid.' + r.code)); } });`
|
|
12
|
+
- Properties:
|
|
13
|
+
- `ok: any` Preview color where it can be placed, read when a preview is made
|
|
14
|
+
- `bad: any` Preview color where it cannot be placed, read when a preview is made
|
|
15
|
+
- `previewOpacity: number` Opacity of the preview box, read when a preview is made
|
|
16
|
+
- `previewHeight: number` Height of the preview box (meters), read when a preview is made
|
|
17
|
+
- `tiles: Record<string, Record<string, any>>` Tile colors by layer name, { layer: { field: color } } (first truthy field of a cell wins), read when a layer is made
|
|
18
|
+
- `tileLift: number` Height of tiles above the ground (meters), read when a layer is made
|
package/docs/api/ground.md
CHANGED
|
@@ -6,11 +6,10 @@
|
|
|
6
6
|
- `ground.has(x: number, z: number) → boolean` — Is there ground at (x, z). Always true except off the outline of terrain({ shape }), where height is -Infinity and slope 0. Example: `if (engine.ground.has(x, z)) engine.snapToGround(chest);`
|
|
7
7
|
- `ground.voidY() → number` — Height below which something has fallen out of the world (terrain:void): engine.terrain.voidY with terrain({ shape }), else -Infinity
|
|
8
8
|
- `ground.forEachCollider(x: number, z: number, range: number, fn: (cx, cz, r) => void)` — Optional: iterate the circular colliders (tree trunks etc.) within range meters of (x, z)
|
|
9
|
-
- `ground.viewRange() → number` — Optional: how far (meters) the ground is shown around a stream source now; stream entries build within it by default (else
|
|
10
|
-
- `ground.chunkCollision(cx: number, cz: number) → any` — Optional: collision data of a chunk (used by the physics module)
|
|
11
|
-
- `ground.staticTrimeshes() → { positions, indices }[]` — Optional: static triangle mesh (the level module provides it for physics)
|
|
12
|
-
- `ground.staticVersion() → number` — Optional: version number of the static mesh; rebuild when it changes
|
|
13
|
-
- `ground.navGeometry() → { positions, indices }` — Optional: triangle mesh for building the navmesh (walkable surfaces + obstacle volumes), used by the nav module
|
|
9
|
+
- `ground.viewRange() → number` — (experimental) Optional: how far (meters) the ground is shown around a stream source now; stream entries build within it by default (else engine.uniforms.uViewDistance)
|
|
10
|
+
- `ground.chunkCollision(cx: number, cz: number) → any` — (experimental) Optional: collision data of a chunk (used by the physics module)
|
|
11
|
+
- `ground.staticTrimeshes() → { positions, indices }[]` — (experimental) Optional: static triangle mesh (the level module provides it for physics)
|
|
12
|
+
- `ground.staticVersion() → number` — (experimental) Optional: version number of the static mesh; rebuild when it changes
|
|
14
13
|
- Properties:
|
|
15
14
|
- `waterLevel: number` Global water level (meters); -Infinity when there is no water
|
|
16
15
|
- `chunkSize?: number` Optional: chunk edge length (meters)
|
package/docs/api/hud.md
CHANGED
|
@@ -7,7 +7,9 @@ Objective markers, counters, progress bars (hud() module)
|
|
|
7
7
|
|
|
8
8
|
## Methods and properties
|
|
9
9
|
- `hud.marker(target: HudTarget, opts?: HudMarkerOptions) → HudMarker` — Add an objective marker: target is an object, position or place name
|
|
10
|
-
- `hud.counter(id: string, opts: { label?, icon?, value?, max?, anchor? })` — Counter or text status (calling again with the same id = update; calling every frame is fine): counter('fish', { label: '鱼', value: 2, max: 5 }), counter('clock', { value: '08:30' }); no value = the label alone
|
|
10
|
+
- `hud.counter(id: string, opts: { label?, icon?, value?, max?, anchor? })` — Counter or text status (calling again with the same id = update; calling every frame is fine): counter('fish', { label: '鱼', value: 2, max: 5 }), counter('clock', { value: '08:30' }); no value = the label alone, no label = the value alone (the id is not shown)
|
|
11
|
+
- `hud.bump(id: string, n?: number) → number` — Add n (default 1) to a number counter, return the new value; one not declared yet starts at 0 with its id as the label
|
|
12
|
+
- `hud.value(id: string) → number | string | undefined` — Current value of a counter or bar (number or text), undefined when there is none; reads what interactions.add({ counter }) has added up
|
|
11
13
|
- `hud.bar(id: string, opts: { value, max?, label?, anchor? })` — Progress bar (calling again with the same id = update; calling every frame is fine, the DOM is untouched when the value is unchanged), value/max 0–max
|
|
12
14
|
- `hud.remove(id: string)` — Delete a counter or progress bar
|
|
13
15
|
- Properties:
|
|
@@ -29,3 +31,4 @@ Objective markers, counters, progress bars (hud() module)
|
|
|
29
31
|
- `set(opts: HudMarkerOptions)` — Change parameters
|
|
30
32
|
- `setTarget(target: HudTarget)` — Change the target (the marker itself is not rebuilt)
|
|
31
33
|
- `remove()` — Delete
|
|
34
|
+
- **HudAnchor** = `'top-left' | 'top' | 'top-right' | 'left' | 'right' | 'bottom-left' | 'bottom' | 'bottom-right'` — Screen corner / edge a counter or bar column sits at (default 'top-left'); each anchor stacks its own column
|
package/docs/api/i18n.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# engine.i18n (I18n) — engine.i18n: string tables; t(key, params) fetches text and replaces {name} with params
|
|
1
|
+
# engine.i18n (I18n) — engine.i18n: string tables; engine.t(key, params) fetches text and replaces {name} with params
|
|
2
2
|
|
|
3
|
+
- `engine.t(key: string, params?: Record<string, any>) → string` — Get UI text (i18n): {name} in the text takes params.name, {key:action} the label of the key bound to that action; a key with no text comes back as itself. Example: `engine.t('shop.buy', { name: 'Fish' });`
|
|
3
4
|
- `i18n.add(tables: StringTables)` — Register string tables (never overrides text the game gave). Example: `engine.i18n.add({ 'zh-CN': { 'shop.buy': '购买 {name}' }, en: { 'shop.buy': 'Buy {name}' } });`
|
|
4
|
-
- `i18n.setLocale(l: string)` — Switch language ('auto' picks from the browser like createEngine)
|
|
5
|
+
- `i18n.setLocale(l: string)` — (experimental) Switch language ('auto' picks from the browser like createEngine)
|
|
5
6
|
- `i18n.has(key: string) → boolean` — Whether the key exists
|
|
6
|
-
- `i18n.t(key: string, params?: Record<string, any>) → string` — Fetch text; params replace {name}, {key:action} shows the key label. Example: `engine.i18n.t('shop.buy', { name: '鱼' });`
|
|
7
7
|
- Properties:
|
|
8
|
-
- `fallback: string` Language used when a key is missing in the current one (default 'en')
|
|
9
|
-
- `locale: any` Current language, e.g. 'zh-CN' ('zh' and 'zh-Hans' resolve to it, 'en-US' to 'en')
|
|
10
|
-
- `languages: string[]` All available languages
|
|
8
|
+
- `fallback: string` (experimental) Language used when a key is missing in the current one (default 'en')
|
|
9
|
+
- `locale: any` (experimental) Current language, e.g. 'zh-CN' ('zh' and 'zh-Hans' resolve to it, 'en-US' to 'en')
|
|
10
|
+
- `languages: string[]` (experimental) All available languages
|
package/docs/api/input.md
CHANGED
|
@@ -6,24 +6,25 @@
|
|
|
6
6
|
- `input.simulate(action: string, down?: boolean)` — Press (down true) or release an action from code, through the same path as a real key: tests, AI drivers, replays. Presses the action's first bound key and holds it until simulate(action, false), so the player walks like with a held key. Takes action names (moveForward, moveLeft, run, interact, ...; engine.input.actions lists them), not keys; an unknown name throws unknown-name with the closest one. Example: `engine.input.simulate('moveForward'); engine.step(1); engine.input.simulate('moveForward', false)`
|
|
7
7
|
- `input.rebind(action: string, keys: string | string[] | null)` — The player's rebinding (the settings menu calls this and saves it): replaces the game's keys on the settings layer of 'input.keys'. keys null takes the player's choice away (the game's or the default keys show again). Works before the action is declared (a saved binding is restored at start, the module declaring the action comes later). Example: `engine.input.rebind('jump', ['KeyJ']); engine.input.rebind('jump', null); // back to the game's keys`
|
|
8
8
|
- `input.rebound() → Record<string, string[]>` — The player's rebindings now in effect: { action: keys } (what the settings menu saves)
|
|
9
|
-
- `input.keysOf(action: string) → readonly string[]` — 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
|
|
9
|
+
- `input.keysOf(action: string) → readonly string[]` — (experimental) 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
|
|
10
|
+
- `input.isUnbound(action: string) → boolean` — 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 (a mouse-only game): "no key at all" is the fault, whichever key the game or the player chose is not. Example: `if (engine.input.isUnbound('interact')) engine.input.bind(presets.bindings.interact);`
|
|
10
11
|
- `input.label(action: string) → string` — Key name shown in the UI, e.g. "E"
|
|
11
12
|
- `input.down(action: string) → boolean` — Held (a snapshot of this step in fixed, the latest state in frame)
|
|
12
13
|
- `input.pressed(action: string) → boolean` — Just pressed. Read in onFixed / module fixed: pressed since the previous fixed step, true only for this step (counted once however the frame rate varies, never lost); read in onFrame / module frame: pressed this frame (UI keys only). Read gameplay keys in fixed. Example: `engine.onFixed(() => { if (engine.input.pressed('jump')) player.jump(); });`
|
|
13
|
-
- `input.released(action: string) → boolean` — Just released (which copy is read is the same as pressed; for things like release-to-fire after charging). Example: `if (engine.input.released('fire')) shoot(charge);`
|
|
14
|
+
- `input.released(action: string) → boolean` — (experimental) Just released (which copy is read is the same as pressed; for things like release-to-fire after charging). Example: `if (engine.input.released('fire')) shoot(charge);`
|
|
14
15
|
- `input.pressedRaw(action: string) → boolean` — Just pressed, ignoring input contexts (for menus and dialogue themselves, which run while a context blocks the game)
|
|
15
16
|
- `input.push(name: string, opts?: { pass?: boolean; owner?: string }) → { name: string; remove(): void }` — Push an input context (an action group, like a Unity Action Map). The top context shadows lower actions bound to the same key. Opaque by default (nothing below is readable: menus, dialogue, cutscenes); { pass: true } lets unrelated lower actions keep working (vehicle, build mode). Applies at the start of the next fixed step; actions it blocks lose their held state (no stuck keys after a menu closes). Join a context with input.action(name, { context }); menu keys: pressedRaw. Example: `const h = engine.input.push('vehicle', { pass: true }); // vehicle-context actions (brake) work, and shadow gameplay actions on the same key h.remove();`
|
|
16
|
-
- `input.describe() → { stack, unbound, rebound }` — describe().input: the context stack, declared actions nobody bound (unbound
|
|
17
|
+
- `input.describe() → { stack, unbound, rebound }` — describe().input: the context stack, declared actions nobody bound (unbound: isUnbound) and the player's rebindings
|
|
17
18
|
- `input.gate(action: string, owner?: string | { owner?, for?, clock? }) → { owner: string; remove(): void }` — Close one action while anyone holds its gate (stun: no jump; a tutorial: no attack yet), without a whole input context. Same rules as every engine.mod stack (it is the shared point 'input.gate', one entry per owner and action): only the owner opens it, { for } ends it by itself. A closed action reads as not down / pressed / released; describe().holds.gates lists the owners. Example: `const stun = engine.input.gate('jump', { owner: 'stun', for: 1.5 }); // no jumping for 1.5 s; stun.remove() reopens it early`
|
|
18
19
|
- Properties:
|
|
19
20
|
- `look: { dx: number; dy: number; zoom: number }` This frame's look-drag amount (pixels) and wheel notches
|
|
20
21
|
- `pointer: Pointer` Mouse/touch pointer
|
|
21
|
-
- `stick: { x: number; y: number }` On-screen stick (touch)
|
|
22
|
+
- `stick: { x: number; y: number }` (experimental) On-screen stick (touch)
|
|
22
23
|
- `autopilot: Autopilot | null` Auto movement (stress tests, test scripts)
|
|
23
24
|
- `actions: Map<string, { labelKey: string; context: string; optional: …` action name -> its declaration: labelKey (string-table key), context, optional, by (who declared it; null = only bound so far). Keys are not here: keysOf(action) reads the shared point 'input.keys'
|
|
24
|
-
- `lastDevice: "keyboard" | "pad" | "touch"` Most recently used device: UI key hints follow it
|
|
25
|
-
- `touch: boolean` Is this a touch device?
|
|
26
|
-
- `contexts: string[]` Names of the active contexts, bottom to top (pending switches apply at the next fixed step)
|
|
27
|
-
- `holders: { context: string; owner: string; pass: boolean }[]` Who holds input, bottom to top above the base context: [{ context, owner, pass }] (pass: unrelated gameplay actions still read)
|
|
28
|
-
- `enabled: boolean` False while an opaque context (menu, dialogue, cutscene...) covers gameplay: no game action can be read, and cameras ignore
|
|
25
|
+
- `lastDevice: "keyboard" | "pad" | "touch"` (experimental) Most recently used device: UI key hints follow it
|
|
26
|
+
- `touch: boolean` (experimental) Is this a touch device?
|
|
27
|
+
- `contexts: string[]` (experimental) Names of the active contexts, bottom to top (pending switches apply at the next fixed step)
|
|
28
|
+
- `holders: { context: string; owner: string; pass: boolean }[]` (experimental) Who holds input, bottom to top above the base context: [{ context, owner, pass }] (pass: unrelated gameplay actions still read). 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
|
|
29
|
+
- `enabled: boolean` False while an opaque context (menu, dialogue, cutscene...) covers gameplay: no game action can be read, and cameras ignore picture/zoom
|
|
29
30
|
- `axis: { x: number; y: number }` Movement direction: x positive right, y positive forward, length <= 1 (a snapshot of this step in fixed, the latest state in frame)
|
package/docs/api/interactions.md
CHANGED
|
@@ -10,10 +10,10 @@ Interaction prompts (interactions() module)
|
|
|
10
10
|
|
|
11
11
|
## Methods and properties
|
|
12
12
|
- `interactions.add(target: Object3D | PositionLike, opts?: InteractionOptions) → Handle` — Add an interaction: passing an object makes it follow the object, passing a position (Vector3 / [x, y, z] / { x, y, z }) makes a fixed point. Returns a handle { remove() }
|
|
13
|
-
- `interactions.get(id: string) →
|
|
13
|
+
- `interactions.get(id: string) → Interaction | undefined` — The interaction with this id, or undefined. Using one is the op: engine.ops.run('interaction.use', { id }) (no id = the one the actor would pick)
|
|
14
14
|
- Properties:
|
|
15
|
-
- `promptHeight: number` How high the prompt floats (meters)
|
|
16
|
-
- `items:
|
|
15
|
+
- `promptHeight: number` (experimental) How high the prompt floats (meters)
|
|
16
|
+
- `items: Interaction[]` All interactions in the order added (a fresh array each read; get(id) finds one without it)
|
|
17
17
|
- `radius: number` Default reach of add() in meters (2.5)
|
|
18
18
|
- `pickMode: InteractionPick` How the one in front of the actor is chosen; can be changed at runtime
|
|
19
19
|
- `current: any` The interaction the prompt shows right now (null if none)
|
|
@@ -24,10 +24,12 @@ Interaction prompts (interactions() module)
|
|
|
24
24
|
- **InteractionOptions**
|
|
25
25
|
- `id?: string` Stable id for the op interaction.use { id } (default: the world record id it was built for, else a running number)
|
|
26
26
|
- `label?: string | ((object, ctx) => string)` Prompt text, or a function (object, { actor }) returning text; actor = world record id of who looks at it
|
|
27
|
-
- `radius?: number` How close the actor must be (meters),
|
|
27
|
+
- `radius?: number` How close the actor must be (meters), measured from the object's origin in 3D, not its edge, so a large object (a boat, a house) needs a larger radius or a small marker object at the spot to use. Default interactions({ radius }) = 2.5
|
|
28
28
|
- `action?: string` Key action name, default 'interact' (E key). Give one object a second verb by adding another interaction with another action
|
|
29
29
|
- `onUse?: (object: Object3D, ctx: { actor: string }) => any` Called when used, with who uses it (ctx.actor of interaction.use: the local user, a net peer, an NPC). Its return value is the op's value; { ok: false, code } fails the op with that code
|
|
30
30
|
- `enabled?: (object: Object3D, ctx: { actor: string }) => boolean` When this returns false the whole prompt disappears (to show a state such as "growing", don't use enabled: have the label function return different text by state and decide in onUse whether it can be used)
|
|
31
31
|
- `height?: number` How high the prompt floats above the object (meters)
|
|
32
32
|
- `hold?: number` Seconds the key must stay down before onUse runs (0 = a press). The engine counts it and interrupts it on release, leaving reach, enabled() false or locked input (interaction:hold / interaction:interrupt); the prompt gets progress 0-1. The op interaction.use itself is the completed use
|
|
33
33
|
- `approach?: boolean` Walk the player there first (walkTo, stops 1.2 m away), then use it; with radius: Infinity it can be used from anywhere (point-and-click)
|
|
34
|
+
- `once?: boolean` Hide the object after a use and allow no second one (onUse returning { ok: false } leaves it). Saved under id, else the object's name; development throws when it has neither
|
|
35
|
+
- `counter?: string` Name of a HUD counter each use adds 1 to (hud.bump; nothing without hud()). Saved; read the total with hud.value(name)
|
package/docs/api/inventory.md
CHANGED
|
@@ -7,7 +7,7 @@ Inventory (inventory() module)
|
|
|
7
7
|
- `pauseGame?: boolean` true: gameplay freezes (engine.freeze) while the inventory window is open, default false. Also settable at runtime: engine.inventory.pauseGame
|
|
8
8
|
- `capacity?: number` Slot limit of the player inventory, default Infinity (no limit)
|
|
9
9
|
- `maxWeight?: number` Weight limit of the player inventory, default Infinity
|
|
10
|
-
- `defaultStack?: number` Default stack limit, default 99
|
|
10
|
+
- `defaultStack?: number` (experimental) Default stack limit, default 99
|
|
11
11
|
|
|
12
12
|
## Methods and properties
|
|
13
13
|
- `inventory.of(actor?: string) → Container` — The bag of an actor (default engine.actor): the container with the actor's id, created empty on first use; inside an op pass ctx.actor
|
|
@@ -16,22 +16,21 @@ Inventory (inventory() module)
|
|
|
16
16
|
- `inventory.count(x: string) → number` — How many of an item, or of one entry key
|
|
17
17
|
- `inventory.has(x: string, n?: number) → boolean` — Whether there are at least n (default 1)
|
|
18
18
|
- `inventory.list() → ItemEntry[]` — Player inventory entries (for custom UI)
|
|
19
|
-
- `inventory.get(key: string) → ItemEntry |
|
|
20
|
-
- `inventory.add(id: string, n?: number, opts?: { data?, silent? }) →
|
|
19
|
+
- `inventory.get(key: string) → ItemEntry | undefined` — One player inventory entry by key, or undefined
|
|
20
|
+
- `inventory.add(id: string, n?: number, opts?: { data?, silent? }) → ItemAddResult` — Add n to the player inventory (default 1), opts { data, silent }; returns { ok: true, key, added }, or { ok: false, code: 'full' } when none fit
|
|
21
21
|
- `inventory.remove(x: string, n?: number) → boolean` — Remove n (default 1) of an item or entry key, returns false if there are not enough
|
|
22
22
|
- `inventory.trade(take: string, give: string, opts?: { takeN?, giveN?, data?, silent? }) → { ok, code?, facts?, nextActions?, took?, gave?, … }` — Atomic trade: take A (id or entry key) and give B in one all-or-nothing step; failure code 'notEnough' / 'full'. Ops: inventory.trade, engine.ops.undo reverses it
|
|
23
23
|
- `inventory.setData(key: string, data: Record<string, any> | null, n?: number) → string` — Replace a player inventory entry's data for n pieces (default all); returns the key now holding them
|
|
24
24
|
- `inventory.container(id: string, opts?: { capacity?, maxWeight?, items? }) → Container` — Get or create a container (chest, corpse, shelf...); the id can be the id of a world record, and the contents are saved. A second call returns the same one; deleting the world record does not delete the container automatically
|
|
25
25
|
- `inventory.transfer(from: Container | string, to: Container | string, item: string, n?: number) → number` — Move n (default 1) of an item or one entry key between containers (pieces keep data and key); moves fewer if the target cannot hold them all, returns how many were actually moved
|
|
26
26
|
- `inventory.removeContainer(id: string) → boolean` — Delete a container together with its contents ('player' cannot be deleted), returns whether one was deleted
|
|
27
|
-
- `inventory.contents() → Record<string, any[]>` — Every container's items as plain data, the player bag included: { [containerId]: entries } (what setContents takes; net syncs through these two)
|
|
28
|
-
- `inventory.setContents(data: Record<string, any[] | null>, opts?: { only?: boolean })` — Replace containers' items from contents() data, silently like a save load; a null entry empties that container, only: true empties the rest too
|
|
27
|
+
- `inventory.contents() → Record<string, any[]>` — (experimental) Every container's items as plain data, the player bag included: { [containerId]: entries } (what setContents takes; net syncs through these two)
|
|
28
|
+
- `inventory.setContents(data: Record<string, any[] | null>, opts?: { only?: boolean })` — (experimental) Replace containers' items from contents() data, silently like a save load; a null entry empties that container, only: true empties the rest too
|
|
29
29
|
- Properties:
|
|
30
30
|
- `pauseGame: boolean` true: gameplay freezes while the inventory window is open (set from inventory({ pauseGame }) or at runtime)
|
|
31
|
-
- `
|
|
32
|
-
- `
|
|
33
|
-
- `
|
|
34
|
-
- `slotsUsed: number` Slots used
|
|
31
|
+
- `capacity: number` (experimental) Slot limit of the player inventory
|
|
32
|
+
- `bag: Container` (experimental) Player inventory: the bag of engine.actor (= of())
|
|
33
|
+
- `defaultStack: number` (experimental)
|
|
35
34
|
|
|
36
35
|
## Data structures
|
|
37
36
|
- **ItemDef** Item definition
|
|
@@ -53,11 +52,11 @@ Inventory (inventory() module)
|
|
|
53
52
|
- `data?: Record<string, any>` The piece's own data (a dropped sword keeps its durability)
|
|
54
53
|
- `name?: string` Name in the prompt ("Pick up {name}"), default the item's name
|
|
55
54
|
- `model?: string` Shape on the ground: a model name from an asset pack (default the item's model, else 'pickup:<item>', else 'pickup', else a gray box)
|
|
56
|
-
- `color?: ColorLike` Color of the gray placeholder / a geometry-only model (default the item's color, else
|
|
55
|
+
- `color?: ColorLike` Color of the gray placeholder / a geometry-only model (default the item's color, else pickups({ color }))
|
|
57
56
|
- `radius?: number` Reach in meters, default pickups({ radius }) (2)
|
|
58
57
|
- `auto?: boolean` Taken by walking into it (no key press, no prompt), by every actor in pickups.takers
|
|
59
58
|
- `mesh?: Object3D | null` The game's own three.js object for this one pickup (only detached when it goes; otherwise the model name decides the shape)
|
|
60
|
-
- `respawnSeconds?: number`
|
|
59
|
+
- `respawnSeconds?: number` Calendar seconds until it reappears, 0 = never reappears
|
|
61
60
|
- `bob?: boolean` Bob up and down and rotate, default true
|
|
62
61
|
- `initial?: boolean` Pickup authored in content (needs an id): the initial record of world; saves record only being picked up / waiting to respawn, with identical results whether the load comes before or after this spawn
|
|
63
62
|
- `zone?: string | null` Which zone it belongs to (a level name, see world.zone): the data stays across level changes (a picked-up one stays picked up)
|
package/docs/api/jobs.md
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
- `jobs.add(work: (() => T) | (() => Generator<any, T, a…) | Generator<any, T, any> | …, opts?: { priority?, apply?, lag?, valid? }) → Promise<T>` — Add a job: a plain function runs in one go, a generator may pause at each yield until the next frame; higher priority runs first; returns the job's result. A job that changes gameplay state passes apply: the result takes effect on a fixed tick via engine.commits (lag fixed steps later, default 30), and is finished on the spot if not done by then, so machine speed does not affect gameplay. Such a job must be a plain function or generator (it cannot return a Promise). With apply, the returned Promise resolves when the work finishes, before apply may have run; put logic that needs "state already changed" inside apply. A step over slowStepMs warns in dev to slice it with yield. Example: `await engine.jobs.add(function* () { for (const p of props) { place(p); yield; } }, { priority: 10 });`
|
|
4
4
|
- `jobs.run(opts?: { deterministic?: boolean })` — Run the queue (the engine calls this each frame): by millisecond budget by default; deterministic: true ignores real time and drains it (used by step)
|
|
5
5
|
- Properties:
|
|
6
|
-
- `budgetMs: number` Milliseconds allowed per frame, default 3
|
|
7
|
-
- `loadingMs: number` Milliseconds allowed per frame while the loading screen is up, default 12
|
|
8
|
-
- `maxSteps: number` Max steps per deterministic run (stops jobs that keep adding jobs from hanging), default 100000
|
|
9
|
-
- `slowStepMs: number` A step slower than this many ms warns in dev (default 8)
|
|
10
|
-
- `pending: number` Number of jobs not yet finished
|
|
6
|
+
- `budgetMs: number` (experimental) Milliseconds allowed per frame, default 3
|
|
7
|
+
- `loadingMs: number` (experimental) Milliseconds allowed per frame while the loading screen is up, default 12
|
|
8
|
+
- `maxSteps: number` (experimental) Max steps per deterministic run (stops jobs that keep adding jobs from hanging), default 100000
|
|
9
|
+
- `slowStepMs: number` (experimental) A step slower than this many ms warns in dev (default 8)
|
|
10
|
+
- `pending: number` (experimental) Number of jobs not yet finished
|
package/docs/api/level.md
CHANGED
|
@@ -10,24 +10,23 @@ Hand-built level (level() module)
|
|
|
10
10
|
- `cellSize?: number` Heightfield cell size (meters), default 0.5
|
|
11
11
|
- `outside?: number` Ground height outside the level (meters), default 0
|
|
12
12
|
- `waterLevel?: number` Water surface height (meters), default no water
|
|
13
|
-
- `colliderPad?: number` Expand the collision box outward by this much (meters)
|
|
14
|
-
- `colliderHeight?: number` Minimum height of the collision box (meters)
|
|
15
|
-
- `sharpEdge?: number` Treat it as a step edge when the height difference between adjacent grid points exceeds this (meters), default 0.6
|
|
16
|
-
- `hideMarkers?: boolean` Hide the marker placeholder meshes, default true
|
|
17
|
-
- `addToScene?: boolean` Add the scene to engine.scene, default true
|
|
13
|
+
- `colliderPad?: number` (experimental) Expand the collision box outward by this much (meters)
|
|
14
|
+
- `colliderHeight?: number` (experimental) Minimum height of the collision box (meters)
|
|
15
|
+
- `sharpEdge?: number` (experimental) Treat it as a step edge when the height difference between adjacent grid points exceeds this (meters), default 0.6
|
|
16
|
+
- `hideMarkers?: boolean` (experimental) Hide the marker placeholder meshes, default true
|
|
17
|
+
- `addToScene?: boolean` (experimental) Add the scene to engine.scene, default true
|
|
18
18
|
|
|
19
19
|
## Methods and properties
|
|
20
20
|
- `level.marker(name: string) → LevelMarker | null` — Get a marker, null if none
|
|
21
21
|
- `level.markersWith(prefix: string) → LevelMarker[]` — Get all markers whose names start with prefix, e.g. markersWith('npc_')
|
|
22
|
-
- `level.unload()` — Unload the level (the scene is fully deleted with engine.remove; collision, ray registrations and things registered with track are removed together)
|
|
22
|
+
- `level.unload()` — (experimental) Unload the level (the scene is fully deleted with engine.remove; collision, ray registrations and things registered with track are removed together)
|
|
23
23
|
- `level.load(urlOrScene: string | Object3D) → Promise<void>` — Change level: unload the current one, load the new one (glTF path/asset name, or a THREE object), and emit level:loaded when done. When a load changes level, the save system waits for it
|
|
24
24
|
- `level.track(handle: T) → T` — Register things that belong to the current level and need not be kept (the { remove() } handles of triggers...); they are deleted automatically on level change / unload; returns the same handle. world data that keeps state (NPCs, pickups, props) needs no registration: with a zone, a level change only tears down the model
|
|
25
25
|
- Properties:
|
|
26
26
|
- `root: Object3D | null` Scene root node
|
|
27
|
-
- `object: Object3D | null` Same as root (the name consistent with player.object and ent.object)
|
|
28
27
|
- `markers: Record<string, LevelMarker>` All markers: name -> marker
|
|
29
28
|
- `spawn: Vector3` Spawn point position
|
|
30
|
-
- `heightfield: any` Heightfield (for debugging)
|
|
29
|
+
- `heightfield: any` (experimental) Heightfield (for debugging)
|
|
31
30
|
- `ready: boolean` Whether loading is finished
|
|
32
31
|
|
|
33
32
|
## Data structures
|
package/docs/api/lightPool.md
CHANGED
|
@@ -12,14 +12,13 @@ Light pool: many light sources, a fixed number of real lights (lightPool() modul
|
|
|
12
12
|
|
|
13
13
|
## Methods and properties
|
|
14
14
|
- `lightPool.add(position: PositionLike, opts?: LightSourceOptions) → LightSource` — Register a light source at a position (an Object3D: it follows that object every frame). Example: `const torch = engine.lightPool.add(torchMesh, { color: 0xffa040, intensity: 4, distance: 8, glow: haloSprite }); torch.set({ intensity: 0 }); // put out: its light goes to another torch`
|
|
15
|
-
- `lightPool.usage() → LightPoolUsage` — What the pool is doing now (also in describe().lightPool)
|
|
16
15
|
- Properties:
|
|
17
16
|
- `lights: Object3D[]` The real three.js lights, created once at install and never added, removed or hidden (the pool sets their position, color, intensity)
|
|
18
17
|
- `focus: PositionLike | null` Distance is measured from this object / position; null = the camera
|
|
19
18
|
|
|
20
19
|
## Data structures
|
|
21
20
|
- **LightSourceOptions** Options of lightPool.add(position, opts): one light source (a torch, lamp, campfire, muzzle flash...)
|
|
22
|
-
- `name?: string` Name shown in
|
|
21
|
+
- `name?: string` Name shown in describe().lightPool
|
|
23
22
|
- `type?: 'point' | 'spot'` 'point' (default) or 'spot' (needs lightPool({ spot: n }))
|
|
24
23
|
- `color?: ColorLike` Light color, default white
|
|
25
24
|
- `intensity?: number` three.js intensity, default 1; 0 = off (gives its light away). With decay 2 a surface d m away gets intensity / d^2: pick it for the distance to what it lights (one that pools on a street 4 m below blows a wall 1 m away to white). Example values are no targets: threedog shot / snap name a light that glares.
|
|
@@ -32,7 +31,7 @@ Light pool: many light sources, a fixed number of real lights (lightPool() modul
|
|
|
32
31
|
- `target?: PositionLike | null` Spot aim: a position or an Object3D it follows; default straight down
|
|
33
32
|
- `flicker?: ((time: number, index: number) => number) | null` Brightness factor each frame (time = presentation seconds, index = the source's number): (t, i) => 0.85 + 0.15 * Math.sin(t * 13 + i)
|
|
34
33
|
- `glow?: Material | Object3D | null` Stand-in shown while the source has no real light: a halo Sprite / Mesh (its material's opacity) or an emissive material (emissiveIntensity) scaled from its value at add() down to 0 as the real light fades in. Give each source its own material
|
|
35
|
-
- `dusk?: boolean | number` Follow the time of day
|
|
34
|
+
- `dusk?: boolean | number` Follow the time of day on the curve of engine.uniforms.uNight: true = its default dusk, a number = the daylight (0..1; 0 = on only while daylight is 0) below which the source fades in. Off by day (its light goes to lit sources, its stand-in dims too). Default false: lit at any hour. Needs calendar() or sky()
|
|
36
35
|
- **LightSourcePatch** What lightPool.add().set(patch) can change (type and castShadow are fixed when added)
|
|
37
36
|
- `position?: PositionLike` New position, or an Object3D to follow
|
|
38
37
|
- `name?: string`
|
|
@@ -52,7 +51,3 @@ Light pool: many light sources, a fixed number of real lights (lightPool() modul
|
|
|
52
51
|
- `weight: number` How much of its light it has now, 0-1
|
|
53
52
|
- `set(patch: LightSourcePatch) → LightSource` — Change the source; returns the same handle
|
|
54
53
|
- `remove()` — Unregister: its light fades out and moves on, the stand-in is put back (safe to call twice)
|
|
55
|
-
- **LightPoolUsage** lightPool.usage(): what the pool is doing now
|
|
56
|
-
- `sources: number` Registered sources
|
|
57
|
-
- `lit: number` Real lights lighting a source now
|
|
58
|
-
- `slots: { type, shadow, source, weight }[]` One per real light: its kind, whether it casts shadows, the source it holds (name or number, null = idle) and its fade 0-1
|
package/docs/api/music.md
CHANGED
|
@@ -7,12 +7,12 @@ Background music (music() module)
|
|
|
7
7
|
- `rules?: MusicRule[]` Auto track rules (same as engine.music.rules(list))
|
|
8
8
|
- `fade?: number` Default crossfade seconds, default 2
|
|
9
9
|
- `duckDialogue?: number | false` Duck the music bus during dialogue to this (0-1, e.g. 0.35); default false = no duck (the game opts in)
|
|
10
|
-
- `duckFade?: number` Fade seconds for the ducking
|
|
10
|
+
- `duckFade?: number` (experimental) Fade seconds for the ducking
|
|
11
11
|
- `hold?: number` Rule debounce seconds, default 2
|
|
12
12
|
- `interval?: number` Rule check interval (seconds), default 1
|
|
13
13
|
|
|
14
14
|
## Methods and properties
|
|
15
|
-
- `music.
|
|
15
|
+
- `music.define(name: string, track: MusicTrack)` — Define a track: a url, or { url, volume, loop, stems }. The same name again replaces it. Example: `engine.music.define('town', '/music/town.ogg')`
|
|
16
16
|
- `music.play(name: string | null, opts?: { fade?: number; force?: boolean })` — Play a track (cross-fade over fade seconds). Does nothing if it is already playing; force replays it
|
|
17
17
|
- `music.stop(opts?: { fade?: number })` — Fade out and stop (fade over fade seconds; default the music({ fade }) option). An options object like play's: stop(3) throws in dev
|
|
18
18
|
- `music.stinger(name: string, opts?: { duck?: number; volume?: number })` — Layer a one-shot piece (victory, discovered place...); the background dips to `duck` while it plays
|
|
@@ -24,7 +24,7 @@ Background music (music() module)
|
|
|
24
24
|
- `current: string | null` Name of the track playing (or wanted)
|
|
25
25
|
- `intensity: number` 0-1: how loud each stem of the playing track is (see the stems `at` range); fades in about half a second
|
|
26
26
|
- `ready: boolean` Whether audio is usable
|
|
27
|
-
- `ruled: boolean` Auto track rules are in use
|
|
27
|
+
- `ruled: boolean` (experimental) Auto track rules are in use
|
|
28
28
|
- `state: { current, playing, pending, override, intensity, gain, … }` State (for debugging and tests): gain is the playing track's fade level, stems each stem's level
|
|
29
29
|
|
|
30
30
|
## Data structures
|
package/docs/api/nav.md
CHANGED
|
@@ -8,11 +8,11 @@ Navmesh (nav() module)
|
|
|
8
8
|
- `agentHeight?: number` Character height (meters), default reads engine.movement.height
|
|
9
9
|
- `maxClimb?: number` Step height that can be climbed (meters), default reads engine.movement.stepHeight
|
|
10
10
|
- `maxSlope?: number` Max walkable slope (degrees), default reads engine.movement.maxSlope
|
|
11
|
-
- `tileSize?: number` Tile size (in cells), default 32
|
|
11
|
+
- `tileSize?: number` (experimental) Tile size (in cells), default 32
|
|
12
12
|
- `crowd?: boolean` NPCs use Recast crowd avoidance, default false
|
|
13
13
|
- `debug?: boolean` Show the navmesh (debug), default false
|
|
14
|
-
- `maxObstacles?: number` Most TileCache obstacles (collision boxes are cut into several), default 1024
|
|
15
|
-
- `maxAgents?: number` Most crowd agents (with crowd: true), default 128
|
|
14
|
+
- `maxObstacles?: number` (experimental) Most TileCache obstacles (collision boxes are cut into several), default 1024
|
|
15
|
+
- `maxAgents?: number` (experimental) Most crowd agents (with crowd: true), default 128
|
|
16
16
|
- `arrive?: number` Meters past the character's radius a path may end short of its goal and still count as arrived, default 0.6
|
|
17
17
|
|
|
18
18
|
## Methods and properties
|
|
@@ -20,10 +20,10 @@ Navmesh (nav() module)
|
|
|
20
20
|
- `nav.dispose()` — Unload the navmesh (frees native objects); characters.findPath then falls back to A*
|
|
21
21
|
- Properties:
|
|
22
22
|
- `ready: boolean` The navmesh has been generated
|
|
23
|
-
- `navMesh: any` Native Recast NavMesh (null until ready)
|
|
24
|
-
- `query: any` Native Recast NavMeshQuery
|
|
25
|
-
- `tileCache: any` Native Recast TileCache (for dynamic obstacles)
|
|
26
|
-
- `crowd: any` Native Recast Crowd (only when crowd: true)
|
|
27
|
-
- `helper: any` three.js object for the debug display (only when debug: true)
|
|
28
|
-
- `version: number` +1 on rebuild / unload: code that cached native objects (crowd agents etc.) must recreate them when it changes
|
|
29
|
-
- `agent: { radius, height, maxClimb, maxSlope } | null` Character size actually in effect (from engine.movement, or the override in nav())
|
|
23
|
+
- `navMesh: any` (experimental) Native Recast NavMesh (null until ready)
|
|
24
|
+
- `query: any` (experimental) Native Recast NavMeshQuery
|
|
25
|
+
- `tileCache: any` (experimental) Native Recast TileCache (for dynamic obstacles)
|
|
26
|
+
- `crowd: any` (experimental) Native Recast Crowd (only when crowd: true)
|
|
27
|
+
- `helper: any` (experimental) three.js object for the debug display (only when debug: true)
|
|
28
|
+
- `version: number` (experimental) +1 on rebuild / unload: code that cached native objects (crowd agents etc.) must recreate them when it changes
|
|
29
|
+
- `agent: { radius, height, maxClimb, maxSlope } | null` (experimental) Character size actually in effect (from engine.movement, or the override in nav())
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# engine.occlusion (Occlusion)
|
|
2
|
+
|
|
3
|
+
- Properties:
|
|
4
|
+
- `enabled: boolean` Occlusion culling of hlod cells and batched groups; describe().render.occlusion says what it saved
|
|
5
|
+
- `stats: { watched, hidden, trianglesSkipped }` What it does now: { watched, hidden, trianglesSkipped } (items, items hidden this frame, triangles not drawn this frame)
|
package/docs/api/openWorld.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
- `density?: number` Vegetation density multiplier
|
|
8
8
|
- `flatten?: FlattenZone[]` Flatten a plot (for a house)
|
|
9
9
|
- `time?: number` Start time 0-1
|
|
10
|
-
- `dayLength?: number`
|
|
10
|
+
- `dayLength?: number` Calendar seconds per day (default 360)
|
|
11
11
|
- `weather?: WeatherName | (string & {}) | Part<typeof weather>` Starting weather name, false (no weather module) or weather() options
|
|
12
12
|
- `autoWeather?: boolean` Automatic weather changes
|
|
13
13
|
- `camera: 'follow' | 'firstPerson' | 'rts' | 'fixed' | ModuleDef | false` Required, no default: 'follow' / 'firstPerson' / 'rts' / 'fixed', a camera module with options (e.g. followCamera(presets.camera.overShoulder)), or false
|
package/docs/api/particles.md
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
# engine.particles — particles()
|
|
1
|
+
# engine.particles — particles(opts?: ParticlesOptions)
|
|
2
2
|
|
|
3
3
|
Particles (particles() module)
|
|
4
4
|
|
|
5
|
+
- Options `ParticlesOptions`:
|
|
6
|
+
- `effects?: Record<string, ParticleOptions>` Effect params by name: under what define() gives, and defined on the first emit / attach when define() never ran
|
|
7
|
+
- `default?: ParticleOptions` Params every effect starts from
|
|
5
8
|
|
|
6
9
|
## Methods and properties
|
|
7
|
-
- `particles.define(name: string, opts?: ParticleOptions) → ParticleEffect` — Define an effect (same name replaces it, and emitters attached to it move to the new definition); params sit on top of
|
|
10
|
+
- `particles.define(name: string, opts?: ParticleOptions) → ParticleEffect` — Define an effect (same name replaces it, and emitters attached to it move to the new definition); params sit on top of particles({ effects, default }). Returns the effect object: .points is its THREE.Points (a Sprite on WebGPURenderer); .material is its plain three.js material (set your own and it is drawn as given, null gives the engine's back); .uniforms are the engine material's { value } objects (uMap, uHasMap, uScale, uMaxPx), which a ShaderMaterial of yours can share. A material of yours lasts until the effect is defined again. Example: `engine.particles.define('sparks', { blending: 'additive' }).material = myMaterial;`
|
|
8
11
|
- `particles.has(name: string) → boolean` — Whether this effect has been defined
|
|
9
12
|
- `particles.emit(name: string, position: PositionLike, opts?: { count?, overrides? })` — Burst: emit count particles at once (default 10) at position (Vector3 / Object3D / [x, y, z] / {x, y, z}). overrides affect this batch only (color, speed, direction...; max/texture/blending cannot be changed temporarily)
|
|
10
13
|
- `particles.attach(name: string, object3d: THREE.Object3D, opts?: { rate?, offset?, overrides? }) → ParticleEmitter` — Keep emitting while following an object: rate per second, offset in the object's local coordinates [x, y, z] (meters). Returns a handle { remove(), rate, active } (active = false pauses)
|
|
11
14
|
- `particles.count(name?: string) → number` — Live particle count (no name = all)
|
|
12
15
|
- `particles.clear(name?: string)` — Clear one effect's (or all) particles
|
|
13
16
|
- Properties:
|
|
14
|
-
- `effects: Map<string, ParticleEffect>` Defined effects
|
|
17
|
+
- `effects: Map<string, ParticleEffect>` (experimental) Defined effects
|
|
15
18
|
|
|
16
19
|
## Data structures
|
|
17
|
-
- **ParticleOptions** Particle effect parameters (
|
|
18
|
-
- `max?: number` Maximum alive at once, default 120 (
|
|
20
|
+
- **ParticleOptions** Particle effect parameters (define(), and each entry of particles({ effects, default })). All optional
|
|
21
|
+
- `max?: number` Maximum alive at once, default 120 (60 on low-tier devices; a number the game gives stands)
|
|
19
22
|
- `lifetime?: Range` Seconds each particle lives [min, max]
|
|
20
23
|
- `rate?: number` Default particles per second for attach
|
|
21
24
|
- `speed?: Range` Initial speed (m/s) [min, max]
|
package/docs/api/photo.md
CHANGED
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
Photo mode (photo() module)
|
|
4
4
|
|
|
5
5
|
- Options `PhotoOptions` (also includes the fields of PhotoTakeOptions):
|
|
6
|
-
- `maxAlbum?: number` How many photos the album keeps at most, default 50
|
|
6
|
+
- `maxAlbum?: number` (experimental) How many photos the album keeps at most, default 50
|
|
7
7
|
|
|
8
8
|
## Methods and properties
|
|
9
9
|
- `photo.take(opts?: PhotoTakeOptions) → PhotoShot` — Capture a photo now without checks. Gameplay takes photos through the op: engine.ops.run('photo.take') (checks canTake, logged)
|
|
10
|
-
- `photo.subject() → { name, kind, distance } | null` — What is in the middle of the frame (NPC, entity, named object, vegetation), null if nothing; this is the subject of take()
|
|
10
|
+
- `photo.subject() → { name, kind, distance } | null` — (experimental) What is in the middle of the frame (NPC, entity, named object, vegetation), null if nothing; this is the subject of take()
|
|
11
11
|
- Properties:
|
|
12
12
|
- `album: PhotoShot[]` Album (newest first)
|
|
13
13
|
- `canTake: () => boolean | string` The op photo.take's can: return true, or false / a reason string to refuse (e.g. () => engine.inventory.has('film') // 'noFilm')
|
|
14
|
+
- `format: string` (experimental)
|
|
15
|
+
- `maxAlbum: number` (experimental)
|
package/docs/api/pickups.md
CHANGED
|
@@ -4,8 +4,11 @@ pickups()
|
|
|
4
4
|
|
|
5
5
|
- Options `PickupsOptions`:
|
|
6
6
|
- `radius?: number` Reach of pickups that do not set their own radius (meters), default 2
|
|
7
|
-
- `showDistance?: number` Pickups have a model, float and spin only within this distance (meters) of the stream sources, default 60
|
|
7
|
+
- `showDistance?: number` (experimental) Pickups have a model, float and spin only within this distance (meters) of the stream sources, default 60
|
|
8
8
|
- `takers?: (e: Engine) => string[]` Who walks into auto pickups (actor ids); default engine.actor, plus net peers on a host
|
|
9
|
+
- `color?: ColorLike` Color of the placeholder box and geometry-only models when the pickup and its item set none, default 0xcccccc
|
|
10
|
+
- `size?: number` Edge of the placeholder box (meters), default 0.25
|
|
11
|
+
- `lift?: number` Height above the ground a pickup floats at (meters), default 0.4
|
|
9
12
|
|
|
10
13
|
## Methods and properties
|
|
11
14
|
- `pickups.spawn(position: PositionLike, opts: PickupOptions) → PickupHandle` — Place a pickup on the ground at position; its y, if any, is the reference height on multi-layer ground (needs the interactions module unless auto): spawn(v, { give: 'berry', count: 2 }). Returns a handle, remove() deletes it
|
|
@@ -13,3 +16,6 @@ pickups()
|
|
|
13
16
|
- Properties:
|
|
14
17
|
- `radius: number` Reach of pickups that do not set their own (meters)
|
|
15
18
|
- `takers: (e: Engine) => string[]` Who walks into auto pickups: default engine.actor plus net peers on a host, none on a client
|
|
19
|
+
- `material: Material` The three.js material of every placeholder box and geometry-only model. Set it to swap all of them at once; used as given. A pickup with its own color or a vertex-colored geometry draws with a copy of it carrying that color. Example: `engine.pickups.material = new THREE.MeshStandardMaterial({ color: 0xffd24a, metalness: 0.8 })`
|
|
20
|
+
- `size: number` Edge of the placeholder box (meters), read when one is built
|
|
21
|
+
- `lift: number` (experimental) Height above the ground new pickups float at (meters)
|
package/docs/api/post.md
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
# engine.post (PostFX)
|
|
2
2
|
|
|
3
|
-
- `post.object() → any` —
|
|
4
|
-
- `post.targets() → { renderTarget1, renderTarget2, readBuffer, writeBuffer } | null | …` — The composer's render targets, for reading (sample the last frame's color or depth in a game pass, check formats / samples), or null while there is no composer. renderTarget1 / renderTarget2 are the ping-pong pair. During the chain readBuffer is a pass's input and writeBuffer its output; EffectComposer swaps them after every pass with needsSwap (most passes; the scene RenderPass does not). The last pass draws to the canvas and still swaps, so after the frame (engine.onRender(fn, { when: 'after' })) neither target holds the final picture: writeBuffer holds the input of that last pass (readBuffer when the last pass does not swap) and readBuffer is stale. For the final image, render into a target of your own.
|
|
5
|
-
- `post.
|
|
6
|
-
- `post.
|
|
3
|
+
- `post.object() → any` — (experimental) What the chain runs in, for reading, or null while no post work has run yet (built the first time an effect or MSAA is on; it is not built here, so asking never costs a render target). WebGLRenderer: the three.js EffectComposer (pass list, sizes, its targets). WebGPURenderer: { pipeline, scenePass }, three's RenderPipeline and the scene's pass() node. Read-only by rule, not by lock: the engine owns it, rebuilds the chain whenever the list changes and disposes it with the engine. To add a pass use post.add, to own the whole chain post.own() (recipe 52). Why public: a game reading the chain had to dig into an internal field (review 2026-11-03)
|
|
4
|
+
- `post.targets() → { renderTarget1, renderTarget2, readBuffer, writeBuffer } | null | …` — (experimental) The composer's render targets, for reading (sample the last frame's color or depth in a game pass, check formats / samples), or null while there is no composer, and always on WebGPURenderer (its pass nodes own their targets: post.object().scenePass). renderTarget1 / renderTarget2 are the ping-pong pair. During the chain readBuffer is a pass's input and writeBuffer its output; EffectComposer swaps them after every pass with needsSwap (most passes; the scene RenderPass does not). The last pass draws to the canvas and still swaps, so after the frame (engine.onRender(fn, { when: 'after' })) neither target holds the final picture: writeBuffer holds the input of that last pass (readBuffer when the last pass does not swap) and readBuffer is stale. For the final image, render into a target of your own.
|
|
5
|
+
- `post.add(x: any, o?: { name?, slot?, order? }) → PostHandle` — The one way to add a post effect. x is a three.js Pass (WebGL), a TSL node function (input, ctx) => node (WebGPU), or an effect { name, create / node / fuse, slot, order, params, needsDepth, needsBuffers, backend, skipOnLowTier, facts } (both renderers when it gives create and node, or a fuse). A wrong shape throws with nothing added. needsDepth, needsBuffers ('normal' / 'diffuse' / 'velocity', WebGPU), backend ('webgpu': not on the WebGL2 backend), skipOnLowTier (held when engine.tier is 'low') and facts (shown by describe().render.post) are explained on PostEffect. A Pass that draws engine.scene takes the 'scene' slot, FXAA / SMAA / TAA 'final', any other 'hdr' after the effects already there, or 'ldr' once an OutputPass was added. A RenderPass of engine.scene and an OutputPass are the engine's own stages: skipped and said once (an OutputPass still marks where display color starts). Example: `const glow = engine.post.add(new UnrealBloomPass(size, 0.6, 0.4, 0.85), { name: 'glow' }); glow.enabled = false;`
|
|
6
|
+
- `post.get(name: string) → PostHandle | undefined` — (experimental) An added effect's handle (as add() returns it), or undefined. Example: `engine.post.get('bloom').set({ strength: 0.6 });`
|
|
7
|
+
- `post.own(on?: boolean)` — (experimental) Hand the built chain to the game: the engine stops rebuilding it, so the composer's passes (post.object().passes) or the WebGPU pipeline's outputNode are the game's to edit. own(false) gives it back and rebuilds from the list. describe().owned shows who has it. Example: `engine.post.own(); engine.post.object().passes.reverse();`
|
|
8
|
+
- `post.setAntialias(on: boolean)` — (experimental) Turn MSAA on or off. It is a render setting, not a drawing part. With no effect on, the start value is the canvas's own MSAA (free: no post chain); the other value, and any effect, draws through the chain, whose render targets carry the MSAA. Example: `engine.post.setAntialias(false);`
|
|
7
9
|
- `post.list() → { name, slot, order, enabled }[]` — (experimental) Effects in render order: [{ name, slot, order, enabled }]
|
|
8
10
|
- `post.render(dt: number, target?: any)` — Draw the frame through the chain. target: a render target to draw the finished picture into instead of the canvas (engine.renderOnce(target)); it gets the canvas's pixels (tone mapped, output color space). Why a target argument and not "set the render target first": the WebGL chain's last pass always writes to the canvas (EffectComposer renderToScreen); the WebGPU pipeline draws into whatever target is set.
|
|
9
11
|
- Properties:
|
|
10
|
-
- `antialias: boolean` MSAA on
|
|
12
|
+
- `antialias: boolean` (experimental) MSAA on. Writing it takes effect like setAntialias.
|
|
11
13
|
- `active: boolean` Whether the post chain runs: an effect is on, or antialias differs from the canvas's own MSAA (fixed when the renderer was made, so a runtime switch away from it goes through the chain's targets)
|
|
14
|
+
|
|
15
|
+
## Data structures
|
|
16
|
+
- **PostEffect** An effect as data, the form post.add() takes. node (WebGPURenderer): returns the effect's output color node built on input (the color node so far); called again only when a param that is not a number, boolean, color or vector changes (those are live in ctx.p). An effect with only create cannot run on WebGPURenderer (it throws by name). create: builds the implementation the first time the effect is on (WebGL: a three.js postprocessing Pass); optional when fuse is given. fuse: see PostFuse; effects with a fuse in the same slot next to each other are merged (never in slot 'scene'), their params update in place (no update() needed). slot: a PostSlot; typed as any string too because a slot in a plain JS object (an effect returned from a function) is a string to TypeScript, and the chain throws on an unknown slot naming the valid ones.
|
|
17
|
+
- `name: string`
|
|
18
|
+
- `create?: (ctx: PostContext) => object`
|
|
19
|
+
- `node?: (input: any, ctx: PostNodeContext) => any`
|
|
20
|
+
- `fuse?: PostFuse`
|
|
21
|
+
- `slot?: PostSlot | (string & {})`
|
|
22
|
+
- `order?: number`
|
|
23
|
+
- `enabled?: boolean`
|
|
24
|
+
- `needsDepth?: boolean`
|
|
25
|
+
- `needsBuffers?: ("normal" | "diffuse" | "velocity")[]`
|
|
26
|
+
- `backend?: "webgpu"`
|
|
27
|
+
- `skipOnLowTier?: boolean`
|
|
28
|
+
- `facts?: () => Record<string, any> | null`
|
|
29
|
+
- `params?: Record<string, any>`
|
|
30
|
+
- `update?: (impl: any, params: Record<string, any>) => void`
|
package/docs/api/quests.md
CHANGED
|
@@ -4,7 +4,7 @@ Quests (quests() module)
|
|
|
4
4
|
|
|
5
5
|
- Options `QuestsOptions`:
|
|
6
6
|
- `action?: string` Action name that opens the quest log, default 'quests'
|
|
7
|
-
- `checkInterval?: number` Check interval (
|
|
7
|
+
- `checkInterval?: number` (experimental) Check interval (real seconds, checked in the fixed step; not checked while frozen / paused), default 0.5
|
|
8
8
|
- `notify?: boolean | ((msg) => void)` Messages on quest start / step / done: true a toast with kind 'quest' (default) · false none · a function to show them your way. Example: `quests({ notify: false }) quests({ notify: ({ type, text }) => type === 'done' && myBanner(text) })`
|
|
9
9
|
|
|
10
10
|
## Methods and properties
|
|
@@ -12,11 +12,11 @@ Quests (quests() module)
|
|
|
12
12
|
- `quests.start(id: string)` — Start a quest
|
|
13
13
|
- `quests.state(id: string) → { step, steps, done, failed, active } | null` — One quest's progress (a copy): step index, step count, done, failed, active; null before it starts
|
|
14
14
|
- `quests.advance(id: string) → boolean` — Finish the current step from code (its done() is not asked) and go on; the last step completes the quest. false when not active
|
|
15
|
+
- `quests.isDone(id: string) → boolean` — (experimental)
|
|
15
16
|
- `quests.isActive(id: string) → boolean` — Started, not done and not failed
|
|
16
|
-
- `quests.isFailed(id: string) → boolean` — Its fail condition held (start(id) begins it again)
|
|
17
|
+
- `quests.isFailed(id: string) → boolean` — (experimental) Its fail condition held (start(id) begins it again)
|
|
17
18
|
- `quests.check()` — Check completion conditions once immediately
|
|
18
19
|
- `quests.list() → { id, title, desc?, done, failed, steps }[]` — Quest list (for custom UI)
|
|
19
|
-
- Also: `quests.isDone(id: string) → boolean`
|
|
20
20
|
- Properties:
|
|
21
21
|
- `win: { open, toggle, refresh }` The quest log (UI part 'questLog'): open, toggle(on?), refresh()
|
|
22
22
|
|