threedog 0.7.0 → 1.0.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 +411 -1
- package/README.md +8 -11
- package/core/{Animator.js → assets/Animator.js} +30 -18
- package/core/{Assets.js → assets/Assets.js} +131 -56
- package/core/{Baked.js → assets/Baked.js} +4 -4
- package/core/assets/assetEntry.js +302 -0
- package/core/{assetHot.js → assets/assetHot.js} +9 -7
- package/core/{assetLoad.js → assets/assetLoad.js} +55 -16
- package/core/assets/assetLod.js +113 -0
- package/core/{assetManifest.js → assets/assetManifest.js} +19 -11
- package/core/{assetReport.js → assets/assetReport.js} +7 -14
- package/core/{namedModel.js → assets/namedModel.js} +17 -13
- package/core/{Audio.js → audio/Audio.js} +47 -25
- 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} +15 -12
- package/core/{Random.js → base/Random.js} +7 -4
- package/core/{Vars.js → base/Vars.js} +14 -4
- package/core/{easing.js → base/easing.js} +1 -1
- package/core/{errorCodes.js → base/errorCodes.js} +151 -125
- package/core/{errorHints.js → base/errorHints.js} +17 -10
- package/core/{errors.js → base/errors.js} +12 -10
- package/core/{events.generated.js → base/events.generated.js} +11 -0
- package/core/base/follows.js +26 -0
- package/core/base/math.js +66 -0
- package/core/{params.js → base/params.js} +5 -6
- package/core/base/saveValues.js +81 -0
- package/core/base/sections.js +97 -0
- package/core/base/spelling.js +32 -0
- package/core/base/util.js +32 -0
- package/core/{validate.js → base/validate.js} +34 -34
- package/core/{Engine.js → engine/Engine.js} +137 -91
- package/core/{Loading.js → engine/Loading.js} +34 -5
- package/core/{copies.js → engine/copies.js} +4 -4
- package/core/{headlessLoad.js → engine/headlessLoad.js} +32 -15
- package/core/{lifecycle.js → engine/lifecycle.js} +41 -34
- package/core/{loop.js → engine/loop.js} +88 -49
- package/core/engine/moduleSlots.js +176 -0
- package/core/{moduleTypes.js → engine/moduleTypes.js} +26 -14
- package/core/engine/modules.js +503 -0
- package/core/{page.js → engine/page.js} +59 -29
- package/core/{plugins.js → engine/plugins.js} +21 -12
- package/core/{services.js → engine/services.js} +50 -40
- package/core/{startup.js → engine/startup.js} +66 -54
- package/core/{Input.js → input/Input.js} +67 -39
- package/core/{inputContext.js → input/inputContext.js} +14 -5
- package/core/input/inputKeyboard.js +39 -0
- package/core/{inputPad.js → input/inputPad.js} +24 -3
- package/core/{inputPointer.js → input/inputPointer.js} +11 -3
- package/core/input/inputSeat.js +66 -0
- package/core/{inputTouch.js → input/inputTouch.js} +24 -7
- package/core/{Budget.js → inspect/Budget.js} +21 -20
- package/core/{DebugOverrides.js → inspect/DebugOverrides.js} +43 -18
- package/core/{Describe.js → inspect/Describe.js} +34 -26
- package/core/{Inspect.js → inspect/Inspect.js} +39 -10
- package/core/{InspectMaterials.js → inspect/InspectMaterials.js} +7 -8
- package/core/{InspectPerf.js → inspect/InspectPerf.js} +19 -13
- package/core/{InspectScene.js → inspect/InspectScene.js} +8 -5
- package/core/{MaterialInfo.js → inspect/MaterialInfo.js} +3 -2
- package/core/{UrlState.js → inspect/UrlState.js} +60 -24
- package/core/{catalog.js → inspect/catalog.js} +15 -8
- package/core/{checks.js → inspect/checks.js} +7 -5
- package/core/{debugView.js → inspect/debugView.js} +4 -4
- package/core/{describeRender.js → inspect/describeRender.js} +24 -22
- package/core/{describeText.js → inspect/describeText.js} +17 -8
- package/core/inspect/geometryWatch.js +38 -0
- package/core/{lightWatch.js → inspect/lightWatch.js} +8 -8
- package/core/inspect/metadata.generated.js +4140 -0
- package/core/{pictureWriters.js → inspect/pictureWriters.js} +130 -47
- package/core/{shaderCost.js → inspect/shaderCost.js} +1 -1
- package/core/inspect/toolDoor.js +21 -0
- package/core/inspect/valueHistory.js +35 -0
- package/core/{Ops.js → ops/Ops.js} +44 -14
- package/core/{control.js → ops/control.js} +57 -31
- package/core/ops/holds.js +140 -0
- package/core/{opsAtomic.js → ops/opsAtomic.js} +18 -5
- package/core/{opsCheck.js → ops/opsCheck.js} +11 -10
- package/core/{opsFail.js → ops/opsFail.js} +5 -7
- package/core/{opsGuard.js → ops/opsGuard.js} +3 -3
- package/core/{opsRun.js → ops/opsRun.js} +9 -6
- package/core/{owned.js → ops/owned.js} +33 -19
- package/core/{sharedPoint.js → ops/sharedPoint.js} +13 -16
- package/core/{stackFrames.js → ops/stackFrames.js} +2 -2
- package/core/{stacks.js → ops/stacks.js} +34 -15
- package/core/{wrap.js → ops/wrap.js} +8 -6
- package/core/{SaveStore.js → saves/SaveStore.js} +53 -27
- package/core/{Saves.js → saves/Saves.js} +171 -54
- package/core/saves/saveApply.js +312 -0
- package/core/{saveFiles.js → saves/saveFiles.js} +45 -38
- package/core/{saveVersions.js → saves/saveVersions.js} +24 -23
- package/core/saves/session.js +231 -0
- package/core/saves/stateReplace.js +184 -0
- package/core/{Rays.js → scene/Rays.js} +44 -30
- package/core/{Views.js → scene/Views.js} +16 -8
- package/core/{adaptive.js → scene/adaptive.js} +19 -9
- package/core/{canvasBox.js → scene/canvasBox.js} +4 -3
- package/core/scene/compositeGround.js +72 -0
- package/core/scene/floor.js +17 -0
- package/core/{gameLights.js → scene/gameLights.js} +17 -7
- package/core/{grayMap.js → scene/grayMap.js} +8 -2
- package/core/{grid.js → scene/grid.js} +6 -4
- package/core/{gridLoad.js → scene/gridLoad.js} +1 -1
- package/core/scene/ground.contract.js +14 -0
- package/core/scene/ground.js +139 -0
- package/core/{movement.js → scene/movement.js} +3 -3
- package/core/{pictureSlots.js → scene/pictureSlots.js} +2 -2
- package/core/scene/pixel.js +154 -0
- package/core/scene/pixelRatio.js +167 -0
- package/core/{sceneDelta.js → scene/sceneDelta.js} +5 -5
- package/core/{sceneMethods.js → scene/sceneMethods.js} +43 -15
- package/core/scene/stepPoses.js +60 -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} +25 -16
- package/core/{things.js → scene/things.js} +18 -5
- package/core/{threePatches.js → scene/threePatches.js} +1 -1
- package/core/{tier.js → scene/tier.js} +10 -0
- package/core/scene/view.js +161 -0
- package/core/{Batching.js → stream/Batching.js} +85 -28
- package/core/{Stream.js → stream/Stream.js} +80 -38
- package/core/{batchGroups.js → stream/batchGroups.js} +11 -9
- package/core/{chunkStream.js → stream/chunkStream.js} +40 -0
- package/core/{scatter.js → stream/scatter.js} +7 -4
- package/core/{streamSources.js → stream/streamSources.js} +14 -8
- package/core/{Commits.js → threads/Commits.js} +17 -11
- package/core/{Jobs.js → threads/Jobs.js} +25 -13
- package/core/{Threads.js → threads/Threads.js} +21 -18
- 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} +20 -11
- package/core/{dayTime.js → time/dayTime.js} +5 -1
- package/core/{skip.js → time/skip.js} +28 -21
- package/core/{time.js → time/time.js} +32 -20
- package/core/{uiClock.js → time/uiClock.js} +4 -4
- package/docs/AI.md +92 -72
- package/docs/API.md +33 -28
- package/docs/CODEMAP.md +121 -200
- package/docs/COMMANDS.md +77 -70
- package/docs/CONVENTIONS.md +167 -24
- package/docs/MIGRATING-0.8.md +171 -0
- package/docs/MIGRATING-1.0.md +101 -0
- package/docs/THREE.md +140 -38
- package/docs/api/assets.md +12 -13
- package/docs/api/audio.md +6 -5
- package/docs/api/budget.md +4 -4
- package/docs/api/calendar.md +10 -11
- package/docs/api/cameraRig.md +32 -29
- package/docs/api/characters.md +35 -24
- package/docs/api/clock.md +1 -1
- package/docs/api/collider3d.md +9 -0
- package/docs/api/collision.md +12 -9
- package/docs/api/content.md +18 -17
- package/docs/api/dialogue.md +5 -4
- package/docs/api/engine.md +58 -54
- package/docs/api/events.md +17 -6
- package/docs/api/flow.md +1 -1
- package/docs/api/grids.md +1 -1
- package/docs/api/ground.md +6 -7
- package/docs/api/hud.md +2 -2
- package/docs/api/i18n.md +6 -6
- package/docs/api/input.md +9 -8
- package/docs/api/interactions.md +5 -5
- package/docs/api/inventory.md +10 -10
- package/docs/api/jobs.md +5 -5
- package/docs/api/level.md +10 -9
- package/docs/api/lightPool.md +1 -6
- package/docs/api/music.md +3 -3
- package/docs/api/nav.md +14 -12
- package/docs/api/openWorld.md +1 -1
- package/docs/api/particles.md +10 -7
- package/docs/api/photo.md +4 -2
- package/docs/api/pickups.md +3 -3
- package/docs/api/post.md +21 -5
- package/docs/api/quests.md +7 -5
- package/docs/api/rays.md +7 -7
- package/docs/api/rigid.md +29 -19
- package/docs/api/saves.md +13 -11
- package/docs/api/settings.md +9 -8
- package/docs/api/sky.md +8 -7
- package/docs/api/stream.md +8 -9
- package/docs/api/swarm.md +34 -0
- package/docs/api/terrain.md +6 -8
- package/docs/api/terrainDraw.md +2 -2
- package/docs/api/timeline.md +4 -4
- package/docs/api/tools.md +27 -22
- package/docs/api/triggers.md +2 -0
- package/docs/api/vars.md +1 -1
- package/docs/api/vegetation.md +4 -3
- package/docs/api/vegetationDraw.md +2 -2
- package/docs/api/water.md +7 -3
- package/docs/api/weather.md +27 -12
- package/docs/api/weatherDraw.md +4 -4
- package/docs/api/world.md +6 -6
- package/docs/recipes/01-new-game.md +28 -43
- package/docs/recipes/02-npc.md +21 -23
- package/docs/recipes/03-items-pickups.md +37 -53
- package/docs/recipes/04-quests.md +5 -4
- package/docs/recipes/05-props-bake.md +34 -44
- package/docs/recipes/06-clock-events.md +31 -22
- package/docs/recipes/07-flow-scenes-pause.md +30 -32
- package/docs/recipes/08-weather-sky.md +91 -37
- package/docs/recipes/09-materials-lights-models.md +25 -39
- package/docs/recipes/10-blender-level.md +22 -11
- package/docs/recipes/11-vehicles.md +44 -24
- package/docs/recipes/12-navmesh.md +60 -15
- package/docs/recipes/13-animation.md +70 -22
- package/docs/recipes/14-custom-module.md +33 -20
- package/docs/recipes/15-perf.md +51 -28
- package/docs/recipes/16-dev-bridge.md +39 -58
- package/docs/recipes/18-world.md +49 -28
- package/docs/recipes/19-shooting-picking.md +7 -4
- package/docs/recipes/20-content-actions-save.md +55 -40
- package/docs/recipes/21-camera.md +47 -25
- package/docs/recipes/22-shop-gold.md +21 -16
- package/docs/recipes/23-ops.md +28 -24
- package/docs/recipes/26-ui-parts.md +25 -14
- package/docs/recipes/27-net.md +3 -5
- package/docs/recipes/28-terrain.md +119 -23
- package/docs/recipes/29-grid.md +3 -3
- package/docs/recipes/30-templates.md +63 -30
- package/docs/recipes/31-audio.md +7 -7
- package/docs/recipes/32-action-game.md +21 -11
- package/docs/recipes/33-stream-sources.md +6 -3
- package/docs/recipes/34-environment-lighting.md +72 -25
- package/docs/recipes/35-picture-from-reference.md +20 -23
- package/docs/recipes/36-ground-plants.md +106 -0
- package/docs/recipes/40-scene.md +18 -21
- package/docs/recipes/43-shader-patches-surfaces.md +27 -48
- package/docs/recipes/44-water-weather-hooks.md +56 -50
- package/docs/recipes/45-cascaded-shadows.md +41 -20
- package/docs/recipes/46-blender-art-route.md +9 -10
- package/docs/recipes/49-game-module-contract.md +7 -6
- package/docs/recipes/50-own-renderer.md +3 -2
- package/docs/recipes/51-capability-catalog.md +14 -8
- package/docs/recipes/52-around-the-picture.md +56 -100
- package/docs/recipes/53-ground-up-close.md +61 -24
- package/docs/recipes/55-mods-time-wrap.md +17 -20
- package/docs/recipes/56-webgpu-tsl.md +28 -15
- package/docs/recipes/57-control.md +39 -12
- package/docs/recipes/58-input.md +15 -2
- package/docs/recipes/59-depth-post-effects.md +1 -1
- package/docs/recipes/60-judge-the-picture.md +30 -25
- package/docs/recipes/62-picture-code.md +129 -39
- package/docs/recipes/63-third-person-start.md +19 -5
- package/docs/recipes/64-particles.md +54 -5
- package/docs/recipes/65-swarm.md +140 -0
- package/docs/recipes/66-common-tasks.md +313 -0
- package/examples/action/.threedog/content-index.json +1 -1
- package/examples/action/GAMEMAP.md +5 -5
- package/examples/perf-island/.threedog/content-index.json +1 -0
- package/examples/{sheepisland → perf-island}/GAMEMAP.md +15 -14
- package/examples/{sheepisland → perf-island}/assets.js +1 -1
- package/examples/{sheepisland → perf-island}/main.js +8 -8
- package/examples/{sheepisland → perf-island}/models.js +1 -1
- package/examples/{sheepisland → perf-island}/params.js +1 -1
- package/examples/{sheepisland → perf-island}/picture/index.js +1 -1
- package/examples/{sheepisland → perf-island}/picture/palette.js +2 -2
- package/examples/{sheepisland → perf-island}/views.js +1 -1
- package/examples/plain-picture/GAMEMAP.md +4 -1
- package/examples/rc2d/GAMEMAP.md +4 -3
- package/examples/rc2d/main.js +1 -3
- package/examples/rc2d/rc2d.js +1 -1
- package/examples/styletest/.threedog/content-index.json +1 -1
- package/examples/styletest/GAMEMAP.md +6 -5
- package/examples/techniques/contact-shadows/contactShadows.js +1 -1
- package/examples/techniques/contact-shadows/main.js +1 -1
- package/examples/techniques/interior-light/main.js +1 -1
- package/examples/techniques/modular-building/README.md +7 -6
- package/examples/techniques/outlines-and-rim/picture/post.js +1 -1
- package/examples/techniques/procedural-animation/README.md +1 -1
- package/examples/webgpu-tsl/GAMEMAP.md +2 -1
- package/examples/world/.threedog/content-index.json +1 -1
- package/examples/world/GAMEMAP.md +9 -7
- package/examples/world/main.js +3 -3
- package/examples/world/picture/sky.js +1 -1
- package/index.d.ts +16 -12
- package/index.js +53 -32
- package/llms.txt +11 -14
- package/modules/ambience/Ambience.js +16 -11
- package/modules/calendar/Calendar.js +19 -19
- package/modules/calendar/index.js +18 -16
- package/modules/calendar/schedule.js +11 -6
- package/modules/calendar/seasons.js +7 -7
- package/modules/camera/FirstPersonCamera.js +5 -5
- package/modules/camera/FixedCamera.js +43 -30
- package/modules/camera/FollowCamera.js +24 -15
- package/modules/camera/RtsCamera.js +12 -11
- package/modules/camera/common.js +72 -37
- package/modules/camera/contract.js +1 -0
- package/modules/camera/pixelSnap.js +62 -0
- package/modules/characters/Character.js +166 -70
- package/modules/characters/NPC.js +84 -44
- package/modules/characters/assetModel.js +16 -12
- package/modules/characters/astar.js +48 -27
- package/modules/characters/behaviors.js +4 -5
- package/modules/characters/character.contract.js +21 -0
- package/modules/characters/contract.js +17 -3
- package/modules/characters/index.js +240 -226
- package/modules/characters/moveHelpers.js +88 -12
- package/modules/characters/mover.contract.js +14 -0
- package/modules/characters/movers/common.js +22 -18
- package/modules/characters/movers/manual.js +1 -1
- package/modules/characters/movers/rapier.js +18 -10
- package/modules/characters/movers/simple.js +26 -13
- package/modules/characters/movers/support.js +24 -13
- package/modules/characters/npcAvoid.js +19 -16
- package/modules/characters/npcSim.js +88 -32
- package/modules/characters/npcView.js +19 -11
- package/modules/characters/pathAsync.js +81 -29
- package/modules/characters/pathJob.js +38 -21
- package/modules/characters/pathWorker.js +1 -1
- package/modules/characters/player.js +120 -0
- package/modules/characters/playerStrings.js +2 -2
- package/modules/characters/proceduralRig.js +2 -2
- package/modules/characters/seat.js +56 -0
- package/modules/characters/useModel.js +3 -3
- package/modules/characters/vehicle.contract.js +8 -5
- package/modules/characters/walkTo.js +40 -33
- package/modules/collision/Collision.js +69 -45
- package/modules/collision/contract.js +15 -0
- package/modules/collision/grid.js +6 -1
- package/modules/content/explain.js +2 -3
- package/modules/content/fields.js +24 -3
- package/modules/content/ids.js +5 -3
- package/modules/content/index.js +132 -114
- package/modules/content/loader.js +117 -140
- package/modules/content/markers.js +25 -0
- package/modules/content/models.js +54 -17
- package/modules/content/packs.js +5 -4
- package/modules/content/parts.js +2 -2
- package/modules/content/places.js +36 -0
- package/modules/content/props.js +22 -17
- package/modules/content/rules.js +47 -61
- package/modules/content/stages.js +7 -7
- package/modules/content/templates.js +80 -49
- package/modules/content/words.js +47 -0
- package/modules/debug/DebugPanel.js +14 -45
- package/modules/flow/contract.js +2 -1
- package/modules/flow/index.js +30 -16
- package/modules/gameplay/Container.js +17 -13
- package/modules/gameplay/Containers.js +23 -6
- package/modules/gameplay/Dialogue.js +93 -34
- package/modules/gameplay/Interactions.js +93 -51
- package/modules/gameplay/Inventory.js +64 -22
- package/modules/gameplay/Quests.js +146 -30
- package/modules/gameplay/boxOps.js +8 -1
- package/modules/gameplay/dialogueBubbles.js +16 -12
- package/modules/gameplay/inventoryOps.js +11 -8
- package/modules/gameplay/pickups.js +63 -37
- package/modules/gameplay/questLog.js +4 -2
- package/modules/gameplay/questSave.js +9 -4
- package/modules/gameplay/quests.contract.js +1 -1
- package/modules/grid/Grid.js +2 -2
- package/modules/grid/Layer.js +12 -8
- package/modules/grid/index.js +28 -23
- package/modules/grid/ops.js +43 -46
- package/modules/grid/preview.js +7 -7
- package/modules/grid/tiles.js +6 -6
- package/modules/hlod/index.js +42 -57
- package/modules/hud/index.js +22 -14
- package/modules/hud/parts.js +8 -8
- package/modules/level/contract.js +16 -0
- package/modules/level/heightfield.js +29 -31
- package/modules/level/index.js +113 -161
- package/modules/level/load.js +196 -0
- package/modules/level/meshes.js +65 -0
- package/modules/level/nodes.js +40 -23
- package/modules/lights/index.js +33 -183
- package/modules/lights/slots.js +93 -0
- package/modules/lights/sources.js +90 -0
- package/modules/music/Music.js +34 -28
- package/modules/music/rules.js +1 -1
- package/modules/nav/contract.js +16 -0
- package/modules/nav/index.js +180 -49
- package/modules/nav/navPath.js +45 -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 +6 -5
- package/modules/net/sync.js +2 -2
- package/modules/net/transports.js +2 -2
- package/modules/particles/Particles.js +95 -29
- package/modules/particles/effect.js +86 -32
- package/modules/particles/shaders.js +19 -1
- package/modules/photo/Photo.js +23 -23
- package/modules/rigid/RigidBodies.js +255 -89
- package/modules/rigid/Vehicles.js +17 -8
- package/modules/rigid/collider3d.contract.js +26 -0
- package/modules/rigid/ragdoll.js +298 -0
- package/modules/rigid/ragdollBones.js +209 -0
- package/modules/rigid/refresh.js +10 -0
- package/modules/rigid/sync.js +51 -20
- package/modules/settings/Settings.js +177 -61
- package/modules/settings/apply.js +20 -13
- package/modules/settings/sections.js +19 -14
- package/modules/settings/strings.js +2 -2
- package/modules/settings/view.js +3 -3
- package/modules/sky/Sky.js +29 -22
- package/modules/sky/clouds.js +7 -7
- package/modules/sky/dome.js +33 -20
- package/modules/sky/domeLayers.js +9 -9
- package/modules/sky/environment.js +6 -6
- package/modules/sky/frame.js +19 -10
- package/modules/sky/season.js +7 -1
- package/modules/sky/shader.js +24 -25
- package/modules/sky/skyModule.js +17 -28
- package/modules/sky/tint.js +1 -1
- package/modules/swarm/Swarm.js +356 -0
- package/modules/swarm/draw.js +68 -0
- package/modules/swarm/grid.js +63 -0
- package/modules/terrain/ChunkManager.js +71 -59
- package/modules/terrain/chunkQueries.js +7 -24
- package/modules/terrain/chunkWorker.js +1 -1
- package/modules/terrain/draw.js +14 -11
- package/modules/terrain/index.js +42 -42
- package/modules/terrain/terrainColorMap.js +6 -3
- package/modules/terrain/terrainDefaults.js +2 -1
- package/modules/terrain/terrainEdit.js +45 -29
- package/modules/terrain/terrainGen.js +19 -12
- 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 +83 -43
- package/modules/timeline/Tween.js +25 -19
- package/modules/timeline/shots.js +24 -17
- package/modules/triggers/index.js +95 -28
- package/modules/vegetation/Vegetation.js +34 -26
- package/modules/vegetation/densityMap.js +4 -7
- package/modules/vegetation/draw.js +39 -18
- package/modules/vegetation/groundChunks.js +21 -38
- package/modules/vegetation/index.js +37 -12
- package/modules/vegetation/modelGeometry.js +3 -6
- package/modules/vegetation/nearFade.js +1 -1
- package/modules/water/Water.js +20 -16
- package/modules/water/surface.js +3 -3
- package/modules/weather/Weather.js +52 -40
- package/modules/weather/particles.js +8 -8
- package/modules/weather/weatherDraw.js +28 -23
- package/modules/world/World.js +28 -15
- package/modules/world/explain.js +1 -1
- package/modules/world/index.js +30 -17
- package/modules/world/persist.js +90 -27
- package/modules/world/pos.js +5 -5
- package/modules/world/records.js +37 -11
- package/modules/world/sim.js +78 -27
- package/modules/world/simFar.js +2 -2
- package/modules/world/state.js +43 -11
- package/modules/world/thingSource.js +20 -5
- package/modules/world/views.js +27 -14
- package/package.json +48 -7
- package/presets.js +1 -3
- package/render/PostFX.js +83 -53
- package/render/backend.js +31 -33
- package/render/cascades.js +17 -12
- package/render/cascades.tsl.js +5 -8
- package/render/daylight.js +20 -3
- package/render/detail.js +8 -7
- package/render/effects.js +28 -25
- package/render/fuse.js +3 -3
- package/render/fx/cloudShadow.tsl.js +3 -3
- package/render/fx/detail.tsl.js +1 -1
- package/render/fx/index.js +5 -10
- 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/particles.tsl.js +8 -6
- package/render/fx/patchNodes.tsl.js +5 -15
- package/render/fx/postWebGPU.tsl.js +30 -26
- package/render/fx/sky.tsl.js +15 -17
- package/render/fx/uniforms.tsl.js +4 -4
- package/render/fx/wind.tsl.js +1 -1
- package/render/fxNumbers.js +3 -0
- package/render/layers.js +2 -2
- package/render/lighting.js +5 -3
- package/render/lightmap.js +41 -21
- package/render/lights.js +6 -6
- package/render/lit.js +24 -0
- package/render/materials.js +8 -7
- package/render/mergeCommon.js +22 -0
- package/render/modeling.js +2 -2
- package/render/occlusion.js +62 -15
- package/render/ownFrame.js +4 -4
- package/render/patches.js +15 -15
- package/render/postWebGL.js +15 -12
- package/render/probes.js +41 -19
- 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/{core → render}/shadows.js +59 -13
- package/render/slots.js +7 -7
- package/render/terms.js +22 -24
- package/render/uniformDecl.js +1 -1
- package/types/core.d.ts +336 -202
- package/types/gameplay.d.ts +254 -130
- package/types/generated/core/{Audio.d.ts → audio/Audio.d.ts} +22 -7
- 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} +8 -16
- package/types/generated/core/{Random.d.ts → base/Random.d.ts} +4 -3
- package/types/generated/core/{page.d.ts → engine/page.d.ts} +8 -9
- package/types/generated/core/{Input.d.ts → input/Input.d.ts} +28 -10
- package/types/generated/core/input/inputSeat.d.ts +26 -0
- package/types/generated/core/{Budget.d.ts → inspect/Budget.d.ts} +36 -26
- package/types/generated/core/{DebugOverrides.d.ts → inspect/DebugOverrides.d.ts} +17 -3
- package/types/generated/core/{Ops.d.ts → ops/Ops.d.ts} +6 -4
- package/types/generated/core/{control.d.ts → ops/control.d.ts} +14 -10
- package/types/generated/core/{Saves.d.ts → saves/Saves.d.ts} +62 -18
- package/types/generated/core/{session.d.ts → saves/session.d.ts} +3 -2
- package/types/generated/core/{Rays.d.ts → scene/Rays.d.ts} +8 -27
- package/types/generated/core/{Views.d.ts → scene/Views.d.ts} +2 -2
- package/types/generated/core/{Batching.d.ts → stream/Batching.d.ts} +7 -7
- package/types/generated/core/{Stream.d.ts → stream/Stream.d.ts} +22 -18
- 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/Grid.d.ts +1 -0
- package/types/generated/modules/grid/Layer.d.ts +1 -1
- package/types/generated/modules/grid/index.d.ts +3 -3
- package/types/generated/modules/music/Music.d.ts +7 -5
- package/types/generated/modules/particles/Particles.d.ts +5 -4
- package/types/generated/modules/sky/Sky.d.ts +21 -10
- package/types/generated/modules/swarm/Swarm.d.ts +80 -0
- package/types/generated/modules/timeline/Timeline.d.ts +7 -5
- package/types/generated/modules/water/Water.d.ts +1 -0
- package/types/generated/modules/weather/Weather.d.ts +14 -16
- package/types/generated/modules/weather/weatherDraw.d.ts +3 -3
- package/types/generated/modules/world/World.d.ts +11 -7
- package/types/generated/render/PostFX.d.ts +21 -23
- package/types/generated/render/materials.d.ts +1 -0
- package/types/generated/render/occlusion.d.ts +9 -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 +47 -15
- package/types/physics.d.ts +150 -73
- package/types/pixel.d.ts +75 -0
- package/types/tsl.d.ts +37 -4
- package/types/world.d.ts +48 -75
- package/ui/Focus.js +10 -9
- package/ui/Parts.js +13 -5
- package/ui/UI.js +7 -7
- package/ui/defaults.js +3 -2
- package/ui/theme.js +7 -5
- package/core/assetEntry.js +0 -109
- package/core/engineCamera.js +0 -32
- package/core/ground.js +0 -104
- package/core/holds.js +0 -134
- package/core/math.js +0 -48
- package/core/moduleSlots.js +0 -100
- package/core/modules.js +0 -314
- package/core/saveApply.js +0 -210
- package/core/saveValues.js +0 -46
- package/core/session.js +0 -174
- package/core/shadowTypes.js +0 -16
- package/core/util.js +0 -17
- package/core/view.js +0 -43
- package/docs/MIGRATING-0.3.md +0 -248
- package/docs/MIGRATING-0.4.md +0 -320
- package/docs/MIGRATING-0.5.md +0 -68
- package/docs/MIGRATING-0.6.md +0 -126
- package/docs/PERF.md +0 -245
- package/docs/recipes/36-sky-ground-plants.md +0 -158
- package/docs/recipes/37-terrain-hooks.md +0 -115
- package/docs/recipes/38-environment-hooks.md +0 -67
- package/docs/recipes/42-terrain-shape.md +0 -64
- package/docs/recipes/47-island-snow-backdrop.md +0 -43
- package/docs/recipes/54-three-idioms.md +0 -88
- package/examples/plain-picture/FINDINGS.md +0 -53
- package/examples/sheepisland/.threedog/content-index.json +0 -1
- package/modules/camera/projection.js +0 -21
- /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/{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/examples/{sheepisland → perf-island}/content/templates.js +0 -0
- /package/examples/{sheepisland → perf-island}/content/vegetation.js +0 -0
- /package/examples/{sheepisland → perf-island}/picture/lights.js +0 -0
- /package/examples/{sheepisland → perf-island}/picture/materials.js +0 -0
- /package/examples/{sheepisland → perf-island}/picture/sky.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,7 +24,7 @@ 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
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
|
|
@@ -28,9 +40,7 @@ one line; the detail is here.
|
|
|
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
42
|
## Values the engine writes on its own (camera, shadow box)
|
|
31
|
-
Lights, fog, exposure and the environment have one writer, the game's `picture/` code
|
|
32
|
-
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
|
|
33
|
-
writing it, warns once). The camera: `engine.takeCamera(owner)` or a timeline camera step.
|
|
43
|
+
Lights, fog, exposure and the environment have one writer, the game's `picture/` code (recipe 62). What the engine writes itself, the camera pose and the shadow box, and how to take it: recipe 52 "Who writes it".
|
|
34
44
|
|
|
35
45
|
## Layers the engine keeps
|
|
36
46
|
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`.
|
|
@@ -39,7 +49,7 @@ The three.js layers below belong to the engine (one table: `RESERVED_LAYERS` in
|
|
|
39
49
|
| --- | --- | --- |
|
|
40
50
|
| 26 | `lightVolumes` | the box of air and the lights `lightVolumes` reads |
|
|
41
51
|
| 27 | `occlusionBox` | occlusion culling's query boxes, seen by the scene render of the view camera alone |
|
|
42
|
-
| 28 | `occlusionHidden` |
|
|
52
|
+
| 28 | `occlusionHidden` | nothing sits here: culling sets it on shadow cameras, so what it hides still casts |
|
|
43
53
|
| 29 | `outlineOff` | objects `outline({ offLayer })` leaves without lines; `OUTLINE_OFF_LAYER` from `@threedog/post-effects` is this same layer |
|
|
44
54
|
| 31 | `batched` | originals drawn through `engine.batching`, still hit by `engine.rays` |
|
|
45
55
|
|
|
@@ -53,12 +63,25 @@ logic need none of this.
|
|
|
53
63
|
| 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` |
|
|
54
64
|
| 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` |
|
|
55
65
|
| Close one action for a while (stunned: no jump) | `engine.input.gate(action, { owner, for })` | `recipes/55-mods-time-wrap.md` |
|
|
56
|
-
| 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" |
|
|
57
|
-
| 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.
|
|
58
|
-
| 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
|
|
66
|
+
| Replace a whole system (your own inventory, interactions, dialogue, quests, flow, characters, camera, collision, level; 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" |
|
|
67
|
+
| 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): write it directly, the engine yields; `engine.autoView.manual(key)` is for borrowing one and giving it back; a screen effect: `engine.post.add(x)` |
|
|
68
|
+
| 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` |
|
|
69
|
+
|
|
70
|
+
**What can be replaced**: a slot with a contract file (inventory, interactions, dialogue, quests, flow, characters, calendar, cameraRig, particles, collision, level; nav only with a Recast-based implementation, see below) lists what a replacement must supply, and `runContract` checks it. `nav` is narrower than the others: the path search calls Recast's `findPath` and `findStraightPath` on `query` and `getOffMeshConnectionByRef` on `navMesh`, the path worker gives the bytes from `exportMesh` to Recast's `importNavMesh`, and NPC steering calls `addAgent` on `crowd`, so a replacement is Recast underneath (a different mesh build, say), not another navigation library. For a search of another kind, leave `nav()` out and call yours from game code. The slots below have no contract; a replacement must supply what the engine's own callers read:
|
|
71
|
+
|
|
72
|
+
| Slot | A replacement must supply |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `sky` | the `engine.uniforms` signals your `picture/` code reads; `dome` (the object a photo leaves out) if it has one |
|
|
75
|
+
| `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 |
|
|
76
|
+
| `weather` | `types`, `name`, `current`, `label(name)`, `set(name, { seconds })`, `auto`. Replace `weatherDraw` with it |
|
|
77
|
+
| `vegetation` | `define(name, rule)` (content), `instanceAt(point, { radius })` (photo), `host` (settings). Replace `vegetation-draw` with it |
|
|
78
|
+
| `rigid` | `vehicles`, a list of objects that meet `modules/characters/vehicle.contract.js`; `collider3d`, the three-axis slot (`modules/rigid/collider3d.contract.js`) |
|
|
79
|
+
| `swarm` | nothing: no other module calls it |
|
|
80
|
+
|
|
81
|
+
**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`).
|
|
59
82
|
|
|
60
83
|
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
|
|
61
|
-
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.
|
|
84
|
+
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.
|
|
62
85
|
|
|
63
86
|
**Time channels**: most games use only the default (fixed `dt` in real seconds, `engine.clock` for calendar time). A channel exists so one group
|
|
64
87
|
of things can run slower or faster than the rest (bullet time on enemies, haste on the player): `engine.onFixed(fn, { channel: 'enemies' })` gets
|
|
@@ -74,20 +97,126 @@ into, or a convenience for after.
|
|
|
74
97
|
| 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 |
|
|
75
98
|
| 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 |
|
|
76
99
|
| Sun / light strength | your own three.js light in `picture/`, reading `engine.uniforms` (recipe 62) | the placeholders: write `engine.lights.sun` directly |
|
|
77
|
-
| 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, `
|
|
100
|
+
| 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) |
|
|
78
101
|
| 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 })` |
|
|
79
102
|
| Camera | install one: `openWorld({ camera })`, `engine.use(fixedCamera({ position, lookAt }))` | switch kinds at runtime: `setCamera(kind)`; a shot of your own: `takeCamera(owner)` |
|
|
80
103
|
| 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 |
|
|
81
104
|
| Environment light | `engine.sky.environment({ into: engine.scene })`, or `scene.environment` | light that changes from place to place: `bakeProbes` |
|
|
82
105
|
| 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()` |
|
|
83
106
|
| Ambient occlusion | `engine.post.add(ao())` (screen space) | a model made in code: `bakeVertexAO(geometry)`; bounce light between places: `bakeProbes` |
|
|
107
|
+
| Days, months and seasons that pass | `calendar()`, read `engine.calendar` (recipe 06) | one fixed moment: `sky({ time })` |
|
|
108
|
+
| See through the hero's eyes | `firstPersonCamera()` (recipe 21) | switch at runtime: `setCamera(kind)` |
|
|
109
|
+
| Still view of a room, security-camera style | `fixedCamera({ position, lookAt })` (recipe 21) | a moving shot: `takeCamera(owner)` |
|
|
110
|
+
| Strategy view from above, edge scrolling | `rtsCamera()` (recipe 21) | a view of your own: a module writing `engine.camera` |
|
|
111
|
+
| A person who walks, follows a path, is steered | `engine.characters` (recipe 13, 57) | a mover of your own: `characters.kit` |
|
|
112
|
+
| Levels, items and quests written as data files | `content/` files, read by `engine.content` (recipe 20) | built at runtime: plain code in a module |
|
|
113
|
+
| Dev info on screen, a key that shows it | `debug()`: F3 opens the panel, `engine.debug` (recipe 15) | outside the page: `threedog describe` |
|
|
114
|
+
| Far buildings or forests merged into one cheap mesh | `engine.hlod.add(root)` (recipe 15) | close objects: `engine.batching` |
|
|
115
|
+
| Next map, next stage, change level | `engine.level.load(name)` (recipe 10) | a fade around it: `engine.flow` (recipe 07) |
|
|
116
|
+
| Background song that changes in a fight or a place | `engine.music`, rules as data (recipe 31) | one track: `engine.audio.play` |
|
|
117
|
+
| An enemy walks around obstacles to reach someone | `engine.characters.findPath` on `engine.nav` (recipe 12) | a search of your own is fine: it reads `engine.collision.walkable` |
|
|
118
|
+
| Two people play together over the internet | `engine.net` (recipe 27) | |
|
|
119
|
+
| Take a snapshot in the game and keep it | `photo()`, `engine.photo.take()` | the raw image: `renderer.domElement.toBlob` |
|
|
120
|
+
| A cutscene: steps in order; tween a value | `engine.timeline`, `engine.timeline.tween(target, to)` (recipe 07) | one delay: `engine.clock.after` |
|
|
121
|
+
| Something happens when the player enters a zone | `engine.triggers` (recipe 20) | a press inside it: `engine.interactions` |
|
|
122
|
+
| Raindrops and snow drawn on screen | `engine.weatherDraw` (recipe 08) | your own drawing: `THREE.md` |
|
|
123
|
+
| Lower the resolution when the frame rate drops | `engine.adaptive` (recipe 15) | a fixed size: `engine.setPixelRatio` |
|
|
124
|
+
| Draw many copies of one mesh in one call | `engine.batching` (recipe 05) | your own `InstancedMesh`: plain three.js |
|
|
125
|
+
| What each frame costs, against limits | `engine.budget` (recipe 15) | |
|
|
126
|
+
| A cutscene takes the view for a moment | `engine.takeCamera(owner)`, read `engine.cameraOverride` | a whole shot list: `engine.timeline` |
|
|
127
|
+
| Sweep a shape through solid things, overlap tests | `engine.collider3d` (recipe 11) | a line: `engine.rays` |
|
|
128
|
+
| Spread mesh changes over frames so nothing hitches | `engine.commits` (recipe 15) | any other work: `engine.jobs` |
|
|
129
|
+
| Message when the game crashes, the last error | `engine.error` and `.threedog/errors.log` (recipe 16) | |
|
|
130
|
+
| Tell other systems something happened | `engine.events` (recipe 06) | |
|
|
131
|
+
| Height of the floor under a point | `engine.ground.height(x, z)` (recipe 28) | |
|
|
132
|
+
| Heavy work done bit by bit without freezing a frame | `engine.jobs` (recipe 15) | off the main thread: `engine.threads` |
|
|
133
|
+
| Loading screen, progress bar while files load | `engine.loading` (recipe 07) | |
|
|
134
|
+
| Pause when the browser tab is hidden | `engine.page` does it: gameplay freezes under owner `page` (recipe 07) | |
|
|
135
|
+
| Style files that plug in with no main.js line | `plugins/`, `engine.plugins` (recipe 40) | |
|
|
136
|
+
| Seeded dice roll that replays the same | `engine.random` (recipe 06) | |
|
|
137
|
+
| What is the mouse pointing at, click an object | `engine.rays`, `engine.pick(x, y)` (recipe 19) | |
|
|
138
|
+
| Which systems are stopped and who stopped them | `engine.runState` (recipe 16) | |
|
|
139
|
+
| Remember progress between visits | `engine.saves` (recipe 20) | |
|
|
140
|
+
| New game and continue from the menu | `engine.session` (recipe 07) | |
|
|
141
|
+
| Cloud shadow and season in your own material | `engine.shaderTerms` (recipe 52) | |
|
|
142
|
+
| Stack bonuses from several sources on one value | `engine.stacks` (recipe 55) | one value, no bookkeeping: `engine.mod` |
|
|
143
|
+
| How long the first frame took to load | `engine.startup` (recipe 15) | |
|
|
144
|
+
| Load far parts of a big map only when near | `engine.stream` (recipe 33) | |
|
|
145
|
+
| Heavy work in a web worker | `engine.threads` (recipe 15) | bit by bit on the main thread: `engine.jobs` |
|
|
146
|
+
| How many seconds passed in the game | `engine.time.now()` (recipe 06) | |
|
|
147
|
+
| Remember a flag or a count, a door was opened | `engine.vars` (recipe 20) | |
|
|
148
|
+
| A named fixed view, a second camera to show | `engine.views` (recipe 46) | |
|
|
149
|
+
| Load a model, texture or sound file | `engine.assets` (recipe 05) | a format it does not read: a three.js loader |
|
|
150
|
+
| Something at a set hour of game time (a shop opens at nine) | `engine.clock`, `engine.calendar` (recipe 06) | |
|
|
151
|
+
| A guard patrols or wanders between points | `engine.characters` with `findPath` (recipe 12, 57) | |
|
|
152
|
+
| Back to the main menu after losing, game over, retry | `engine.flow`, `engine.session` (recipe 07) | the rules of the ending: recipe 32 |
|
|
153
|
+
| Sunset, sunrise, the sky's colors | `engine.sky`, `engine.calendar` (recipe 08) | your own sky: `THREE.md` |
|
|
154
|
+
| Mission marker, an arrow on screen | `engine.hud.marker()` (recipe 04) | |
|
|
155
|
+
| Place furniture and merge it for speed | content `props` (recipe 05) | |
|
|
156
|
+
| Your own colors, textures and models | plain three.js in `picture/` (recipe 09) | |
|
|
157
|
+
| A map or model from a 3D modeling tool (Blender) | `engine.level` (recipe 10) | art only: recipe 46 |
|
|
158
|
+
| Write your own engine system | a module (recipe 14) | one that plugs into saves and time: recipe 49 |
|
|
159
|
+
| Match the look of a reference painting or picture | recipe 35 | |
|
|
160
|
+
| The image looks flat, what to adjust | recipe 60 | |
|
|
161
|
+
|
|
162
|
+
### Look-alike entries
|
|
163
|
+
Each of these does one job. Take the row for your job; none replaces another.
|
|
164
|
+
|
|
165
|
+
**What each wait waits for**
|
|
166
|
+
|
|
167
|
+
| Entry | Waits for |
|
|
168
|
+
|---|---|
|
|
169
|
+
| `engine.ready` (`await engine.start()`) | World built and the loading screen gone |
|
|
170
|
+
| `x.whenReady` (`x.ready` is the same as a boolean) | That one thing: a character's model, a stream source's area, `saves` storage |
|
|
171
|
+
| `engine.loading.settled()` | Every module installed after start() finished its init, also when one failed |
|
|
172
|
+
| `engine.stateApplied` | start() done and the URL parameters or latest `applyState` applied: for tests and screenshots |
|
|
173
|
+
|
|
174
|
+
**Time**
|
|
175
|
+
|
|
176
|
+
| Entry | Job |
|
|
177
|
+
|---|---|
|
|
178
|
+
| `engine.clock` | Timers: `after`, `every` |
|
|
179
|
+
| `engine.time` | Reading game time: ticks and each channel's `now` |
|
|
180
|
+
| `engine.calendar` | Time of day, days, seasons |
|
|
181
|
+
|
|
182
|
+
**Hooks**
|
|
183
|
+
|
|
184
|
+
| Entry | Runs | For |
|
|
185
|
+
|---|---|---|
|
|
186
|
+
| `onFixed` | 60 times a game second, stops when frozen | Rules: movement, damage, cooldowns |
|
|
187
|
+
| `onFrame` | Once a frame | Presentation: animation, UI, what the player sees |
|
|
188
|
+
| `onRender` | Around the frame's render | Extra three.js renders into your own targets |
|
|
189
|
+
|
|
190
|
+
**Loading a save**
|
|
191
|
+
|
|
192
|
+
| Entry | Job |
|
|
193
|
+
|---|---|
|
|
194
|
+
| `session.load` | The default: Continue or retry, nothing of the current playthrough left over |
|
|
195
|
+
| `saves.load` | A quick load inside the same playthrough |
|
|
196
|
+
|
|
197
|
+
**Putting something in**
|
|
198
|
+
|
|
199
|
+
| Entry | Use it for | Saved |
|
|
200
|
+
|---|---|---|
|
|
201
|
+
| `scene.add` | Plain three.js, rebuilt by code on every start | No |
|
|
202
|
+
| `engine.add(obj, { id })` | The same, with an id so changes to it persist | Its changes |
|
|
203
|
+
| `world.add` | A game object that lives on while far away or across levels | Yes |
|
|
204
|
+
| `content.spawn` | A placement of something written as data, at run time | Yes |
|
|
205
|
+
|
|
206
|
+
**Taking something out**
|
|
207
|
+
|
|
208
|
+
| Entry | Leaves the scene | Frees |
|
|
209
|
+
|---|---|---|
|
|
210
|
+
| `scene.remove` | Yes | Nothing: plain three.js, GPU memory stays until you dispose it |
|
|
211
|
+
| `obj.removeFromParent()` | Yes | Nothing, on purpose: you will add it back |
|
|
212
|
+
| `engine.remove` | Yes | Its and its children's geometry and materials; rays unregistered. Asset-shared data stays with the asset cache |
|
|
84
213
|
|
|
85
214
|
## Owners
|
|
86
|
-
Everything that holds the engine is named by an owner, and only that owner releases it. Positional `
|
|
215
|
+
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.
|
|
87
216
|
|
|
88
217
|
| What | Take | Release | Returns |
|
|
89
218
|
|---|---|---|---|
|
|
90
|
-
| Real-time loop | `
|
|
219
|
+
| Real-time loop | `haltLoop(owner)` (tests and tools; a game freezes) | `handle.remove()` | handle `{ remove() }` |
|
|
91
220
|
| Gameplay freeze | `freeze(owner, { kind? })` | `handle.remove()` | handle |
|
|
92
221
|
| Camera | `takeCamera(owner, { focus? })` | `handle.remove()` | handle |
|
|
93
222
|
| Where a character goes | `control.take(character, { owner, layer, step? })` (layers base < script < cutscene < net; higher pauses lower) | `handle.remove()` | handle `{ active, move(), remove() }` |
|
|
@@ -98,10 +227,10 @@ Everything that holds the engine is named by an owner, and only that owner relea
|
|
|
98
227
|
not contain functions.
|
|
99
228
|
Workers are created only through `engine.threads.lane({ create, local })` (the same handler runs on the main thread when there are no workers); no
|
|
100
229
|
`new Worker` / `postMessage` elsewhere (`npm run check` rule R19). Worker files import only worker-safe code (a game:
|
|
101
|
-
`import { serve } from 'threedog/worker'`; inside the engine `core/threadServe.js`, `core/threadPure.js`), never `core/Threads.js` or three.js.
|
|
230
|
+
`import { serve } from 'threedog/worker'`; inside the engine `core/threads/threadServe.js`, `core/threads/threadPure.js`), never `core/threads/Threads.js` or three.js.
|
|
102
231
|
|
|
103
232
|
### Worker results that change gameplay: `engine.commits`
|
|
104
|
-
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`,
|
|
233
|
+
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`,
|
|
105
234
|
default 30 steps), so threads on or off, fast or slow machine, give the same state.
|
|
106
235
|
```js
|
|
107
236
|
const t = engine.commits.request({
|
|
@@ -141,14 +270,15 @@ inside template strings, which then throw on the first call).
|
|
|
141
270
|
`ground.height(x, z)`; `{ place, x, z }` in content data is a data form.
|
|
142
271
|
- **Registrations return a handle**: anything that registers a listener, timer, continuing effect or registration (`events.on/once`,
|
|
143
272
|
`onFixed/onFrame`, `clock.after/every`, `calendar.at/between/daily/onSeason`, `collision.addBox/...`, `interactions.add`, `rays.addStatic`, `stream.add`,
|
|
144
|
-
`triggers.add`, `hud.marker`, `hlod.add`, `particles.attach`, `pickups.spawn`, `rigid.addBox/...`, `audio.addBus`, `defineState`) returns a
|
|
273
|
+
`triggers.add`, `hud.marker`, `hlod.add`, `particles.attach`, `pickups.spawn`, `rigid.addBox/...`, `audio.addBus`, `defineState`, `ops.define`, `saves.register`, `ui.define`) returns a
|
|
145
274
|
handle `{ owner?, remove() }`; `h.remove()` undoes it, the only give-back form (no `null` / `false` hand-back calls)
|
|
146
|
-
(safe to call repeatedly), never a bare function. `remove()` undoes what that call did: models it created itself are deleted with it (such as a
|
|
275
|
+
(safe to call repeatedly, and it removes only its own registration, so `ctx.track` takes any of them), never a bare function. `remove()` undoes what that call did: models it created itself are deleted with it (such as a
|
|
147
276
|
pickup); objects you passed in are not. APIs that add an object or change business data return what their own signature says: `engine.add(obj)`
|
|
148
277
|
returns the added object, `inventory.add` returns a result, `world.add` a record; delete those with `engine.remove(obj)` / their own remove call.
|
|
278
|
+
A definition by name (`inventory.define`, `quests.define`, `settings.define`) is data, not a registration: it returns its own object, and defining the name again replaces it.
|
|
149
279
|
- **Verbs**: defining a kind is `define` (`vegetation.define`, `particles.define`, `grids.define`, `ops.define`); placing one is `add` / `spawn`;
|
|
150
280
|
hooking up a provider the engine calls back is `register` (`saves.register(key, { save, load })`: it defines no kind and places nothing).
|
|
151
|
-
One timer entry: `engine.clock.after(seconds, fn, data,
|
|
281
|
+
One timer entry: `engine.clock.after(seconds, fn, { data, channel })` (calendar seconds, or `'real'` / a time channel's seconds with `channel`);
|
|
152
282
|
one queue, so `remove()` is immediate: a removed timer never fires, not even later in the same step.
|
|
153
283
|
- **Unknown options throw**: every options bag goes through a `readParams` schema (one schema gives the check, the defaults and the catalog entry); an
|
|
154
284
|
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
|
|
@@ -157,7 +287,7 @@ inside template strings, which then throw on the first call).
|
|
|
157
287
|
- **Event names are `noun:action`**: the noun is the emitter's singular camelCase name (`item`, `template`...), the action is a lowercase verb or state
|
|
158
288
|
(`add`, `done`, `change`); a game's own events follow the same rule (`door:open`).
|
|
159
289
|
- **Time**: one source, `engine.time.tick`; real, ambient, channel and calendar seconds are read-only views (`engine.time.now(name)`), and only
|
|
160
|
-
`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
|
|
290
|
+
`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
|
|
161
291
|
the table of which one to use for movement, action timelines, cooldowns, hit-stop, crop growth, calendar and UI, and what pause / freeze /
|
|
162
292
|
`clock.rate` 2 do to each. Speeds change only through `engine.mod` (the "Customization ladder" above).
|
|
163
293
|
- **Input**: gameplay keys (attack, jump, interact...) are read in the fixed step (`onFixed` / module `fixed`), where `pressed / down / released` give
|
|
@@ -179,12 +309,10 @@ inside template strings, which then throw on the first call).
|
|
|
179
309
|
dev warning naming the fix.
|
|
180
310
|
- 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
|
|
181
311
|
`<game>/.threedog/ops-guard.log`). (game side)
|
|
182
|
-
- **One source for "can walk there"**: `
|
|
183
|
-
collision, the Rapier capsule, navigation, A* and level steps all read it; don't write another 0.4 / 0.45 in a module. A character's position
|
|
184
|
-
belongs to the Character mover; other systems only request movement (`placeAt` / `move` / vehicle `enter`) and never set `player.position` directly.
|
|
312
|
+
- **One source for "can walk there"**: `engine.movement`, and a character's position belongs to its mover (recipe 12 section 5).
|
|
185
313
|
Who calls `move` is the character's control holder (`engine.control`, `recipes/57-control.md`): one per step; anyone else is `[control-bypass]`.
|
|
186
314
|
- 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).
|
|
187
|
-
- Never call `requestAnimationFrame` or `renderer.render` yourself. **Game logic always uses
|
|
315
|
+
- Never call `requestAnimationFrame` or `renderer.render` yourself. **Game logic always uses real seconds or calendar seconds** (the hook's `dt`,
|
|
188
316
|
`engine.clock`; see the time table in `recipes/06-clock-events.md`); no `setTimeout` / `setInterval` / `performance.now()`: they ignore pause,
|
|
189
317
|
freeze and `engine.step` fast-forward, so they can't be tested or saved.
|
|
190
318
|
- To be saved, call `engine.saves.register(key, { save, load })` (`load` may return a Promise); `saves.save / load` always return `Promise<boolean>`,
|
|
@@ -197,7 +325,7 @@ inside template strings, which then throw on the first call).
|
|
|
197
325
|
`terrain({ height, groundType })` must be pure functions.
|
|
198
326
|
- Loading follows the `engine.stream` sources (player + camera focus by default); display, physics and world data are separate: unloading a model
|
|
199
327
|
never removes its world record.
|
|
200
|
-
- 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
|
|
328
|
+
- 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
|
|
201
329
|
`page:*`. Show "saved" only after `saves.save` returns true.
|
|
202
330
|
- Character bodies are assets: `createPlayer({ ...presets.player.thirdPerson, model: 'humanoid' | 'hero' })` (a procedural builder is built
|
|
203
331
|
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
|
|
@@ -210,4 +338,19 @@ inside template strings, which then throw on the first call).
|
|
|
210
338
|
## Failures: which shape
|
|
211
339
|
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.
|
|
212
340
|
|
|
213
|
-
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.
|
|
341
|
+
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.
|
|
342
|
+
|
|
343
|
+
## Stability
|
|
344
|
+
|
|
345
|
+
`@experimental` means one thing: the name may change or go in any version, with no migration note. Everything unmarked is frozen at 1.0.
|
|
346
|
+
|
|
347
|
+
- **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.
|
|
348
|
+
- **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.
|
|
349
|
+
- **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`.
|
|
350
|
+
- **Effects still moving with three.js**: all of `threedog/tsl` and `@threedog/post-effects/tsl`.
|
|
351
|
+
- **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.
|
|
352
|
+
- **Coordination no test game has used**: `engine.stacks`, `engine.wrap`, `engine.mod`, `time.channel / channels`.
|
|
353
|
+
- **Systems still settling**: `net()`, `engine.threads`, `engine.commits`, `grids()`, `hlod()`, `swarm()`, `stream.source / teleport / addReadyCheck / sources`, `post.get / own / antialias / list`, `world.simulate({ worker })`, `terrain.edit`, `ops.guard / allow`, `terrainDraw`, `vegetationDraw`, `weatherDraw`, `engine.bakeProbes / loadProbes / loadLightmap`.
|
|
354
|
+
- **Flat content**: an entry's `source`, `content stamp`, `content capture`.
|
|
355
|
+
- **Tuning and readings**: `engine.moduleOrder / moduleStates`, `player.saveMotion / loadMotion`, `jobs.loadingMs / maxSteps / slowStepMs`, `stream.unloadFactor`, `batching.held`, `world.steps`, `level.heightfield`.
|
|
356
|
+
- **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,171 @@
|
|
|
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
|
+
First run `threedog doctor --fix`: it rewrites the `threedog` and `@threedog/*` pins in each game's `package.json`. A game in `games/` of a clone that still pins `^0.7.1` stops `npm install` with `ETARGET`.
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
## Uniforms
|
|
10
|
+
|
|
11
|
+
Search your shader strings as well as your JavaScript.
|
|
12
|
+
|
|
13
|
+
| 0.7 | 0.8 |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `engine.uniforms.uCloudScale` | `uCloudShadowScale` (the cloud shadows on the ground) |
|
|
16
|
+
| `engine.uniforms.uCloudSpeed` | `uCloudShadowSpeed` |
|
|
17
|
+
| `uCloud` | `uWeatherCloud` |
|
|
18
|
+
| `uCurve` | `uSkyCurve` |
|
|
19
|
+
| `uCover` | `uGroundCover` |
|
|
20
|
+
| `uSunPower` | `uSunBrightness` |
|
|
21
|
+
| `uMoonPower` | `uMoonBrightness` |
|
|
22
|
+
| `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`) |
|
|
23
|
+
|
|
24
|
+
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.
|
|
25
|
+
|
|
26
|
+
## Changed shapes
|
|
27
|
+
|
|
28
|
+
These do not fail loudly, so search for them.
|
|
29
|
+
|
|
30
|
+
| 0.7 | 0.8 |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `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)` |
|
|
33
|
+
| `clock.after(s, 'ev', data, { channel })` | `clock.after(s, 'ev', { data, channel })`, the same third argument as `clock.every`. The old form throws |
|
|
34
|
+
| `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 |
|
|
35
|
+
| `player.onLand = impact => ...` | `engine.events.on('character:land', ({ character, impact }) => ...)`. Assigning the old property does nothing and says nothing, so search for it |
|
|
36
|
+
| `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` |
|
|
37
|
+
| `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` |
|
|
38
|
+
| `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` |
|
|
39
|
+
| `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)` |
|
|
40
|
+
| `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` |
|
|
41
|
+
|
|
42
|
+
## Removed names
|
|
43
|
+
|
|
44
|
+
| 0.7 | 0.8 |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `engine.rays.cast(...)`, `engine.rays.pick(...)` | `engine.raycast(...)`, `engine.pick(...)` |
|
|
47
|
+
| `engine.THREE` | `import { THREE } from 'threedog'`, the same copy of three.js. |
|
|
48
|
+
| `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. |
|
|
49
|
+
| `engine.i18n.t(key)` | `engine.t(key)` |
|
|
50
|
+
| `inventory.slotsUsed` | `inventory.of().slotsUsed` |
|
|
51
|
+
| `engine.openWindows` | `engine.ui.isOpen(id)` |
|
|
52
|
+
| `engine.decoders` | set it with `createEngine({ decoders })`; it can no longer be read back |
|
|
53
|
+
| `EASINGS` | `ease(name)` |
|
|
54
|
+
| `assets.reportText(name)` | `assets.report(name)` |
|
|
55
|
+
| `assets.users(name)` | no replacement: it was internal |
|
|
56
|
+
| `player.object`, `character.object` | `.root`, the same object (`npc.object` stays) |
|
|
57
|
+
| `character.addTo()` | `engine.add(character.root)` for a `new Character` of your own; `createPlayer` still adds the player |
|
|
58
|
+
| `engine.rigid.R` | `engine.rigid.rapier` |
|
|
59
|
+
| `collision.circles`, `collision.boxes` | `collision.forEachStatic((type, data) => ...)` |
|
|
60
|
+
| `engine.stream.readyCheck(name, fn)` | `engine.stream.addReadyCheck(name, fn)` |
|
|
61
|
+
| `engine.music.addTracks({ a: url, b: url })` | `engine.music.define('a', url)`, one call per track; it no longer returns the music object |
|
|
62
|
+
| `debug.startBench()`, `debug.benchmarking`, the debug panel's stress button, `describe().debugPanel.benchmarking` | `threedog stress` |
|
|
63
|
+
| The types `Object3D`, `Vector3`, `Vector2`, `Color`, `Quaternion`, `Material`, `BufferGeometry`, `Texture` from `threedog` | import them from `three` |
|
|
64
|
+
| `threedog assets` with no verb | `threedog assets optimize` (it writes files) or `threedog assets check`. `npm run assets` becomes `npm run assets -- optimize` |
|
|
65
|
+
| `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 |
|
|
66
|
+
| `engine.tick` | `engine.time.tick` |
|
|
67
|
+
| `engine.cpuMs`, `engine.cpuPhases` | `engine.inspect.perf()` (`cpuMs`, `cpuPhases`), `engine.budget.values().cpuMs` |
|
|
68
|
+
| `saves.queue(fn)` | `saves.putAttachment(group, id, blob, meta)`, `saves.removeAttachment(group, id)`; read with `saves.attachments(group)` |
|
|
69
|
+
| `saves.prefix` | `saves.storageKey(name)` for a key of your own |
|
|
70
|
+
| `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` |
|
|
71
|
+
| `engine.adaptive.paused` | `engine.adaptive.on = false` |
|
|
72
|
+
| `settings.removeSection(id)` | List the tabs you want: `settings({ sections: [...] })` |
|
|
73
|
+
| `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) |
|
|
74
|
+
| `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 })` |
|
|
75
|
+
| 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 |
|
|
76
|
+
| `calendar.daysPerSeason` (the field) | Nothing read it and writing it did nothing. The option `calendar({ daysPerSeason })` stays |
|
|
77
|
+
| `ground.navGeometry` on a ground API of your own | Nothing read it: the navmesh comes from `staticTrimeshes()` |
|
|
78
|
+
| `settings.saved` | No replacement: nothing read it |
|
|
79
|
+
| `withHint` from `threedog/error-hints` | `hintText` |
|
|
80
|
+
| `threePatches.off('hlod-visible')` | The patch is gone: `hlod` hides a far original on the batch layer |
|
|
81
|
+
| `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 |
|
|
82
|
+
|
|
83
|
+
## Renamed
|
|
84
|
+
|
|
85
|
+
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.
|
|
86
|
+
|
|
87
|
+
| 0.7 | 0.8 |
|
|
88
|
+
|---|---|
|
|
89
|
+
| `hud.add(id, n)` | `hud.bump(id, n)` |
|
|
90
|
+
| `dialogue.cps` | `dialogue.charsPerSecond` (the option already had this name) |
|
|
91
|
+
| `rtsCamera({ angle })`, `cameraRig.angle` under that camera | `pitch`, as on the other cameras; `angle` is now refused as an unknown option |
|
|
92
|
+
| `weather.define(field, spec)` | `weather.defineField(field, spec)` |
|
|
93
|
+
| `terrain.T` | `terrain.generator` |
|
|
94
|
+
| `terrain.CHUNK` | `terrain.chunkSize` (`createTerrain()` keeps its own `CHUNK`) |
|
|
95
|
+
| `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 |
|
|
96
|
+
| `engine.paused`, `describe().time.paused` | `engine.halted`, `describe().time.halted` |
|
|
97
|
+
| `engine.mod('pause', ...)`, `describe().holds.pause` | `engine.mod('halt', ...)`, `describe().holds.halt` |
|
|
98
|
+
| `runState.state` `'test-paused'`, `'paused'` | `'halted'` (the loop is stopped), `'frozen'` (a game, page or error freeze) |
|
|
99
|
+
| `engine.terms`, `terms.cloudShadow`, `terms.season` | `engine.shaderTerms`, with the same two members |
|
|
100
|
+
| `engine.view`, `view.manual` | `engine.autoView`, `autoView.manual` |
|
|
101
|
+
| `lightPool.usage()` | `engine.describe().lightPool` |
|
|
102
|
+
| `terrain.isReadyAround(p)`, `rigid.groundReady(p)` | `engine.stream.addReadyCheck` and `stateApplied` already wait on them |
|
|
103
|
+
|
|
104
|
+
## Error codes
|
|
105
|
+
|
|
106
|
+
Search any `e.code === '...'` or `catch` in your game, and any test that names a code.
|
|
107
|
+
|
|
108
|
+
| 0.7 | 0.8 |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `options-object` | `bad-position` |
|
|
111
|
+
| `npc-option` | `character-option` |
|
|
112
|
+
| `pickup-prop-id` | `world-id` |
|
|
113
|
+
| `session-handle` | `module-handle` |
|
|
114
|
+
| `world-missing` | `module-needs` |
|
|
115
|
+
| `load-failed` | `asset-load` |
|
|
116
|
+
| `pause-owner` | `halt-owner` |
|
|
117
|
+
| `bad-arg` | Gone: `input.bind` raises `input-keys`, `characters.support` raises `character-option`, `settings({ presets })` raises `module-params` |
|
|
118
|
+
| `state-at` | Gone: `applyState` lists the value in `refused` |
|
|
119
|
+
| `renamed-field`, `shadow-type` | Gone, nothing raises them: the old names they caught are plain unknown options now |
|
|
120
|
+
| `engine.stacks.define` of a known name raised `mod-owner` | `engine-misuse` |
|
|
121
|
+
| `weather.set` with bad seconds raised `module-params` | `weather-option` |
|
|
122
|
+
| `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)` |
|
|
123
|
+
| `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 |
|
|
124
|
+
|
|
125
|
+
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.
|
|
126
|
+
|
|
127
|
+
## Behaves differently
|
|
128
|
+
|
|
129
|
+
No error tells you about these.
|
|
130
|
+
|
|
131
|
+
| 0.7 | 0.8 |
|
|
132
|
+
|---|---|
|
|
133
|
+
| 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 |
|
|
134
|
+
| `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 |
|
|
135
|
+
| `engine.batching` cell 64 m | 256 m, about 13-25% more triangles drawn. A game with heavy props sets `createEngine({ batching: { cell: 64 } })` |
|
|
136
|
+
| `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 |
|
|
137
|
+
| `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 |
|
|
138
|
+
| 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 |
|
|
139
|
+
| A skybox reached full brightness at ambient 1.2 | At the brightest row of the game's keyframes |
|
|
140
|
+
| `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 |
|
|
141
|
+
| 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 |
|
|
142
|
+
| `music.play`, `music.stinger`, `hud.counter`, `hud.bar`, `calendar.at`, `calendar.daily`, `calendar.between`, `vegetation.removeInstance` ignored an unknown option | They throw on it |
|
|
143
|
+
| 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 |
|
|
144
|
+
| 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 |
|
|
145
|
+
| An `approach` interaction on a held character walked or hung | Refused with `cannotWalk` |
|
|
146
|
+
| `characters.findPath` with no navmesh routed to a target inside a wall or water | `null` (`noPath` when detailed) |
|
|
147
|
+
| `hud.counter` with no label showed the id | The value alone |
|
|
148
|
+
| 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 |
|
|
149
|
+
| `inspect.perf()` on a halted page read `cpuMs` and `fps` as 0 | `null`, and `measured` says whether anything was counted |
|
|
150
|
+
| Two manifest entries naming each other as `fallback` waited for good | The load fails once with `asset-fallback-cycle`, naming the chain |
|
|
151
|
+
| 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` |
|
|
152
|
+
| 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 |
|
|
153
|
+
| `release('shrub')` on a name that fell back to `rock` touched `rock`'s data | A name that fell back holds no data: release `rock` |
|
|
154
|
+
| 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 |
|
|
155
|
+
|
|
156
|
+
## Tools
|
|
157
|
+
|
|
158
|
+
| 0.7 | 0.8 |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `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 |
|
|
161
|
+
| `assets optimize --strict` or a lower `--budget` skipped cached models | Cached models count, so a run that passed may now fail |
|
|
162
|
+
| `check` passed a kind in `content/index.js` listed without `rules` | An error |
|
|
163
|
+
| `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) |
|
|
164
|
+
| `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 |
|
|
165
|
+
| `shot` and `capture` ignored a value the page refused (`--weather rian`) | They fail |
|
|
166
|
+
| `threedog state` and `threedog snap` added a tick or two | They move no game time, so a script that counted on it steps itself |
|
|
167
|
+
| `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 |
|
|
168
|
+
|
|
169
|
+
## Stability
|
|
170
|
+
|
|
171
|
+
`@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`.
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Moving a game from 0.9 to 1.0
|
|
2
|
+
|
|
3
|
+
First run `threedog doctor --fix`, then `npm run check`: a removed name shows up as a type error on the line that uses it. Most games need nothing else. The tables say what you will see and what to do, and every error below names its own fix.
|
|
4
|
+
|
|
5
|
+
## What now stops with an error
|
|
6
|
+
|
|
7
|
+
| You will see | What changed | What to do |
|
|
8
|
+
|---|---|---|
|
|
9
|
+
| A game's own vehicle loses its rider after a load in a fresh session | Saved riders find vehicles through one registry, not through `rigid` | Call `engine.characters.addVehicle(vehicle)` once it is built, before or after the load |
|
|
10
|
+
| `exit()` returns `false` and the rider stays | No exit of the vehicle is walkable | Move the vehicle, offer more exits through `exitPosition(seat, n)`, or `exit({ force: true })` |
|
|
11
|
+
| `walkTo` answers `'cancelled'` after `placeAt`, `enter`, a level change or a ragdoll | Each of them ends the walk. It used to carry on, or wait under the ragdoll | A follower that wants to go on after being placed calls `walkTo` again |
|
|
12
|
+
| `walkTo` ends `'noPath'` before a gap where it ended `'stuck'` at it; small bodies take gaps they used to go round; a stall the first time a new size asks | Navmesh paths fit the radius that asks, on a mesh of that size built on first ask | Drop an `agentRadius` set to the widest walker unless `crowd: true` needs it. Ask once per size during loading to move the stall there (recipe 12 section 5) |
|
|
13
|
+
| `[shared-taken]` at `engine.use(...)`, naming `terrain` and `level` | `ground` is one exclusive slot. The later `setGround` used to win | Keep one, or swap with `engine.use(level(), { replaces: 'ground' })`. To run both: `terrain({ part: true })`, `level({ part: true })` and `compositeGround({ parts: [{ of: 'terrain' }, { of: 'level', region }] })` |
|
|
14
|
+
| `[shared-taken]` for any other slot, in a release build too | A second provider of an exclusive slot is refused in every build. A release build used to warn and let the later one win | Install one, or `engine.use(mine(), { replaces: 'slot' })` |
|
|
15
|
+
| `[shared-conflict]`, in a release build too | Two owners `set` one point on one layer. A release build used to warn and let the later write win | Contribute with `add` / `mul`, use another `layer`, or keep one owner. The message has each fix to copy |
|
|
16
|
+
| `[control-conflict]`, in a release build too | Two owners take one character on one control layer. A release build used to warn and let the later owner win | End the old hold first (`handle.remove()`), or take another layer. The message has both fixes to copy |
|
|
17
|
+
| `[container] ... must be a whole number >= 1` | `add`, `remove`, `setData`, `transfer` and `trade` refuse 0, negatives, fractions and NaN. `remove('apple', -2)` used to add stock | Pass a whole number of pieces. To put stock back, call `add` |
|
|
18
|
+
| `engine.disabledModules` | Removed: a switched-off module has state `'disabled'`, and one list is derived from it | `engine.describe().disabledModules` |
|
|
19
|
+
| `settings({ presets: { low: { viewChunks: 3 } } })` | `viewChunks` and `density` in a preset are shares (0 to 1) of the game's own value, as `pixelRatio` already was; above 1 throws | Write the share, e.g. `viewChunks: 0.6` |
|
|
20
|
+
| `engine.post.antialias` with no effect on | It no longer switches the post chain on to reach an MSAA the canvas lacks; MSAA is fixed with the canvas | `createEngine({ antialias })`; the settings row applies at the next launch |
|
|
21
|
+
| `settings.set(key)` on a key no row owns | Throws `settings-row` after start; before start it waits for a module's row and warns if none came | Define the row, or add the tab that has it |
|
|
22
|
+
| `applyState({ wether: 'rain' })` | A key no installed module names in `stateKeys` is refused in the answer, not thrown | Read `refused` |
|
|
23
|
+
| `[module-needs] content quests: no installed module reads this section` | A module owns its content section, and data for a module that is not installed stops the load | Add the module the message names, or remove the data |
|
|
24
|
+
| The same error after `engine.use(mine(), { replaces: 'quests' })` | Replacing a module replaces its section too | Give the replacement `content: { quests: { commit(d) { ... } } }` (recipe 14) |
|
|
25
|
+
| `[character-option] mover "...": use 'simple', 'rapier', 'manual' or your own` | An unknown mover name used to warn and walk with `'simple'` | Fix the name, or pass `(character, engine) => ({ name, move(x, z, run, dt, y) })` (recipe 57) |
|
|
26
|
+
| A player or a body that fell out of the world stays gone, and a dev build says `no rule 'fall' is set` | The engine no longer rescues by default: `character:fall` and the rule `fall` stay, `'rescue'` is a built-in the game chooses. `openWorld` and the new-game templates choose it | `engine.mod('fall', { owner: 'game', set: 'rescue' })`, or `characters({ fall: 'rescue' })`. A deep pit or a death that was fighting the rescue needs nothing |
|
|
27
|
+
| `preventDefault is not a function` in a `character:fall` listener | Falling is one rule, `fall`, for characters and rigid bodies | Remove the call. `engine.mod('fall', { owner: 'game', id: 'player', set: false })` leaves the fall to the game; a function `(facts, engine) => 'rescue' \| false` decides per fall |
|
|
28
|
+
| `nothing explains 'picture' (did you mean 'value'?)` | `explain({ picture })` is now `explain({ value })`, which also gives the short history | Rename the key. On the command line: `threedog explain value fog.far` |
|
|
29
|
+
| `explain is not a function` on a thing | `engine.explain` is the one way to ask why | `engine.thing(id).explain()` becomes `engine.explain({ thing: id }).detail`, and `threedog thing <id>` becomes `threedog explain thing <id> --full` (MCP: `explain` with `about: 'thing'`) |
|
|
30
|
+
| `[save-key-taken]` from `saves.register` | A second register on a held key used to take the part from its owner with nothing said, and that owner stopped being saved | Use another key, or `remove()` the first handle before registering again |
|
|
31
|
+
| `[skip-busy]` from `engine.skip` | A second skip during a first one's fade used to resolve and unfreeze the game mid-fade. The doc always said it rejects | Await the first skip, then skip again |
|
|
32
|
+
| `[save-busy]` from `saves.collect` | A load is running. `saves.save` waits for it, `collect` cannot | Collect after the load. Do not await `saves.apply` or `saves.load` inside a part's `load()` or an `afterLoad`: dev warns `save-nested`, because it would wait forever |
|
|
33
|
+
| `setViewChunks is not a function` or `setDensity is not a function` | One entry each: `terrain.viewChunks` and `terrain.density` take effect when written | `terrain.setViewChunks(n)` becomes `terrain.viewChunks = n`; `terrain.setDensity(d)` becomes `terrain.density = d`. Plants that block stand at every density |
|
|
34
|
+
| `[save-bad-record]` on loading a save, naming `the level file` or a record `model` | A save may name a registered asset or a relative path on this site, nothing else. A full URL, `//host`, a backslash or `..` used to be fetched | Register a level or model that lives on another host in the asset manifest and name it there: a registered entry passes whatever its URL |
|
|
35
|
+
| `setRadius is not a function`, `setAuto is not a function`, `setAntialias is not a function` | One entry each, like `terrain.viewChunks` | `stream.setRadius(m)` becomes `stream.radius = m`, `weather.setAuto(on)` becomes `weather.auto = on`, `post.setAntialias(on)` becomes `post.antialias = on` |
|
|
36
|
+
| `threedog eval` is an unknown command | It was a second name for `threedog js` | Use `threedog js` |
|
|
37
|
+
| A type error on `engine.moduleStates` | It was experimental and is internal now | Ask `engine.explain({ module: name })`, or read `engine.describe().moduleStates` for what is not running |
|
|
38
|
+
| An op that ends in `return e.content.run(...)` fails where it used to pass | `content.run` answers with a failure when a word failed, and an op that returns one fails with it (an atomic one rolls back) | Good if that is what you meant; else do not return the answer |
|
|
39
|
+
| A quest with a `give` reward and a full bag says the reward was not given, and pays it later | The items used to be lost. They are owed now | Nothing, or add `onUnpaid` to decide yourself (recipe 04) |
|
|
40
|
+
| An async `onUse` on a `once` item is not used up at once, and a second use is refused until it settles | It is judged when it settles. It used to spend the item straight away, whatever came back | Nothing. Read the answer with `await r.value` |
|
|
41
|
+
| `const { skipped } = await timeline.play(...)` is undefined, same for `timeline:end` | A run has one ending | Read `ending`: `'finished'`, `'skipped'`, `'dropped'` or `'failed'` (with `error`) |
|
|
42
|
+
| A cutscene's remaining `do` steps no longer run at a new game | A new game drops the run, as a load does. It used to skip it, running them on the new state | Put what must happen in `session:end` |
|
|
43
|
+
| `[engine-misuse] vars.bump` | `n` must be a finite number. NaN used to go into the counter | Pass a number |
|
|
44
|
+
| `[module-params] triggers.add({ radius })` | A NaN or negative radius used to sit in the zone list and never match | Pass a finite number >= 0 |
|
|
45
|
+
| `[grids-misuse] grids.add` | A cell, origin or size that is no valid number is refused | Cell > 0, a finite origin, size whole numbers > 0 or left out |
|
|
46
|
+
| `[quest-step] ... next` | A step's `next` must be a step of that quest or a function | Fix the id the message quotes |
|
|
47
|
+
| `[save-version]` at `saves.register` | A `migrate` key must be a whole version below the current one | Rename the key |
|
|
48
|
+
| `saves.save` answers false with `[save-part-threw]` | A part's `save()` returned a function, a symbol, NaN or an infinity, which a save cannot hold | Return plain data, or null for nothing |
|
|
49
|
+
| `[save-write]` from `saves.putAttachment` | Only a Blob is stored | Pass a Blob |
|
|
50
|
+
| `[terrain-option]` from a terrain edit | An edit that would touch more than about four million points is refused | Use a smaller radius or several edits |
|
|
51
|
+
| `[rigid-misuse] ... differs between axes` | A body cannot follow a parent scaled unevenly | Make the parent's scale equal on all axes |
|
|
52
|
+
| `[bad-position]`, `badArgs`, `[world-add]`, `[world-id]`, `[interaction-option]`, `[content-template]`, `[content-place]`, in a release build | These checks ran only in development. A game that passes its development run sees none of them | Fix what the message names |
|
|
53
|
+
| The contract check fails on a replacement's own `contract.js` that lists `methods` | Object contracts (`mover`, `vehicle`, `ground`, `collider3d`) list their members under `api` like every other contract | Rename `methods` to `api` |
|
|
54
|
+
| `module-order` from `use()` for an order written with a capability name | The same order by module name always threw | Put the provider in the stage the order needs (`stage: 'environment'`), or drop `before` / `after` from the module that says it |
|
|
55
|
+
| `engine.detach is not a function` | Removed: it only called three.js | `obj.removeFromParent()`. `engine.remove` stays |
|
|
56
|
+
| `Cannot set property locale` on `engine.i18n` | `locale` is read-only. Writing it skipped the name lookup and `i18n:change` | `engine.i18n.setLocale(name)` |
|
|
57
|
+
|
|
58
|
+
## What now behaves differently, with no error
|
|
59
|
+
|
|
60
|
+
- A `level.load` or `content.load` inside a save part's `load()` or a module's `afterLoad` needs the turn they get: `load(d, turn) { return engine.level.load(d.level, { turn }); }`. Without it the call waits for that load to end, so awaiting or returning it never ends (dev: `[save-nested]` after 3 s). Calls that are not awaited run right after the load.
|
|
61
|
+
- A save part registered while a load runs gets its data after that load, not during it. Idle it is still before `register` returns.
|
|
62
|
+
- `content.load` returns a Promise of this load instead of `engine.content`. Chain with a second statement: `content.load(a).load(b)` becomes two lines. Bad data still throws on the line; a pack with nothing to wait for is still live on the next line.
|
|
63
|
+
- A pack that swapped the level and then failed now rejects, after the old level is back, where it used to throw at once while the old level loaded in the background. Read the failure with `await` or `.catch`. A failed restore is on `err.notRestored`.
|
|
64
|
+
- A collision module that throws from `addBox` while taking the level walls now fails its `use()`, and the module it replaced comes back. An old `engine.haltLoop` or `views.show` handle removed after a new one was taken does nothing.
|
|
65
|
+
- `world.simulate` with `channel`: `far` and a tiered `near` get the channel time the record lived through, not the seconds owed times the speed at that moment. Remove anything written to work around a far `dt` that followed the last speed. The world save part gains `marks`; older saves load without it.
|
|
66
|
+
- A level file that fails rejects even when the manifest gives it a fallback; a level never stands on a stand-in. Nothing to write unless a game relied on the gray box.
|
|
67
|
+
- `engine.loading.timeoutMs` is now the limit on every load, on each module's `init()` and on every wait for "settled", not only on `isReady`. A file with no sign of life for that long fails like any failed file. Raise it for a load that is silent for longer than 120 s.
|
|
68
|
+
- `flow.transition` rejects with `module-not-ready` when the world does not settle within the limit. The screen and input come back first. Catch it if the game has an answer.
|
|
69
|
+
- `level.load` during `saves.load`, `saves.apply` or a `session` call runs after it, so the level the load answered true for stands first. Do not await it inside a part's `load()` after an `await`: that waits for itself.
|
|
70
|
+
- Autosave does not fire during `flow.transition` or `timeline.play`; it fires on the first step after. A save the game asks for itself still goes at once.
|
|
71
|
+
- `content.load` during a state replacement commits after it.
|
|
72
|
+
- The `level` save part of a level built in code holds a token only that page can read. From another page the load stays on the level that stands, as before.
|
|
73
|
+
|
|
74
|
+
| You will see | What changed | What to do |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| An unhandled rejection from `level.load` | The new level is built first. On failure the old one stays, `level:failed` fires instead of `level:loaded`, and the Promise rejects | `await` it in a `try`, or add `.catch`. A save that names a broken level now rolls back |
|
|
77
|
+
| `ops.run` / `ops.can` / `ops.undo` answer `'loading'` | They change nothing for the whole of a state replacement, including a part's `load()` and `afterLoad` | Retry after the load: `await` it, or wait for `save:loaded` |
|
|
78
|
+
| A game's `applyState` hook no longer gets `?weather=rain` from the URL | Only core's own keys and the keys a module names in `stateKeys` are read from the URL. A hook with no `stateKeys` still gets such a key from a direct `applyState({ weather: 'rain' })`, but with the module that owned it absent, nothing reads it from the URL | Name the key in your module: `stateKeys: ['weather']` |
|
|
79
|
+
| A second `saves.apply` or `saves.load` waits | Overlapping loads now take turns and end as one whole save | Nothing, unless you relied on the second one starting at once |
|
|
80
|
+
| A `control.take` on a script, cutscene or physics layer, or a `world.anchor` set during play, stayed after a new game | Both end with the playthrough; `world.anchor` goes back to what boot left | Take or set it again from a `session:start` listener, or take the hold through `ctx.control` when it belongs to a module |
|
|
81
|
+
| `saves.load` or `saves.apply` left the title open | Any save put back closes it, and a rollback fires `session:failed` with `kind: 'quick'` | Drop your own `ui.close('title')`; a `session:failed` listener that only meant `session.*` checks `kind` |
|
|
82
|
+
| Code that looked for the freeze owners `threedog:load` / `threedog:load-parts` finds nothing | They are one owner now, `threedog:state-replace` | Wait for `save:loaded` |
|
|
83
|
+
| `thing.set`, `world.set` or `world.move` on the player or an NPC with a model now really moves it, and it lands on what stands there | The character owns its position, so these writes are its `placeAt`. They used to return ok and change the record until the next step put it back. A write that matches where the character stands changes nothing | Remove any `placeAt` you added beside such a write. To set the exact spot, `root.position` then `syncRecord()` from a control hold (recipe 57) |
|
|
84
|
+
| A seated character gets out when it is placed: `vehicle:exit` fires and the vehicle brakes | `placeAt`, `engine.stream.teleport` and any write to its record's position end the ride. The seat used to pull it back on the next step | To take the rider along, move the vehicle. To keep a stale position write from ending a ride, drop the write. Undo of such a `thing.set` seats it again, and can answer `ownerRefuses`: read the result |
|
|
85
|
+
| `placeAt` or a position write on a ragdoll moves the whole body, which stays limp | The next step used to put root back on the body. It arrives at rest, so a fall's speed is dropped | To stand it up elsewhere, `remove()` first as before; the result is the same |
|
|
86
|
+
| `rot` or `scale` on a live character's record turns or sizes it, and `thing.set` keeps all of `rotation` / `scale` given as `[x, y, z]` | They used to land on the record and do nothing, and the array forms kept only y and x. A tilt, a turn while seated or a value that is not a number or `[x, y, z]` is refused: `thing.set` answers `ownerRefuses`, `world.set` throws `[character-option]` | A field of your own called `rot` or `scale` on the player or an NPC needs another name |
|
|
87
|
+
| A write to a record with `positionFrom: 'view'` moves its model and rigid body, which comes to rest there | `world.move`, `world.set`, `thing.set` and `rec.position` used to be overwritten by the model at the end of the step. `rot` or `scale` on a template with a `body` now rebuilds the body | Drop a write that relied on being ignored; to push a body, use `rigid.impulse` |
|
|
88
|
+
| `engine.use(mine(), { replaces })` receives the old module's save data | A save part that leaves keeps its data and hands it to the next part with that key | Give `mine` its own key if the format differs |
|
|
89
|
+
| A module waits as `'blocked'`, with no `init` and no hooks | `requires` means the provider works, not only that it is installed | `engine.explain({ module: name })` says on what |
|
|
90
|
+
| The flat ground returns when a ground provider leaves | `ground` belongs to the module that holds the slot | A module of your own declares `provides: ['ground']` and calls `ctx.ground.provide(...)` |
|
|
91
|
+
| Paths are `{ x, y, z }` | `findPath`, `findPathAsync` and `engine.nav` keep the height | Read `y` if your game has floors; code that reads `x` and `z` is unchanged |
|
|
92
|
+
| With two engines on a page, only one reacts to a key or a gamepad | The engine last pressed or focused owns the keyboard and the gamepads, the first one until then. Both used to hear every key and pad | Nothing with one engine. To hand the keyboard over from code, focus something in that engine's `uiRoot` |
|
|
93
|
+
| The wheel changes the view height of a real `OrthographicCamera` under a default follow rig | It used to change `distance`, which shows nothing there | Nothing |
|
|
94
|
+
| `engine.camera` is another object after a rig or shot with `projection: 'orthographic'`, and `camera.orthoSize` and `camera.isEngineCamera` read `undefined` | The engine's first camera is a plain `THREE.PerspectiveCamera`. An orthographic view is now always a real `THREE.OrthographicCamera` in `engine.camera`, and the next perspective view brings the first camera back. It has no `fov` or `aspect` | Read `engine.camera` where you use it, not from a copy kept across a switch. The view height is `camera.top - camera.bottom` or `describe().camera.orthoSize` |
|
|
95
|
+
| `projection: 'orthographic'` over a real perspective camera you assigned works | It used to throw `[camera-option]`. The rig's own orthographic camera stands in until the next perspective view, which brings yours back | Nothing |
|
|
96
|
+
| With two tabs open, `saves.remove` keeps a slot and `putAttachment` / `removeAttachment` reject with `[save-stale]` | They follow the rule saves already had: a tab changes only what it last wrote or saw. A forgotten tab used to delete or replace newer progress | Nothing for one tab. On the rejection read `saves.attachments(group)` first, or use another id |
|
|
97
|
+
| A settings row or tab is gone after `engine.unuse` | A row or tab a module made in its install, init or a hook leaves with that module and gives its limits back. It used to stay, driving nothing | Define a row that must stay from the game, not from the module. The player's choice comes back when the module does |
|
|
98
|
+
| `findPath` without `nav` says `noPath`, and `walkTo` ends with that status | A goal on a floor the walker cannot reach used to be `ok`, with a path that ended under it | Handle `noPath` |
|
|
99
|
+
| `threedog how --list` is gone | `threedog how` or `--browse [category]` to browse, `--card <id>` for one capability. The MCP tool takes `browse` and `card` fields; `task: "--list"` is only words now | Use the new flags |
|
|
100
|
+
|
|
101
|
+
Everything else since 0.9.0 is new and opt-in, or changes nothing for a game: `CHANGELOG.md` has the full list.
|