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
package/docs/MIGRATING-0.4.md
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
# Moving a game from 0.3 to 0.4
|
|
2
|
-
|
|
3
|
-
Upgrade steps for what an existing 0.3 game runs into, the most common first; [CHANGELOG.md](../CHANGELOG.md) lists every change. Each item is:
|
|
4
|
-
what you see (the error code in square brackets, or the silent symptom) → what to write instead.
|
|
5
|
-
|
|
6
|
-
## The 0.2 name traps are gone
|
|
7
|
-
|
|
8
|
-
- The dev-only errors for 0.2 names (`[renamed-field]` on `clock.timeScale`, the sky's calendar fields such as `sky.timeOfDay`, a failed
|
|
9
|
-
result's `.reason`, `runState.by`, `describe().ui.inputContexts`; dialogue `{ lock }`, `style.pickup.model`, an item's `mesh`) were removed as
|
|
10
|
-
announced. *silent*: reading one of those names now gives `undefined`; unknown option keys (`{ lock }`, `style.pickup.model`) still throw
|
|
11
|
-
`[module-params]`. A 0.2 game moves to 0.3 first with [MIGRATING-0.3.md](MIGRATING-0.3.md).
|
|
12
|
-
|
|
13
|
-
## Shadows, fog and sky values go through look
|
|
14
|
-
|
|
15
|
-
- `createEngine({ shadows, shadowType })` `[module-params]` → `engine.look.shadow.set({ enabled, type })` (works without a sky).
|
|
16
|
-
- `engine.setShadows(on)` / `engine.shadows` / `engine.shadowType` → `engine.look.shadow.set({ enabled: on })` / read `engine.look.shadow.value('enabled')`.
|
|
17
|
-
- `look.lights.set({ sun: { shadow } })` → `engine.look.shadow.set({ enabled })`.
|
|
18
|
-
- `createEngine({ fogFar })` `[module-params]` → `style.sky.fog.far` or `sky({ fog: { far } })` for the start value.
|
|
19
|
-
- `engine.setFogFar(d)` / `engine.fogFar` → `engine.look.fog.set({ far: d })` / `engine.look.fog.value('far')`.
|
|
20
|
-
- `engine.mod('sky.sunLight' | 'sky.ambient' | 'sky.fog' | 'sky.tint' | 'sky.flash' | 'sky.cover', ...)` → `engine.mod('look.lights.sun.intensity' |
|
|
21
|
-
'look.lights.hemi.intensity' | 'look.fog.far' | 'look.sky.tint' | 'look.sky.flash' | 'look.ground.cover', ...)`.
|
|
22
|
-
- `engine.sky.modifiers` → `engine.stacks.get('look.fog.far').value()` (one point by name) or `describe().shared`.
|
|
23
|
-
- *silent*: `look.lights.set({ sun: { intensity: 3 } })` now dims in rain and at sunset (effects multiply on the game's value) → for the exact
|
|
24
|
-
number, `look.lights.manual('sun')` or `{ layer: 'system' }`.
|
|
25
|
-
- Two owners `set` the same look value on one layer `[shared-conflict]` → one owner, or `mul` / `add`, or another `layer`.
|
|
26
|
-
- `engine.mod(name, { priority: 'base' | 200 })` → `{ layer: 'engine' | 'style' | 'game' | 'effect' | 'settings' | 'system' | 'debug' }` (no numbers).
|
|
27
|
-
- *silent*: a weather `far` no longer scales an explicit fog `density` (only `far`).
|
|
28
|
-
|
|
29
|
-
## Keys: modules declare actions, the game binds
|
|
30
|
-
|
|
31
|
-
- `inventory({ keys, pad })`, `quests({ keys, pad })`, `photo({ keys, pad })`, `interactions({ keys })`, `settings({ keys })`, `triggers({ keys })`,
|
|
32
|
-
`grids.preview({ rotateKeys })`, `rtsCamera({ rotateKeys })` (`rotate: false` turns it off), `characters({ brakeKeys, brakePad })`, `createPlayer({ jumpKeys, runKeys })`,
|
|
33
|
-
`timeline({ skipKeys })`, `dialogue({ choiceKeys })` `[module-params]` → bind the action in the game:
|
|
34
|
-
`createEngine({ bindings: { ...presets.bindings.walk, ...presets.bindings.interact, ...presets.bindings.inventory } })` or `engine.input.bind(map)`.
|
|
35
|
-
The maps: `presets.bindings.walk / interact / inventory / quests / photo / gridRotate / rtsRotate / brake / dialogNumbers / cutsceneSkip / debug`.
|
|
36
|
-
- `presets.keys.*` → `presets.bindings.*`; `presets.player.*` / `presets.interactions.*` carry no keys any more (spread `presets.bindings.walk` /
|
|
37
|
-
`.interact`).
|
|
38
|
-
- `createEngine({ padBindings: { jump: 'PadA' } })` → pad buttons sit in the same list: `bindings: { jump: ['Space', 'PadA'] }`.
|
|
39
|
-
- `engine.input.define(action, keys, label, { pad, context })` → `engine.input.action(action, { label, context, keys: [...keys, pad] })`
|
|
40
|
-
(a module: `ctx.input.action(name, { label, context })` with no keys; the game binds them).
|
|
41
|
-
- *silent*: F3 (debug panel), F4 (triggers view), number keys 1-9 in dialogue and the cutscene skip keys are no longer bound → spread
|
|
42
|
-
`presets.bindings.debug`, `.dialogNumbers`, `.cutsceneSkip` into `bindings`.
|
|
43
|
-
- `input.rebind(action, keys)` is a settings-layer binding: `rebind(action, null)` gives the game's keys back; `input.rebound()` is what to save.
|
|
44
|
-
- The base input context is `'walk'` (was `'gameplay'`): `input.action(name, { context: 'gameplay' })` → `context: 'walk'`; dialogue pushes `'dialog'`.
|
|
45
|
-
- Two owners binding one action `[input-bound-twice]`; one action declared in two contexts `[input-action-context]`; a needed action left unbound
|
|
46
|
-
warns `[input-unbound]` once.
|
|
47
|
-
|
|
48
|
-
## Character control has one owner
|
|
49
|
-
|
|
50
|
-
- `player.control = fn` or `createPlayer({ control: 'none' })` / `presets.player.none` → the player's `control` is given once at `createPlayer`;
|
|
51
|
-
to steer it for a while, `const h = engine.control.take(player, { owner: 'myScript', layer: 'script', step: (dt, ch) => ({ x, z }) })`,
|
|
52
|
-
`h.remove()` gives it back. Standing still: a step (or a `control` function) returning `null`.
|
|
53
|
-
- `timeline.play(steps, { lockInput })` `[module-params]` → `{ actors: [...] }` (default: the player); a cutscene holds their control on layer
|
|
54
|
-
`'cutscene'`.
|
|
55
|
-
- `character.move()` from code that does not hold the control `[control-bypass]` → take control first (in a module: `ctx.control.take(ch, { layer, step })`).
|
|
56
|
-
- Two owners on one layer `[control-conflict]`; moving a remote (net) character `[control-net]`.
|
|
57
|
-
|
|
58
|
-
## One time source
|
|
59
|
-
|
|
60
|
-
- `engine.elapsed` `[renamed-field]` → `engine.time.now('real')` (fixed seconds, stops while frozen) or `engine.time.now('ambient')` (keeps moving).
|
|
61
|
-
- `engine.time.real` → `engine.time.now('real')`; `engine.time.tick` / `engine.tick` is the one counter.
|
|
62
|
-
- `describe().elapsed` → `describe().time` (`tick`, `real`, `ambient`, `calendar`).
|
|
63
|
-
- *silent*: `engine.clock.now` is read-only (writing it throws `[engine-misuse]`) → `engine.skip({ seconds })`.
|
|
64
|
-
- *silent*: a timer removed earlier in the same step no longer fires; `skip({ to: '06:00' })` lands just past the mark.
|
|
65
|
-
- 0.3 saves load: the old `'clock'` save part is read into `'time'`.
|
|
66
|
-
- `engine.time.manual(name, fn)` is gone: it replaced the channel's speed outside the shared point, so a second call silently won →
|
|
67
|
-
`engine.mod('time.<channel>', { owner, set: speed })` (one owner each; two `set`s on one layer are `[shared-conflict]`; the handle's `remove()` gives it back).
|
|
68
|
-
|
|
69
|
-
## Handles end with remove(); timing arguments are options
|
|
70
|
-
|
|
71
|
-
- A tween promise's `cancel()`, a `dialogue.say()` promise's `stop()`, a look part's `dispose()` → `remove()`.
|
|
72
|
-
- Positional seconds throw `[module-params]` in dev → options objects:
|
|
73
|
-
`h.fade(to, s)` → `h.fade({ to, seconds: s })`; `h.stop(s)` → `h.stop({ fade: s })`; `music.stop(fade)` → `music.stop({ fade })`;
|
|
74
|
-
`timeline.tween(t, to, d, ease)` → `tween(t, to, { duration: d, ease })`; `fadeScreen(engine, to, s)` → `fadeScreen(engine, to, { seconds: s })`;
|
|
75
|
-
`anim.go(state, fade)` / `anim.action(name, fade)` → `{ fade }`; fixed camera `blend(name, s, ease)` → `blend(name, { seconds: s, ease })`.
|
|
76
|
-
|
|
77
|
-
## Engine options and three.js
|
|
78
|
-
|
|
79
|
-
- `setValidate(on)` → `createEngine({ validate: on })` (per engine, `engine.validate`).
|
|
80
|
-
- A wrong shape for a `createEngine` option (`batching: 'yes'`, `fov: 'wide'`) or an unknown `fallback` now throws `[module-params]`.
|
|
81
|
-
- *silent*: `Mesh.prototype.raycast` is three's own again; a game whose own `THREE.Raycaster` relied on the engine's BVH sets up three-mesh-bvh
|
|
82
|
-
itself (registered static meshes still have one). The two remaining class changes are listed in `describe().threePatches`.
|
|
83
|
-
- `inventory({ pauseGame })` of the wrong type is `[module-params]` (was `[inventory-misuse]`).
|
|
84
|
-
|
|
85
|
-
## Physics, nav, weather, collision
|
|
86
|
-
|
|
87
|
-
- `weather.set('rain', 20)` throws `[module-params]` in dev → `weather.set('rain', { seconds: 20 })`.
|
|
88
|
-
- *silent*: `engine.collision.boxes.length` / `.circles.length` is `undefined` (they are Sets now) → `.size`; `boxes.filter(...)` → `[...boxes].filter(...)`.
|
|
89
|
-
- *silent*: pushing to or splicing `engine.interactions.items` does nothing (it is a fresh array per read) → `interactions.add` / the handle's `remove()`.
|
|
90
|
-
- A module of yours that copied the collision statics into another world (`forEachStatic` plus a version check) can use
|
|
91
|
-
`engine.collision.mirror({ add(type, data) { return piece; }, remove(piece) {} })` and call `sync()` each step.
|
|
92
|
-
- *silent*: a game listening to `rigid:rebuilt` sees it once per `newGame()` / `load()` (it fired twice with the world module).
|
|
93
|
-
- Storm rhythm and nav capacity were constants: `weather({ lightningInterval: [2, 6] })`, `nav({ maxObstacles: 4096, maxAgents: 256, arrive: 0.3 })`.
|
|
94
|
-
|
|
95
|
-
## Plain three.js is adopted
|
|
96
|
-
|
|
97
|
-
- `engine.scene.add(obj)` now registers each root under the scene like `engine.add(obj)`: `engine.thing(obj)` works, `describe().scene.game`
|
|
98
|
-
counts it. Code that relied on scene.add staying invisible (counting things, `engine.thing` throwing) sees the object now. A module that
|
|
99
|
-
puts its own objects in the scene marks them first: `scene.add(engineOwned('mymodule', obj))` (`core/things.js`), or `engine.add(obj, { owner: 'engine:mymodule' })`.
|
|
100
|
-
- *silent*: a plain lit material of yours (`new THREE.MeshStandardMaterial(...)` and the other lit types) now darkens under the engine's
|
|
101
|
-
cloud shadow like the ground does. A material that must stay unshaded (a screen, a hologram, a UI panel in the world) sets
|
|
102
|
-
`material.userData.cloudShadow = false` before it enters the scene; `describe().owned['cloudShadow.plain']` lists what was adopted.
|
|
103
|
-
- A `look.post.add({ name, create: () => pass })` that only wraps one Pass can be `look.post.add(pass, { name })`.
|
|
104
|
-
- A game that renders the canvas itself (own `EffectComposer.render()` / `renderer.render` outside `engine.onRender`) no longer gets a second
|
|
105
|
-
engine frame drawn over it: the engine yields and warns once `[own-frame]`. Draw overlays inside `engine.onRender(fn, { when: 'after' })`.
|
|
106
|
-
|
|
107
|
-
## Module types and capabilities
|
|
108
|
-
|
|
109
|
-
- `module X has no type` `[module-type]` → add `type` to every module the game writes: `engine.use({ name: 'shop', type: 'rules', install(e) { ... } })`.
|
|
110
|
-
`'rules'` is game logic (the usual one); `'look'` only shows things, `'ui'` is panels and menus, `'world'` holds state and draws nothing
|
|
111
|
-
(recipes/14-custom-module.md has the table).
|
|
112
|
-
- `module X (type 'look') defined op ...` / `(type 'ui') bound keys ...` `[module-type-rule]` → do what the message says: move the op or the
|
|
113
|
-
save part into a `rules` module, bind keys in the game (`engine.input.bind` or `createEngine({ bindings })`), or change the module's type.
|
|
114
|
-
- `module X requires 'Y', which no installed module provides` `[module-requires]` → install the engine's `Y()` first, or a module of your own
|
|
115
|
-
with `provides: ['Y']`. `requires` names a capability; the built-in ones are named after the engine modules.
|
|
116
|
-
- *silent*: `describe().modules` is a list of `{ name, type, provides?, requires? }`; code that did `.includes('sky')` now reads
|
|
117
|
-
`.some(m => m.name === 'sky')`.
|
|
118
|
-
- `presentation: true` on a module is gone: the type decides. A `look` or `ui` module whose hook throws is switched off (`module:disabled`) and
|
|
119
|
-
the game keeps running; any other type freezes gameplay in dev. Delete the field. *silent*: a `look` / `ui` module of yours that had no
|
|
120
|
-
`presentation: true` used to freeze the game on an error; now only that module stops.
|
|
121
|
-
- `stage: 'world'` / `stage: 'presentation'` `[module-stage]` → `stage: 'ground'` / `stage: 'effects'` (same place in the order; `stage` only orders hooks).
|
|
122
|
-
|
|
123
|
-
## Weather is state + look
|
|
124
|
-
|
|
125
|
-
- `engine.weather.systems`, `.flash`, `.apply(camera)`, `.particles`, `.area` → `engine.weatherLook.*` (the look half). `engine.weather` keeps
|
|
126
|
-
the table, `current`, `name`, `set`, `setAuto`, `label`, the save and the events.
|
|
127
|
-
- `describe().weather.rainVisible / snowVisible` → `describe().weatherLook.rainVisible / snowVisible`.
|
|
128
|
-
- `weather()` returns two modules; `engine.use(weather(...))` and `openWorld()` install both as before. Code that read `weather().name` reads
|
|
129
|
-
`weather()[0].name`. To change only the look, replace that half: `engine.use(myRain(), { replaces: 'weatherLook' })` with `provides: ['weatherLook']`
|
|
130
|
-
on yours; the weather state, its save and its events stay.
|
|
131
|
-
|
|
132
|
-
- *silent*: the weather look's entries on `look.lights.*`, `look.fog.far`, `look.sky.*`, `look.ground.cover` are owned by `'weatherLook'`, not `'weather'`:
|
|
133
|
-
code that found them with `holders().find(h => h.owner === 'weather')` reads `'weatherLook'`.
|
|
134
|
-
|
|
135
|
-
## Terrain and vegetation are data + look
|
|
136
|
-
|
|
137
|
-
- `c.terrain` / `c.group` on a terrain chunk → `engine.terrainLook.meshes.get(c)` (`{ group, mesh, ... }`); the chunk keeps only data (`c.data`).
|
|
138
|
-
- `c.veg[name]` / `c.vegGroup` → `engine.vegetationLook.mesh(c, name)`; placement data is `c.plants[name]` (`n`, `m`, `c`, `ids`), felled
|
|
139
|
-
slots `c.hidden[name]`. `im.userData.hidden` / `im.userData.ids` → `c.hidden[name]` / `c.plants[name].ids`.
|
|
140
|
-
- `vegetation.define(...).geometry / .lodGeometry / .material / .fadeUniforms` → `engine.vegetationLook.kind(name)`.
|
|
141
|
-
- `terrain()` and `vegetation()` return two modules each; `engine.use(...)` and `openWorld()` install both. To draw the ground or the plants your
|
|
142
|
-
own way: `engine.use(mine, { replaces: 'terrain-look' })` with `engine.terrain.view({ add, change, remove, show })`, or
|
|
143
|
-
`{ replaces: 'vegetation-look' }` with `engine.vegetation.view({ species, change, ring, show, drop })` (recipe 28 section 6).
|
|
144
|
-
- *silent*: the ground colors (`style.terrain.colors / biomeColors / steep / variation`, the look keys of `style.terrain.config`) are read by
|
|
145
|
-
the terrain look; with `{ replaces: 'terrain-look' }` the chunks carry neutral gray vertex colors. The `terrain({ viewFog: true })` fog
|
|
146
|
-
distance is written by the look too (owner `'terrainLook'`, was `'terrain:view'`) and leaves with it: a look of your own that wants it reads
|
|
147
|
-
`engine.terrain.viewFogFar` and writes `ctx.mod('look.fog.far', { layer: 'engine', set })`.
|
|
148
|
-
- *silent*: a terrain rule that throws no longer leaves loading waiting for ever: after 3 tries the chunk stays empty and `[terrain-chunk-failed]`
|
|
149
|
-
is reported; `engine.terrain.retry()` sends it again.
|
|
150
|
-
|
|
151
|
-
## Calendar reads the time source
|
|
152
|
-
|
|
153
|
-
- `calendar.tick(dt)` is gone: the calendar's time of day and day are views of the `'calendar'` time channel. Move time with `engine.step` /
|
|
154
|
-
`engine.skip`, or set `calendar.timeOfDay` / `calendar.day` (they move the origin).
|
|
155
|
-
- *silent*: `day:start`, `season:change` and `calendar.at` timers fire right after time moves (`engine.time.onMove`), no longer inside the
|
|
156
|
-
calendar's fixed hook; a listener that read state another fixed hook writes in the same step sees that step's value.
|
|
157
|
-
|
|
158
|
-
## Module boundaries
|
|
159
|
-
|
|
160
|
-
- `describe().player.running` / `.jumping` are gone: use `describe().player.state === 'run'` (or `'jump'` / `'fall'`).
|
|
161
|
-
- Your own module's loading-screen name: register it with your text, `engine.i18n.add({ 'zh-CN': { 'module.shop': '商店' }, en: { 'module.shop': 'shop' } })` in install (the label stays the fallback).
|
|
162
|
-
- A light pool of your own: mark each pooled light `light.userData.fixedCount = true` (the light-count warning used to skip names starting `lightPool_`).
|
|
163
|
-
- A clock module of your own that should switch night glow: register `engine.audio.measure('daylight', () => value01)`.
|
|
164
|
-
- Title screen `items: ['settings']` needs the settings module installed (it adds the button with `engine.ui.titleItem`); an extra button of yours: `ctx.track(engine.ui.titleItem('credits', { label, run }))`.
|
|
165
|
-
- A game's inventory replacement (`provides: ['inventory']`) used with net(): add `contents()` and `setContents(data, { only })` (see types/gameplay.d.ts).
|
|
166
|
-
- Code that set `engine.ops._route` / `_client`: use `engine.ops.route(fn)` (returns `{ remove }`); `engine.world._s.fixed = () => {}`: use `engine.world.pauseSimulation()`.
|
|
167
|
-
|
|
168
|
-
## Saves
|
|
169
|
-
|
|
170
|
-
- *silent*: while a part's `load()` Promise is pending, no fixed step runs and every op fails with code `loading`. A part that ran an op from its
|
|
171
|
-
own async load must write its state directly instead (load already runs inside `ops.allow`).
|
|
172
|
-
- 0.3 saves load. The calendar part now also stores `at` (the channel second its time belongs to); a save without it takes the time as of the load.
|
|
173
|
-
|
|
174
|
-
## Ops and post
|
|
175
|
-
|
|
176
|
-
- `ops.list({ available: true })` returning an entry with code `badOffer` / `offersFailed` (it used to throw, and so did `describe()`): fix the
|
|
177
|
-
op's `offers` (`facts.error` says why) so each offered arg set passes its `args`.
|
|
178
|
-
- A tone-mapping curve of your own as a post stage: `engine.look.post.add({ name: 'myTone', slot: 'tone', create: ctx => pass })` (or `node` on
|
|
179
|
-
WebGPU) replaces OutputPass / renderOutput; it gets linear HDR color and must output display color. Only one effect can hold the slot.
|
|
180
|
-
|
|
181
|
-
## Material roles: one entry; style packs bundle look plugins; the lowpoly pack is gone
|
|
182
|
-
|
|
183
|
-
- `makeMaterial(role)` reads only `engine.look.materials`. The style's `materials` table is that part's style layer (specs, Material instances and
|
|
184
|
-
functions alike); writing `engine.style.materials` at run time no longer changes anything: use `engine.look.materials.set({ role: {...} })` or
|
|
185
|
-
`replace(role, material)`. `set` now also recolors a role whose style entry is a Material instance or function.
|
|
186
|
-
- A style may bring look plugins: `plugins: import.meta.glob('./plugins/*.js', { eager: true })` in the style object (the same files the game's
|
|
187
|
-
`plugins/` folder takes). They are plugged by `engine.plugins` as `<style>/<file>`, on the style layer; `engine.plugins.off('<style>')` takes them out.
|
|
188
|
-
- The world example's big `lowpoly` style is deleted. Its procedural trees, rocks, humanoid and pickup shape are the example's art in
|
|
189
|
-
`examples/world/art/` (`import { assets } from '.../examples/world/art/index.js'`); `examples/world/style/` is now a small look named `world`.
|
|
190
|
-
The humanoid no longer falls back to built-in colors: give the roles `cloth`, `skin`, `trousers`, `hair` in your style.
|
|
191
|
-
|
|
192
|
-
## One way to add a post effect (2026-11-03)
|
|
193
|
-
|
|
194
|
-
Every post effect now goes in through `engine.look.post.add(x, { name, slot, order, owner })`; game code, the plugins folder and a style's
|
|
195
|
-
plugins all call it, so each effect has a name, an owner and on / off with `look.post.set`. Plan: `docs/plans/done/2026-11-03-one-post-entry.md`.
|
|
196
|
-
|
|
197
|
-
| Before | Now |
|
|
198
|
-
|---|---|
|
|
199
|
-
| `engine.post.addPass(pass)` | `engine.look.post.add(pass)` |
|
|
200
|
-
| `engine.post.insertPass(pass, i)` | `engine.look.post.add(pass, { order })` |
|
|
201
|
-
| `engine.post.removePass(pass)` | `const h = engine.look.post.add(pass); h.remove()` (the Pass is not disposed, as before) |
|
|
202
|
-
| `look.post.patch('grain', glsl)` | `look.post.add({ name: 'grain', fuse: { glsl }, slot: 'ldr' })` |
|
|
203
|
-
| style `post: [bloom(), grain()]` | `style/plugins/10-bloom.js: export default bloom()` (one file per effect) and `plugins: import.meta.glob('./plugins/*.js', { eager: true })` in the style; *loud*: `style.post` throws `[style-value]` |
|
|
204
|
-
| `postAdd(grain())` on top of a pack | a game `plugins/20-grain.js: export default grain()`, or `look.post.add(grain())` |
|
|
205
|
-
| `postRemove('ao')` | `engine.plugins.off('<pack>/<file>')`, or `look.post.set({ ao: false })` |
|
|
206
|
-
| `createEngine({ post: { bloom: true } })` | `look.post.set({ bloom: true })` after the effect is added (*loud*: the option throws `[post-effect]` and names the call); the engine ships no effects, so "turn on bloom" is `look.post.add(bloom())` |
|
|
207
|
-
| a plugin exporting `(input, ctx) => node` | `export default { name: 'glow', node: (input, ctx) => ..., create: ctx => pass }` (*loud*: a function export is `[plugin-shape]` on both renderers) |
|
|
208
|
-
|
|
209
|
-
- *silent*: a Pass that renders `engine.scene` itself (RenderPixelatedPass, SSAARenderPass, TAARenderPass) now replaces the scene render (slot
|
|
210
|
-
`scene`) instead of running after it in `hdr`: the scene is drawn once a frame. Only one such pass at a time.
|
|
211
|
-
- *silent*: on WebGPU, removing an effect now disposes the nodes the engine built for it (bloom's targets leaked before).
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
## One small look API (2026-11-03)
|
|
215
|
-
|
|
216
|
-
Every `engine.look.<part>` has the same verbs: `set` (values), `patch(hook, code)` (swap one named hook; nothing else), `add` (one more named
|
|
217
|
-
thing: `look.post.add`, `look.materials.add`), `replace(thing)` (the one three.js thing the part draws), `manual(keys)`, and one read, `value(key)`.
|
|
218
|
-
A whole module is still `engine.use(mine(), { replaces: '<slot>' })`.
|
|
219
|
-
|
|
220
|
-
| Before | Now |
|
|
221
|
-
|---|---|
|
|
222
|
-
| `look.materials.patch(name, patch, { roles })` | `look.materials.add(name, patch, { roles })`; `patch(name, null)` to remove becomes the handle's `remove()` (*loud*: `materials.patch` throws `[look-verb]` naming `add`) |
|
|
223
|
-
| `look.fog.replace(new THREE.Fog(...))` | `engine.scene.fog = new THREE.Fog(...)` (the engine yields, describe says `three`); `look.fog.replace(null)` becomes `look.fog.manual(false)` (*loud*: `fog.replace` throws `[look-verb]` naming `scene.fog =`) |
|
|
224
|
-
| `part.write / ownerValue / extend / retract / restyle / has / resolved / values / top / point / drive / driven / feed / tick / batch / remove / signatures` on a part | the same names on `part.author` (module code only); `signatures` is also `engine.catalog('look.<part>').signatures` (*loud*: a call on the part is a TypeError) |
|
|
225
|
-
| `look.<part>.clear(owner)` (typed, never there) | drop the handle `set()` returned: `h.remove()` |
|
|
226
|
-
| writer `manual:look.fog.replace` in `describe().owned` | `three (engine yielded)` |
|
|
227
|
-
|
|
228
|
-
- *silent*: `collide: 'circle'` on a prop or template measures the model's base, not its widest extent, so trees and lamps block much less (a pine: 1.51 m -> 0.30 m). A row of such props that worked as a fence may now let the player through: write `collide: { circle: <radius> }` on it, or use `engine.collision.addSegment`.
|
|
229
|
-
- *loud*: a `collide` other than `false`, `'box'`, `'circle'` or `{ circle, occluder? }` throws at load (`collide: true` used to mean a box: write `'box'`).
|
|
230
|
-
- *silent*: `engine.catalog(...).verbs` lists a part's own named verbs too (`post`: `add`, `materials`: `add`, `glow`, `shadow`: `include`).
|
|
231
|
-
|
|
232
|
-
## Style tools become picture tools
|
|
233
|
-
|
|
234
|
-
- `threedog style check` → gone with style packs: a look is plain three.js in `look/`, and `npm run check` type-checks it.
|
|
235
|
-
- `threedog style palette | compare` → `threedog picture palette | compare`; bridge commands `style-palette`, `style-compare` → `picture-palette`, `picture-compare`; MCP tools `style_palette`, `style_compare` → `picture_palette`, `picture_compare`. Options and output are unchanged.
|
|
236
|
-
- `npm run check` no longer runs R34 (a game's `style/` folder).
|
|
237
|
-
## Module looks: options and materials
|
|
238
|
-
|
|
239
|
-
- `material spec { lighting: { rim, wrap, shadowTint } }` → a plain patch in the `lighting` slot through `applyEffects` (recipe 43); toon `ramp` → three.js `gradientMap` (recipe 09 §1).
|
|
240
|
-
- `createEngine({ style: { ui: { bg, accent, css, fonts, templates } } })` → `createEngine({ ui: { theme: { bg, accent }, css, fonts, templates } })`.
|
|
241
|
-
- *silent*: `style.ui.promptHeight` → `interactions({ promptHeight })`; `ui.theme.promptHeight` `[ui-misuse]`.
|
|
242
|
-
- `ui: { bg: '#123' }` (a color beside the part names) `[ui-misuse]` → `ui: { theme: { bg: '#123' } }`.
|
|
243
|
-
- *silent*: `style.pickup: { color, size, lift }` → `pickups({ color, size, lift })`; the `pickup` material role → `engine.pickups.material`.
|
|
244
|
-
- *silent*: `style.character.animation` → `characters({ animation })`; the capsule's `character` material role → `engine.characters.material`.
|
|
245
|
-
- *silent*: `style.triggers: { debugColor, debugOpacity }` → `triggers({ debugColor, debugOpacity })`.
|
|
246
|
-
- *silent*: `style.palette` → `engine.assets.palette` (plain object; `this.palette` in generators and the cache key read it). A baked file no longer stands in for a generator while a palette is set, unless it is `source: 'file'`.
|
|
247
|
-
- *silent*: a cached or baked model's material comes back as recorded, not rebuilt from the current material role; a toon `gradientMap` now counts as lost in the GLB (`{ build, cache: false }`). `assets.report()` `madeByStyle` → `madeByEngine`; `materialInfo` `from` is `'engine' | 'game'` and `keys` is gone.
|
|
248
|
-
- *silent*: `style.grid: { ok, bad, previewOpacity, previewHeight, tiles, tileLift }` → `grids({ ... })`, same keys; the `decal` role → `pv.material`, `layer.material`.
|
|
249
|
-
## The ground's look is plain three.js on the module
|
|
250
|
-
|
|
251
|
-
- `style.terrain.colors | biomeColors | steep | variation | detail`, the look keys of `style.terrain.config` → `terrain({ colors, biomeColors, steep, variation, detail, shading, colorResolution, normals, normalFn })`.
|
|
252
|
-
- `look.ground.set({ colors | biomeColors | steep | variation | shading | normals | detail })` → `engine.terrain.recolor({ ... })`; each value is given whole, `null` takes it out.
|
|
253
|
-
- `look.ground.replace(m)`, `style.terrain.material` → `engine.terrain.material = m`, drawn as given; `applyEffects(m, { patches: engine.terrain.patches })` keeps cloud shadow, season and detail.
|
|
254
|
-
- `look.ground.replace(m, { effects: false })` → `engine.terrain.material = m`, or `terrain({ material: m, effects: false })`.
|
|
255
|
-
- `engine.terrainLook.setMaterial(m)` → `engine.terrain.material = m`.
|
|
256
|
-
- *silent*: `style.terrain` is no longer read, and the default ground is the plain neutral material whatever `style.materials` says.
|
|
257
|
-
|
|
258
|
-
## The water's look is plain three.js on the module
|
|
259
|
-
|
|
260
|
-
- `look.water.set({ color | opacity })`, `style.water.color | opacity`, `style.materials.water` → `engine.water.material.color.set(...)`, `engine.water.material.opacity = ...`.
|
|
261
|
-
- `look.water.set({ waveHeight | waveScale | waveSpeed | fresnel })`, `style.water.*` → `engine.water.uniforms.uWave | uWaveScale | uWaveSpeed | uFresnel.value = ...`.
|
|
262
|
-
- `look.water.set({ depthColor | foam })`, `style.water.depthColor | foam`, `look.water.patch('wave' | 'surface', glsl)`, `water({ uniforms })` → `engine.water.shader({ depthColor, foam, wave, surface, uniforms })`.
|
|
263
|
-
- `look.water.set({ normalMap | normalScale | normalRepeat | normalSpeed })` → `engine.water.normalMap(name, { scale, repeat, speed })`; the texture field `engine.water.normalMap` → `engine.water.normalTexture`.
|
|
264
|
-
- `look.water.set({ shininess | specular })` → your own `MeshPhongMaterial` through `engine.water.material`.
|
|
265
|
-
- `look.water.replace((engine, { uniforms, waves, surface, normalMap }) => m)`, `style.water.material` → `engine.water.material = m`; the four are `engine.water.uniforms`, `.patches` (by `name`), `.normalTexture`.
|
|
266
|
-
- *silent*: `style.water` is no longer read, and the default water is the plain neutral Lambert whatever `style.materials` says.
|
|
267
|
-
## Plants take plain materials (2026-11-04)
|
|
268
|
-
- `look.wind.set({ frequency, amplitude })` → `engine.uniforms.uWindFreq.value`, `engine.uniforms.uWindAmp.value`.
|
|
269
|
-
- `look.wind.patch('sway', spec)` → `engine.vegetation.sway(spec)` (now reaches planted species too).
|
|
270
|
-
- `look.vegetation.patch('color', spec)` → `engine.vegetation.color(spec)`.
|
|
271
|
-
- `makeMaterial('vegetation')` default → neutral gray; `engine.vegetation.material = myMaterial` for all, `vegetation.define(name, { material })` for one.
|
|
272
|
-
|
|
273
|
-
## Weather looks are options and plain writes (2026-11-04)
|
|
274
|
-
- `style.weather.rain / snow / area / lightning / lightningBrightness / overcastColor` → the same keys on `weather({ ... })`. `style.weather.snow.cover` → `weather({ snow: { cover } })`.
|
|
275
|
-
- `style.weather.types` → removed; write the numbers in `weather({ types })`.
|
|
276
|
-
- `look.weather.replace({ field: spec })` → `engine.weather.define(field, spec)`; `null` as spec gives the field back.
|
|
277
|
-
- `look.weather.set({ 'rain.speed', 'rain.opacity', 'rain.slant' })` → `engine.weather.particles.rain.spec.speed = 30` (live, no rebuild).
|
|
278
|
-
- `look.weather.set({ 'rain.color', 'rain.length', 'snow.size', 'snow.sway' })` → `engine.weather.particles.rain.uniforms.uColor.value.set(...)`, `uLen`, `uPx`, `uSwayAmp`.
|
|
279
|
-
- `look.weather.set({ 'lightning.brightness', overcastColor })` → `engine.weather.lightningBrightness = 0.5`, `engine.weather.overcastColor.set(...)`.
|
|
280
|
-
- `style.particles.<name>`, `style.particles.default` → `particles({ effects: { name: spec }, default: spec })`; `fx.material` is get / set, `fx.uniforms` holds the `{ value }` objects.
|
|
281
|
-
- `look.weather.patch('rain.fragment', text)` → `engine.weather.define('rain', { glsl: { fragment: text } })`, or set `engine.weather.particles.rain.material`.
|
|
282
|
-
|
|
283
|
-
## The dev panel writes three.js directly (2026-11-04)
|
|
284
|
-
|
|
285
|
-
- `openPanel(engine, { overrides })` and `?ov=` → `openPanel(engine)`; "apply and rebuild" and "export overrides" are gone, values are written live and saved with "write back".
|
|
286
|
-
- `engine.styleWorkbench` → `engine.devPanel` (`{ pane, tune }`); `describe().stylePanel` → `describe().devPanel`.
|
|
287
|
-
- The panel's environment switch only turns on and off a `scene.environment` that is already there; making one is the game's call.
|
|
288
|
-
- Panel multipliers for sun, ambient and fog → each light's `intensity` and `scene.fog` near / far / density.
|
|
289
|
-
- The `threedog tune` block: `engine.look.<part>.set(...)` and `tunedStyle` → plain writes (`engine.scene.fog.far = 90;`, `engine.water.material.color.set(0x3388aa);`). A `.threedog/tune.json` saved before this: press "write back" again.
|
|
290
|
-
|
|
291
|
-
## Materials are plain three.js (2026-11-04)
|
|
292
|
-
|
|
293
|
-
- `makeMaterial('role', { color })`, `engine.makeMaterial` → `new THREE.MeshLambertMaterial({ color })` (any three.js material) in your `look/` code; `MATERIAL_PURPOSES` is gone with the roles.
|
|
294
|
-
- `look.materials.set({ role: { key } })`, `look.materials.replace(role, mat)`, `look.materials.object(role)`, `look.materials.rebuild()` → write your own material objects; a module's material is `engine.<module>.material`.
|
|
295
|
-
- `look.materials.add(name, patch, { roles })` → `applyEffects(material, { patches: [patch] })`.
|
|
296
|
-
- Spec keys `type`, `steps`, `ramp`, `soften` → `new THREE.MeshToonMaterial({ gradientMap: rampTexture(ramp, soften) })`.
|
|
297
|
-
- Spec keys `map: 'name'`, `repeat`, `wrap` → `engine.assets.useTexture(name, t => { mat.map = t; })`, then `t.repeat` and `t.wrapS`.
|
|
298
|
-
- `look.surface.set({ lighting })`, `style.lighting`, spec key `lighting`, `look.surface.patch('lighting', glsl)` → `applyEffects(mat, { lighting: { wrap, shadowTint, rim } })` or `{ lighting: { glsl } }`, per material.
|
|
299
|
-
- `look.surface.set({ detail })`, spec key `detail`, `look.surface.patch('detail', glsl)` → `applyEffects(mat, { detail })`, with `detail: { glsl }`.
|
|
300
|
-
- `look.surface.set({ ramp, soften })` → `rampTexture(ramp, soften)` on each toon material.
|
|
301
|
-
- `look.materials.glow(match, { night, day, dusk })` → `mat.emissiveIntensity` from `engine.uniforms.uNight` in your frame code (recipe 09 "Night glow").
|
|
302
|
-
- A Material or a ShaderPatch in `plugins/` → put it on its mesh or module in `look/`; `plugins.off / on` lost `{ rebuild }`, and `reach` / `rebuilt` are gone from their results and from `plugins.list()`.
|
|
303
|
-
- `userData.materialSource` is gone; `inspect.scene` says `from: engine | game`.
|
|
304
|
-
- Hint kind `material` of R40 is gone: remove it from `threedog.hints`.
|
|
305
|
-
## No style option: the look is game code (2026-11-04)
|
|
306
|
-
|
|
307
|
-
- `createEngine({ style })` → throws. Write the picture as plain three.js in the game's `look/` code; UI colors and CSS go in `createEngine({ ui })`.
|
|
308
|
-
- A style given as a list of parts (deep merge, `null` removes, `describe().look` naming the `pack`) → gone; game code composes plain values however it likes.
|
|
309
|
-
- `engine.style` → gone from the public API; read the three.js object or the module you are after.
|
|
310
|
-
- `style.background` → `engine.scene.background = new THREE.Color(0xefebe4)`.
|
|
311
|
-
- `style.antialias` → `createEngine({ antialias })`.
|
|
312
|
-
- `style.toneMapping`, `style.exposure` → `engine.renderer.toneMapping = THREE.AgXToneMapping`, `engine.renderer.toneMappingExposure = 1.2`.
|
|
313
|
-
- `style.plugins` → the game's `plugins/` folder, or `engine.plugins.add(files)`; plugin names lose the `<pack>/` prefix, `engine.plugins.off('<pack>')` and the `style` field of `engine.plugins.list()` are gone.
|
|
314
|
-
- `style.clouds.shadow / scale / speed` → `engine.uniforms.uCloudShadow.value`, `uCloudScale.value`, `uCloudSpeed.value.set(x, z)`.
|
|
315
|
-
- `style.wind.frequency` → `engine.uniforms.uWindFreq.value`.
|
|
316
|
-
- `style.seasons` → `engine.sky.seasonTints = { mode, strength, autumn: { foliage, ground } }`, plain data read every frame.
|
|
317
|
-
- `style.sky.shadow`, `style.sky.environment`, `style.sky.clouds` → `sky({ shadow, environment, clouds })`.
|
|
318
|
-
- `style.sky.fog` → `engine.scene.fog` or `look.fog.set`; `style.sky.dim` → `engine.sky.dim.tint` / `.stars`; other `style.sky.<key>` → `look.sky.set({ <key> })`.
|
|
319
|
-
- Types `Style`, `StyleInput`, `StyleWater`, `StyleTerrain`, `StyleWind` → gone. `StyleSky` → `SkyLookOptions`, `StyleShadow` → `SkyShadowOptions`, `StyleFog` → `SkyFogOptions`, `StyleEnvironment` → `SkyEnvironmentOptions`, `StyleSkyClouds` → `SkyCloudOptions`, `StyleSkyLayer` → `SkyLayerOptions`, `StyleSeasons` → `SeasonTints`.
|
|
320
|
-
- Error code `style-value` → gone.
|
package/docs/MIGRATING-0.5.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Moving a game from 0.4 to 0.5
|
|
2
|
-
|
|
3
|
-
Upgrade steps for what an existing 0.4 game runs into; [CHANGELOG.md](../CHANGELOG.md) lists every change. Each item is:
|
|
4
|
-
what you see (the error code in square brackets, or the silent symptom) → what to write instead.
|
|
5
|
-
|
|
6
|
-
## Plugins: one owner per file, material plugins rebuild what is out
|
|
7
|
-
|
|
8
|
-
- `[shared-conflict]` at start naming two plugins of one style pack (`style:ink/10-a` and `style:ink/20-b`): both write the same key (two
|
|
9
|
-
Materials for one role). Before, the pack shared one owner and the later file silently won (and switching it off dropped both). Keep one
|
|
10
|
-
file, or say which wins in it: `export const replaces = '10-a';`.
|
|
11
|
-
- *silent*: `engine.plugins.off / on` of a material or patch plugin now also changes the materials already made (they are made again and
|
|
12
|
-
swapped in place: `engine.look.materials.rebuild()`). A game that kept a reference to such a material holds the old, disposed one: read
|
|
13
|
-
the mesh's `material` (or `look.materials.object(role)`) after the switch, or pass `{ rebuild: false }`.
|
|
14
|
-
- *silent*: `plugins.off` / `on` return a result object instead of `undefined`, and two post effects with equal `order` keep their first
|
|
15
|
-
place after off / on (before, the one switched on again moved to the end of its slot).
|
|
16
|
-
|
|
17
|
-
## Shadows off no longer touches your lights
|
|
18
|
-
|
|
19
|
-
- *silent*: with shadows off (`look.shadow.set({ enabled: false })` or the settings menu) a light's `castShadow` now stays what the game set;
|
|
20
|
-
only `renderer.shadowMap.enabled` goes off (both renderers then draw and sample no shadow maps). Code that read `castShadow === false` to
|
|
21
|
-
learn whether shadows are off → read `engine.renderer.shadowMap.enabled` (or `engine.look.shadow.value('enabled')`).
|
|
22
|
-
`describe().owned['shadows.off']` is gone (nothing is held any more); budget `shadowLights` reads 0 while shadows are off.
|
|
23
|
-
|
|
24
|
-
## Save parts must return copyable data
|
|
25
|
-
|
|
26
|
-
- `[save-part-threw]` "returned data that cannot be copied" on `saves.load` / `apply` / `session.newGame`: the engine now copies every part's
|
|
27
|
-
`save()` before a load (structuredClone) so a failed load can be undone even when `save()` returns the live object. A `save()` whose result
|
|
28
|
-
holds a function, a DOM node or a three object (written to disk it lost those silently) → return plain data: `save: () => ({ hp: s.hp, items: [...s.items] })`.
|
|
29
|
-
- *silent*: a listener that throws after an `await` in an async part `load()` now fails the load (resolves false, rolled back), as one before
|
|
30
|
-
the `await` always did. A test that expected such a load to resolve true had the bug.
|
|
31
|
-
## Look values left the module options
|
|
32
|
-
|
|
33
|
-
One entry per value: a look value is a `look.*` param (style layer: the style file), and a module option is only a structural choice.
|
|
34
|
-
A removed option throws in dev at the call, naming the new one (`[water-option]`, `[sky-option]`, `[terrain-option]`):
|
|
35
|
-
|
|
36
|
-
- `water({ color | opacity | waveHeight | waveScale | waveSpeed | fresnel | depthColor | foam | normalMap | normalScale | normalRepeat |
|
|
37
|
-
normalSpeed | shininess | specular })` → the same key in `style.water`, or `engine.look.water.set({ ... })` after `engine.use(water())`.
|
|
38
|
-
`water({ material })` → `engine.look.water.replace(material)` (or `style.water.material`): the same slot, one entry. `water()` keeps
|
|
39
|
-
`sea`, `level`, `flat`, `size`, `segments`, `uniforms` (they declare the uniforms the `look.water.patch` hooks read, and your replaced
|
|
40
|
-
material gets them in its `{ uniforms }`).
|
|
41
|
-
- `sky({ keyframes | sunSize | sunGlow | sunBrightness | moonSize | moonColor | moonBrightness | starDensity | starScale | gradientCurve |
|
|
42
|
-
groundTint | orbitTilt | orbitSway | dim | clouds | backdrop })` → `style.sky.<key>`, or `engine.look.sky.set({ ... })` (`dim: { stars: false }`
|
|
43
|
-
and `clouds: { coverage }` nest as before). `sky({ skybox })` → `engine.look.sky.replace(skybox)`; `sky({ layers })` →
|
|
44
|
-
`engine.look.sky.patch('layer:<name>', layer)` per layer (or `style.sky.layers`). `sky()` keeps `time`, `fog`, `sun`, `hemisphere`, `shadow`,
|
|
45
|
-
`environment`.
|
|
46
|
-
- `terrain({ normals })` → `style.terrain.config.normals`, or `engine.look.ground.set({ normals })`.
|
|
47
|
-
- *silent*: these values used to sit on the game layer of the look (`describe().look.water.opacity.writer` was `game`); from the style they
|
|
48
|
-
read `style`, from `set` `game` (or your owner).
|
|
49
|
-
|
|
50
|
-
## Library code pulled into plugins/
|
|
51
|
-
|
|
52
|
-
- *silent*: `threedog lib pull <code entry>` now copies the entry's files into `plugins/<name>/` and writes `plugins/<name>.js`, the wiring
|
|
53
|
-
file that calls its factory (`export default makeIt();`). A game that pulled with 0.4 and hand-wrote the line keeps working; pulling again
|
|
54
|
-
lands beside it, so delete the old copy first. Set the call when adding (`threedog lib add ... --plug "makeIt({ size: 4 })"`) or when
|
|
55
|
-
pulling (`--plug`).
|
|
56
|
-
- `[plugin-shape]` messages changed: each names the file, what it exports, and the fix for that case (a factory function, a module with no
|
|
57
|
-
`type`, a module with no hook, an effect with no name). A test matching the old text ("exports a function") needs the new wording.
|
|
58
|
-
|
|
59
|
-
## Names taken out of the type declarations
|
|
60
|
-
|
|
61
|
-
These never did anything a game needed; `npm run types` now reports them. Nothing changes at runtime.
|
|
62
|
-
|
|
63
|
-
- `engine.look.clouds` (an old name; at runtime it has been `undefined` since 0.3) → `engine.look.cloudShadow`.
|
|
64
|
-
- `import type { Light } from 'threedog'` (three.js's class, leaked by the declarations; the runtime never exported it) → `import type { Light } from 'three'`.
|
|
65
|
-
- `.engine` on `engine.terrain`, a character (`engine.player`, an NPC), `engine.cameraRig`, `engine.control`, `engine.views` → use the
|
|
66
|
-
`engine` your code already holds (the factory's `install(engine)`, `createEngine`'s result).
|
|
67
|
-
- `engine.audio.info`, `engine.ambience.info`, `engine.level.buildMs`: debug readouts the engine's own tests read. They still answer at
|
|
68
|
-
runtime; a game that reads them for its own logic should keep its own state instead (the rules it set, the sounds it played).
|
package/docs/MIGRATING-0.6.md
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
# Moving a game from 0.5 to 0.6
|
|
2
|
-
|
|
3
|
-
`engine.look.*` is removed: the capabilities stay, as plain three.js or as one entry on the module that owns them. Each row is old -> new.
|
|
4
|
-
|
|
5
|
-
## Sky: `engine.look.sky` is gone
|
|
6
|
-
|
|
7
|
-
| Old | New |
|
|
8
|
-
|---|---|
|
|
9
|
-
| `engine.look.sky.replace(x)` | `engine.sky.replace(x)` (null gives the dome back) |
|
|
10
|
-
| `engine.look.sky.set({ sunSize, moonColor, starDensity, ... })` | `sky({ ... })` at install; after it `engine.uniforms.uSunSize.value` and friends (recipe 08) |
|
|
11
|
-
| `engine.look.sky.set({ clouds: { coverage, scale, speed } })` | `engine.uniforms.uCloudCover`, `uSkyCloudScale`, `uSkyCloudSpeed` |
|
|
12
|
-
| `engine.look.sky.set({ keyframes })` | `engine.sky.keyframes(rows)` |
|
|
13
|
-
| `engine.look.sky.set({ top, horizon, backdrop, orbitTilt, dim })` | plain fields `engine.sky.top`, `.horizon`, `.backdrop`, `.orbit.tilt`, `.dim`; a color function: write the field in your frame code |
|
|
14
|
-
| `engine.look.sky.patch('clouds', x)`, `patch('layer:<name>', x)` | `engine.sky.clouds(x)`, `engine.sky.layer(name, x)` |
|
|
15
|
-
| `engine.look.env.replace('sky')`, `sky({ environment })`, `style.sky.environment` | `engine.sky.environment({ into: engine.scene })` |
|
|
16
|
-
| `engine.look.env.replace(asset \| Texture \| target)`, `look.env.set({ intensity, rotation })` | `scene.environment`, `scene.environmentIntensity`, `scene.environmentRotation`, `THREE.PMREMGenerator` (recipe 34) |
|
|
17
|
-
| `engine.mod('look.sky.tint' \| 'look.sky.flash' \| 'look.ground.cover', ...)` | `engine.mod('sky.tint' \| 'sky.flash' \| 'ground.cover', ...)` |
|
|
18
|
-
| keyframe rows `[time, zenith, horizon, lightColor, lightIntensity, ambient]` | `[time, zenith, horizon, sunColor, ambient]`: the intensity column drove nothing and six columns now throw; the color is the signal `engine.uniforms.uSunColor` |
|
|
19
|
-
| `engine.sky.setShadowMapSize(n)`, `engine.sky.shadowMapSize` | `engine.shadows.mapSize(light, n)`, `light.shadow.mapSize` |
|
|
20
|
-
|
|
21
|
-
## Post effects: `engine.look.post` is gone
|
|
22
|
-
|
|
23
|
-
| 0.5 | 0.6 |
|
|
24
|
-
|---|---|
|
|
25
|
-
| `engine.look.post.add(x, { name, slot, order })` | `engine.post.add(x, { name, slot, order })`, returns `{ name, enabled, set(params), remove() }` |
|
|
26
|
-
| `look.post.set({ bloom: false })` | `engine.post.get('bloom').enabled = false` |
|
|
27
|
-
| `look.post.set({ 'bloom.strength': 0.6 })` | `engine.post.get('bloom').set({ strength: 0.6 })` |
|
|
28
|
-
| `look.post.replace([...])` | remove the handles and add the new effects |
|
|
29
|
-
| `look.post.manual('chain')` | `engine.post.own()`, back with `engine.post.own(false)` |
|
|
30
|
-
| settings `{ limits: 'look.post.<name>.enabled' }` | `{ limits: 'post.<name>.enabled' }` |
|
|
31
|
-
| a heavy effect a style brought started off on low-tier devices (`costly`) | the engine no longer decides: read `engine.tier` before adding it |
|
|
32
|
-
|
|
33
|
-
## Tone: `engine.look.tone` is gone
|
|
34
|
-
|
|
35
|
-
| 0.5 | 0.6 |
|
|
36
|
-
|---|---|
|
|
37
|
-
| `engine.look.tone.set({ exposure })` | `engine.renderer.toneMappingExposure = x` |
|
|
38
|
-
| `engine.look.tone.manual('toneMapping')` | nothing to take: `engine.renderer.toneMapping = THREE.AgXToneMapping` |
|
|
39
|
-
|
|
40
|
-
## Lights: `engine.look.lights` is gone
|
|
41
|
-
|
|
42
|
-
| 0.5 | 0.6 |
|
|
43
|
-
|---|---|
|
|
44
|
-
| `engine.look.lights.set({ sun: { intensity, color } })`, `hemi` likewise | `engine.lights.sun.intensity = x`, `engine.lights.hemi.color.set(c)`, or `createEngine({ lights: false })` and your own lights |
|
|
45
|
-
| `engine.mod('look.lights.sun.intensity', { mul })`, `settings { limits: 'look.lights.*' }` | keep your own factor in your `picture/` code and multiply when you write the light; weather's is `engine.uniforms.uWeatherLight` |
|
|
46
|
-
| `engine.look.lights.set({ env: { intensity } })` (the neutral room map) | `scene.environment = new THREE.PMREMGenerator(engine.renderer).fromScene(new RoomEnvironment()).texture`, `scene.environmentIntensity = x` (`RoomEnvironment` from `three/addons/environments/RoomEnvironment.js`) |
|
|
47
|
-
| `engine.look.lights.manual('probes')` | `probes.own()`, back with `probes.own(false)` |
|
|
48
|
-
|
|
49
|
-
## Fog: `engine.look.fog` is gone
|
|
50
|
-
|
|
51
|
-
| 0.5 | 0.6 |
|
|
52
|
-
|---|---|
|
|
53
|
-
| `engine.look.fog.set({ far, near, color })` | `engine.scene.fog = new THREE.Fog(color, near, far)`, or write `.color`, `.near`, `.far` on it; read `engine.uniforms.uViewDistance`, `uSkyHorizon`, `uWeatherFog` |
|
|
54
|
-
| `engine.look.fog.set({ kind: 'exp2', density })` | `engine.scene.fog = new THREE.FogExp2(color, density)` |
|
|
55
|
-
| `engine.look.fog.set({ enabled: false })` | `engine.scene.fog = null` |
|
|
56
|
-
| `engine.look.fog.set({ kind: 'height' })`, `look.fog.patch('fog', x)` | three.js: `onBeforeCompile` on your materials, `scene.fogNode` on `renderer: 'webgpu'` |
|
|
57
|
-
| `engine.mod('look.fog.far', { mul })` | your own factor in your `picture/` code, multiplied in when you write the fog |
|
|
58
|
-
|
|
59
|
-
## Cloud shadow: `engine.look.cloudShadow` is gone
|
|
60
|
-
|
|
61
|
-
| 0.5 | 0.6 |
|
|
62
|
-
|---|---|
|
|
63
|
-
| `look.cloudShadow.set({ shadow, scale, speed })` | `engine.uniforms.uCloudShadow.value`, `uCloudScale.value`, `uCloudSpeed.value.set(x, z)` |
|
|
64
|
-
| `look.cloudShadow.replace(spec \| false)` | `engine.terms.cloudShadow(spec \| false)`, returns `{ remove() }` |
|
|
65
|
-
| a plain lit material took the cloud shadow on its own; `userData.cloudShadow = false` kept one out | nothing is added unasked: call `applyEffects(mat)` on the materials that should darken |
|
|
66
|
-
|
|
67
|
-
## Season tint: `engine.look.season` is gone
|
|
68
|
-
|
|
69
|
-
| 0.5 | 0.6 |
|
|
70
|
-
|---|---|
|
|
71
|
-
| `look.season.replace(spec \| kind => spec \| false)` | `engine.terms.season(spec \| kind => spec \| false)`, returns `{ remove() }` |
|
|
72
|
-
|
|
73
|
-
## Wind: `engine.look.wind` is gone
|
|
74
|
-
|
|
75
|
-
| 0.5 | 0.6 |
|
|
76
|
-
|---|---|
|
|
77
|
-
| `look.wind.set({ frequency, amplitude })` | `engine.uniforms.uWindFreq.value`, `uWindAmp.value` |
|
|
78
|
-
| `look.wind.patch('sway', { glsl, tsl, uniforms })` | the species' `wind: { amplitude, glsl, tsl, uniforms }` in `vegetation.define`, or `applyEffects(mat, { wind: { ... } })` |
|
|
79
|
-
|
|
80
|
-
## Shadows: one map now follows the camera
|
|
81
|
-
|
|
82
|
-
`engine.shadows.cascades(light)` with one map (`count: 1`, or a low-tier device) used to leave your light where it was, on three's default 10 m shadow box. It now places the light like cascades do: the map follows the camera and covers `maxFar` each way, `remove()` puts everything back, and `engine.shadows.box` on that light is refused while it is on. Nothing to change unless you sized that light's shadow camera yourself for the low tier: leave it to `maxFar`, or call `engine.shadows.box(light, { ... })` instead of `cascades` there.
|
|
83
|
-
|
|
84
|
-
## The rest of the look and style layer is gone
|
|
85
|
-
|
|
86
|
-
Older parts and every `style.*` key, row by row: [MIGRATING-0.4.md](MIGRATING-0.4.md).
|
|
87
|
-
|
|
88
|
-
| 0.5 | 0.6 |
|
|
89
|
-
|---|---|
|
|
90
|
-
| `createEngine({ style })` | throws `[engine-misuse]`: the picture is plain three.js in the game's `picture/` folder, `createPicture(engine)` (recipes 62, 63); UI colors go in `createEngine({ ui })` |
|
|
91
|
-
| `engine.mod(point, { layer: 'style' })` | throws `[shared-layer]`: use the default `game` layer (recipe 55) |
|
|
92
|
-
| `look.<part>.manual(key)` | `engine.view.manual('far' \| 'fov' \| 'pixelRatio')`; the other values have the entries in the tables above |
|
|
93
|
-
| `engine.look.water` | `engine.water.material`, `.uniforms`, `.patches`, `.shader()`, `.normalMap()` (recipe 44) |
|
|
94
|
-
| `makeMaterial(role)`, `engine.makeMaterial`, `engine.look.materials` | any `new THREE.*Material` in `picture/materials.js`; a module's material is `engine.<module>.material` (recipe 09) |
|
|
95
|
-
| `engine.look.surface` | per material: `applyEffects(mat, { lighting, detail })`, `rampTexture(ramp, soften)` on a toon material (recipe 43) |
|
|
96
|
-
| `look.shadow.set({ enabled })` | `engine.shadows.enabled = false` |
|
|
97
|
-
| `look.shadow.set({ type })` | `engine.renderer.shadowMap.type` |
|
|
98
|
-
| `look.shadow.set({ cascades })`, `look.shadow.include(mat)` | `engine.shadows.cascades(light, { count })`, `engine.shadows.include(mat)` (recipe 45) |
|
|
99
|
-
| `defineLookPart(...)` in a module | module options and a plain `engine.<module>.material` |
|
|
100
|
-
| `threedog style check` | `npm run check` type-checks `picture/` |
|
|
101
|
-
| `threedog style palette \| compare` | `threedog picture palette \| compare` |
|
|
102
|
-
| `engine.styleWorkbench` | `engine.devPanel`, after `openPanel(engine)` from `@threedog/tools/panel` (recipe 35) |
|
|
103
|
-
|
|
104
|
-
## Names: "look" becomes "picture"
|
|
105
|
-
|
|
106
|
-
The look layer is gone, so the word no longer names picture things. Mouse and camera look (`input.look`, `lookAt`, `mouseLook`) keep their names. No aliases: the old names just stop existing.
|
|
107
|
-
|
|
108
|
-
| Old | New |
|
|
109
|
-
| --- | --- |
|
|
110
|
-
| game folder `look/` | `picture/` (also the `include` line of a game's `tsconfig.json`) |
|
|
111
|
-
| `createLook(engine)`, `const look = ...`, `look.lamp(id)`, `look.materials` | `createPicture(engine)`, `const picture = ...`, `picture.lamp(id)`, `picture.materials` |
|
|
112
|
-
| module type `type: 'look'` | `type: 'picture'` |
|
|
113
|
-
| `engine.terrainLook`, `engine.vegetationLook`, `engine.weatherLook` | `engine.terrainDraw`, `engine.vegetationDraw`, `engine.weatherDraw` |
|
|
114
|
-
| `replaces: 'terrainLook'`, `'vegetationLook'`, `'weatherLook'` | `replaces: 'terrainDraw'`, `'vegetationDraw'`, `'weatherDraw'` |
|
|
115
|
-
| slots `terrain-look`, `vegetation-look`, provides `weatherLook` | `terrain-draw`, `vegetation-draw`, `weatherDraw` |
|
|
116
|
-
| `SkyLookOptions` (types) | `SkyPictureOptions` |
|
|
117
|
-
| `threedog shot --no-look`, `threedog snap --no-look` | `--no-picture` |
|
|
118
|
-
| `look` and `lookMs` in `threedog shot --json`; the printed `Look:` line | `picture` and `pictureMs`; `Picture:` |
|
|
119
|
-
| DESIGN.md line `Look intent:` | `Picture intent:` |
|
|
120
|
-
| `threedog lib add --kind look` | `--kind picture` (an entry of the old kind in a library is re-added under the new one) |
|
|
121
|
-
| `@threedog/tools/look` (`lookHints`, `lookNumbers`, `probeLook`, `pageLook`, `imageLook`, `formatLook`) | `@threedog/tools/picture-check` (`pictureHints`, `pictureNumbers`, `probePicture`, `pagePicture`, `imagePicture`, `formatPicture`) |
|
|
122
|
-
| recipes 35-look-from-reference, 36-sky-ground-plant-looks, 37-terrain-look-hooks, 38-environment-look-hooks, 43-shader-patches-surface-looks, 44-water-weather-look-hooks, 52-look | 35-picture-from-reference, 36-sky-ground-plants, 37-terrain-hooks, 38-environment-hooks, 43-shader-patches-surfaces, 44-water-weather-hooks, 52-around-the-picture |
|
|
123
|
-
| recipe 41-thing-registry | merged into 40-scene (one recipe on what is in the scene and what a save keeps) |
|
|
124
|
-
| example `plain-look` | `plain-picture` |
|
|
125
|
-
| `grids.preview({ look })` | `grids.preview({ draw })` (`false`, or `(engine) => part`) |
|
|
126
|
-
| `layer(name, { tiles: { look } })` | `tiles: { color }`, the same `(data, cell) => color \| null`; an unknown `tiles` key now throws |
|