threedog 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +196 -1
- package/README.md +6 -9
- package/core/{Animator.js → assets/Animator.js} +28 -18
- package/core/{Assets.js → assets/Assets.js} +98 -54
- package/core/{Baked.js → assets/Baked.js} +4 -4
- package/core/assets/assetEntry.js +237 -0
- package/core/{assetHot.js → assets/assetHot.js} +7 -6
- 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} +6 -12
- package/core/{namedModel.js → assets/namedModel.js} +17 -13
- package/core/{Audio.js → audio/Audio.js} +26 -23
- package/core/{audioRules.js → audio/audioRules.js} +8 -5
- package/core/{audioVoice.js → audio/audioVoice.js} +17 -30
- package/core/{Events.js → base/Events.js} +3 -3
- package/core/{I18n.js → base/I18n.js} +10 -10
- package/core/{Random.js → base/Random.js} +5 -4
- package/core/{easing.js → base/easing.js} +1 -1
- package/core/{errorCodes.js → base/errorCodes.js} +98 -110
- package/core/{errorHints.js → base/errorHints.js} +5 -9
- package/core/{errors.js → base/errors.js} +6 -6
- package/core/{events.generated.js → base/events.generated.js} +1 -0
- package/core/{math.js → base/math.js} +15 -4
- package/core/{params.js → base/params.js} +3 -4
- package/core/base/util.js +32 -0
- package/core/{validate.js → base/validate.js} +28 -7
- package/core/{Engine.js → engine/Engine.js} +80 -77
- package/core/{Loading.js → engine/Loading.js} +4 -2
- package/core/{copies.js → engine/copies.js} +4 -4
- package/core/{headlessLoad.js → engine/headlessLoad.js} +4 -4
- package/core/{lifecycle.js → engine/lifecycle.js} +14 -12
- package/core/{loop.js → engine/loop.js} +68 -47
- package/core/{moduleSlots.js → engine/moduleSlots.js} +6 -6
- package/core/{moduleTypes.js → engine/moduleTypes.js} +13 -14
- package/core/{modules.js → engine/modules.js} +14 -11
- package/core/{page.js → engine/page.js} +36 -23
- package/core/{plugins.js → engine/plugins.js} +6 -9
- package/core/{services.js → engine/services.js} +47 -40
- package/core/{startup.js → engine/startup.js} +26 -24
- package/core/{Input.js → input/Input.js} +30 -22
- package/core/{inputContext.js → input/inputContext.js} +14 -5
- package/core/{inputPad.js → input/inputPad.js} +1 -1
- package/core/{inputPointer.js → input/inputPointer.js} +8 -2
- package/core/{inputTouch.js → input/inputTouch.js} +1 -1
- package/core/{Budget.js → inspect/Budget.js} +21 -20
- package/core/{DebugOverrides.js → inspect/DebugOverrides.js} +30 -16
- package/core/{Describe.js → inspect/Describe.js} +26 -22
- package/core/{Inspect.js → inspect/Inspect.js} +9 -7
- 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} +52 -20
- package/core/{catalog.js → inspect/catalog.js} +3 -3
- 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} +21 -20
- package/core/{describeText.js → inspect/describeText.js} +11 -6
- package/core/inspect/geometryWatch.js +38 -0
- package/core/{lightWatch.js → inspect/lightWatch.js} +8 -8
- package/core/{pictureWriters.js → inspect/pictureWriters.js} +15 -16
- package/core/{shaderCost.js → inspect/shaderCost.js} +1 -1
- package/core/{Ops.js → ops/Ops.js} +16 -11
- package/core/{control.js → ops/control.js} +13 -12
- package/core/ops/holds.js +139 -0
- package/core/{opsAtomic.js → ops/opsAtomic.js} +2 -1
- package/core/{opsCheck.js → ops/opsCheck.js} +4 -5
- package/core/{opsGuard.js → ops/opsGuard.js} +3 -3
- package/core/{opsRun.js → ops/opsRun.js} +7 -4
- package/core/{owned.js → ops/owned.js} +14 -17
- package/core/{sharedPoint.js → ops/sharedPoint.js} +8 -8
- package/core/{stackFrames.js → ops/stackFrames.js} +2 -2
- package/core/{stacks.js → ops/stacks.js} +12 -14
- package/core/{wrap.js → ops/wrap.js} +8 -6
- package/core/{SaveStore.js → saves/SaveStore.js} +1 -1
- package/core/{Saves.js → saves/Saves.js} +58 -36
- package/core/{saveApply.js → saves/saveApply.js} +13 -9
- package/core/{saveFiles.js → saves/saveFiles.js} +17 -15
- package/core/{saveValues.js → saves/saveValues.js} +20 -3
- package/core/{saveVersions.js → saves/saveVersions.js} +4 -17
- package/core/{session.js → saves/session.js} +31 -17
- package/core/{Rays.js → scene/Rays.js} +23 -25
- package/core/{Views.js → scene/Views.js} +14 -6
- package/core/{adaptive.js → scene/adaptive.js} +15 -8
- package/core/{canvasBox.js → scene/canvasBox.js} +2 -3
- package/core/{engineCamera.js → scene/engineCamera.js} +1 -1
- package/core/{gameLights.js → scene/gameLights.js} +17 -7
- package/core/{grayMap.js → scene/grayMap.js} +8 -2
- package/core/{grid.js → scene/grid.js} +4 -4
- package/core/{gridLoad.js → scene/gridLoad.js} +1 -1
- package/core/{ground.js → scene/ground.js} +9 -9
- package/core/{movement.js → scene/movement.js} +3 -3
- package/core/{pictureSlots.js → scene/pictureSlots.js} +2 -2
- package/core/{sceneDelta.js → scene/sceneDelta.js} +2 -2
- package/core/{sceneMethods.js → scene/sceneMethods.js} +36 -13
- package/core/scene/stepPoses.js +55 -0
- package/core/{targeting.js → scene/targeting.js} +4 -5
- package/core/{thingExplain.js → scene/thingExplain.js} +6 -5
- package/core/{thingOps.js → scene/thingOps.js} +4 -3
- package/core/{things.js → scene/things.js} +18 -5
- package/core/{threePatches.js → scene/threePatches.js} +1 -1
- package/core/{view.js → scene/view.js} +17 -16
- package/core/{Batching.js → stream/Batching.js} +85 -27
- package/core/{Stream.js → stream/Stream.js} +60 -30
- package/core/{batchGroups.js → stream/batchGroups.js} +10 -9
- package/core/{chunkStream.js → stream/chunkStream.js} +40 -0
- package/core/{scatter.js → stream/scatter.js} +2 -2
- package/core/{streamSources.js → stream/streamSources.js} +12 -7
- package/core/{Commits.js → threads/Commits.js} +6 -5
- package/core/{Jobs.js → threads/Jobs.js} +12 -10
- package/core/{Threads.js → threads/Threads.js} +16 -16
- package/core/{threadPure.js → threads/threadPure.js} +7 -5
- package/core/{threadServe.js → threads/threadServe.js} +3 -3
- package/core/{Clock.js → time/Clock.js} +17 -10
- package/core/{dayTime.js → time/dayTime.js} +5 -1
- package/core/{skip.js → time/skip.js} +18 -17
- package/core/{time.js → time/time.js} +18 -12
- package/core/{uiClock.js → time/uiClock.js} +4 -4
- package/docs/AI.md +22 -19
- package/docs/API.md +24 -23
- package/docs/CODEMAP.md +76 -183
- package/docs/COMMANDS.md +66 -58
- package/docs/CONVENTIONS.md +54 -14
- package/docs/MIGRATING-0.8.md +169 -0
- package/docs/THREE.md +78 -29
- 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 +29 -29
- package/docs/api/characters.md +23 -18
- package/docs/api/clock.md +1 -1
- package/docs/api/collision.md +12 -9
- package/docs/api/content.md +6 -6
- package/docs/api/dialogue.md +3 -3
- package/docs/api/engine.md +45 -43
- package/docs/api/events.md +3 -2
- package/docs/api/flow.md +1 -1
- package/docs/api/grids.md +1 -1
- package/docs/api/ground.md +4 -5
- package/docs/api/hud.md +2 -2
- package/docs/api/i18n.md +6 -6
- package/docs/api/input.md +7 -7
- package/docs/api/interactions.md +4 -4
- package/docs/api/inventory.md +9 -9
- package/docs/api/jobs.md +5 -5
- package/docs/api/level.md +7 -7
- package/docs/api/lightPool.md +1 -6
- package/docs/api/music.md +3 -3
- package/docs/api/nav.md +10 -10
- package/docs/api/openWorld.md +1 -1
- package/docs/api/particles.md +2 -2
- package/docs/api/photo.md +4 -2
- package/docs/api/pickups.md +2 -2
- package/docs/api/post.md +20 -3
- package/docs/api/quests.md +3 -3
- package/docs/api/rays.md +5 -7
- package/docs/api/rigid.md +27 -18
- package/docs/api/saves.md +8 -7
- package/docs/api/settings.md +9 -8
- package/docs/api/sky.md +8 -7
- package/docs/api/stream.md +7 -7
- package/docs/api/swarm.md +34 -0
- package/docs/api/terrain.md +7 -8
- package/docs/api/terrainDraw.md +1 -1
- package/docs/api/timeline.md +2 -2
- package/docs/api/tools.md +25 -22
- package/docs/api/vars.md +1 -1
- package/docs/api/vegetation.md +4 -3
- package/docs/api/vegetationDraw.md +1 -1
- package/docs/api/water.md +1 -1
- package/docs/api/weather.md +9 -9
- package/docs/api/weatherDraw.md +3 -3
- package/docs/api/world.md +5 -5
- package/docs/recipes/01-new-game.md +25 -40
- package/docs/recipes/02-npc.md +19 -20
- package/docs/recipes/03-items-pickups.md +27 -43
- package/docs/recipes/04-quests.md +3 -4
- package/docs/recipes/05-props-bake.md +29 -39
- package/docs/recipes/06-clock-events.md +27 -18
- package/docs/recipes/07-flow-scenes-pause.md +12 -17
- package/docs/recipes/08-weather-sky.md +88 -34
- package/docs/recipes/09-materials-lights-models.md +22 -36
- package/docs/recipes/10-blender-level.md +6 -7
- package/docs/recipes/11-vehicles.md +30 -22
- package/docs/recipes/12-navmesh.md +9 -8
- package/docs/recipes/13-animation.md +39 -17
- package/docs/recipes/14-custom-module.md +14 -13
- package/docs/recipes/15-perf.md +49 -26
- package/docs/recipes/16-dev-bridge.md +32 -52
- package/docs/recipes/18-world.md +36 -23
- package/docs/recipes/19-shooting-picking.md +4 -2
- package/docs/recipes/20-content-actions-save.md +30 -35
- package/docs/recipes/21-camera.md +33 -5
- package/docs/recipes/22-shop-gold.md +0 -4
- package/docs/recipes/23-ops.md +10 -10
- package/docs/recipes/26-ui-parts.md +22 -12
- package/docs/recipes/27-net.md +0 -2
- package/docs/recipes/28-terrain.md +117 -21
- package/docs/recipes/29-grid.md +2 -2
- package/docs/recipes/30-templates.md +55 -19
- package/docs/recipes/31-audio.md +5 -5
- package/docs/recipes/32-action-game.md +15 -6
- package/docs/recipes/33-stream-sources.md +2 -2
- package/docs/recipes/34-environment-lighting.md +67 -19
- package/docs/recipes/35-picture-from-reference.md +10 -17
- package/docs/recipes/36-ground-plants.md +105 -0
- package/docs/recipes/40-scene.md +7 -11
- package/docs/recipes/43-shader-patches-surfaces.md +20 -41
- package/docs/recipes/44-water-weather-hooks.md +48 -43
- package/docs/recipes/45-cascaded-shadows.md +39 -17
- package/docs/recipes/46-blender-art-route.md +7 -8
- package/docs/recipes/49-game-module-contract.md +5 -5
- package/docs/recipes/50-own-renderer.md +2 -2
- package/docs/recipes/52-around-the-picture.md +54 -98
- package/docs/recipes/53-ground-up-close.md +61 -24
- package/docs/recipes/55-mods-time-wrap.md +12 -16
- package/docs/recipes/56-webgpu-tsl.md +16 -14
- package/docs/recipes/57-control.md +9 -2
- package/docs/recipes/58-input.md +2 -2
- package/docs/recipes/59-depth-post-effects.md +1 -1
- package/docs/recipes/60-judge-the-picture.md +29 -24
- package/docs/recipes/62-picture-code.md +49 -17
- package/docs/recipes/63-third-person-start.md +17 -4
- package/docs/recipes/64-particles.md +1 -1
- package/docs/recipes/65-swarm.md +140 -0
- package/examples/action/.threedog/content-index.json +1 -1
- package/examples/action/GAMEMAP.md +2 -2
- package/examples/{sheepisland → perf-island}/.threedog/content-index.json +1 -1
- package/examples/{sheepisland → perf-island}/GAMEMAP.md +12 -11
- 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 +1 -0
- package/examples/rc2d/GAMEMAP.md +3 -2
- package/examples/rc2d/main.js +1 -3
- package/examples/styletest/.threedog/content-index.json +1 -1
- package/examples/styletest/GAMEMAP.md +3 -2
- 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 +1 -0
- package/examples/world/.threedog/content-index.json +1 -1
- package/examples/world/GAMEMAP.md +4 -3
- package/examples/world/picture/sky.js +1 -1
- package/index.d.ts +8 -7
- package/index.js +31 -31
- package/llms.txt +9 -13
- package/modules/ambience/Ambience.js +11 -8
- package/modules/calendar/Calendar.js +19 -19
- package/modules/calendar/index.js +13 -13
- package/modules/calendar/schedule.js +11 -6
- package/modules/calendar/seasons.js +7 -7
- package/modules/camera/FirstPersonCamera.js +2 -2
- package/modules/camera/FixedCamera.js +14 -15
- package/modules/camera/FollowCamera.js +4 -4
- package/modules/camera/RtsCamera.js +11 -11
- package/modules/camera/common.js +48 -24
- package/modules/camera/contract.js +1 -0
- package/modules/camera/projection.js +2 -2
- package/modules/characters/Character.js +33 -30
- package/modules/characters/NPC.js +27 -19
- package/modules/characters/assetModel.js +14 -10
- package/modules/characters/astar.js +7 -5
- package/modules/characters/behaviors.js +4 -5
- package/modules/characters/contract.js +2 -2
- package/modules/characters/index.js +168 -214
- package/modules/characters/moveHelpers.js +14 -3
- package/modules/characters/movers/common.js +16 -14
- package/modules/characters/movers/manual.js +1 -1
- package/modules/characters/movers/rapier.js +7 -6
- package/modules/characters/movers/simple.js +3 -3
- package/modules/characters/movers/support.js +8 -8
- package/modules/characters/npcAvoid.js +4 -4
- package/modules/characters/npcSim.js +23 -17
- package/modules/characters/npcView.js +6 -5
- package/modules/characters/pathAsync.js +12 -10
- package/modules/characters/pathWorker.js +1 -1
- package/modules/characters/player.js +108 -0
- package/modules/characters/playerStrings.js +2 -2
- package/modules/characters/proceduralRig.js +2 -2
- package/modules/characters/useModel.js +3 -3
- package/modules/characters/walkTo.js +11 -17
- package/modules/collision/Collision.js +26 -20
- package/modules/collision/contract.js +15 -0
- package/modules/content/explain.js +1 -2
- package/modules/content/fields.js +24 -3
- package/modules/content/ids.js +2 -2
- package/modules/content/index.js +61 -99
- package/modules/content/loader.js +14 -17
- package/modules/content/markers.js +25 -0
- package/modules/content/models.js +10 -7
- package/modules/content/packs.js +3 -3
- package/modules/content/parts.js +2 -2
- package/modules/content/places.js +35 -0
- package/modules/content/props.js +17 -14
- package/modules/content/rules.js +25 -21
- package/modules/content/stages.js +7 -7
- package/modules/content/templates.js +20 -20
- package/modules/content/words.js +34 -0
- package/modules/debug/DebugPanel.js +10 -43
- package/modules/flow/contract.js +1 -1
- package/modules/flow/index.js +11 -7
- package/modules/gameplay/Container.js +12 -11
- package/modules/gameplay/Containers.js +14 -5
- package/modules/gameplay/Dialogue.js +13 -11
- package/modules/gameplay/Interactions.js +37 -24
- package/modules/gameplay/Inventory.js +8 -9
- package/modules/gameplay/Quests.js +16 -9
- package/modules/gameplay/boxOps.js +1 -1
- package/modules/gameplay/dialogueBubbles.js +3 -4
- package/modules/gameplay/inventoryOps.js +0 -1
- package/modules/gameplay/pickups.js +22 -23
- package/modules/gameplay/questSave.js +3 -3
- package/modules/grid/Grid.js +1 -1
- package/modules/grid/Layer.js +4 -4
- package/modules/grid/index.js +7 -8
- package/modules/grid/preview.js +7 -7
- package/modules/grid/tiles.js +6 -6
- package/modules/hlod/index.js +37 -55
- package/modules/hud/index.js +17 -11
- package/modules/hud/parts.js +4 -4
- package/modules/level/contract.js +16 -0
- package/modules/level/heightfield.js +12 -10
- package/modules/level/index.js +47 -152
- package/modules/level/load.js +79 -0
- package/modules/level/meshes.js +65 -0
- package/modules/level/nodes.js +6 -7
- package/modules/lights/index.js +28 -181
- package/modules/lights/slots.js +93 -0
- package/modules/lights/sources.js +88 -0
- package/modules/music/Music.js +30 -26
- package/modules/music/rules.js +1 -1
- package/modules/nav/contract.js +14 -0
- package/modules/nav/index.js +11 -10
- package/modules/net/Client.js +7 -7
- package/modules/net/Host.js +7 -7
- package/modules/net/Net.js +1 -1
- package/modules/net/index.js +5 -4
- package/modules/net/sync.js +2 -2
- package/modules/net/transports.js +2 -2
- package/modules/particles/Particles.js +11 -8
- package/modules/particles/effect.js +7 -5
- package/modules/particles/shaders.js +2 -1
- package/modules/photo/Photo.js +15 -17
- package/modules/rigid/RigidBodies.js +66 -43
- package/modules/rigid/Vehicles.js +2 -3
- package/modules/rigid/ragdoll.js +287 -0
- package/modules/rigid/ragdollBones.js +159 -0
- package/modules/rigid/sync.js +6 -6
- package/modules/settings/Settings.js +108 -39
- package/modules/settings/apply.js +6 -6
- package/modules/settings/sections.js +16 -14
- 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 +14 -27
- package/modules/sky/tint.js +1 -1
- package/modules/swarm/Swarm.js +346 -0
- package/modules/swarm/draw.js +68 -0
- package/modules/swarm/grid.js +63 -0
- package/modules/terrain/ChunkManager.js +70 -52
- 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 +28 -34
- package/modules/terrain/terrainColorMap.js +6 -3
- package/modules/terrain/terrainDefaults.js +2 -1
- package/modules/terrain/terrainEdit.js +32 -27
- package/modules/terrain/terrainGen.js +17 -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 +27 -19
- package/modules/timeline/Tween.js +6 -6
- package/modules/timeline/shots.js +5 -7
- package/modules/triggers/index.js +9 -9
- package/modules/vegetation/Vegetation.js +30 -23
- package/modules/vegetation/densityMap.js +4 -7
- package/modules/vegetation/draw.js +23 -18
- package/modules/vegetation/groundChunks.js +11 -31
- package/modules/vegetation/index.js +8 -6
- package/modules/vegetation/modelGeometry.js +3 -6
- package/modules/vegetation/nearFade.js +1 -1
- package/modules/water/Water.js +16 -16
- package/modules/water/surface.js +3 -3
- package/modules/weather/Weather.js +41 -30
- package/modules/weather/particles.js +8 -8
- package/modules/weather/weatherDraw.js +22 -18
- package/modules/world/World.js +8 -8
- package/modules/world/explain.js +1 -1
- package/modules/world/index.js +18 -12
- package/modules/world/persist.js +73 -25
- package/modules/world/pos.js +4 -4
- package/modules/world/records.js +28 -8
- package/modules/world/sim.js +4 -4
- package/modules/world/state.js +12 -5
- package/modules/world/thingSource.js +4 -2
- package/modules/world/views.js +11 -9
- package/package.json +42 -7
- package/presets.js +1 -3
- package/render/PostFX.js +39 -27
- package/render/backend.js +26 -32
- 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/patchNodes.tsl.js +5 -15
- package/render/fx/postWebGPU.tsl.js +27 -23
- 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 +1 -1
- package/render/lighting.js +5 -3
- package/render/lightmap.js +20 -20
- 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 +20 -4
- package/render/ownFrame.js +4 -4
- package/render/patches.js +13 -13
- package/render/postWebGL.js +12 -10
- package/render/probes.js +16 -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 +57 -11
- package/render/slots.js +7 -7
- package/render/terms.js +22 -24
- package/render/uniformDecl.js +1 -1
- package/types/core.d.ts +200 -153
- package/types/gameplay.d.ts +163 -91
- 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} +7 -15
- 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} +12 -8
- package/types/generated/core/{Budget.d.ts → inspect/Budget.d.ts} +36 -26
- package/types/generated/core/{DebugOverrides.d.ts → inspect/DebugOverrides.d.ts} +2 -2
- package/types/generated/core/{Ops.d.ts → ops/Ops.d.ts} +4 -3
- package/types/generated/core/{control.d.ts → ops/control.d.ts} +4 -10
- package/types/generated/core/{Saves.d.ts → saves/Saves.d.ts} +37 -13
- package/types/generated/core/{session.d.ts → saves/session.d.ts} +2 -1
- package/types/generated/core/{Rays.d.ts → scene/Rays.d.ts} +8 -27
- package/types/generated/core/{Views.d.ts → scene/Views.d.ts} +1 -1
- package/types/generated/core/{Batching.d.ts → stream/Batching.d.ts} +7 -7
- package/types/generated/core/{Stream.d.ts → stream/Stream.d.ts} +18 -16
- package/types/generated/core/{Commits.d.ts → threads/Commits.d.ts} +1 -1
- package/types/generated/core/{Jobs.d.ts → threads/Jobs.d.ts} +6 -6
- package/types/generated/core/{Threads.d.ts → threads/Threads.d.ts} +4 -4
- package/types/generated/modules/calendar/Calendar.d.ts +10 -11
- package/types/generated/modules/debug/DebugPanel.d.ts +1 -9
- package/types/generated/modules/grid/Layer.d.ts +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 +1 -1
- 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 +2 -1
- package/types/generated/modules/water/Water.d.ts +1 -0
- package/types/generated/modules/weather/Weather.d.ts +16 -12
- package/types/generated/modules/weather/weatherDraw.d.ts +3 -3
- package/types/generated/modules/world/World.d.ts +5 -3
- package/types/generated/render/PostFX.d.ts +17 -11
- 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 +11 -11
- package/types/physics.d.ts +99 -70
- package/types/tsl.d.ts +37 -4
- package/types/world.d.ts +38 -71
- package/ui/Focus.js +10 -9
- package/ui/Parts.js +4 -3
- package/ui/UI.js +7 -7
- package/ui/defaults.js +3 -2
- package/ui/theme.js +5 -3
- package/core/assetEntry.js +0 -109
- package/core/holds.js +0 -134
- package/core/shadowTypes.js +0 -16
- package/core/util.js +0 -17
- 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/core/{Vars.js → base/Vars.js} +0 -0
- /package/core/{mulberry32.js → base/mulberry32.js} +0 -0
- /package/core/{inputDefaults.js → input/inputDefaults.js} +0 -0
- /package/core/{textureBytes.js → inspect/textureBytes.js} +0 -0
- /package/core/{actor.js → ops/actor.js} +0 -0
- /package/core/{opsFail.js → ops/opsFail.js} +0 -0
- /package/core/{opsHistory.js → ops/opsHistory.js} +0 -0
- /package/core/{saveIds.js → saves/saveIds.js} +0 -0
- /package/core/{screenToGround.js → scene/screenToGround.js} +0 -0
- /package/core/{tier.js → scene/tier.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
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
// Naming rule for a NEW code: `<area>-<problem>` in lowercase with hyphens (save-version, unknown-name): the area first so the codes sort
|
|
5
5
|
// and grep by subsystem. Codes already published keep their names even where they do not follow it (renaming would break the tools and tests that match them).
|
|
6
|
+
// One code per kind of misuse per module: the message names the exact call, the value it got and the accepted values; the fix says what to change.
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Errors the engine raises by name (the message ends with "[code]"): code -> { fix, docs }. Codes are stable: tools and tests may match on them.
|
|
@@ -35,12 +36,9 @@ export const ERROR_CODES = {
|
|
|
35
36
|
'session-early': {
|
|
36
37
|
docs: ['recipes/20-content-actions-save.md', 'api/engine.md'],
|
|
37
38
|
fix: 'engine.session needs the new-game state that start() captures: call it from a button or after `await engine.start()`.' },
|
|
38
|
-
'session-handle': {
|
|
39
|
-
docs: ['api/engine.md'],
|
|
40
|
-
fix: 'session.track(handle) takes something with remove(), such as the result of events.on / onFixed / clock.after.' },
|
|
41
39
|
'clock-interval': {
|
|
42
40
|
docs: ['recipes/06-clock-events.md', 'api/clock.md'],
|
|
43
|
-
fix: 'clock.after / every take a finite number of
|
|
41
|
+
fix: 'clock.after / every take a finite number of calendar seconds (every needs > 0). For every fixed step use engine.onFixed.' },
|
|
44
42
|
'threads-option': {
|
|
45
43
|
docs: ['recipes/15-perf.md', 'api/engine.md'],
|
|
46
44
|
fix: 'createEngine({ threads }) takes \'auto\', a worker count (0 = none) or false.' },
|
|
@@ -70,7 +68,7 @@ export const ERROR_CODES = {
|
|
|
70
68
|
'disposed one.' },
|
|
71
69
|
'skip-amount': {
|
|
72
70
|
docs: ['recipes/06-clock-events.md', 'api/engine.md'],
|
|
73
|
-
fix: 'engine.skip takes { to: \'06:00\' } (needs the
|
|
71
|
+
fix: 'engine.skip takes { to: \'06:00\' } (needs the calendar module) or { seconds: 600 } (calendar seconds, > 0).' },
|
|
74
72
|
'stream-timeout': {
|
|
75
73
|
docs: ['recipes/18-world.md', 'api/stream.md'],
|
|
76
74
|
fix: 'The teleport destination did not finish loading in time (terrain, colliders, nearby models). Read describe().loading or ' +
|
|
@@ -81,20 +79,17 @@ export const ERROR_CODES = {
|
|
|
81
79
|
'whenReady only on a source you keep.' },
|
|
82
80
|
'stream-option': {
|
|
83
81
|
docs: ['recipes/18-world.md', 'api/stream.md'],
|
|
84
|
-
fix: 'stream.source(position, { detail }) takes \'full\' or \'simple\'.' },
|
|
82
|
+
fix: 'stream.source(position, { detail }) takes \'full\' or \'simple\'; stream.radius takes a finite number of meters or null.' },
|
|
85
83
|
'op-misuse': {
|
|
86
84
|
docs: ['recipes/23-ops.md', 'api/engine.md'],
|
|
87
85
|
fix: 'Ops are defined with ops.define(name, { can, run }) and run with ops.run(name, args); args are plain data and can() only ' +
|
|
88
86
|
'reads. The message says which rule was broken.' },
|
|
89
|
-
'
|
|
90
|
-
docs: ['MIGRATING-0.4.md'],
|
|
91
|
-
fix: 'A name removed in 0.4 was read (engine.elapsed); the message names the new form (engine.time.now(\'real\') or engine.time.now(\'ambient\')). Checked in dev only.' },
|
|
92
|
-
'pause-owner': {
|
|
87
|
+
'halt-owner': {
|
|
93
88
|
docs: ['recipes/23-ops.md', 'api/engine.md'],
|
|
94
|
-
fix: 'const
|
|
89
|
+
fix: 'const h = engine.haltLoop(owner); ... h.remove() ends that owner\'s halt; the loop restarts only when every owner has removed theirs.' },
|
|
95
90
|
'mod-owner': {
|
|
96
91
|
docs: ['recipes/55-mods-time-wrap.md', 'api/engine.md'],
|
|
97
|
-
fix: "engine.mod(point, { owner, set | add | mul | clamp, layer?, for?, clock?, id? }): owner is a non-empty string, exactly one of set / add / mul / clamp for a number (set for a value point); in a module ctx.mod(point, { mul }) names the module itself.
|
|
92
|
+
fix: "engine.mod(point, { owner, set | add | mul | clamp, layer?, for?, clock?, id? }): owner is a non-empty string, exactly one of set / add / mul / clamp for a number (set for a value point); in a module ctx.mod(point, { mul }) names the module itself. haltLoop / freeze / takeCamera / debug.view name their owner the same way. Only that owner ends it, with the handle's remove()." },
|
|
98
93
|
'shared-conflict': {
|
|
99
94
|
docs: ['recipes/55-mods-time-wrap.md'],
|
|
100
95
|
fix: "Two owners set one shared value on the same layer, so nothing says which one decides (dev builds throw; release builds let the later write win and warn once). Copy one fix from the message: contribute instead (mul / add), decide on another layer ({ layer }), or take it over on purpose (manual, or a set on the system layer)." },
|
|
@@ -109,7 +104,7 @@ export const ERROR_CODES = {
|
|
|
109
104
|
fix: 'A number shared value got a value it cannot combine: set / add / mul take a finite number; clamp takes { min?, max? } with each given bound a finite number and min <= max. The same check runs on engine.mod and on handle.change, so a NaN never reaches the value.' },
|
|
110
105
|
'shared-layer': {
|
|
111
106
|
docs: ['recipes/55-mods-time-wrap.md'],
|
|
112
|
-
fix:
|
|
107
|
+
fix: "layer is one of engine < game < effect < system < settings < debug (default game); most code never passes it." },
|
|
113
108
|
'views-define': {
|
|
114
109
|
docs: ['recipes/46-blender-art-route.md', 'api/engine.md'],
|
|
115
110
|
fix: "engine.views.define(name, { position: [x, y, z], target?: [x, y, z], fov? }): position and target are 3-number arrays." },
|
|
@@ -119,16 +114,14 @@ export const ERROR_CODES = {
|
|
|
119
114
|
'engine.ops.run(...) or an onFixed / module fixed hook.' },
|
|
120
115
|
'quest-step': {
|
|
121
116
|
docs: ['recipes/04-quests.md', 'api/quests.md'],
|
|
122
|
-
fix:
|
|
123
|
-
'}]) or add a migrate step to the quests save part.' },
|
|
117
|
+
fix: "A quest step is wrong. In a definition: each step has done (a function) or all: [parts] with at least one part not optional, and step ids are unique. In a save: a step id the definition no longer has restarts the quest from its first step; keep step ids stable, or add a migrate step to the quests save part." },
|
|
124
118
|
'save-write': {
|
|
125
119
|
docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
|
|
126
120
|
fix: 'The browser refused to store the save (storage full, private mode, blocked IndexedDB); the previous save is kept. Free ' +
|
|
127
121
|
'space or export the save as a file.' },
|
|
128
122
|
'save-bad-record': {
|
|
129
123
|
docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
|
|
130
|
-
fix:
|
|
131
|
-
'load was refused and rolled back. The save was edited by hand or damaged: fix the field the message names, or load another save.' },
|
|
124
|
+
fix: "A core field of saved data is malformed (a position that is not three finite numbers, a record without kind, a swarm without its columns); the load was refused and rolled back. The save was edited by hand or damaged: fix the field the message names, or load another save." },
|
|
132
125
|
'save-value': {
|
|
133
126
|
docs: ['recipes/20-content-actions-save.md', 'api/saves.md'],
|
|
134
127
|
fix: 'A saved number was not finite or out of range (a negative clock, a count beyond any stack); it was clamped or dropped and the ' +
|
|
@@ -141,6 +134,14 @@ export const ERROR_CODES = {
|
|
|
141
134
|
docs: ['recipes/15-perf.md', 'api/budget.md'],
|
|
142
135
|
fix: 'A performance budget set with createEngine({ budget }) was exceeded; the message names the biggest costs. Measure with ' +
|
|
143
136
|
'describe().perf or npm run perf.' },
|
|
137
|
+
'webgpu-records-unread': {
|
|
138
|
+
docs: ['recipes/56-webgpu-tsl.md'],
|
|
139
|
+
fix: 'three.js changed the private list of draw records the WebGPU sweep reads (usually a three upgrade), so the sweep is off and the game runs on. ' +
|
|
140
|
+
'Until the engine is updated, send the event yourself when a mesh is gone for good: mesh.dispatchEvent({ type: \'dispose\' }).' },
|
|
141
|
+
'geometry-undisposed': {
|
|
142
|
+
docs: ['recipes/56-webgpu-tsl.md'],
|
|
143
|
+
fix: 'Meshes are leaving the scene with their geometry never disposed, so the renderer keeps counting it. Call mesh.geometry.dispose() when a mesh is gone for good, ' +
|
|
144
|
+
'or engine.remove(mesh). Geometry parked for reuse is fine; this warns only about a steady climb.' },
|
|
144
145
|
'jobs-slow': {
|
|
145
146
|
docs: ['recipes/15-perf.md', 'api/jobs.md'],
|
|
146
147
|
fix: 'A job step ran too long or a job queued too many steps. Yield more often inside the generator (engine.jobs.add(function* ' +
|
|
@@ -151,8 +152,7 @@ export const ERROR_CODES = {
|
|
|
151
152
|
'results, only slower. Fix the worker file or its imports; a lane whose tasks really take longer passes a bigger lane({ timeout }).' },
|
|
152
153
|
'input-bound-twice': {
|
|
153
154
|
docs: ['recipes/58-input.md', 'api/input.md'],
|
|
154
|
-
fix:
|
|
155
|
-
'modules). One owner binds an action: keep one of the two, or bind another action name. The same owner binding again just replaces its keys.' },
|
|
155
|
+
fix: "Two different owners bound the same action (createEngine({ bindings }) of the game and a module, or two modules). One owner binds an action: keep one of the two, or bind another action name. The same owner binding again just replaces its keys." },
|
|
156
156
|
'input-action-context': {
|
|
157
157
|
docs: ['recipes/58-input.md', 'api/input.md'],
|
|
158
158
|
fix: 'Two owners declared one action in different input contexts. An action belongs to one context: rename one of them, or declare both in ' +
|
|
@@ -163,8 +163,11 @@ export const ERROR_CODES = {
|
|
|
163
163
|
"engine.input.bind('action', ['KeyX']), createEngine({ bindings }) or a presets.bindings.* map." },
|
|
164
164
|
'interaction-no-key': {
|
|
165
165
|
docs: ['recipes/63-third-person-start.md', 'recipes/58-input.md', 'api/interactions.md'],
|
|
166
|
-
fix: 'Interactions were added but their action has no key, so
|
|
167
|
-
'engine.input.bind; any key works, and bind it to [] if the game
|
|
166
|
+
fix: 'Interactions were added but their action has no key, so no key press reaches them; the game keeps running. Bind it in createEngine({ bindings }) or with ' +
|
|
167
|
+
'engine.input.bind; any key works, and bind it to [] if the game reaches them another way (a click, a touch, its own button): that ends this warning.' },
|
|
168
|
+
'signal-overwritten': {
|
|
169
|
+
docs: ['recipes/62-picture-code.md'],
|
|
170
|
+
fix: 'This signal has one writer that rewrites it every frame, so a direct write lasts at most a frame. The message names the entry that changes it.' },
|
|
168
171
|
'asset-cache': {
|
|
169
172
|
docs: ['recipes/05-props-bake.md', 'api/assets.md'],
|
|
170
173
|
fix: 'The dev model cache could not be used, so code-generated models are built from code. Run the game through its vite ' +
|
|
@@ -175,8 +178,7 @@ export const ERROR_CODES = {
|
|
|
175
178
|
'unless it repeats: then lower quality or texture sizes.' },
|
|
176
179
|
'module-params': {
|
|
177
180
|
docs: ['recipes/51-capability-catalog.md'],
|
|
178
|
-
fix:
|
|
179
|
-
'The message names the option and what it should be; engine.catalog(name).params lists every option with its default.' },
|
|
181
|
+
fix: "A module option or call argument does not fit (unknown key, wrong type, out of range or not one of the allowed values). The message names it and what it should be; engine.catalog(name).params lists every option with its default." },
|
|
180
182
|
'module-dispose': {
|
|
181
183
|
docs: ['recipes/14-custom-module.md'],
|
|
182
184
|
fix: 'A module\'s dispose(e) threw; the other modules and core were still cleaned up. Fix that module\'s dispose.' },
|
|
@@ -192,9 +194,12 @@ export const ERROR_CODES = {
|
|
|
192
194
|
docs: ['recipes/14-custom-module.md', 'api/engine.md'],
|
|
193
195
|
fix: 'start() waited longer than engine.loading.timeoutMs for modules whose isReady(e) stays false. Fix what that module waits for, ' +
|
|
194
196
|
'or raise engine.loading.timeoutMs if the load is only slow. engine.loading.view().waiting names the current item.' },
|
|
197
|
+
'step-during-load': {
|
|
198
|
+
docs: ['api/engine.md'],
|
|
199
|
+
fix: 'engine.step() ran during a load nobody awaited. Await engine.start(), or the session.newGame / load / quit that is running, then step.' },
|
|
195
200
|
'step-seconds': {
|
|
196
201
|
docs: ['api/engine.md'],
|
|
197
|
-
fix: 'engine.step(seconds) takes a finite number >= 0 in
|
|
202
|
+
fix: 'engine.step(seconds) takes a finite number >= 0 in real seconds: 0 advances nothing, 0.5 is half a second, 1 / 60 is one fixed step.' },
|
|
198
203
|
'player-control': {
|
|
199
204
|
docs: ['recipes/01-new-game.md', 'api/characters.md'],
|
|
200
205
|
fix: "createPlayer() has no default feel: give control. Usually createPlayer({ ...presets.player.thirdPerson, spawn }); else control: 'camera' | " +
|
|
@@ -214,8 +219,7 @@ export const ERROR_CODES = {
|
|
|
214
219
|
"const h = engine.control.take(ch, { owner, layer: 'script', step }) (or h.move(x, z, run, dt)), then h.remove() to hand it back." },
|
|
215
220
|
'control-layer': {
|
|
216
221
|
docs: ['recipes/57-control.md'],
|
|
217
|
-
fix: "engine.control.take(character, { owner, layer?, step? }): a character (or its id), a non-empty owner name, layer 'base' | 'script' | "
|
|
218
|
-
"'cutscene' (net is the network's), step a function (dt, ch) => ({ x, z, run }) or left out." },
|
|
222
|
+
fix: "engine.control.take(character, { owner, layer?, step? }): a character (or its id), a non-empty owner name, layer 'base' | 'script' | 'cutscene' (physics and net are the engine's own), step a function (dt, ch) => ({ x, z, run }) or left out." },
|
|
219
223
|
'interaction-setup': {
|
|
220
224
|
docs: ['recipes/02-npc.md', 'api/interactions.md'],
|
|
221
225
|
fix: 'interactions() has no default pick: use interactions({ ...presets.interactions.nearest }) or interactions({ pick }); the game binds ' +
|
|
@@ -228,11 +232,10 @@ export const ERROR_CODES = {
|
|
|
228
232
|
fix: 'A lightPool source has a wrong dusk value, or follows daylight while nothing tells day from night: install sky() or calendar(), or register the daylight measure.' },
|
|
229
233
|
'engine-terms': {
|
|
230
234
|
docs: ['recipes/52-around-the-picture.md'],
|
|
231
|
-
fix: 'engine.
|
|
235
|
+
fix: 'engine.shaderTerms was given a spec it cannot draw: a term is { glsl, tsl, uniforms?, pars?, slot? } with the form this renderer needs, or false for none.' },
|
|
232
236
|
'engine-two-copies': {
|
|
233
237
|
docs: ['THREE.md'],
|
|
234
|
-
fix: "vite.config.js: resolve: { dedupe: ['threedog', 'three'] }. Two copies of threedog are loaded (the message names both paths); "
|
|
235
|
-
'each hooks THREE.Mesh.prototype for shadows, so keep one: `npm ls threedog`, and packs / tools list threedog as a peerDependency.' },
|
|
238
|
+
fix: "vite.config.js: resolve: { dedupe: ['threedog', 'three'] }. Two copies of threedog are loaded (the message names both paths); each hooks THREE.Mesh.prototype for shadows, so keep one: `npm ls threedog`, and packs / tools list threedog as a peerDependency." },
|
|
236
239
|
'debug-override': {
|
|
237
240
|
docs: ['recipes/40-scene.md'],
|
|
238
241
|
fix: "engine.debug.override(owner, target, patch): owner names who sets it (engine.debug.clear(owner) removes all of them), target is a thing id or Object3D, " +
|
|
@@ -240,7 +243,7 @@ export const ERROR_CODES = {
|
|
|
240
243
|
'plugin-shape': {
|
|
241
244
|
docs: ['THREE.md', 'recipes/40-scene.md'],
|
|
242
245
|
fix: 'A file in the plugins folder is plugged by what it exports: an Object3D, a three.js Pass, a post effect { name, create | node | fuse }, ' +
|
|
243
|
-
'a
|
|
246
|
+
'a module { name, type, install }, or an array of these (default export, else every named export). ' +
|
|
244
247
|
'A function is never a plugin (on either renderer): export what a factory returns (export default makeIt({ ... })), a node pass as { name, node }; threedog lib pull writes that line for library code. plugins.json names only files that exist.' },
|
|
245
248
|
'thing-id': {
|
|
246
249
|
docs: ['recipes/40-scene.md'],
|
|
@@ -263,28 +266,23 @@ export const ERROR_CODES = {
|
|
|
263
266
|
fix: 'An engine call got an argument it cannot use; the message names the call and the accepted forms.' },
|
|
264
267
|
'many-lights': {
|
|
265
268
|
docs: ['recipes/09-materials-lights-models.md', 'api/lightPool.md'],
|
|
266
|
-
fix:
|
|
267
|
-
'engine.lightPool.add(...) so a fixed small set of real lights follows the nearest sources.' },
|
|
269
|
+
fix: "Too many real-time lights are in the scene (the message has the count). Use engine.use(lightPool({ point: 8 })) and register torches / lamps with engine.lightPool.add(...), so a fixed small set of real lights follows the nearest sources." },
|
|
268
270
|
'light-recompile': {
|
|
269
271
|
docs: ['recipes/09-materials-lights-models.md', 'api/lightPool.md'],
|
|
270
272
|
fix: 'The number of lights changed during play, so three.js compiled new shader programs (a long frame). Keep the light ' +
|
|
271
273
|
'count fixed: engine.use(lightPool({ point: 8 })) before engine.start() and register torches / lamps with ' +
|
|
272
274
|
'engine.lightPool.add(...), or create your own lights before start and fade them with intensity instead of adding, ' +
|
|
273
275
|
'removing or hiding them.' },
|
|
274
|
-
// ---- W4 (one failure shape): every engine throw carries a code. One code per kind of misuse per module; the message names the exact
|
|
275
|
-
// call and the accepted values, the fix says where to look and what to change. Hint-table classes that matched engine messages moved here too
|
|
276
|
-
// (the engine tags its own errors now; errorHints.js keeps patterns only for three.js / browser messages).
|
|
277
276
|
'preset-option': {
|
|
278
277
|
docs: ['api/openWorld.md', 'api/engine.md'],
|
|
279
278
|
fix: 'An openWorld() / preset option has a wrong value or a part name it does not know. The message lists the accepted values; ' +
|
|
280
279
|
'use one of them, or leave the key out for the default.' },
|
|
281
280
|
'asset-misuse': {
|
|
282
281
|
docs: ['api/assets.md', 'recipes/05-props-bake.md'],
|
|
283
|
-
fix:
|
|
284
|
-
'(manifest or assets.define) and pass its name, or the object assets.model() returned.' },
|
|
282
|
+
fix: "An engine.assets call got a model it does not know, an object that is not an assets.model() copy, or setParams on a model with no params schema. Register the model (engine.assets.manifest) and pass its name, or the object assets.model() returned." },
|
|
285
283
|
'batching-option': {
|
|
286
284
|
docs: ['recipes/15-perf.md'],
|
|
287
|
-
fix:
|
|
285
|
+
fix: "createEngine({ batching }) takes false or an object with the keys named in the message." },
|
|
288
286
|
'debug-view': {
|
|
289
287
|
docs: ['recipes/16-dev-bridge.md', 'api/engine.md'],
|
|
290
288
|
fix: 'engine.debug.defineView(name, { what, apply }): the name must be new (not a built-in view mode) and apply(scene) returns ' +
|
|
@@ -320,20 +318,16 @@ export const ERROR_CODES = {
|
|
|
320
318
|
docs: ['api/input.md'],
|
|
321
319
|
fix: 'input.push(name, { owner }) needs a non-empty owner string (who pushed the context), so pop / describe can tell owners apart.' },
|
|
322
320
|
'owned-misuse': {
|
|
323
|
-
docs: ['recipes/52-around-the-picture.md', '
|
|
324
|
-
fix: 'defineOwned / engine.
|
|
321
|
+
docs: ['recipes/52-around-the-picture.md', 'THREE.md'],
|
|
322
|
+
fix: 'defineOwned / engine.autoView.manual(key) was called wrongly: a module definition misses id / part / read / levels.manual, or ' +
|
|
325
323
|
'manual() named a key the part does not write. Use a key listed in the message.' },
|
|
326
324
|
'shadow-cascades': {
|
|
327
325
|
docs: ['recipes/45-cascaded-shadows.md'],
|
|
328
326
|
fix: 'engine.shadows (cascades, box, budget, include, enabled) was called wrongly: the message names what to change. ' +
|
|
329
327
|
'An engine draws one set of cascades, and a light takes a box or cascades, not both.' },
|
|
330
|
-
'shadow-type': {
|
|
331
|
-
docs: ['recipes/45-cascaded-shadows.md'],
|
|
332
|
-
fix: 'Unknown shadow type: use one of the names listed in the message.' },
|
|
333
328
|
'wrap-misuse': {
|
|
334
329
|
docs: ['recipes/55-mods-time-wrap.md'],
|
|
335
|
-
fix:
|
|
336
|
-
'(the message lists them). Wrap a public method, not a private _one.' },
|
|
330
|
+
fix: "engine.wrap(target, method, fn): target is an object, fn a function, and method the name of a method that exists on it (the message lists the public ones). A name with a leading _ is the object's inside: it can be wrapped, a dev warning says so once, and an engine update may change it without notice." },
|
|
337
331
|
'ambience-rule': {
|
|
338
332
|
docs: ['api/ambience.md', 'api/audio.md'],
|
|
339
333
|
fix: 'An ambience rule names no sound: give sound: a name registered in audio.sounds.' },
|
|
@@ -342,9 +336,8 @@ export const ERROR_CODES = {
|
|
|
342
336
|
fix: 'A camera option is wrong: projection is \'perspective\' or \'orthographic\' (orthographic needs size > 0 and engine.camera), ' +
|
|
343
337
|
'ground / shots use the values the message lists.' },
|
|
344
338
|
'character-option': {
|
|
345
|
-
docs: ['api/characters.md', 'recipes/13-animation.md'],
|
|
346
|
-
fix:
|
|
347
|
-
'the registered ones.' },
|
|
339
|
+
docs: ['api/characters.md', 'recipes/13-animation.md', 'recipes/02-npc.md'],
|
|
340
|
+
fix: "A character / NPC option or model name is wrong: the message names the option and the accepted forms, and an unknown model lists the registered ones. An NPC's interact is { op: 'name', args?, ... } or null; characters.support(object, { carry, id }) takes an Object3D with meshes, a listed carry mode and a unique id." },
|
|
348
341
|
'collision-misuse': {
|
|
349
342
|
docs: ['api/collision.md'],
|
|
350
343
|
fix: 'A collision call got a wrong argument, e.g. collision.addBlocked needs fn(x, z) => boolean.' },
|
|
@@ -366,11 +359,10 @@ export const ERROR_CODES = {
|
|
|
366
359
|
'field, a module it needs not installed). The message names the template and the field to fix.' },
|
|
367
360
|
'inventory-misuse': {
|
|
368
361
|
docs: ['recipes/03-items-pickups.md', 'api/inventory.md'],
|
|
369
|
-
fix:
|
|
370
|
-
'form in the message.' },
|
|
362
|
+
fix: "inventory.define(id): an item id may not contain '#', which marks entry keys (sword#3). Pick an id without it." },
|
|
371
363
|
'grids-misuse': {
|
|
372
364
|
docs: ['recipes/29-grid.md', 'api/grids.md'],
|
|
373
|
-
fix:
|
|
365
|
+
fix: "grids(): a grid or item name is unknown or defined twice, a mapping lacks toCell / center, or a layer / preview material is not a three.js material or has nothing to draw on. Use a listed name, or the form in the message." },
|
|
374
366
|
'level-node': {
|
|
375
367
|
docs: ['recipes/10-blender-level.md', 'api/level.md'],
|
|
376
368
|
fix: 'A level node points at content that is not defined, clashes with another record, or is used before the level loaded. Define ' +
|
|
@@ -386,7 +378,7 @@ export const ERROR_CODES = {
|
|
|
386
378
|
fix: 'net() needs role \'host\' or \'client\' and a transport; reconnect() is for clients only.' },
|
|
387
379
|
'rigid-misuse': {
|
|
388
380
|
docs: ['recipes/11-vehicles.md', 'api/rigid.md'],
|
|
389
|
-
fix:
|
|
381
|
+
fix: "The message says which: an id already used by another body or vehicle (give each its own id); joints lost when newGame / a load rebuilt the physics world (re-create them in a rigid:rebuilt listener, recipe 11 section 3 \"Joints\"); rigid.ragdoll() got something it cannot drive (a skinned character out of its vehicle, with the bones named when they cannot be read); or a moving body left the terrain colliders and froze (raise rigid({ terrainRing }) if it must keep moving there, recipe 11 section 3)." },
|
|
390
382
|
'settings-tab': {
|
|
391
383
|
docs: ['api/settings.md'],
|
|
392
384
|
fix: 'settings({ tabs }) names a built-in tab that does not exist. Use a listed built-in name, or define your own section.' },
|
|
@@ -398,19 +390,19 @@ export const ERROR_CODES = {
|
|
|
398
390
|
fix: 'A calendar option, season name or scenario season is wrong (day length not > 0, a season list entry without name / days, a season the ' +
|
|
399
391
|
'calendar does not have). Day, time, seasons and hours per day are calendar({...}) options; sky({ time }) is only the fixed time drawn without a calendar.' },
|
|
400
392
|
'sky-option': {
|
|
401
|
-
docs: ['recipes/08-weather-sky.md', '
|
|
402
|
-
fix: 'A sky
|
|
393
|
+
docs: ['recipes/08-weather-sky.md', 'api/sky.md'],
|
|
394
|
+
fix: 'A sky or clouds option has a wrong value (day length, days and seasons are calendar() options). Own GLSL goes through ' +
|
|
403
395
|
'engine.sky.clouds() and engine.sky.layer(), not an option key. The message lists the accepted values.' },
|
|
404
396
|
'terrain-chunk-failed': {
|
|
405
397
|
docs: ['recipes/28-terrain.md', 'api/terrain.md'],
|
|
406
398
|
fix: 'A terrain chunk failed on every try and stays empty (no ground, no collision there). Usually the height / groundType / placement rule ' +
|
|
407
399
|
'throws at that spot: fix what it reads, then engine.terrain.retry() sends the failed chunks again (terrain:chunkFailed names each one).' },
|
|
408
400
|
'terrain-option': {
|
|
409
|
-
docs: ['recipes/28-terrain.md', '
|
|
401
|
+
docs: ['recipes/28-terrain.md', 'api/terrain.md'],
|
|
410
402
|
fix: 'A terrain option or terrain edit is wrong (shape mask missing, a brush number not a number, an unknown paint). Use the form ' +
|
|
411
403
|
'in the message.' },
|
|
412
404
|
'vegetation-option': {
|
|
413
|
-
docs: ['api/vegetation.md', 'recipes/36-
|
|
405
|
+
docs: ['api/vegetation.md', 'recipes/36-ground-plants.md'],
|
|
414
406
|
fix: 'A vegetation option is wrong: positions entries, densityMap form, fade range or a model with several materials. Fix the ' +
|
|
415
407
|
'entry the message points at.' },
|
|
416
408
|
'water-option': {
|
|
@@ -418,7 +410,7 @@ export const ERROR_CODES = {
|
|
|
418
410
|
fix: 'A water option is wrong; own GLSL goes through engine.water.shader({ wave, surface }) and must define the function the message names.' },
|
|
419
411
|
'weather-option': {
|
|
420
412
|
docs: ['api/weather.md', 'recipes/44-water-weather-hooks.md'],
|
|
421
|
-
fix:
|
|
413
|
+
fix: "A weather type, field, pool, particle definition or weather.set argument is wrong. The message lists the defined types and the accepted forms." },
|
|
422
414
|
'world-option': {
|
|
423
415
|
docs: ['recipes/18-world.md', 'api/world.md'],
|
|
424
416
|
fix: 'A world option is wrong (an anchor shape, a simulate channel that is not a time channel). Use the form in the message.' },
|
|
@@ -447,13 +439,8 @@ export const ERROR_CODES = {
|
|
|
447
439
|
fix: 'A UI part, theme or toast call is wrong (an unknown part or verb, a value of the wrong type, the engine not passed first). ' +
|
|
448
440
|
'The message lists the defined parts and the accepted forms.' },
|
|
449
441
|
'module-needs': {
|
|
450
|
-
docs: ['recipes/14-custom-module.md', 'api/engine.md'],
|
|
451
|
-
fix:
|
|
452
|
-
'rigid bodies need engine.start() first). Install the module named in the message, or call after engine:ready.' },
|
|
453
|
-
'load-failed': {
|
|
454
|
-
docs: ['api/assets.md', 'recipes/05-props-bake.md'],
|
|
455
|
-
fix: 'A file the engine loads on the side (a particle texture, a generated vegetation model, an ambience sound, a level) failed; ' +
|
|
456
|
-
'the engine fell back (round dot, no model, silence). Check the path named in the message.' },
|
|
442
|
+
docs: ['recipes/14-custom-module.md', 'recipes/18-world.md', 'api/engine.md'],
|
|
443
|
+
fix: "A call needs a module that is not installed or not ready yet (the data of NPCs, props and pickups lives in world(), pickups need interactions(), timeline say needs dialogue(), rigid bodies need engine.start() first). Install the module named in the message before the one that needs it (openWorld() already includes world()), or call after engine:ready." },
|
|
457
444
|
'tween-property': {
|
|
458
445
|
docs: ['api/timeline.md'],
|
|
459
446
|
fix: 'A tween names a property path that does not exist or is not a number / color / vector. Check the path (a.b.c) against the object.' },
|
|
@@ -471,7 +458,6 @@ export const ERROR_CODES = {
|
|
|
471
458
|
'grid-orphan': {
|
|
472
459
|
docs: ['recipes/29-grid.md', 'api/grids.md'],
|
|
473
460
|
fix: 'A placed record names an item the content no longer defines, so it has no size and takes no cells; the record is kept. Define the item again, or remove the record with grid.remove.' },
|
|
474
|
-
// ---- classes that were patterns in errorHints.js: the engine raises these messages itself, now tagged with the code ----
|
|
475
461
|
'module-requires': {
|
|
476
462
|
docs: ['recipes/14-custom-module.md', 'api/engine.md'],
|
|
477
463
|
fix: "A module requires a capability ('world', 'inventory') no installed module provides yet. Install the engine's part of that name first (engine.use(world(), mine())), or your own module with provides: ['<name>'] (a typo is suggested in the message)." },
|
|
@@ -486,10 +472,10 @@ export const ERROR_CODES = {
|
|
|
486
472
|
fix: 'before / after constraints of two or more modules point at each other. Remove one of them or give a module a different stage.' },
|
|
487
473
|
'module-type': {
|
|
488
474
|
docs: ['recipes/14-custom-module.md'],
|
|
489
|
-
fix: "
|
|
475
|
+
fix: "A module's type names what it owns: 'rules' (game logic, the default), 'world' | 'picture' | 'actor' | 'ui' | 'net' | 'tool' (core/engine/moduleTypes.js). This one is not a type: a typo?" },
|
|
490
476
|
'module-type-rule': {
|
|
491
477
|
docs: ['recipes/14-custom-module.md'],
|
|
492
|
-
fix: 'A module did something its type does not own (a picture module defining an op or writing world records, a ui module binding keys or registering a save part). Move that part into a module of the right type, or change the type, as the message says.' },
|
|
478
|
+
fix: 'A warning, the call went through: a module did something its type does not usually own (a picture module defining an op or writing world records, a ui module binding keys or registering a save part). Move that part into a module of the right type, or change the type, as the message says, or leave it if the game means it.' },
|
|
493
479
|
'module-stage': {
|
|
494
480
|
docs: ['recipes/14-custom-module.md'],
|
|
495
481
|
fix: 'Modules sort by stage (+ before / after), not by number. Use one of the listed stage names.' },
|
|
@@ -497,59 +483,36 @@ export const ERROR_CODES = {
|
|
|
497
483
|
docs: ['recipes/14-custom-module.md'],
|
|
498
484
|
fix: 'The module name becomes engine.<name>; it must not be an existing engine property or another module name.' },
|
|
499
485
|
'module-handle': {
|
|
500
|
-
docs: ['recipes/14-custom-module.md'],
|
|
501
|
-
fix:
|
|
502
|
-
'A handle tracked after its module was unloaded (an async init resuming after replaces / unload) is removed at once: check what the init does after its await.' },
|
|
486
|
+
docs: ['recipes/14-custom-module.md', 'api/engine.md'],
|
|
487
|
+
fix: "ctx.track(handle) (the ctx install / init receive) and engine.session.track(handle) take something with remove(), such as the result of events.on / onFixed / clock.after. A handle tracked after its module was unloaded (an async init resuming after replaces / unload) is removed at once: check what the init does after its await." },
|
|
503
488
|
'module-called': {
|
|
504
489
|
docs: ['recipes/01-new-game.md', 'api/engine.md'],
|
|
505
490
|
fix: 'engine.use() takes the module object: write engine.use(sky()), not engine.use(sky).' },
|
|
506
491
|
'describe-name': {
|
|
507
492
|
docs: ['recipes/16-dev-bridge.md', 'api/engine.md'],
|
|
508
493
|
fix: 'describe.add names share one namespace with the standard fields and module names. Pick a unique name.' },
|
|
509
|
-
// (registered after the fact: these were raised before they had an entry, so err.fix was null; tests/errorCodeScan.mjs now fails on that)
|
|
510
|
-
'options-object': {
|
|
511
|
-
docs: ['CONVENTIONS.md', 'api/engine.md'],
|
|
512
|
-
fix: 'A position is one argument: a Vector3, [x, y, z] or { x, z } (a horizontal position needs finite x and z). The old (x, z) ' +
|
|
513
|
-
'number form and a 2-element [x, z] array do not work; pass { x, z }.' },
|
|
514
494
|
'input-keys': {
|
|
515
495
|
docs: ['recipes/01-new-game.md', 'api/input.md'],
|
|
516
|
-
fix: 'The engine binds no gameplay key on its own and modules take no keys option: bind the action the module declares, '
|
|
517
|
-
"createEngine({ bindings: { ...presets.bindings.<name> } }) or engine.input.bind('<action>', ['KeyX']); [] = deliberately no key." },
|
|
518
|
-
'bad-arg': {
|
|
519
|
-
docs: ['api/characters.md', 'recipes/32-action-game.md'],
|
|
520
|
-
fix: 'characters.support(object, opts): object is a three.js Object3D with meshes to stand on, carry is one of the listed modes and ' +
|
|
521
|
-
'each support id is unique. Fix the argument the message names.' },
|
|
522
|
-
'npc-option': {
|
|
523
|
-
docs: ['recipes/02-npc.md', 'api/characters.md'],
|
|
524
|
-
fix: "An NPC's interact option is { op: 'name', args?, ... } (an op the player runs on it) or null for none. Fix the value the " +
|
|
525
|
-
'message shows.' },
|
|
496
|
+
fix: "Keys are names like 'KeyE', 'Space', 'PadA', 'Mouse0'. The engine binds no gameplay key on its own and modules take no keys option: bind the action the module declares, createEngine({ bindings: { ...presets.bindings.<name> } }) or engine.input.bind('<action>', ['KeyX']); [] = deliberately no key." },
|
|
526
497
|
'interaction-option': {
|
|
527
498
|
docs: ['api/interactions.md', 'recipes/03-items-pickups.md'],
|
|
528
|
-
fix:
|
|
529
|
-
'anywhere), and a once item needs its own stable id or mesh.name. Fix the option the message names.' },
|
|
499
|
+
fix: "interactions.add(): hold is seconds the key stays down (a number >= 0), radius is meters > 0 (Infinity = from anywhere), counter is a HUD counter name, and a once item needs its own stable id or mesh.name. Fix the option the message names." },
|
|
530
500
|
'hud-option': {
|
|
531
501
|
docs: ['api/hud.md', 'recipes/26-ui-parts.md'],
|
|
532
|
-
fix:
|
|
533
|
-
'the option the message names.' },
|
|
502
|
+
fix: "A hud element option is wrong: anchor is one of the listed corners / edges, a counter value is a number or text, and hud.bump needs a counter that shows a number. Fix the option the message names." },
|
|
534
503
|
'describe-threw': {
|
|
535
504
|
docs: ['recipes/14-custom-module.md', 'api/engine.md'],
|
|
536
505
|
fix: "A module's describe(e, ctx) hook threw; describe() put { error, code } under that module's name and kept the rest. Fix the " +
|
|
537
506
|
'hook named in the message (it must return plain data or nothing).' },
|
|
538
|
-
'world-missing': {
|
|
539
|
-
docs: ['recipes/18-world.md', 'api/world.md'],
|
|
540
|
-
fix: 'The feature stores its data in engine.world, but the world() module is not installed or comes after it. engine.use(world(), ...) first; the openWorld() preset already includes it.' },
|
|
541
507
|
'world-plain': {
|
|
542
508
|
docs: ['recipes/18-world.md', 'api/world.md'],
|
|
543
|
-
fix:
|
|
544
|
-
'pickup-prop-id': {
|
|
545
|
-
docs: ['recipes/03-items-pickups.md', 'api/inventory.md'],
|
|
546
|
-
fix: 'A pickup / prop id collides with other data. Use distinct ids; stable ids are what saves match on.' },
|
|
509
|
+
fix: "A saved record holds a three.js object, function or class instance. World data must be JSON-like (it is saved and may go to a worker): write { x, y, z } for a vector. A model: world.present('crate', { build: rec => mesh }), then world.view(id) gets it. Nothing to save: world.add(rec, { save: false }) may hold anything." },
|
|
547
510
|
'pickup-misuse': {
|
|
548
511
|
docs: ['recipes/03-items-pickups.md', 'api/inventory.md'],
|
|
549
|
-
fix:
|
|
512
|
+
fix: "pickups.spawn() got a wrong value (give is an item id, which needs inventory(), or a function (e, { actor }) => result; radius is a positive number), or engine.pickups.material got something that is not a three.js material." },
|
|
550
513
|
'world-id': {
|
|
551
|
-
docs: ['recipes/18-world.md', 'api/world.md'],
|
|
552
|
-
fix:
|
|
514
|
+
docs: ['recipes/18-world.md', 'api/world.md', 'recipes/03-items-pickups.md'],
|
|
515
|
+
fix: "Two things claim one id: every world record (props, pickups, NPCs, template instances) shares one id space. Omit id to auto-number, give each its own id, or use world.set(id, patch) to update the existing record." },
|
|
553
516
|
'world-record': {
|
|
554
517
|
docs: ['recipes/18-world.md', 'api/world.md'],
|
|
555
518
|
fix: 'The id was never added, was removed, or is misspelled. world.query({ kind }) lists what exists.' },
|
|
@@ -561,10 +524,10 @@ export const ERROR_CODES = {
|
|
|
561
524
|
fix: 'present(kind, { build }) must return a three.js object (or use show: rec => false to hide). Errors inside build also land here.' },
|
|
562
525
|
'bad-position': {
|
|
563
526
|
docs: ['CONVENTIONS.md', 'api/world.md'],
|
|
564
|
-
fix:
|
|
565
|
-
'state-
|
|
566
|
-
docs: ['recipes/
|
|
567
|
-
fix: '
|
|
527
|
+
fix: "A position was NaN, out of range or the wrong shape: a Vector3 used like an array (v[0]), a missing field, a division by zero upstream, or the old (x, z) number form. A position is one argument: a Vector3, [x, y, z] or { x, z }; a 2-element [x, z] array does not work." },
|
|
528
|
+
'state-value': {
|
|
529
|
+
docs: ['recipes/16-dev-bridge.md'],
|
|
530
|
+
fix: 'applyState got a value it cannot use: the message names the key and the accepted forms. Nothing was applied.' },
|
|
568
531
|
'content-place': {
|
|
569
532
|
docs: ['recipes/20-content-actions-save.md', 'api/content.md'],
|
|
570
533
|
fix: 'content.load references a place that has no coordinates, or needs world() for props / pickups. Give the place in content.load({ places }) or add the marker to the level.' },
|
|
@@ -582,9 +545,9 @@ export const ERROR_CODES = {
|
|
|
582
545
|
fix: 'A name (action, item, asset, weather, text key, ...) was never registered or has a typo. The message lists the registered names.' },
|
|
583
546
|
'event-typo': {
|
|
584
547
|
docs: ['api/events.md'],
|
|
585
|
-
fix:
|
|
548
|
+
fix: "This event name is one letter or so from an engine event, and nothing emits it. Use the suggested name; if this really is a new event of your own, ignore the warning." },
|
|
586
549
|
'owned-prop': {
|
|
587
|
-
docs: ['recipes/52-around-the-picture.md', '
|
|
550
|
+
docs: ['recipes/52-around-the-picture.md', 'THREE.md'],
|
|
588
551
|
fix: 'The engine wrote this value on its own (sky, camera, fog distance ...); your direct write took it over, so the engine no longer changes it. Intended: say so with the manual() call in the message. Not intended: give it back with manual(key, false) and adjust it with set(...).' },
|
|
589
552
|
'picture-held': {
|
|
590
553
|
docs: ['recipes/62-picture-code.md'],
|
|
@@ -603,13 +566,13 @@ export const ERROR_CODES = {
|
|
|
603
566
|
fix: 'setCamera() got an unknown camera kind. Use one of the listed kinds; for a camera of your own, take it with engine.takeCamera(owner) and place engine.camera yourself (recipes/21-camera.md).' },
|
|
604
567
|
'camera-none': {
|
|
605
568
|
docs: ['recipes/21-camera.md', 'api/cameraRig.md'],
|
|
606
|
-
fix: 'setCamera() switches between camera kinds once a camera module is installed. Install one first: engine.use(fixedCamera({ position, lookAt })) (or followCamera / firstPersonCamera / rtsCamera)
|
|
569
|
+
fix: 'setCamera() switches between camera kinds once a camera module is installed. Install one first: engine.use(fixedCamera({ position, lookAt })) (or followCamera / firstPersonCamera / rtsCamera), or name one: openWorld({ camera: \'follow\' }).' },
|
|
607
570
|
'movement': {
|
|
608
571
|
docs: ['api/characters.md', 'api/engine.md'],
|
|
609
|
-
fix:
|
|
572
|
+
fix: "createEngine({ movement }): every movement value is a number > 0. A typo in a name gives undefined; the message names the key." },
|
|
610
573
|
'commit-fallback': {
|
|
611
574
|
docs: ['api/jobs.md'],
|
|
612
|
-
fix:
|
|
575
|
+
fix: "commits.request() needs fallback: () => result. Async results apply at fixed steps; when a result is late, the fallback computes it on the main thread, so the outcome never depends on machine speed." },
|
|
613
576
|
'asset-critical': {
|
|
614
577
|
docs: ['recipes/05-props-bake.md', 'api/assets.md'],
|
|
615
578
|
fix: 'An asset marked critical: true in the manifest (or an engine.loading.track step) failed, so start() stopped instead of starting a broken game. The line names the file, HTTP status and manifest. Fix the path or the file; if the game can run without it, drop critical so it falls back. engine.loading.list({ phase: "failed" }) or threedog loading shows every failure.' },
|
|
@@ -619,9 +582,16 @@ export const ERROR_CODES = {
|
|
|
619
582
|
'asset-not-loaded': {
|
|
620
583
|
docs: ['api/assets.md', 'recipes/05-props-bake.md'],
|
|
621
584
|
fix: 'assets.modelNow only hands out a model something already loaded; it never starts a load. A code-built model loads too (built, or read from the bake cache). Write `modelNow(name) ?? await model(name)`, or mark it preload: true and await assets.preload() before the code that must not wait.' },
|
|
585
|
+
'asset-lod': {
|
|
586
|
+
docs: ['recipes/15-perf.md', 'api/assets.md'],
|
|
587
|
+
fix: 'assets.lod and a prop\'s lod need level files from `threedog assets optimize --lod` (skipped models say why in its report), distances as rising meters, and levels made from the same version of the model. A LOD object is never batched, so for many copies of a light model drop lod and let engine.batching draw them.',
|
|
588
|
+
},
|
|
589
|
+
'asset-fallback-cycle': {
|
|
590
|
+
docs: ['api/assets.md'],
|
|
591
|
+
fix: 'Entries name each other as fallback (A falls back to B, B back to A), so a failed load would wait on itself forever. The line lists the chain. Give one of them no fallback, or point it at a file that loads.' },
|
|
622
592
|
'asset-load': {
|
|
623
593
|
docs: ['api/assets.md', 'recipes/05-props-bake.md'],
|
|
624
|
-
fix:
|
|
594
|
+
fix: "Read the reason in the message first. \"called before the backend is initialized\" means the load ran before engine.start() finished: await engine.start() first, or register the file in a manifest. Otherwise the file was not found (404) or is not valid. Check the path (files under public/ are served from /), the extension, and the case of the name. A file that is not critical falls back (a registered fallback, a stand-in texture, silence) and the game runs on; engine.loading.get(name) has the details." },
|
|
625
595
|
'audio-unsupported': {
|
|
626
596
|
docs: ['api/audio.md'],
|
|
627
597
|
fix: 'No AudioContext in this browser / test environment. Guard calls with typeof AudioContext, or skip audio in headless tests.' },
|
|
@@ -639,12 +609,30 @@ export const ERROR_CODES = {
|
|
|
639
609
|
fix: 'engine.dispose() takes nothing or { keepContext: true }.' },
|
|
640
610
|
'tsl-misuse': {
|
|
641
611
|
docs: ['recipes/43-shader-patches-surfaces.md'],
|
|
642
|
-
fix:
|
|
612
|
+
fix: "A threedog/tsl function cannot work here; the message says why. Usually: pass the engine, draw with the engine renderer, on a Mesh or InstancedMesh." },
|
|
643
613
|
'webgpu-needs-tsl': {
|
|
644
614
|
docs: ['recipes/56-webgpu-tsl.md'],
|
|
645
615
|
fix: "On WebGPURenderer the engine draws with node materials. Either threedog/tsl is not loaded (add import 'threedog/tsl' at the top of the entry), " +
|
|
646
616
|
'or a part is written only as GLSL text: give it a tsl form too (a patch: tsl next to glsl; sky / fog hooks: { glsl, tsl }; a weather glsl spec: ' +
|
|
647
617
|
'create(engine) returning your own node-material object). The message names the part.' },
|
|
618
|
+
'swarm-full': {
|
|
619
|
+
docs: ['recipes/65-swarm.md'],
|
|
620
|
+
fix: 'The swarm holds capacity objects and spawn returned -1, so that object does not exist. Raise capacity in engine.swarm({ capacity }), or remove objects sooner; describe().swarm.<name>.dropped counts the refused spawns.' },
|
|
621
|
+
'swarm-handle': {
|
|
622
|
+
docs: ['recipes/65-swarm.md'],
|
|
623
|
+
fix: 'free takes a handle, not a row: rows move when objects are removed. Inside onStep or near pass d.id[i]; to remove the object onStep is on, return false.' },
|
|
624
|
+
'swarm-step': {
|
|
625
|
+
docs: ['recipes/65-swarm.md'],
|
|
626
|
+
fix: "swarm.onStep(fn) sets the one function that runs every fixed step: pass a function, once at setup, not from onFixed. Do several jobs in one function, or h.remove() the old one first." },
|
|
627
|
+
'swarm-field': {
|
|
628
|
+
docs: ['recipes/65-swarm.md'],
|
|
629
|
+
fix: 'spawn() was given a name that is no column. Columns are x, y, z, the names in engine.swarm({ fields }), and with { color: true } r, g, b and the spawn key color.' },
|
|
630
|
+
'swarm-name': {
|
|
631
|
+
docs: ['recipes/65-swarm.md'],
|
|
632
|
+
fix: 'Swarm names are unique: they are the keys in describe() and in saves. Pick another name, or dispose() the old swarm first.' },
|
|
633
|
+
'swarm-disposed': {
|
|
634
|
+
docs: ['recipes/65-swarm.md'],
|
|
635
|
+
fix: 'This swarm was disposed. Make a new one with engine.swarm(options), or keep it and call clear() to empty it.' },
|
|
648
636
|
'module-disabled': {
|
|
649
637
|
docs: ['recipes/14-custom-module.md'],
|
|
650
638
|
fix: 'A picture or ui module (particles, sky, music, a panel...) threw and was switched off; the game keeps running without it. The error printed with it is the real cause.' },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Error hints: "what to do + which doc to read" for any error, so an AI that sees one knows the next step without searching. Appended to
|
|
2
2
|
// engine.error (errors.js), warnOnce (validate.js), .threedog/errors.log (vite-error-relay) and the dev bridge `errors` command, all through
|
|
3
|
-
// hintText()
|
|
3
|
+
// hintText().
|
|
4
4
|
//
|
|
5
5
|
// throw codedError('clock-interval', 'clock.every(0): ...') // err.code, err.fix, err.docs; the message ends with [clock-interval]
|
|
6
6
|
// hintFor('... [world-plain]') // { id: 'world-plain', cause: ERROR_CODES fix, docs } (from the tag)
|
|
@@ -31,14 +31,15 @@ export const ERROR_HINTS = [
|
|
|
31
31
|
// undefined only: a module that is not installed is undefined, never null. A read on null is another cause (null-value below), and
|
|
32
32
|
// calling it "not installed" sent a reader after engine.use() when three.js mergeGeometries had returned null.
|
|
33
33
|
{ id: 'not-installed', match: /Cannot read properties of undefined \(reading '[\w$]+'\)|engine\.[\w$]+(\.[\w$]+)* is undefined/,
|
|
34
|
-
cause: '
|
|
35
|
-
'engine.start() finished
|
|
34
|
+
cause: 'A plain TypeError: something was undefined where code read a property, and the message does not say which. If the stack line reads engine.<module>, ' +
|
|
35
|
+
'that module is not installed (engine.use(...)) or the code ran before engine.start() finished; otherwise it is a missing object, array item or ' +
|
|
36
|
+
'misspelled field in the game own code. Check the stack for the line.',
|
|
36
37
|
docs: ['recipes/01-new-game.md', 'api/engine.md'] },
|
|
37
38
|
{ id: 'null-value', match: /Cannot read properties of null \(reading '[\w$]+'\)|[\w$.]+ is null/,
|
|
38
39
|
cause: 'A value was null where code read a property: a lookup or helper returned null (document.querySelector found nothing; ' +
|
|
39
40
|
'three.js BufferGeometryUtils.mergeGeometries returns null when the geometries have different attributes and logs which one in the ' +
|
|
40
41
|
'console just before). Check the stack for the line and what produced the value.',
|
|
41
|
-
docs: ['
|
|
42
|
+
docs: ['THREE.md', 'recipes/16-dev-bridge.md'] },
|
|
42
43
|
{ id: 'not-function', match: /[\w$.]+ is not a function/,
|
|
43
44
|
cause: 'The method name is wrong, or the module is not installed (the property is then undefined). Check spelling against api/<module>.md.',
|
|
44
45
|
docs: ['api/engine.md', 'CODEMAP.md'] },
|
|
@@ -100,8 +101,3 @@ export function hintText(message) {
|
|
|
100
101
|
if (!h) return '';
|
|
101
102
|
return (tagOf(String(message)) ? '' : `\n Code: ${h.id}`) + `\n Possible cause: ${h.cause}\n Read: ${h.docs.join(', ')}`;
|
|
102
103
|
}
|
|
103
|
-
|
|
104
|
-
/** message + its hint (unchanged if none matches or it already has one). @example withHint('world data must be plain values (...)') @param {string} message */
|
|
105
|
-
export function withHint(message) {
|
|
106
|
-
return /\n\s*Possible cause:/.test(message) ? message : message + hintText(message);
|
|
107
|
-
}
|