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/CONVENTIONS.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
For API details see `api/<module>.md`; this file holds conventions that don't belong to one API but cause problems when broken. `AI.md` lists each in
|
|
4
4
|
one line; the detail is here.
|
|
5
5
|
|
|
6
|
+
## Where a thing goes in the world
|
|
7
|
+
|
|
8
|
+
| The thing | Use |
|
|
9
|
+
|---|---|
|
|
10
|
+
| Built by code on every start | `scene.add` (plain three.js) or `engine.add` |
|
|
11
|
+
| Must be saved, or live on while far away | `engine.world` (`world.add`, `world.present` for its model) |
|
|
12
|
+
| Written as data | `content`, the data front of `engine.world` |
|
|
13
|
+
| Drawn in a level file | a level, through `level()` |
|
|
14
|
+
| Placed on cells | `engine.grids`, on top of the above |
|
|
15
|
+
|
|
16
|
+
`engine.stream` is the low-level loader under these; reach for it only for your own distance-based loading.
|
|
17
|
+
|
|
6
18
|
## World data and level ownership
|
|
7
19
|
- **World data**: game objects that must be saved, survive level changes, or change while far away go in `engine.world` (the model is built with
|
|
8
20
|
`present` only when near, the simulation runs with `simulate`).
|
|
@@ -12,14 +24,14 @@ one line; the detail is here.
|
|
|
12
24
|
- **Level ownership**: world data carrying `zone: engine.world.zone` (= the current level name) gets its model built and is simulated only in that
|
|
13
25
|
level; when you leave, the data stays (content NPCs, pickups and props already work this way);
|
|
14
26
|
things that need not be kept (trigger zones, etc.) use `level.track(handle)` and are deleted automatically on level change.
|
|
15
|
-
- **Module type**:
|
|
27
|
+
- **Module type**: a module says what it owns with `type` (`'rules'` for game logic, the default; `'world'` state that draws nothing, `'picture'` what is
|
|
16
28
|
seen and heard, `'ui'` panels, `'actor'`, `'net'`, `'tool'`; recipes/14). Modules depend on capabilities (`requires: ['inventory']`), never on
|
|
17
|
-
another module's name or private fields; a module doing two kinds of thing is two definitions from one factory (`weather()`: state +
|
|
29
|
+
another module's name or private fields; a module doing two kinds of thing is two definitions from one factory (`weather()`: state + drawing).
|
|
18
30
|
- **Who owns a handle**: every `{ remove() }` handle has one owner that removes it, chosen by how long it should live: the module
|
|
19
31
|
(`ctx.track(h)` in its install / init: until the module goes), the playthrough (`engine.session.track(h)`: until newGame / load / quit), or
|
|
20
32
|
the level (`level.track(h)`: until the level changes). A handle with none lives until `engine.dispose()`.
|
|
21
33
|
- **Two doors, one scene**: plain three.js (`engine.add(mesh, { id })`) and templates (`engine.content.spawn`, props) land in the same registry;
|
|
22
|
-
`engine.thing(id)` says what it is and what a save keeps (`recipes/
|
|
34
|
+
`engine.thing(id)` says what it is and what a save keeps (`recipes/40-scene.md`). What must be saved with its own state or edited without
|
|
23
35
|
code goes in `content/` (templates + props with ids, pickups, npcs, containers, game kinds) or the level model; a save stores only changes on top.
|
|
24
36
|
Startup code never creates what a save stores whole (rule R33): things that appear during play come from `engine.content.spawn` inside an op.
|
|
25
37
|
- To find leaks read `engine.counts()` (listeners, timers, geometry count; they should not grow when entering and leaving a level repeatedly).
|
|
@@ -27,13 +39,21 @@ one line; the detail is here.
|
|
|
27
39
|
## Textures
|
|
28
40
|
The opts of `assets.texture(name, opts)` are part of the cache key: the same image with different opts gives two separately configured textures.
|
|
29
41
|
|
|
30
|
-
## Values the engine
|
|
31
|
-
|
|
32
|
-
every frame. Setting
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
42
|
+
## Values the engine writes on its own (camera, shadow box)
|
|
43
|
+
Lights, fog, exposure and the environment have one writer, the game's `picture/` code: the sky computes signals and no module writes them (`recipes/62-picture-code.md`). With a camera module the
|
|
44
|
+
engine writes the `camera` pose every frame, and a sky keeps the shadow box around the focus. Setting one of those directly is plain three.js and works: the engine yields that value (stops
|
|
45
|
+
writing it, warns once). The camera: `engine.takeCamera(owner)` or a timeline camera step.
|
|
46
|
+
|
|
47
|
+
## Layers the engine keeps
|
|
48
|
+
The three.js layers below belong to the engine (one table: `RESERVED_LAYERS` in `threedog/layers`, file `render/layers.js`). A game's own layers are 1 to 25; 30 is the default camera `hideLayer`.
|
|
49
|
+
|
|
50
|
+
| Layer | Name | What sits there |
|
|
51
|
+
| --- | --- | --- |
|
|
52
|
+
| 26 | `lightVolumes` | the box of air and the lights `lightVolumes` reads |
|
|
53
|
+
| 27 | `occlusionBox` | occlusion culling's query boxes, seen by the scene render of the view camera alone |
|
|
54
|
+
| 28 | `occlusionHidden` | what culling is not drawing now, still seen by shadows, `engine.rays` and `voxelGI` |
|
|
55
|
+
| 29 | `outlineOff` | objects `outline({ offLayer })` leaves without lines; `OUTLINE_OFF_LAYER` from `@threedog/post-effects` is this same layer |
|
|
56
|
+
| 31 | `batched` | originals drawn through `engine.batching`, still hit by `engine.rays` |
|
|
37
57
|
|
|
38
58
|
## Customization ladder
|
|
39
59
|
Pick the row for what you want; each row is the one entry for it (take the first that fully works). Plain JS fields and your own `onFixed`
|
|
@@ -45,12 +65,25 @@ logic need none of this.
|
|
|
45
65
|
| Let several systems change one shared value (speed, time scale, gravity, damage taken): the game sets, effects multiply, settings cap | `engine.mod(point, { owner, set \| add \| mul \| clamp, for })`, in a module `ctx.mod`; `mul` / `add` cooperate, two owners' `set` on one layer is an error with the fix; your own point: `engine.stacks.define` | `recipes/55-mods-time-wrap.md` |
|
|
46
66
|
| Run code before / after / around a module method (a weight limit on `inventory.add`) | `engine.wrap(engine.inventory, 'add', (next, ...a) => next(...a), { owner })` | `recipes/55-mods-time-wrap.md` |
|
|
47
67
|
| Close one action for a while (stunned: no jump) | `engine.input.gate(action, { owner, for })` | `recipes/55-mods-time-wrap.md` |
|
|
48
|
-
| Replace a whole system (your own inventory, interactions, dialogue, quests, flow, characters, camera; your own vehicle for `character.enter`) | `engine.use(mine(), { replaces: '<slot>' })` for a part that `provides` that slot; a module (or object) that meets that contract (`<module>.contract.js`; vehicle: `modules/characters/vehicle.contract.js`), checked with `runContract` | `recipes/55-mods-time-wrap.md` "Replacing a module" |
|
|
49
|
-
| Change a
|
|
50
|
-
| Write the
|
|
68
|
+
| Replace a whole system (your own inventory, interactions, dialogue, quests, flow, characters, camera, collision, level, navmesh; your own vehicle for `character.enter`) | `engine.use(mine(), { replaces: '<slot>' })` for a part that `provides` that slot; a module (or object) that meets that contract (`<module>.contract.js`; vehicle: `modules/characters/vehicle.contract.js`), checked with `runContract` | `recipes/55-mods-time-wrap.md` "Replacing a module" |
|
|
69
|
+
| Change a picture value (light, fog, sky, water, tone, post) | write it in your `picture/` code on the three.js object or the module's `material` (recipe 62); a value the engine drives (camera far, fov, pixel ratio): `engine.autoView.manual(key)` first; a screen effect: `engine.post.add(x)` |
|
|
70
|
+
| Write the picture yourself | plain three.js on `engine.scene / camera / renderer` (own material, `ShaderMaterial`, pass); a direct write takes that value over and the engine yields | `THREE.md` |
|
|
71
|
+
|
|
72
|
+
**What can be replaced**: a slot with a contract file (inventory, interactions, dialogue, quests, flow, characters, calendar, cameraRig, particles, collision, level, nav) lists what a replacement must supply, and `runContract` checks it. The slots below have no contract; a replacement must supply what the engine's own callers read:
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
|
|
74
|
+
| Slot | A replacement must supply |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `sky` | the `engine.uniforms` signals your `picture/` code reads; `dome` (the object a photo leaves out) if it has one |
|
|
77
|
+
| `terrain` | the ground through `engine.setGround`; `chunkSize`, `stats`, `edit` (nav), `view` and `setPlanter` (vegetation). Replace `terrain-draw` with it: the drawing half reads the engine terrain's chunks |
|
|
78
|
+
| `weather` | `types`, `name`, `current`, `label(name)`, `set(name, { seconds })`, `setAuto(on)`. Replace `weatherDraw` with it |
|
|
79
|
+
| `vegetation` | `define(name, rule)` (content), `instanceAt(point, { radius })` (photo), `host` (settings). Replace `vegetation-draw` with it |
|
|
80
|
+
| `rigid` | `vehicles`, a list of objects that meet `modules/characters/vehicle.contract.js` |
|
|
81
|
+
| `swarm` | nothing: no other module calls it |
|
|
82
|
+
|
|
83
|
+
**Not replaceable**: `world` (saves, the shared id space, streaming and content stand on its records; it provides the slot so that `requires: ['world']` names a capability), and the player inside `characters` (a replacement of `characters` leaves a live player's `world` record behind, and `engine.player` is the engine's own character; steer it with `control.take`).
|
|
84
|
+
|
|
85
|
+
The starting picture comes from the game's `picture/` folder; what it builds as a factory can also be passed at the call site, and the
|
|
86
|
+
call site wins (`terrain({ material })` and the like; the water surface is `engine.water.material`); a new style factory ships with its call-site option. No module option starts a value taken over.
|
|
54
87
|
|
|
55
88
|
**Time channels**: most games use only the default (fixed `dt` in real seconds, `engine.clock` for calendar time). A channel exists so one group
|
|
56
89
|
of things can run slower or faster than the rest (bullet time on enemies, haste on the player): `engine.onFixed(fn, { channel: 'enemies' })` gets
|
|
@@ -58,43 +91,42 @@ that channel's scaled `dt`, and `engine.mod('time.enemies', { owner, mul })` sca
|
|
|
58
91
|
|
|
59
92
|
### One task, which entry
|
|
60
93
|
Where a task has more than one entry they are layers of the ladder above, not alternatives: take the first, go down only for the reason given.
|
|
61
|
-
|
|
94
|
+
Picture rows (light, glow, environment, post) follow the order in `THREE.md` (plain three.js first): they name the hook your three.js code plugs
|
|
62
95
|
into, or a convenience for after.
|
|
63
96
|
|
|
64
97
|
| Task | First | Go down a layer when |
|
|
65
98
|
|---|---|---|
|
|
66
|
-
| Windows, signs, screens glow at night |
|
|
99
|
+
| Windows, signs, screens glow at night | a material whose `emissiveIntensity` reads `engine.uniforms.uNight` (recipe 09 §1b) | `lightPool.add(obj, { glow })` is something else: the stand-in a pooled lamp shows while it holds no real light |
|
|
67
100
|
| Time of day | `engine.calendar` (`calendar({ time })`) | no calendar at all (one fixed scene): `sky({ time })`; timers: `engine.clock`; one group faster / slower: a time channel |
|
|
68
|
-
| Sun / light strength |
|
|
69
|
-
| A game test (write one for your game) | a spec file `tests/specs/<name>.mjs` exporting `specs` (COMMANDS.md "A game's tests": minimal example, `
|
|
101
|
+
| Sun / light strength | your own three.js light in `picture/`, reading `engine.uniforms` (recipe 62) | the placeholders: write `engine.lights.sun` directly |
|
|
102
|
+
| A game test (write one for your game) | a spec file `tests/specs/<name>.mjs` exporting `specs` (COMMANDS.md "A game's tests": minimal example, `threedog test <name>`) | the test is steps and checks only: a scenario JSON `tests/scenarios/<name>.json` (recipes/23 §7); compare whole state: describe snapshots (recipes/16 §7) |
|
|
70
103
|
| Teleport the player | `player.placeAt(p)` in an op | not streamed in yet: `await engine.stream.teleport(p)` (waits, then places); a test or scenario: `applyState({ pos })` |
|
|
71
|
-
| Camera | install one: `openWorld({ camera })`, `engine.use(fixedCamera({ position, lookAt }))` | switch kinds at
|
|
72
|
-
| Sky |
|
|
73
|
-
| Environment light |
|
|
74
|
-
| Post effects | your own three.js Pass in the engine's chain: `
|
|
75
|
-
| Ambient occlusion | `
|
|
104
|
+
| Camera | install one: `openWorld({ camera })`, `engine.use(fixedCamera({ position, lookAt }))` | switch kinds at runtime: `setCamera(kind)`; a shot of your own: `takeCamera(owner)` |
|
|
105
|
+
| Sky | `sky({ ... })` start values, tuned through `engine.uniforms` and `engine.sky` | a custom sky of your own (shader dome, skybox, painted backdrop): `engine.sky.replace(obj)` (recipe 08 "Your own sky object"); on WebGPU three's `SkyMesh` the same way |
|
|
106
|
+
| Environment light | `engine.sky.environment({ into: engine.scene })`, or `scene.environment` | light that changes from place to place: `bakeProbes` |
|
|
107
|
+
| Post effects | your own three.js Pass in the engine's chain: `engine.post.add(pass)`, the one way in (the engine renders through its composer) | ready-made effects as an optional convenience: `@threedog/post-effects` through the same call or a plugin file, tuned with its handle; a whole chain of your own: `engine.post.own()` |
|
|
108
|
+
| Ambient occlusion | `engine.post.add(ao())` (screen space) | a model made in code: `bakeVertexAO(geometry)`; bounce light between places: `bakeProbes` |
|
|
76
109
|
|
|
77
110
|
## Owners
|
|
78
|
-
Everything that holds the engine is named by an owner, and only that owner releases it. Positional `
|
|
111
|
+
Everything that holds the engine is named by an owner, and only that owner releases it. Positional `freeze('menu')` and `freeze({ owner: 'menu' })` are the same.
|
|
79
112
|
|
|
80
113
|
| What | Take | Release | Returns |
|
|
81
114
|
|---|---|---|---|
|
|
82
|
-
| Real-time loop | `
|
|
115
|
+
| Real-time loop | `haltLoop(owner)` (tests and tools; a game freezes) | `handle.remove()` | handle `{ remove() }` |
|
|
83
116
|
| Gameplay freeze | `freeze(owner, { kind? })` | `handle.remove()` | handle |
|
|
84
117
|
| Camera | `takeCamera(owner, { focus? })` | `handle.remove()` | handle |
|
|
85
118
|
| Where a character goes | `control.take(character, { owner, layer, step? })` (layers base < script < cutscene < net; higher pauses lower) | `handle.remove()` | handle `{ active, move(), remove() }` |
|
|
86
119
|
| Debug override / view | `debug.override(owner, ...)`, `debug.view(mode, { owner })` | `debug.clear(owner)` | handle / state |
|
|
87
|
-
| Look values | `look.<part>.set(values, { owner })` | `handle.remove()` | handle |
|
|
88
120
|
|
|
89
121
|
## Worker limits
|
|
90
122
|
`modules/terrain/terrainGen.js` (via `chunkJob.js`) runs in a Worker and must not import three.js; a vegetation `rule` is sent to the Worker and must
|
|
91
123
|
not contain functions.
|
|
92
124
|
Workers are created only through `engine.threads.lane({ create, local })` (the same handler runs on the main thread when there are no workers); no
|
|
93
125
|
`new Worker` / `postMessage` elsewhere (`npm run check` rule R19). Worker files import only worker-safe code (a game:
|
|
94
|
-
`import { serve } from 'threedog/worker'`; inside the engine `core/threadServe.js`, `core/threadPure.js`), never `core/Threads.js` or three.js.
|
|
126
|
+
`import { serve } from 'threedog/worker'`; inside the engine `core/threads/threadServe.js`, `core/threads/threadPure.js`), never `core/threads/Threads.js` or three.js.
|
|
95
127
|
|
|
96
128
|
### Worker results that change gameplay: `engine.commits`
|
|
97
|
-
A result that changes gameplay never takes effect "when it arrives"; it takes effect on a fixed tick decided when you ask (`engine.tick + lag`,
|
|
129
|
+
A result that changes gameplay never takes effect "when it arrives"; it takes effect on a fixed tick decided when you ask (`engine.time.tick + lag`,
|
|
98
130
|
default 30 steps), so threads on or off, fast or slow machine, give the same state.
|
|
99
131
|
```js
|
|
100
132
|
const t = engine.commits.request({
|
|
@@ -141,7 +173,7 @@ inside template strings, which then throw on the first call).
|
|
|
141
173
|
returns the added object, `inventory.add` returns a result, `world.add` a record; delete those with `engine.remove(obj)` / their own remove call.
|
|
142
174
|
- **Verbs**: defining a kind is `define` (`vegetation.define`, `particles.define`, `grids.define`, `ops.define`); placing one is `add` / `spawn`;
|
|
143
175
|
hooking up a provider the engine calls back is `register` (`saves.register(key, { save, load })`: it defines no kind and places nothing).
|
|
144
|
-
One timer entry: `engine.clock.after(seconds, fn, data,
|
|
176
|
+
One timer entry: `engine.clock.after(seconds, fn, { data, channel })` (calendar seconds, or `'real'` / a time channel's seconds with `channel`);
|
|
145
177
|
one queue, so `remove()` is immediate: a removed timer never fires, not even later in the same step.
|
|
146
178
|
- **Unknown options throw**: every options bag goes through a `readParams` schema (one schema gives the check, the defaults and the catalog entry); an
|
|
147
179
|
unknown key throws in dev with a did-you-mean and warns once in a release build; `checkOptions` is only for extensible data (item, template
|
|
@@ -150,7 +182,7 @@ inside template strings, which then throw on the first call).
|
|
|
150
182
|
- **Event names are `noun:action`**: the noun is the emitter's singular camelCase name (`item`, `template`...), the action is a lowercase verb or state
|
|
151
183
|
(`add`, `done`, `change`); a game's own events follow the same rule (`door:open`).
|
|
152
184
|
- **Time**: one source, `engine.time.tick`; real, ambient, channel and calendar seconds are read-only views (`engine.time.now(name)`), and only
|
|
153
|
-
`core/time.js` adds to them (a spec checks). Always name the unit, real, channel or calendar seconds; `recipes/06-clock-events.md` defines them (and the calendar's time of day) and has
|
|
185
|
+
`core/time/time.js` adds to them (a spec checks). Always name the unit, real, channel or calendar seconds; `recipes/06-clock-events.md` defines them (and the calendar's time of day) and has
|
|
154
186
|
the table of which one to use for movement, action timelines, cooldowns, hit-stop, crop growth, calendar and UI, and what pause / freeze /
|
|
155
187
|
`clock.rate` 2 do to each. Speeds change only through `engine.mod` (the "Customization ladder" above).
|
|
156
188
|
- **Input**: gameplay keys (attack, jump, interact...) are read in the fixed step (`onFixed` / module `fixed`), where `pressed / down / released` give
|
|
@@ -167,8 +199,8 @@ inside template strings, which then throw on the first call).
|
|
|
167
199
|
|
|
168
200
|
## Core conventions
|
|
169
201
|
- Lighting without `sky`: every engine has `engine.lights = { sun, hemi }` (neutral); to light the scene yourself hide or adjust them and add three.js
|
|
170
|
-
lights. The engine ships no art: the humanoid, pickup shapes and flat shading come from the game's `
|
|
171
|
-
`terrain
|
|
202
|
+
lights. The engine ships no art: the humanoid, pickup shapes and flat shading come from the game's `picture/` folder and `assets.js` (e.g.
|
|
203
|
+
`terrain({ shading: 'flat' })`); without them the engine shows a gray capsule, a gray box and flat gray ground at y = 0, with a
|
|
172
204
|
dev warning naming the fix.
|
|
173
205
|
- Gameplay state (world, containers, vars, quests) changes only in fixed steps or inside ops; dev warns otherwise (`npm test` prints the first place, all in
|
|
174
206
|
`<game>/.threedog/ops-guard.log`). (game side)
|
|
@@ -177,31 +209,45 @@ inside template strings, which then throw on the first call).
|
|
|
177
209
|
belongs to the Character mover; other systems only request movement (`placeAt` / `move` / vehicle `enter`) and never set `player.position` directly.
|
|
178
210
|
Who calls `move` is the character's control holder (`engine.control`, `recipes/57-control.md`): one per step; anyone else is `[control-bypass]`.
|
|
179
211
|
- Units are meters, Y is up, north is -Z. Characters and vehicles face the model's +Z; `facing` 0 = +Z, forward = (sin f, cos f).
|
|
180
|
-
- Never call `requestAnimationFrame` or `renderer.render` yourself. **Game logic always uses
|
|
212
|
+
- Never call `requestAnimationFrame` or `renderer.render` yourself. **Game logic always uses real seconds or calendar seconds** (the hook's `dt`,
|
|
181
213
|
`engine.clock`; see the time table in `recipes/06-clock-events.md`); no `setTimeout` / `setInterval` / `performance.now()`: they ignore pause,
|
|
182
214
|
freeze and `engine.step` fast-forward, so they can't be tested or saved.
|
|
183
215
|
- To be saved, call `engine.saves.register(key, { save, load })` (`load` may return a Promise); `saves.save / load` always return `Promise<boolean>`,
|
|
184
216
|
so `await` them. Saved data names things by stable ids, never positions; when it changes shape raise `version` and add a `migrate` step
|
|
185
217
|
(`recipes/20-content-actions-save.md` "Save format").
|
|
186
218
|
- Day / night in gameplay comes from the calendar: read `calendar.isDay`, use `calendar.daylight` (0-1) for fades (they work with no sky); don't judge by clock text yourself.
|
|
187
|
-
- A game's own
|
|
188
|
-
them in one place (mixed, tuned with `look.<part>.set`).
|
|
219
|
+
- A game's own picture parameters (colors, materials) can live anywhere plain three.js code lives; its `picture/` folder keeps them in one place (recipe 62).
|
|
189
220
|
- Vegetation `rule` must not contain functions (it is sent to a Worker).
|
|
190
221
|
- Terrain is editable: `engine.terrain.edit(pos, { lower|raise|flatten|paint })`, only inside an op or fixed step; custom
|
|
191
222
|
`terrain({ height, groundType })` must be pure functions.
|
|
192
223
|
- Loading follows the `engine.stream` sources (player + camera focus by default); display, physics and world data are separate: unloading a model
|
|
193
224
|
never removes its world record.
|
|
194
|
-
- Window blur, tab hidden, pointer lock and WebGL context loss are listened to only in `core/page.js`; modules read `engine.page` or listen to
|
|
225
|
+
- Window blur, tab hidden, pointer lock and WebGL context loss are listened to only in `core/engine/page.js`; modules read `engine.page` or listen to
|
|
195
226
|
`page:*`. Show "saved" only after `saves.save` returns true.
|
|
196
|
-
- Character bodies are assets
|
|
227
|
+
- Character bodies are assets: `createPlayer({ ...presets.player.thirdPerson, model: 'humanoid' | 'hero' })` (a procedural builder is built
|
|
197
228
|
now; a file shows a gray capsule and is swapped in when it loads: `await player.whenReady`, event `character:model`), or `{ rig }`; a name no model
|
|
198
|
-
asset has throws.
|
|
229
|
+
asset has throws. Per-character colors: `colors: { body, skin, legs, hair }` on meshes marked `userData.part`.
|
|
199
230
|
- Importing the engine makes `Mesh.prototype.customDepthMaterial` / `customDistanceMaterial` default to a depth material carrying the mesh material's
|
|
200
231
|
vertex patches, so wind-swayed meshes cast swaying shadows with nothing to set up; assigning your own value still wins. Shader time, wind and cloud
|
|
201
232
|
cover are per engine in `engine.uniforms` (share them in your own `ShaderMaterial`); with two engines on a page, pass the engine to
|
|
202
|
-
`
|
|
233
|
+
`applyEffects(mat, { engine })`.
|
|
203
234
|
|
|
204
235
|
## Failures: which shape
|
|
205
236
|
A runtime "can't" (not enough money, shelf empty) is returned as `{ ok: false, code, facts, nextActions }` (ops.run / can / undo, and direct calls such as `container.trade`, which a module builds by returning that shape, or a code string from an op's `can`). Misuse (a wrong call, a typo) is a thrown `codedError`. Documented exceptions: `checkSkip` / `checkSave` return `{ ok, diffs }`, `walkTo` returns `{ status }`. Read `code` (there is no `reason` field). Predicates (op `can`, `grid.can()`) may return a plain code string.
|
|
206
237
|
|
|
207
|
-
Inside the engine a failure takes one of three forms, so every one reaches the reader with a code, a fix and a page: misuse throws `codedError(code, message)` with an `ERROR_CODES` entry (`core/errorCodes.js`: what to change, which page to read); a recoverable problem warns once with `warnOnce(coded(code, message))`; a game or module callback that threw goes to `reportError`. Check rule R45 rejects a plain `throw new Error` and a bare `console.warn` / `console.error` in engine code.
|
|
238
|
+
Inside the engine a failure takes one of three forms, so every one reaches the reader with a code, a fix and a page: misuse throws `codedError(code, message)` with an `ERROR_CODES` entry (`core/base/errorCodes.js`: what to change, which page to read); a recoverable problem warns once with `warnOnce(coded(code, message))`; a game or module callback that threw goes to `reportError`. Check rule R45 rejects a plain `throw new Error` and a bare `console.warn` / `console.error` in engine code.
|
|
239
|
+
|
|
240
|
+
## Stability
|
|
241
|
+
|
|
242
|
+
`@experimental` means one thing: the name may change or go in any version, with no migration note. Everything unmarked is frozen at 1.0.
|
|
243
|
+
|
|
244
|
+
- **How to see it.** The tag sits on the declaration, so an editor shows it; `api/*.md` prints `(experimental)`; the name's line in `docs/api-surface.txt` ends with it. A tag on a module or an engine member covers what hangs off it. A value or a sub-command has no line of its own, so its docs say so.
|
|
245
|
+
- **How it is kept.** The API lock (rule R55) lets a marked name change. Marking a stable name needs a line in the changelog: the mark takes a promise back.
|
|
246
|
+
- **Objects from other libraries**, which follow that library's version: `rigid.rapier / world / playerBody / playerCollider`, `nav.navMesh / query / tileCache / crowd / helper`, `assets.gltf / draco / ktx2`, `post.object / targets`, `shadows.csm`.
|
|
247
|
+
- **Effects still moving with three.js**: all of `threedog/tsl` and `@threedog/post-effects/tsl`.
|
|
248
|
+
- **Names nothing uses yet**: a public name no game, recipe, example or template used at 0.8 stays marked until one does; `docs/api-surface.txt` lists them.
|
|
249
|
+
- **Coordination no test game has used**: `engine.stacks`, `engine.wrap`, `engine.mod`, `time.channel / channels`.
|
|
250
|
+
- **Systems still settling**: `net()`, `engine.threads`, `engine.commits`, `grids()`, `hlod()`, `swarm()`, `stream.source / teleport / addReadyCheck / sources`, `post.get / own / setAntialias / list`, `world.simulate({ worker })`, `terrain.edit`, `ops.guard / allow`, `terrainDraw`, `vegetationDraw`, `weatherDraw`, `engine.bakeProbes / loadProbes / loadLightmap`.
|
|
251
|
+
- **Flat content**: an entry's `source`, `content stamp`, `content capture`.
|
|
252
|
+
- **Tuning and readings**: `engine.moduleOrder / moduleStates / disabledModules`, `player.saveMotion / loadMotion`, `jobs.loadingMs / maxSteps / slowStepMs`, `stream.unloadFactor`, `batching.held`, `world.steps`, `level.heightfield`.
|
|
253
|
+
- **Commands.** Only the `--json` and MCP shapes are an interface; printed text keeps changing for AI readers. An error's `code` string is frozen, its message is not.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Moving a game from 0.6 to 0.7
|
|
2
|
+
|
|
3
|
+
## Light probes: every pixel takes its own light
|
|
4
|
+
|
|
5
|
+
`engine.bakeProbes` now builds three's probe grid, so the one scene light that followed a point is gone. Bake or load the same way; lit materials pick the grid up by themselves.
|
|
6
|
+
|
|
7
|
+
| 0.6 | 0.7 |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `bakeProbes({ follow })`, `loadProbes(json, { follow })` | delete it: every pixel inside the grid has its own light |
|
|
10
|
+
| `bakeProbes({ height: 1.5 })` (one layer over the ground) | `bounds` around the ground and the air above it; a grid is a box, and needs 2 layers an axis |
|
|
11
|
+
| `probes.probe`, `probes.own()` | `probes.grid`, a plain three.js light; a light of your own from `probes.sample(pos, myProbe)` as before |
|
|
12
|
+
| `probes.probe.intensity` | `probes.grid.intensity` on WebGPU; on WebGL three ignores it, so change the light you bake, or the exposure |
|
|
13
|
+
| a probe file from 0.6 (version 1) | refused with `probes-data`: bake again (the file is now half precision, about a third of the size) |
|
|
14
|
+
| objects anywhere got the light of the follow point | outside the grid there is no probe light: size `bounds` to the scene (`describe().render.probes.outside`) |
|
|
15
|
+
|
|
16
|
+
## Removed from the public surface
|
|
17
|
+
|
|
18
|
+
| 0.6 | 0.7 |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `engine.level.object` | `engine.level.root` (the same object) |
|
|
21
|
+
| `engine.inventory.defs` | `engine.inventory.item(id)` for one definition; not in the types any more |
|
|
22
|
+
| `engine.quests.defs` | `engine.quests.list()`; not in the types any more |
|
|
23
|
+
| `engine.triggers.action`, `engine.settings.action`, `engine.interactions.action` | the option you passed to `triggers()`, `settings()`, `interactions()` |
|
|
24
|
+
|
|
25
|
+
## Follow camera and characters
|
|
26
|
+
|
|
27
|
+
| 0.6 | 0.7 |
|
|
28
|
+
|---|---|
|
|
29
|
+
| `collision({ cameraOcclusion })` defaulted to colliders only | the default is `'both'`: meshes added with `engine.rays.addStatic(mesh, { occluder: true })` and level buildings stop the camera arm too; `cameraOcclusion: 'colliders'` keeps the old test |
|
|
30
|
+
| `character.placeAt` over a prop or platform ignored it | it stands on a registered support (recipe 32 says what a support needs) |
|
|
31
|
+
| `mover: 'manual'` skipped the `states` hook | it runs the `states` hook (recipe 57, "Moved by script") |
|
|
32
|
+
|
|
33
|
+
## Layers 26 to 29 and 31 are reserved
|
|
34
|
+
|
|
35
|
+
The engine keeps these three.js layers for itself (`RESERVED_LAYERS` from `threedog/layers`). A game's own layers are 1 to 25; move anything of yours on layers 26 to 28 down. Layer 30 stays the default camera `hideLayer`.
|
|
36
|
+
|
|
37
|
+
## Starting a game
|
|
38
|
+
|
|
39
|
+
`threedog new-game --example` and `templates/example` are gone: start from `new-game` itself, and read the engine's `examples/` for finished techniques.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Moving a game from 0.7 to 0.8
|
|
2
|
+
|
|
3
|
+
npm never had 0.7.1, so this page goes from 0.7.0 straight to 0.8.0.
|
|
4
|
+
|
|
5
|
+
Names were settled before 1.0: a few were removed, a few renamed. Nothing below keeps working under its old name. A stale uniform name in shader text reads 0 with no error and no warning, so search for the old names below.
|
|
6
|
+
|
|
7
|
+
## Uniforms
|
|
8
|
+
|
|
9
|
+
Search your shader strings as well as your JavaScript.
|
|
10
|
+
|
|
11
|
+
| 0.7 | 0.8 |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `engine.uniforms.uCloudScale` | `uCloudShadowScale` (the cloud shadows on the ground) |
|
|
14
|
+
| `engine.uniforms.uCloudSpeed` | `uCloudShadowSpeed` |
|
|
15
|
+
| `uCloud` | `uWeatherCloud` |
|
|
16
|
+
| `uCurve` | `uSkyCurve` |
|
|
17
|
+
| `uCover` | `uGroundCover` |
|
|
18
|
+
| `uSunPower` | `uSunBrightness` |
|
|
19
|
+
| `uMoonPower` | `uMoonBrightness` |
|
|
20
|
+
| `uCloudScale`, `uCloudSpeed` on `engine.sky.uniforms`, or in `engine.sky.clouds()` and dome layer GLSL | `uSkyCloudScale`, `uSkyCloudSpeed` (the dome's clouds, the same names as on `engine.uniforms`) |
|
|
21
|
+
|
|
22
|
+
The same names apply to `uniforms(engine)` from `threedog/tsl`, `c.fx.uniform('...')`, and `#include <threedog_uniforms>`. A patch that brings its own uniform called `uCover` is yours and is left alone.
|
|
23
|
+
|
|
24
|
+
## Changed shapes
|
|
25
|
+
|
|
26
|
+
These do not fail loudly, so search for them.
|
|
27
|
+
|
|
28
|
+
| 0.7 | 0.8 |
|
|
29
|
+
|---|---|
|
|
30
|
+
| `const key = bag.add(id)`; `false` when full | `const r = bag.add(id)`: `{ ok: true, key, added }`, or `{ ok: false, code: 'full', facts }`. The result is always an object, so `if (bag.add(id))` is now `if (bag.add(id).ok)` |
|
|
31
|
+
| `clock.after(s, 'ev', data, { channel })` | `clock.after(s, 'ev', { data, channel })`, the same third argument as `clock.every`. The old form throws |
|
|
32
|
+
| `player.onStep = type => ...` | `engine.events.on('character:step', ({ character }) => ...)`, ground from `character.groundType()`. Assigning the old property does nothing and says nothing, so search for it |
|
|
33
|
+
| `player.onLand = impact => ...` | `engine.events.on('character:land', ({ character, impact }) => ...)`. Assigning the old property does nothing and says nothing, so search for it |
|
|
34
|
+
| `grids.get(name)`, `inventory.get(key)`, `container.get(key)`, `interactions.get(id)` return `null` when there is none | `undefined`, like every other `get`; a test `=== null` no longer matches, use `!x` |
|
|
35
|
+
| `settings({ presets: { high: { pixelRatio: 1.5 } } })`: a fixed ratio | A share from 0 to 1 of the ratio the engine picked for this device (`high: { pixelRatio: 1 }`); above 1 throws `module-params`. For a fixed ratio call `engine.setPixelRatio` |
|
|
36
|
+
| `settings.values` was the stored object; `settings.get('pixelRatio')` kept the last number set | `settings.values` is a read-only copy, change a value with `settings.set`; `pixelRatio` is the renderer's real ratio, the same as `describe().render.scale.current` |
|
|
37
|
+
| `mesh.visible` on a registered hlod mesh read `false` while far | It is your own value near and far. To ask whether the camera draws it: `mesh.layers.test(engine.camera.layers)` |
|
|
38
|
+
| `await engine.applyState(...)` resolved to nothing, and rejected for `season` with no calendar or an `at` nothing knows | It resolves to `{ ok, refused: [{ key, value, reason }] }`: read `refused`. A `fresh`, `wait` or `pos` it cannot read throws `state-value` |
|
|
39
|
+
|
|
40
|
+
## Removed names
|
|
41
|
+
|
|
42
|
+
| 0.7 | 0.8 |
|
|
43
|
+
|---|---|
|
|
44
|
+
| `engine.rays.cast(...)`, `engine.rays.pick(...)` | `engine.raycast(...)`, `engine.pick(...)` |
|
|
45
|
+
| `engine.THREE` | `import { THREE } from 'threedog'`, the same copy of three.js. |
|
|
46
|
+
| `model.userData.animations` | `model.animations`, three's own place: `model.clone()` keeps it, where `userData` broke the clips. Clips you add by hand go there too. |
|
|
47
|
+
| `engine.i18n.t(key)` | `engine.t(key)` |
|
|
48
|
+
| `inventory.slotsUsed` | `inventory.of().slotsUsed` |
|
|
49
|
+
| `engine.openWindows` | `engine.ui.isOpen(id)` |
|
|
50
|
+
| `engine.decoders` | set it with `createEngine({ decoders })`; it can no longer be read back |
|
|
51
|
+
| `EASINGS` | `ease(name)` |
|
|
52
|
+
| `assets.reportText(name)` | `assets.report(name)` |
|
|
53
|
+
| `assets.users(name)` | no replacement: it was internal |
|
|
54
|
+
| `player.object`, `character.object` | `.root`, the same object (`npc.object` stays) |
|
|
55
|
+
| `character.addTo()` | `engine.add(character.root)` for a `new Character` of your own; `createPlayer` still adds the player |
|
|
56
|
+
| `engine.rigid.R` | `engine.rigid.rapier` |
|
|
57
|
+
| `collision.circles`, `collision.boxes` | `collision.forEachStatic((type, data) => ...)` |
|
|
58
|
+
| `engine.stream.readyCheck(name, fn)` | `engine.stream.addReadyCheck(name, fn)` |
|
|
59
|
+
| `engine.music.addTracks({ a: url, b: url })` | `engine.music.define('a', url)`, one call per track; it no longer returns the music object |
|
|
60
|
+
| `debug.startBench()`, `debug.benchmarking`, the debug panel's stress button, `describe().debugPanel.benchmarking` | `threedog stress` |
|
|
61
|
+
| The types `Object3D`, `Vector3`, `Vector2`, `Color`, `Quaternion`, `Material`, `BufferGeometry`, `Texture` from `threedog` | import them from `three` |
|
|
62
|
+
| `threedog assets` with no verb | `threedog assets optimize` (it writes files) or `threedog assets check`. `npm run assets` becomes `npm run assets -- optimize` |
|
|
63
|
+
| `threedog doctor --json`: `{ healthy, items: [{ status, msg, fix }], render }` | `{ ok, summary, items: [{ level, message, fix }] }`, the shape of `check --json`. Items are the problems (`error`) and info lines (`warn`); passed lines are left out; `summary` says whether a hardware GPU is reachable |
|
|
64
|
+
| `engine.tick` | `engine.time.tick` |
|
|
65
|
+
| `engine.cpuMs`, `engine.cpuPhases` | `engine.inspect.perf()` (`cpuMs`, `cpuPhases`), `engine.budget.values().cpuMs` |
|
|
66
|
+
| `saves.queue(fn)` | `saves.putAttachment(group, id, blob, meta)`, `saves.removeAttachment(group, id)`; read with `saves.attachments(group)` |
|
|
67
|
+
| `saves.prefix` | `saves.storageKey(name)` for a key of your own |
|
|
68
|
+
| `userData.rayVisible = true` on a hidden object | Leave `visible` alone and put the mesh on `RESERVED_LAYERS.batched` (`threedog/layers`): not drawn, no shadows, still hit by `engine.raycast` |
|
|
69
|
+
| `engine.adaptive.paused` | `engine.adaptive.on = false` |
|
|
70
|
+
| `settings.removeSection(id)` | List the tabs you want: `settings({ sections: [...] })` |
|
|
71
|
+
| `sky({ moonSize })`, `sky({ starScale })`, `sky({ gradientCurve })`, `sky({ orbitTilt })`, `sky({ orbitSway })` | Write `engine.uniforms.uMoonSize.value`, `uStarScale.value`, `uSkyCurve.value`, `engine.sky.orbit.tilt`, `engine.sky.orbit.sway` (plain values after `engine.use(sky())`; defaults unchanged) |
|
|
72
|
+
| `saves.register(key, { movedFrom })` | No replacement. Only the calendar used it: the time and day of a 0.2 save, kept under the old `sky` part, are no longer read, and such a save starts from `calendar({ time })` |
|
|
73
|
+
| The old keys of `sky()` and `water()` (`sky({ fog })`, `sky({ sun })`, `sky({ layers })`, `sky({ dayLength })`, `water({ color })`, `water({ glsl })` and the like) | They are ordinary unknown options now: an error with a did-you-mean in development, one warning in a build. Recipes 08, 44 and 62 say where each value lives |
|
|
74
|
+
| `calendar.daysPerSeason` (the field) | Nothing read it and writing it did nothing. The option `calendar({ daysPerSeason })` stays |
|
|
75
|
+
| `ground.navGeometry` on a ground API of your own | Nothing read it: the navmesh comes from `staticTrimeshes()` |
|
|
76
|
+
| `settings.saved` | No replacement: nothing read it |
|
|
77
|
+
| `withHint` from `threedog/error-hints` | `hintText` |
|
|
78
|
+
| `threePatches.off('hlod-visible')` | The patch is gone: `hlod` hides a far original on the batch layer |
|
|
79
|
+
| `threedog bake light --spacing` | The bake traces rays now, so the option is gone, and `--samples` means rays per texel (default 128). Bake again and compare |
|
|
80
|
+
|
|
81
|
+
## Renamed
|
|
82
|
+
|
|
83
|
+
The table below keeps every rename; `engine.page.held` and `describe().page.held` are removed: ask `engine.frozen`, or `engine.stacks.get('freeze').has('page')` for this one holder. A page hold is now a plain freeze by owner `'page'`, so cutscene tweens and `runState` obey it, and `engine.step()` on a page in the background needs the loop stopped first, as the dev bridge already does.
|
|
84
|
+
|
|
85
|
+
| 0.7 | 0.8 |
|
|
86
|
+
|---|---|
|
|
87
|
+
| `hud.add(id, n)` | `hud.bump(id, n)` |
|
|
88
|
+
| `dialogue.cps` | `dialogue.charsPerSecond` (the option already had this name) |
|
|
89
|
+
| `rtsCamera({ angle })`, `cameraRig.angle` under that camera | `pitch`, as on the other cameras; `angle` is now refused as an unknown option |
|
|
90
|
+
| `weather.define(field, spec)` | `weather.defineField(field, spec)` |
|
|
91
|
+
| `terrain.T` | `terrain.generator` |
|
|
92
|
+
| `terrain.CHUNK` | `terrain.chunkSize` (`createTerrain()` keeps its own `CHUNK`) |
|
|
93
|
+
| `engine.pause(owner)` | `engine.haltLoop(owner)`, for tests and tools. It stops rendering too, so a game that wants to pause uses `engine.freeze` or flow `'paused'`. The `{ kind: 'test' }` option is gone |
|
|
94
|
+
| `engine.paused`, `describe().time.paused` | `engine.halted`, `describe().time.halted` |
|
|
95
|
+
| `engine.mod('pause', ...)`, `describe().holds.pause` | `engine.mod('halt', ...)`, `describe().holds.halt` |
|
|
96
|
+
| `runState.state` `'test-paused'`, `'paused'` | `'halted'` (the loop is stopped), `'frozen'` (a game, page or error freeze) |
|
|
97
|
+
| `engine.terms`, `terms.cloudShadow`, `terms.season` | `engine.shaderTerms`, with the same two members |
|
|
98
|
+
| `engine.view`, `view.manual` | `engine.autoView`, `autoView.manual` |
|
|
99
|
+
| `lightPool.usage()` | `engine.describe().lightPool` |
|
|
100
|
+
| `terrain.isReadyAround(p)`, `rigid.groundReady(p)` | `engine.stream.addReadyCheck` and `stateApplied` already wait on them |
|
|
101
|
+
|
|
102
|
+
## Error codes
|
|
103
|
+
|
|
104
|
+
Search any `e.code === '...'` or `catch` in your game, and any test that names a code.
|
|
105
|
+
|
|
106
|
+
| 0.7 | 0.8 |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `options-object` | `bad-position` |
|
|
109
|
+
| `npc-option` | `character-option` |
|
|
110
|
+
| `pickup-prop-id` | `world-id` |
|
|
111
|
+
| `session-handle` | `module-handle` |
|
|
112
|
+
| `world-missing` | `module-needs` |
|
|
113
|
+
| `load-failed` | `asset-load` |
|
|
114
|
+
| `pause-owner` | `halt-owner` |
|
|
115
|
+
| `bad-arg` | Gone: `input.bind` raises `input-keys`, `characters.support` raises `character-option`, `settings({ presets })` raises `module-params` |
|
|
116
|
+
| `state-at` | Gone: `applyState` lists the value in `refused` |
|
|
117
|
+
| `renamed-field`, `shadow-type` | Gone, nothing raises them: the old names they caught are plain unknown options now |
|
|
118
|
+
| `engine.stacks.define` of a known name raised `mod-owner` | `engine-misuse` |
|
|
119
|
+
| `weather.set` with bad seconds raised `module-params` | `weather-option` |
|
|
120
|
+
| `interaction.use` answered `noKey` | With no key it runs when code asks, `ops.list({ available: true })` leaves it out, and `interaction-no-key` is a dev warning. Code that read `noKey` reads `engine.input.isUnbound(action)` |
|
|
121
|
+
| `ground-missing` threw (a prop, spawn or `snapToGround` beyond `terrain({ shape })`) | A warning, and the safe fallback runs: a `catch` for it no longer fires |
|
|
122
|
+
|
|
123
|
+
These used to throw and now warn once in dev and go on: `engine.wrap` on a `_private` method, `createEngine({ fallback })` without WebGPU, a vegetation `rule` beside `positions`, `ui.theme.promptHeight`, a module going against its `type`, `engine.sky.environment()` called twice (the second replaces the first), and `sky({ time })` with a calendar.
|
|
124
|
+
|
|
125
|
+
## Behaves differently
|
|
126
|
+
|
|
127
|
+
No error tells you about these.
|
|
128
|
+
|
|
129
|
+
| 0.7 | 0.8 |
|
|
130
|
+
|---|---|
|
|
131
|
+
| Physics ran at full speed under `engine.mod('time.world', ...)` | Rigid bodies and vehicles follow the `world` channel, and a hit-stop at speed 0 holds them. To keep them at full speed, slow a channel of your own |
|
|
132
|
+
| `engine.freeze(owner, { ambient: true })` left skeletal animation and particles moving | A real still: they stop with `uTime`. A plain freeze keeps them moving as before |
|
|
133
|
+
| `engine.batching` cell 64 m | 256 m, about 13-25% more triangles drawn. A game with heavy props sets `createEngine({ batching: { cell: 64 } })` |
|
|
134
|
+
| `engine.remove` disposed a shared geometry or material at once | It disposes with the last user. Code that relied on the old timing disposes it itself |
|
|
135
|
+
| `engine.stream` unloaded in the same frame | Through `engine.jobs`, so an entry out of range can stay a few frames longer in the real-time loop; `engine.step` still finishes in the frame |
|
|
136
|
+
| A low-tier device lowered `particles.define` `max`, `weather({ particles })`, a weather `count` and `sky.environment({ interval })` | It changes defaults only: these stand as the game gave them |
|
|
137
|
+
| A skybox reached full brightness at ambient 1.2 | At the brightest row of the game's keyframes |
|
|
138
|
+
| `engine.setPixelRatio(p)` was undone by adaptive resolution within two minutes | It is the top adaptive climbs back to; adaptive may still lower it under load |
|
|
139
|
+
| Settings stored every value | Only what the player changed, with a preset stored by name. Stored files of version 1 are read: a value equal to the default lets go |
|
|
140
|
+
| `music.play`, `music.stinger`, `hud.counter`, `hud.bar`, `calendar.at`, `calendar.daily`, `calendar.between`, `vegetation.removeInstance` ignored an unknown option | They throw on it |
|
|
141
|
+
| A class instance in a saved `world` record (`Vector3`, `Color`, `Map`) failed after a load | It throws `world-plain` in dev at `world.add` / `world.set`. Write `{ x, y, z }`, or add the record with `{ save: false }`. `position` stays free |
|
|
142
|
+
| A direct write to `engine.sky.sunDir` was undone on the next frame | It is the same vector as `engine.uniforms.uSunDir` and the write stays; `engine.autoView.manual('sunDir', false)` gives it back |
|
|
143
|
+
| An `approach` interaction on a held character walked or hung | Refused with `cannotWalk` |
|
|
144
|
+
| `characters.findPath` with no navmesh routed to a target inside a wall or water | `null` (`noPath` when detailed) |
|
|
145
|
+
| `hud.counter` with no label showed the id | The value alone |
|
|
146
|
+
| A quest reward that threw stopped the rest of the list | `content.run` runs every effect, rethrows the first error, and the quest still finishes |
|
|
147
|
+
| `inspect.perf()` on a halted page read `cpuMs` and `fps` as 0 | `null`, and `measured` says whether anything was counted |
|
|
148
|
+
| Two manifest entries naming each other as `fallback` waited for good | The load fails once with `asset-fallback-cycle`, naming the chain |
|
|
149
|
+
| An awaited `model()`, `texture()` or `font()` could reject or resume while the engine was disposed | The promise stays pending for good, and so does any later call: put teardown work in your dispose path, not after the `await` |
|
|
150
|
+
| A load ended by `release`, `trim`, a palette write or registering the name again could write its result back | Its result is freed when it arrives; code awaiting it gets a fresh load |
|
|
151
|
+
| `release('shrub')` on a name that fell back to `rock` touched `rock`'s data | A name that fell back holds no data: release `rock` |
|
|
152
|
+
| A mesh dropped while its material stayed in use held memory on WebGPU | The engine sweeps these every few seconds, so calls you added to work around it can go; `threePatches.off('webgpu-record-sweep')` turns it off |
|
|
153
|
+
|
|
154
|
+
## Tools
|
|
155
|
+
|
|
156
|
+
| 0.7 | 0.8 |
|
|
157
|
+
|---|---|
|
|
158
|
+
| `assets optimize` put the optimized pack anywhere in `assets.js` | It comes last, so `/optimized/x.glb` wins over an original of the same name; the next run moves an older game over |
|
|
159
|
+
| `assets optimize --strict` or a lower `--budget` skipped cached models | Cached models count, so a run that passed may now fail |
|
|
160
|
+
| `check` passed a kind in `content/index.js` listed without `rules` | An error |
|
|
161
|
+
| `check` in a game failed on file size, its own docs, a stale GAMEMAP, a module with no key, or startup creation | Warnings: a CI step that relied on one reads the warnings. New rules: R52 (captured twice), R53 (merge conflict markers in a tracked file) |
|
|
162
|
+
| `state`, `step`, `hold`, `press` and scenarios reported success when they did less | They fail with the reason and exit 1: a refused state, seconds that did not pass, a stopped engine |
|
|
163
|
+
| `shot` and `capture` ignored a value the page refused (`--weather rian`) | They fail |
|
|
164
|
+
| `threedog state` and `threedog snap` added a tick or two | They move no game time, so a script that counted on it steps itself |
|
|
165
|
+
| `lib pull` copied an entry the game's renderer cannot draw | Refused, nothing copied; `--force` copies it to port by hand, and `lib check` fails until it is ported |
|
|
166
|
+
|
|
167
|
+
## Stability
|
|
168
|
+
|
|
169
|
+
`@experimental` now means one thing everywhere: the name may change or go in any version with no migration note. See "Stability" in `CONVENTIONS.md` for the list. Nothing stops working, but do not build a save format on a marked name. The printed text of commands was never an interface: read `--json`.
|