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
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
# Starting a new game
|
|
1
|
+
# Starting a new game
|
|
2
2
|
|
|
3
|
-
**In this recipe**: 0. One-command setup · 1. Creating the files by hand · 2. Verify · 3.
|
|
3
|
+
**In this recipe**: 0. One-command setup · 1. Creating the files by hand · 2. Verify · 3. Feel presets · 4. Canvas size
|
|
4
4
|
|
|
5
|
-
Goal:
|
|
6
|
-
|
|
5
|
+
Goal: a game with its own page, modules, content data and tests. The engine's own example is `examples/world/` in the package.
|
|
6
|
+
|
|
7
|
+
In a folder of your own, installed from npm: run `npx threedog init` (add `--open-world` for the second form below), then `npm install`. In the engine repository: `npm run new-game -- my-game` creates `games/my-game/`. The rest of this page uses the repository form; read `games/my-game/` as your folder and `new-game` as `init`.
|
|
7
8
|
|
|
8
9
|
## 0. One-command setup (preferred)
|
|
9
10
|
```
|
|
@@ -18,37 +19,34 @@ The name may only contain lowercase letters, digits and dashes; an existing dire
|
|
|
18
19
|
2. Creates the `node_modules/my-game` link (the path npm gives a workspace named `my-game`). It builds nothing and leaves `package-lock.json` alone; it runs `npm install` only when a dependency of the template is not installed yet, and says so.
|
|
19
20
|
3. Runs `map` (generates GAMEMAP.md) and `check`. Any failing step stops and says why. The smoke test (`threedog test -w games/my-game`) builds, so it is left to you.
|
|
20
21
|
|
|
21
|
-
The default game has no genre: `world()` + `content()`, what nearly every game needs (a start screen with Continue / Start, autosave, Esc = pause + settings menu; delete a line if the game does not want it),
|
|
22
|
-
|
|
23
|
-
(a card table, a puzzle room, a side-scroller and an open world start differently). Content files are empty arrays / objects (each
|
|
24
|
-
has one comment line saying what goes there and which recipe teaches it), and `picture/`: `index.js` (wiring), `palette.js` (colors and key values), `lights.js`, `materials.js`, plain three.js
|
|
25
|
-
that is yours to change or replace (recipe 62). `CLAUDE.md` says "This game has no gameplay yet; build what DESIGN.md describes".
|
|
22
|
+
The default game has no genre: `world()` + `content()`, what nearly every game needs (a start screen with Continue / Start, autosave, Esc = pause + settings menu; delete a line if the game does not want it), a plain `THREE.PerspectiveCamera` placed by hand and the gray starting picture. No ground, sky, player or camera rig: a card table, a puzzle room, a side-scroller and an open world start differently (a character walking around a place you built: recipe 63, about twenty lines).
|
|
23
|
+
Content files start empty, a comment in each saying what goes there, except `props.js`, whose `marker-1` shows the shape. `picture/` (`index.js` wiring, `palette.js`, `lights.js`, `materials.js`) is plain three.js, yours to change or replace (recipe 62).
|
|
26
24
|
`--open-world` swaps `main.js` for `openWorld` (generated terrain from `@threedog/terrain-noise`, vegetation, a day/night sky, weather, water, collision, a
|
|
27
25
|
follow camera) and a player at a flat spot, with `sky()` giving the signals and `picture/` writing the lights; it adds `@threedog/terrain-noise` to `package.json`. `spawn` and `places` take any `{ x, z }` (or `{ x, y, z }`); `findSpawn` is only for generated terrain.
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
The canvas is the one you gave `createEngine({ canvas })`, also `engine.renderer.domElement`; the engine keeps no canvas property of its own.
|
|
27
|
+
|
|
30
28
|
- The comments in `main.js` list further gameplay modules you can add; usage is in `../api/<module>.md`.
|
|
31
29
|
- To change the starting point of new games, edit the real files in `packages/tools/templates/game/` (`templates/openworld/` for `--open-world`).
|
|
32
|
-
- `DESIGN.md` is
|
|
33
|
-
then GAMEMAP, DESIGN) and does not copy engine rules.
|
|
30
|
+
- `DESIGN.md` is a form to fill in with the game's design, `STATUS.md` holds progress, and `CLAUDE.md` holds the working rules, a table cut from AI.md and the reading order.
|
|
34
31
|
- There is no `tests/`: when `tests/specs/` does not exist, `npm test -w games/my-game` runs a smoke test automatically.
|
|
35
32
|
|
|
36
33
|
## 1. Creating the files by hand (to learn what each file is, or when the template doesn't fit)
|
|
37
34
|
| File | Content |
|
|
38
35
|
|---|---|
|
|
39
|
-
| `games/my-game/package.json` | Copy
|
|
36
|
+
| `games/my-game/package.json` | Copy the template's and set `name` to `my-game` (the plain game name; `@threedog/` is the engine's packages). Dependencies `threedog`, `@threedog/tools`, plus `@threedog/terrain-noise` only for an open-world start and `@threedog/post-effects` only when the game imports it |
|
|
40
37
|
| `games/my-game/vite.config.js` | One line: `export default gameConfig(import.meta.dirname)` (imported from `@threedog/tools/vite`); *.html files in the directory are bundled automatically, no `input` needed. Without `@threedog/tools`, a plain vite config needs `worker: { format: 'es' }` (the engine's Workers are ES modules) or `vite build` fails; `threedog dev / build` on a folder with no vite config uses the preset |
|
|
41
|
-
| `games/my-game/index.html` | The page: one `<canvas id="view">` with a CSS size + `/main.js` (for more pages put `xxx.html` in the same directory); see §
|
|
42
|
-
| `games/my-game/main.js` | Install modules, compute places, `content.load`, game
|
|
38
|
+
| `games/my-game/index.html` | The page: one `<canvas id="view">` with a CSS size + `/main.js` (for more pages put `xxx.html` in the same directory); see §4 for embedding |
|
|
39
|
+
| `games/my-game/main.js` | Install modules, compute places, `content.load`, wire the game's systems (template `CLAUDE.md`, "Content vs code") |
|
|
43
40
|
| `games/my-game/content/index.js` | Combines the content files into one object |
|
|
44
|
-
| `games/my-game/content/*.js` | Only these names are read: items pickups containers npcs dialogues quests actions places triggers level vegetation props templates audio grids renames rules, plus the game's own kinds (rules.js) |
|
|
45
|
-
| `games/my-game/DESIGN.md` |
|
|
46
|
-
| `games/my-game/
|
|
47
|
-
| `games/my-game/
|
|
41
|
+
| `games/my-game/content/*.js` | Only these names are read: items pickups containers npcs dialogues quests actions places triggers level vegetation props templates audio views grids renames rules, plus the game's own kinds (rules.js) |
|
|
42
|
+
| `games/my-game/DESIGN.md` | The design as a form (copy the template's), copied into GAMEMAP.md |
|
|
43
|
+
| `games/my-game/STATUS.md` | Progress and what comes next (copy the template's) |
|
|
44
|
+
| `games/my-game/CLAUDE.md` | Working rules and reading order (copy the template's) |
|
|
45
|
+
| `games/my-game/public/` | This game's art assets (URL `/models/...`); keep Blender source files in `games/my-game/art/models/`, `npm run assets -- optimize -w my-game` compresses them into `public/optimized/` |
|
|
48
46
|
|
|
49
47
|
After creating them, run `npm install` once at the repository root (this links the new game into the workspaces so `threedog` can find it).
|
|
50
48
|
|
|
51
|
-
Outside the engine repository, a game installs `threedog` and `three` (plus
|
|
49
|
+
Outside the engine repository, a game installs `threedog` and `three` (plus `@threedog/post-effects` / `@threedog/terrain-noise` if it imports them,
|
|
52
50
|
and `@threedog/tools` as a dev dependency for the CLI and the vite preset). To use an engine folder on disk instead of npm, install it with
|
|
53
51
|
`npm install --install-links <folder>`: a plain link skips the engine's own dependencies (Rapier, Recast) and the build cannot resolve them.
|
|
54
52
|
|
|
@@ -58,13 +56,6 @@ In a game's own repository, `threedog check`, `types` and `map` read only the ga
|
|
|
58
56
|
The template's `tsconfig.json` checks the game files only (`checkJs`), with `lib` ESNext + DOM (dependency typings such as Rapier's use
|
|
59
57
|
`Symbol.dispose`) and `skipLibCheck: true`; without a tsconfig, `threedog types` writes the same settings to `.threedog/tsconfig.types.json`.
|
|
60
58
|
|
|
61
|
-
`games/my-game/index.html` (minimal; the template's `index.html` has the same page with loading styles):
|
|
62
|
-
```html
|
|
63
|
-
<!doctype html>
|
|
64
|
-
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
|
|
65
|
-
<title>My game</title><style>html,body{height:100%;margin:0;overflow:hidden;background:#141a17}#view{position:fixed;inset:0;width:100%;height:100%;display:block;outline:none}</style>
|
|
66
|
-
</head><body><canvas id="view" tabindex="0"></canvas><script type="module" src="/main.js"></script></body></html>
|
|
67
|
-
```
|
|
68
59
|
|
|
69
60
|
`games/my-game/main.js`: the opening lines are written out once, in [recipe 63](63-third-person-start.md) §1 (the blank template's `main.js` has the same opening with `world(), content(), settings()` and the camera placed by hand). What an open-world game with a few gameplay modules changes in it:
|
|
70
61
|
```js
|
|
@@ -85,7 +76,7 @@ engine.use(openWorld({ camera: 'follow', seed: 42, terrain: terrainPreset(), tim
|
|
|
85
76
|
// the terrain is generated: find flat ground as "home" at the start (give your own height range to avoid beach and peaks)
|
|
86
77
|
const home = engine.characters.findSpawn([0, 0, 0], { minH: 3, maxH: 14 });
|
|
87
78
|
engine.characters.createPlayer({ ...presets.player.thirdPerson, spawn: home });
|
|
88
|
-
engine.content.load(data, { places: {
|
|
79
|
+
engine.content.load(data, { places: { home } }); // on top of the names in content/places.js; content uses { place: 'home', x, z }, quests target: 'home'
|
|
89
80
|
```
|
|
90
81
|
Every `openWorld` part takes `false` (leave it out) or its module's own options object, so you never have to drop the preset for one setting:
|
|
91
82
|
`openWorld({ seed: 42, camera: 'follow', calendar: { seasons: ['wet', 'dry'], daysPerSeason: 28 }, characters: { npcs: false }, rigid: false, ambience:
|
|
@@ -102,7 +93,7 @@ engine.setGround({ height: (x, z) => 0 }); // what walking, placing and the ca
|
|
|
102
93
|
```
|
|
103
94
|
Walls and obstacles are `engine.collision.addBox(obj, { halfWidth, halfDepth })`; a Blender level brings its own ground (`level()`, next paragraph).
|
|
104
95
|
`saveKey` must differ per game, otherwise saves overwrite each other. The UI language follows the player's browser (Chinese browser -> Chinese,
|
|
105
|
-
otherwise English) unless you set `createEngine({ locale: 'zh-CN' })` (`'zh'` and `'en-US'` match too; a language with no strings warns). A game
|
|
96
|
+
otherwise English) unless you set `createEngine({ locale: 'zh-CN' })` (`'zh'` and `'en-US'` match too; a language with no strings warns). A game on a level built in code: register
|
|
106
97
|
the level generator function under `models` in `engine.assets.manifest({ name, models })`, use `level({ url: name })` and pick your own modules, then
|
|
107
98
|
create the player and install content in `level:loaded`.
|
|
108
99
|
|
|
@@ -112,7 +103,7 @@ import items, { startItems } from './items.js';
|
|
|
112
103
|
import places from './places.js';
|
|
113
104
|
export default { items, startItems, places };
|
|
114
105
|
```
|
|
115
|
-
`content/places.js`: `export default { home: 'flat ground found at the start
|
|
106
|
+
`content/places.js`: `export default { farm: { x: 12, z: -4 }, home: 'flat ground found at the start' };`. `content.load` reads a place written with coordinates from the data; a text entry only declares the name for `threedog check` and waits for `content.load(data, { places })`.
|
|
116
107
|
|
|
117
108
|
## 2. Verify
|
|
118
109
|
1. `npm run map` -> generates `games/my-game/GAMEMAP.md`; check the "engine modules" and "page /" sections.
|
|
@@ -123,12 +114,8 @@ export default { items, startItems, places };
|
|
|
123
114
|
5. To see the picture: `npm run shot -- -w my-game /` (one image in `games/my-game/.threedog/shots/`); while developing run `npm run dev -w games/my-game` (or
|
|
124
115
|
`npm run dev -- my-game`) and open the printed address; read errors in `games/my-game/.threedog/errors.log`.
|
|
125
116
|
|
|
126
|
-
## 3. Preset parts
|
|
127
|
-
Every `openWorld()` part takes `false` or its module's options object, for example
|
|
128
|
-
`openWorld({ camera: 'follow', calendar: { seasons: ['wet', 'dry'], daysPerSeason: 28 }, debug: false })`. Gameplay modules (interactions, dialogue,
|
|
129
|
-
inventory, quests) are not in the preset: add them with `engine.use`. The debug panel is dev-only by default.
|
|
130
117
|
|
|
131
|
-
##
|
|
118
|
+
## 3. Feel presets (opt-in)
|
|
132
119
|
The engine applies no gameplay feel by itself: `weather()` alone has only a calm `clear`, `sky()` has no seasons, and the calls that need a feel
|
|
133
120
|
refuse to guess: `createPlayer()` throws `[player-control]` without `control`, `interactions()` throws `[interaction-setup]` without `pick` and keys,
|
|
134
121
|
`openWorld()` throws `[open-world-camera]` without `camera`. The core key table holds only movement and menu confirm / cancel; run, jump and interact
|
|
@@ -140,11 +127,9 @@ engine.use(calendar(presets.calendar.fourSeasons), sky(), weather({ ...presets.w
|
|
|
140
127
|
engine.use(interactions({ ...presets.interactions.facing })); // nearest / facing / aim, each with E
|
|
141
128
|
const player = engine.characters.createPlayer({ ...presets.player.lockOn, faceTarget: boss }); // none / thirdPerson / lockOn / aim / sideScroller
|
|
142
129
|
```
|
|
143
|
-
`presets.
|
|
144
|
-
`presets.bindings.walk` (`{ run: ['ShiftLeft', 'ShiftRight', 'PadLB'], jump: ['Space', 'PadA'] }`). No module or preset takes keys: every key
|
|
145
|
-
comes from `createEngine({ bindings })` or `engine.input.bind(...)`.
|
|
130
|
+
The run / jump keys are `presets.bindings.walk`. No module or preset takes keys: every key comes from `createEngine({ bindings })` or `engine.input.bind(...)`.
|
|
146
131
|
|
|
147
|
-
##
|
|
132
|
+
## 4. Canvas size: full window, a page section, a split layout or an editor panel
|
|
148
133
|
The engine follows the canvas's own CSS box (a `ResizeObserver` on the canvas), not the window: renderer size, camera aspect, `input.pointer` (`x / y`
|
|
149
134
|
pixels and `ndcX / ndcY` relative to the canvas), `engine.pick`, `screenToGround`, `worldToScreen` and the HUD all use that box, and the engine's UI
|
|
150
135
|
root is laid exactly over it. So the layout decides:
|
package/docs/recipes/02-npc.md
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# Adding an NPC (schedule + dialogue)
|
|
2
2
|
|
|
3
|
+
**In this recipe**: 1. Write data · 2. Add in code · NPC data and model · Custom behavior · Avoidance · A guard you build yourself · Dialogue choices · 3. Verify · Bubbles
|
|
4
|
+
|
|
3
5
|
Modules needed: `characters()` (NPCs on by default), `interactions({ ...presets.interactions.nearest })`, `dialogue()`; clock-time schedules need
|
|
4
|
-
`
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
dialogue(), content())`.
|
|
6
|
+
`calendar()` with a day cycle (`dayLength`, e.g. `presets.calendar.cycle`: without one the clock never moves and the NPC keeps to one stop). `openWorld()`
|
|
7
|
+
installs `characters()` and the calendar but not the other two: `engine.use(openWorld({ camera: 'follow', calendar: presets.calendar.cycle, ...}),
|
|
8
|
+
interactions({ ...presets.interactions.nearest }), dialogue(), content())`.
|
|
8
9
|
|
|
9
10
|
## 1. Write data (recommended)
|
|
10
11
|
`games/<game>/content/npcs.js`:
|
|
@@ -12,7 +13,7 @@ dialogue(), content())`.
|
|
|
12
13
|
export default {
|
|
13
14
|
guard: {
|
|
14
15
|
name: 'Gate guard',
|
|
15
|
-
colors: { body: 0xc89a5a, legs: 0x5b4a3a, hair: 0x3a2a1a }, // omit to use the
|
|
16
|
+
colors: { body: 0xc89a5a, legs: 0x5b4a3a, hair: 0x3a2a1a }, // omit to use the default colors
|
|
16
17
|
start: { place: 'home', x: 6, z: -3 }, // starting position; omitted = the first stop of the schedule
|
|
17
18
|
schedule: [ // at is a clock time 'HH:MM'; at that time the NPC walks there (pathfinding is automatic)
|
|
18
19
|
{ at: '07:00', place: 'home', x: 6, z: -3 },
|
|
@@ -52,10 +53,10 @@ export default {
|
|
|
52
53
|
},
|
|
53
54
|
};
|
|
54
55
|
```
|
|
55
|
-
The words usable in conditions / effects are in the
|
|
56
|
+
The words usable in conditions / effects are in the last section of `../api/content.md` (flag notFlag has lacks counter can / setFlag
|
|
56
57
|
give take bump startQuest toast particles marker clearMarker op). A game's own action is an op, always written as a pair `[name, args]` (a bare
|
|
57
58
|
name string is rejected): `do: { op: ['delivery.done', { parcel: 'p1' }] }` (`23-ops.md`).
|
|
58
|
-
The items used (coin, pass) must be defined in `items.js`, otherwise validation fails. A `place` name comes from `content.load(data, { places })` or
|
|
59
|
+
The items used (coin, pass) must be defined in `items.js`, otherwise validation fails. A `place` name comes from `content/places.js`, `content.load(data, { places })` or
|
|
59
60
|
from a level marker (such as `npc_guard`). Add a new content file to `content/index.js`.
|
|
60
61
|
|
|
61
62
|
## 2. Add in code (temporary NPCs, dynamic schedules)
|
|
@@ -119,26 +120,24 @@ engine.npcs.behavior('chase', {
|
|
|
119
120
|
npc.setBehavior('chase');
|
|
120
121
|
```
|
|
121
122
|
To path around obstacles, use `engine.characters.findPath(from, to)` to get waypoints and walk them one by one (the schedule behavior does exactly
|
|
122
|
-
this
|
|
123
|
+
this).
|
|
123
124
|
|
|
124
125
|
## Avoidance (NPCs don't clump or pass through each other)
|
|
125
126
|
NPCs with models nearby avoid each other by default: when closer than the sum of two radii (`engine.movement.radius` x 2, about 0.8 meters) they push
|
|
126
127
|
each other apart, harder the more they overlap, at most 3 meters per second; the player counts as an obstacle that only NPCs yield to, and the
|
|
127
128
|
player's position is never pushed. After pushing, `engine.collision` (if installed) constrains them back to walkable ground, so they are not pushed
|
|
128
129
|
into walls. The built-in `schedule` and `wander` both avoid.
|
|
129
|
-
- Deterministic
|
|
130
|
-
|
|
131
|
-
clump only a few ms).
|
|
130
|
+
- Deterministic: done only in the fixed step, no random numbers, neighbors computed from the positions at the start of the step, so a load or a different
|
|
131
|
+
`frameEvery` gives identical positions.
|
|
132
132
|
- Tune or turn off:
|
|
133
133
|
```js
|
|
134
134
|
engine.npcs.avoid.set({ radius: 0.6, strength: 2 }); // stand sparser (radius in meters), push slower (strength in meters/second)
|
|
135
135
|
engine.npcs.avoid.set(false); // turn off (ghosts, crowds passing through); set(true) turns it on again
|
|
136
136
|
```
|
|
137
137
|
- Far away (no model) NPCs are simulated from data without per-NPC avoidance; a few steps after a model is built on approach they get pushed apart.
|
|
138
|
-
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
crowds going around big obstacles use crowd.
|
|
138
|
+
- `nav({ crowd: true })` replaces this push with Recast crowd agents: they route around obstacles along the navmesh but do not guarantee identical
|
|
139
|
+
results after a load. The push routes around nothing and only keeps NPCs from overlapping. For replays and saves use the push; for crowds going
|
|
140
|
+
around big obstacles use crowd.
|
|
142
141
|
- Behaviors you write are not avoided automatically: after your own `character.move`, call `engine.npcs.avoid.push(rec, npc.character, dt)` once
|
|
143
142
|
(inside `near`, before writing back to the data).
|
|
144
143
|
|
|
@@ -146,7 +145,7 @@ engine.npcs.avoid.set(false); // turn off (ghosts, cro
|
|
|
146
145
|
## A guard you build yourself (`Character` + `walkTo`)
|
|
147
146
|
|
|
148
147
|
For a one-off (guard, pet, follower) that `schedule` / `wander` do not cover: `new Character(engine, { rig })` takes a ready body
|
|
149
|
-
(`{ root, body?, head?, limbs?, joints? }`), or `{ model: '
|
|
148
|
+
(`{ root, body?, head?, limbs?, joints? }`), or `{ model: 'villager' }` / `{ model: ['villager', 0xcc8844] }` names a body your own asset pack registers (none ships with the engine; `humanoid` in other pages is such a name) like any character ([13-animation](13-animation.md)); call `character.animate(dt)` each frame.
|
|
150
149
|
`character.walkTo(target, { speed, arrive, turnRate, run })` follows `characters.findPath` on fixed steps (turns at `turnRate` rad/s, skips passed
|
|
151
150
|
points, re-plans when it makes no progress for `stuckSeconds`, up to `maxRepaths`). It returns a promise of `{ status }`: `'arrived'` | `'noPath'` |
|
|
152
151
|
`'stuck'` | `'cancelled'` (never rejects), with `remove()` to cancel.
|
|
@@ -155,7 +154,8 @@ walk, and an escort quest that wants the same NPC takes control itself (`engine.
|
|
|
155
154
|
editing its record.
|
|
156
155
|
|
|
157
156
|
```js
|
|
158
|
-
const guard = new Character(engine, { rig: { root: myGuardMesh } })
|
|
157
|
+
const guard = new Character(engine, { rig: { root: myGuardMesh } });
|
|
158
|
+
engine.add(guard.root);
|
|
159
159
|
guard.placeAt(post);
|
|
160
160
|
const walk = guard.walkTo(player.position, { arrive: 1.5 });
|
|
161
161
|
if ((await walk).status === 'noPath') guard.face(player); // walk.remove() cancels
|
|
@@ -172,12 +172,11 @@ The dialogue's keys go through two ops, so code, tests and the dev bridge drive
|
|
|
172
172
|
`npm run map` it shows up in the NPC table and dialogue graph of GAMEMAP.md.
|
|
173
173
|
- State: `npm run shot -- / --time 13:10 --wait 20 --describe-only`; the "nearby" list has an entry for `Gate guard` tagged as an NPC with its distance in
|
|
174
174
|
meters (only listed within 30 meters; add `--pos x,z` to stand by the tower).
|
|
175
|
-
- Console / tests: `engine.npcs.get('guard').position`, `.currentStop()`; during a dialogue `engine.describe().ui.dialogue` = `{ speaker, text, typing, choices: [labels],
|
|
175
|
+
- Console / tests: `engine.npcs.get('guard').position`, `.currentStop()`; during a dialogue `engine.describe().ui.dialogue` = `{ speaker, text, typing, choices: [labels], selected, advance }`. `describe` shows no node or NPC id: to inspect the node, listen to `engine.events.on("dialogue:line", ({ script, node, speaker, text }) => ...)` (also `dialogue:start` / `dialogue:end`).
|
|
176
|
+
- E opens a conversation; only confirm (Space / Enter) advances it, unless `dialogue({ advanceActions })` adds a key. `describe().ui.dialogue.advance` names the keys. While it is open game input is locked, so E on anything else does nothing: the press is logged as a refused `interaction.use` (`inputLocked`) in `engine.ops.recent()` and `threedog test` prints it under a failed spec.
|
|
176
177
|
- Advancing a dialogue in a headless test (typing and "keys ignored right after opening" both run on game time): press E when near -> `engine.step(1)`
|
|
177
178
|
to finish typing -> press a number key or run `engine.ops.run('dialogue.choose', { index: i })` (while typing it completes the sentence first) ->
|
|
178
179
|
`engine.step(0.3)`. No real-time waiting.
|
|
179
|
-
- Related tests: `npm test -- 小城` (the shopkeeper's schedule and dialogue), `npm test -- "S1 NPC"` (far-away simulation, changing level, saving,
|
|
180
|
-
identical results after loading).
|
|
181
180
|
|
|
182
181
|
## Talking in a bubble instead of a conversation
|
|
183
182
|
`interact: { op: 'npc.talk', args: { channel: 'bubble' } }` (code or content) makes the interact key play the NPC's script as bubble lines over its head while the player keeps
|
|
@@ -9,9 +9,9 @@ Shells on a beach, four kinds of flowers, letters to collect: things the player
|
|
|
9
9
|
engine.hud.counter('shells', { label: 'Shells', value: 0, max: 4 }); // at setup, not on session:start
|
|
10
10
|
shells.forEach((shell, i) => engine.interactions.add(shell, { id: `shell-${i}`, label: 'Pick up', once: true, counter: 'shells', onUse: () => engine.audio.sfx('pick') }));
|
|
11
11
|
```
|
|
12
|
-
`once` hides the mesh after a use (`onUse` returning `{ ok: false }` leaves it); `counter` adds 1 through `engine.hud.
|
|
12
|
+
`once` hides the mesh after a use (`onUse` returning `{ ok: false }` leaves it); `counter` adds 1 through `engine.hud.bump(name, n)`, and does nothing without
|
|
13
13
|
`hud()`. Both are saved and go back on a new game. The save knows a thing by `id`, else `mesh.name`: development throws when it has neither, or shares one with another once item.
|
|
14
|
-
A hidden mesh is only hidden: a collider it had is yours to remove in `onUse`. To add up without a thing to take, call `engine.hud.
|
|
14
|
+
A hidden mesh is only hidden: a collider it had is yours to remove in `onUse`. To add up without a thing to take, call `engine.hud.bump('score', 10)` yourself.
|
|
15
15
|
|
|
16
16
|
| Use | When |
|
|
17
17
|
|---|---|
|
|
@@ -19,10 +19,9 @@ A hidden mesh is only hidden: a collider it had is yours to remove in `onUse`. T
|
|
|
19
19
|
| `pickups.spawn` (below) | it goes in a bag, respawns, is taken by walking into it (`auto`), is laid out in `content/`, or a net host must decide who got it |
|
|
20
20
|
|
|
21
21
|
## Items and pickups
|
|
22
|
-
Modules needed: `inventory()` (
|
|
23
|
-
`inventory
|
|
24
|
-
`
|
|
25
|
-
to a pickup and press E). "Already picked up / how long until it grows back" is data in world and is saved with the game.
|
|
22
|
+
Modules needed: `inventory()` (its window is the UI part `inventory`; the open key is the game's: `presets.bindings.inventory` is I / gamepad Y,
|
|
23
|
+
`inventory: []` none) + `pickups()` (things lying on the ground; needs `world()`, which `openWorld()` includes) +
|
|
24
|
+
`interactions({ ...presets.interactions.nearest })` (walk up to a pickup and press E). "Already picked up / how long until it grows back" is data in world and is saved with the game.
|
|
26
25
|
|
|
27
26
|
**Every actor has its own bag**: the container whose id is the actor's id (`inventory.of(actor)`): `'player'` for the local user, each net peer's actor
|
|
28
27
|
id on the host, an NPC's id. "The player inventory" (`inventory.add / count / list ...`) is the bag of `engine.actor`. Whoever takes a pickup gets it in
|
|
@@ -42,7 +41,7 @@ export const startItems = { coin: 3 }; // what the inventory holds at t
|
|
|
42
41
|
`content/pickups.js` (a list):
|
|
43
42
|
```js
|
|
44
43
|
export default [
|
|
45
|
-
{ item: 'mushroom', place: 'home', x: 8, z: 3, respawn: 120 }, // respawn: after how many
|
|
44
|
+
{ item: 'mushroom', place: 'home', x: 8, z: 3, respawn: 120 }, // respawn: after how many calendar seconds it grows back (omitted = never again)
|
|
46
45
|
{ item: 'coin', x: 40, z: -12, count: 5, auto: true }, // without place it is a world coordinate; count = how many at once; auto = taken by walking into it
|
|
47
46
|
{ item: 'sword', x: 12, z: 4, data: { durability: 60 } }, // data = this piece's own data (see "Single pieces"); radius = reach in meters (default 2)
|
|
48
47
|
];
|
|
@@ -54,26 +53,21 @@ is built only near the player and removed when far.
|
|
|
54
53
|
Id: if you write an `id` it is used; otherwise it is `pickup:<item>:<index in the pickups array>`, the same every time for the same content, and
|
|
55
54
|
distinguishes the same item placed at the same coordinates. **Write an `id` if the content will keep changing** (inserting a new one in the middle
|
|
56
55
|
shifts the later indices).
|
|
57
|
-
When picked up, the record is removed from world; one with `respawn` stays and gets an `until` (
|
|
58
|
-
|
|
59
|
-
Pickups in content are the world's **initial data**: the save records only what was picked up and what is waiting to respawn; it makes no difference
|
|
60
|
-
whether `content.load` runs before or after loading, and picked-up items do not reappear; positions that use a level marker carry a `zone`, so after
|
|
61
|
-
changing level and coming back they are still picked up.
|
|
56
|
+
When picked up, the record is removed from world; one with `respawn` stays and gets an `until` (calendar seconds); while waiting it has no model,
|
|
57
|
+
and at that time (also when far away with no model) it returns to the ground. Pickups in content are initial data, like props (recipe 18 §4).
|
|
62
58
|
`engine.world.remove(id)` deletes one directly.
|
|
63
59
|
|
|
64
60
|
## 2. In code (dynamic drops, custom models, instant effects)
|
|
65
61
|
```js
|
|
66
62
|
engine.inventory.define('gem', { name: 'Gem', icon: '💎', color: 0x66ccff }); // shape: model: 'gemModel' (an asset name), else an asset named 'pickup:gem' / 'pickup', else a gray box (spawn { mesh } puts one object of the game's own down instead)
|
|
67
63
|
const gem = engine.pickups.spawn(engine.player.position, { give: 'gem', count: 1 }); // returns a handle; gem.remove() deletes data and model together
|
|
68
|
-
//
|
|
69
|
-
engine.inventory.add('coin', 2); //
|
|
70
|
-
engine.inventory.remove('coin', 1); // returns false if there isn't enough
|
|
71
|
-
engine.inventory.has('coin', 2); // at least 2?
|
|
64
|
+
// opts.id writes a stable id (spawning again with the same id reuses the existing one)
|
|
65
|
+
engine.inventory.add('coin', 2); // the local bag; { ok: true, key: 'coin', added: 2 }, or { ok: false, code: 'full' } if none fit
|
|
72
66
|
engine.pickups.spawn([8, 0, 2], { give: 'ammo', count: 30, auto: true, radius: 1.2 }); // taken on touch by whoever touches it (pickups.takers), no key, no prompt
|
|
73
67
|
engine.pickups.spawn(p, { give: (e, { actor }) => e.ops.run('hp.heal', { n: 25 }, { actor }), name: 'Medkit', model: 'medkit', auto: true }); // instant effect, no inventory needed
|
|
74
68
|
engine.events.on('pickup:take', ({ actor, x, z }) => engine.particles?.emit('dust', { x, y: engine.surface(x, z), z }, { count: 10 })); // also item:add / item:remove (with container, actor) / item:use
|
|
75
69
|
```
|
|
76
|
-
The default reach is `pickups({ radius: 2 })`; each pickup can set its own `radius`. Taking one is the op `pickup.take { id }` (net: `'peer'`): the
|
|
70
|
+
The default reach is `pickups({ radius: 2 })`; each pickup can set its own `radius`. Reach is a sphere around the pickup, so a coin on a ledge less than `radius` above the player is taken from under it: give it a smaller `radius`. Taking one is the op `pickup.take { id }` (net: `'peer'`): the
|
|
77
71
|
interact key, auto pickups, a net client's press (sent to the host, which puts the item into that peer's bag) and tests all run it as `ctx.actor`.
|
|
78
72
|
A give function is not saved data: code that spawns one spawns it again on load (content and setup code do); a runtime drop gives an item id.
|
|
79
73
|
|
|
@@ -85,10 +79,7 @@ also takes a key.
|
|
|
85
79
|
```js
|
|
86
80
|
const I = engine.inventory;
|
|
87
81
|
I.define('sword', { name: 'Sword', stack: 1 });
|
|
88
|
-
const key
|
|
89
|
-
I.count('sword'); // every sword, with or without data
|
|
90
|
-
I.get(key); // { key, id: 'sword', count: 1, data: { durability: 80, level: 3 }, def }
|
|
91
|
-
I.list(); // every entry: [{ key, id, count, data, def }] for your own UI
|
|
82
|
+
const { key } = I.add('sword', 1, { data: { durability: 80, level: 3 } }); // 'sword#7' (add returns { ok: false, code: 'full' } when it does not fit)
|
|
92
83
|
// change it inside an op or fixed step (data objects are frozen: always pass a new one; the key stays the same)
|
|
93
84
|
const s = I.get(key); I.setData(key, { ...s.data, durability: s.data.durability - 1 });
|
|
94
85
|
I.transfer('player', 'chest-1', key); // exactly this sword; it keeps its data and key
|
|
@@ -100,8 +91,7 @@ Data and keys are saved with the container. Which piece a player means is chosen
|
|
|
100
91
|
|
|
101
92
|
## Limits (all optional, none by default)
|
|
102
93
|
`inventory({ capacity, maxWeight })` for the player and `inventory.container(id, { capacity, maxWeight })` for others:
|
|
103
|
-
`capacity` = slots (an entry uses `ceil(count / stack)`), `maxWeight` = sum of item `weight` × count.
|
|
104
|
-
and `slotsUsed` read the totals. Locks, prices and "only one equipped" are game rules: check them in your op's `can`.
|
|
94
|
+
`capacity` = slots (an entry uses `ceil(count / stack)`), `maxWeight` = sum of item `weight` × count.
|
|
105
95
|
|
|
106
96
|
## Using and dropping (ops)
|
|
107
97
|
```js
|
|
@@ -131,19 +121,17 @@ The window is a UI part (recipe 26): the engine opens and closes it (the bound `
|
|
|
131
121
|
```js
|
|
132
122
|
engine.ui.set('inventory', false); // no window at all (the key does nothing, no DOM)
|
|
133
123
|
engine.ui.set('inventory', { drop: true }); // default window plus a Drop button per row (Use appears for items with use)
|
|
134
|
-
engine.ui.set('inventory', (engine) => { // your own: grid, drag and drop, anything
|
|
124
|
+
engine.ui.set('inventory', (engine) => { // your own: grid, drag and drop, anything; buttons run ops with an entry's key
|
|
135
125
|
const el = document.createElement('div'); engine.uiRoot.appendChild(el);
|
|
136
|
-
el.onclick = ev => { const key = ev.target.dataset.key; if (key) engine.ops.run('inventory.use', { item: key }); };
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
hide: () => { el.hidden = true; }, dispose: () => el.remove() };
|
|
126
|
+
el.onclick = ev => { const key = ev.target.dataset.key; if (key) engine.ops.run('inventory.use', { item: key }); };
|
|
127
|
+
const draw = d => { el.innerHTML = d.items.map(i => `<button data-key="${i.key}">${i.def.name} ×${i.count}</button>`).join(''); };
|
|
128
|
+
return { show: d => { el.hidden = false; draw(d); }, update: draw, hide: () => { el.hidden = true; }, dispose: () => el.remove() };
|
|
140
129
|
});
|
|
141
130
|
engine.ui.open('inventory'); engine.ui.close('inventory'); // open / close from code
|
|
142
131
|
```
|
|
143
|
-
The shape of an item on the ground is a model name from an asset pack, built through the same path as content props
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
note are all just models).
|
|
132
|
+
The shape of an item on the ground is a model name from an asset pack, built through the same path as content props (recipe 05 §1): the item's `model`,
|
|
133
|
+
else a model named `pickup:<item id>`, else one named `pickup`, else a neutral gray box. A generator that returns bare geometry is drawn with
|
|
134
|
+
`engine.pickups.material` in the item's own `color`.
|
|
147
135
|
```js
|
|
148
136
|
engine.use(pickups({ color: 0xd8c070, size: 0.3, lift: 0.5 })); // default color, placeholder box, height above the ground
|
|
149
137
|
engine.pickups.material = new THREE.MeshStandardMaterial({ metalness: 0.8, roughness: 0.3 }); // swaps every box and geometry-only model; used as given
|
|
@@ -154,13 +142,12 @@ To give / take items in content use the effect words: `{ give: { coin: 2 } }`, `
|
|
|
154
142
|
`{ has: { mushroom: 3 } }`, `{ lacks: { coin: 1 } }`.
|
|
155
143
|
|
|
156
144
|
## Chests / corpses / shelves (multiple containers)
|
|
157
|
-
The player inventory is just one container (the bag of `engine.actor
|
|
158
|
-
get or create one (
|
|
159
|
-
`add / remove / count / has / get / list / setData` as the inventory, plus `room(id)` (how many more fit) and `on('add' | 'remove', fn)` (returns a handle).
|
|
145
|
+
The player inventory is just one container (the bag of `engine.actor`). Chests, corpses, shelves and ammo boxes use `inventory.container(id, { capacity })`
|
|
146
|
+
to get or create one (the same id returns the same one); it has the inventory's methods plus `room(id)` and `on('add' | 'remove', fn)`.
|
|
160
147
|
```js
|
|
161
148
|
const I = engine.inventory;
|
|
162
149
|
const chest = I.container('chest-1', { capacity: 8 });
|
|
163
|
-
chest.add('bandage', 2); //
|
|
150
|
+
chest.add('bandage', 2); // { ok: false, code: 'full' } if none fit; if part fits, that part goes in and `added` says how many
|
|
164
151
|
I.transfer(chest, 'player', 'bandage', 1); // a container or a container id both work; returns how many were actually moved (fewer / 0 if the inventory is full)
|
|
165
152
|
I.transfer('player', chest, 'coin', 5); // shelves and money boxes work the same way
|
|
166
153
|
chest.on('remove', ({ id, count, actor }) => console.log(actor, 'took', id, count)); // every container emits item:add / item:remove with { container, actor, id, key, count, total }
|
|
@@ -170,13 +157,10 @@ chest.on('remove', ({ id, count, actor }) => console.log(actor, 'took', id, coun
|
|
|
170
157
|
initial goods). Loading creates the containers first, and a later `container(id, { capacity })` in code just fills in the slot count, in either order.
|
|
171
158
|
- **Deleting a world record does not delete its container automatically** (whether to keep a searched corpse is up to the game). To clear both:
|
|
172
159
|
`engine.events.on('world:remove', ({ id }) => I.removeContainer(id))`.
|
|
173
|
-
- **Pre-filled contents
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
when searched empty (`{}`), so after a refresh and load it is empty and not refilled. Don't fill with `container(id).add(...)` at startup: a
|
|
178
|
-
container with nothing in it is not saved, so after a refresh it would be treated as new and filled again. A container id is any string and all are
|
|
179
|
-
saved ('shop-bakery' and 'prop:chest:3' alike).
|
|
160
|
+
- **Pre-filled contents**: goods are placed only the **first** time; on load the save wins, and a searched-empty container is not refilled. Write
|
|
161
|
+
`content/containers.js` (`export default { 'chest-1': { capacity: 8, items: { bandage: 2 } } }`, exported from `content/index.js`), or in code
|
|
162
|
+
`I.container('chest-1', { capacity: 8, items: { bandage: 2 } })`. Don't fill with `container(id).add(...)` at startup: a container with nothing in it is
|
|
163
|
+
not saved, so after a refresh it would be treated as new and filled again.
|
|
180
164
|
- **UI**: the engine only makes the player inventory window; for a chest UI draw `chest.list()` yourself, and clicking an entry runs
|
|
181
165
|
`engine.ops.run('inventory.transfer', { from: 'chest-1', to: 'player', item: entry.key })`.
|
|
182
166
|
- Non-empty containers appear in `describe()` under `inventory.containers`.
|
|
@@ -23,7 +23,7 @@ export default {
|
|
|
23
23
|
},
|
|
24
24
|
};
|
|
25
25
|
```
|
|
26
|
-
`target` forms: a place name (its coordinates come from `engine.content.load(data, { places })` or a level marker, recipe 01), `{ place, x, z }`, `{ x, z }` (world coordinates; any of these may add `floor` / `y` for a storey on multi-layer ground,
|
|
26
|
+
`target` forms: a place name (its coordinates come from `content/places.js`, `engine.content.load(data, { places })` or a level marker, recipe 01), `{ place, x, z }`, `{ x, z }` (world coordinates; any of these may add `floor` / `y` for a storey on multi-layer ground,
|
|
27
27
|
as in props), `{ npc: 'id in npcs.js' }`, `{ nearest: 'itemId' }` (the closest not-yet-picked-up pickup of that kind to the player; hidden
|
|
28
28
|
automatically once picked up).
|
|
29
29
|
In code you can also write a function `target: () => target or null` (evaluated every frame); to change the target of a manual marker use
|
|
@@ -81,10 +81,9 @@ or bar in that screen column.
|
|
|
81
81
|
`quests: {...}` line).
|
|
82
82
|
In more detail: `engine.quests.list()` (each step has `current/done/target`), `engine.quests.isActive(id)`; story flags in `engine.vars.flags`.
|
|
83
83
|
- Objective markers: `describe().hud.markers` has `{ label: quest title, distance: meters, onScreen }`; counters are in `describe().hud.counters`.
|
|
84
|
-
- After advancing a condition you don't have to wait: `engine.quests.check()` checks immediately.
|
|
84
|
+
- After advancing a condition you don't have to wait: `engine.quests.check()` checks immediately.
|
|
85
85
|
|
|
86
86
|
## Reading and moving progress from code
|
|
87
|
-
|
|
88
|
-
A step the game finishes from its own code (a cutscene ended, a boss fell) can skip its condition: `engine.quests.advance(id)` moves to the next step
|
|
87
|
+
A step the game finishes from its own code (a cutscene ended, a fight was won) can skip its condition: `engine.quests.advance(id)` moves to the next step
|
|
89
88
|
and completes the quest after the last one (reward, `quest:done`); call it from an op or a fixed step. A replacement quests module meets
|
|
90
89
|
`modules/gameplay/quests.contract.js` (define / start / advance / state / list, events quest:start / quest:step / quest:done, save key quests).
|