@woosh/meep-engine 3.45.0 → 3.47.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/build/bundle-worker-terrain.js +1 -1
- package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
- package/editor/actions/concrete/TransformModifyAction.js +10 -2
- package/editor/ecs/component/FieldDescriptor.js +15 -0
- package/editor/ecs/component/createObjectEditor.js +41 -12
- package/editor/ecs/component/editors/ecs/Transform64Editor.d.ts.map +1 -1
- package/editor/ecs/component/editors/ecs/Transform64Editor.js +77 -70
- package/editor/tools/TransformToolV2.d.ts.map +1 -1
- package/editor/tools/TransformToolV2.js +4 -0
- package/editor/tools/v2/TransformControls.d.ts.map +1 -1
- package/editor/tools/v2/TransformControls.js +7 -0
- package/editor/view/ecs/EntityEditor.d.ts.map +1 -1
- package/editor/view/ecs/EntityEditor.js +4 -2
- package/package.json +1 -1
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +5 -1
- package/src/core/binary/hash/XXH128Hash.d.ts +1 -37
- package/src/core/binary/hash/XXH128Hash.d.ts.map +1 -1
- package/src/core/binary/hash/XXH128Hash.js +4 -55
- package/src/core/binary/hash/XXH3_SECRET.d.ts +1 -12
- package/src/core/binary/hash/XXH3_SECRET.d.ts.map +1 -1
- package/src/core/binary/hash/XXH3_SECRET.js +4 -25
- package/src/core/binary/hash/crc32.d.ts +1 -15
- package/src/core/binary/hash/crc32.d.ts.map +1 -1
- package/src/core/binary/hash/crc32.js +4 -96
- package/src/core/binary/hash/xxh3_128.d.ts +1 -9
- package/src/core/binary/hash/xxh3_128.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_128.js +4 -341
- package/src/core/binary/hash/xxh3_64.d.ts +1 -8
- package/src/core/binary/hash/xxh3_64.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_64.js +4 -241
- package/src/core/binary/hash/xxh3_common.d.ts +1 -223
- package/src/core/binary/hash/xxh3_common.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_common.js +90 -476
- package/src/core/collection/array/array_insert_at.d.ts +16 -0
- package/src/core/collection/array/array_insert_at.d.ts.map +1 -0
- package/src/core/collection/array/array_insert_at.js +32 -0
- package/src/core/collection/array/array_remove_at.d.ts +15 -0
- package/src/core/collection/array/array_remove_at.d.ts.map +1 -0
- package/src/core/collection/array/array_remove_at.js +30 -0
- package/src/core/collection/array/combine_hash.d.ts +6 -0
- package/src/core/collection/array/combine_hash.d.ts.map +1 -1
- package/src/core/collection/array/combine_hash.js +6 -0
- package/src/core/function/FunctionCompiler.js +2 -2
- package/src/core/geom/3d/mat4/m4_multiply.d.ts +3 -0
- package/src/core/geom/3d/mat4/m4_multiply.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_multiply.js +3 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts +30 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.js +106 -0
- package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts +37 -0
- package/src/core/geom/3d/quaternion/quat3_look_rotation.d.ts.map +1 -0
- package/src/core/geom/3d/quaternion/quat3_look_rotation.js +172 -0
- package/src/core/geom/ConicRay.js +2 -2
- package/src/core/geom/Quaternion.d.ts +1 -0
- package/src/core/geom/Quaternion.d.ts.map +1 -1
- package/src/core/geom/Quaternion.js +12 -48
- package/src/core/geom/Vector4.d.ts.map +1 -1
- package/src/core/geom/Vector4.js +8 -5
- package/src/core/math/hash/XXH128Hash.d.ts +38 -0
- package/src/core/math/hash/XXH128Hash.d.ts.map +1 -0
- package/src/core/math/hash/XXH128Hash.js +55 -0
- package/src/core/math/hash/XXH3_SECRET.d.ts +13 -0
- package/src/core/math/hash/XXH3_SECRET.d.ts.map +1 -0
- package/src/core/math/hash/XXH3_SECRET.js +25 -0
- package/src/core/math/hash/crc32.d.ts +16 -0
- package/src/core/math/hash/crc32.d.ts.map +1 -0
- package/src/core/math/hash/crc32.js +96 -0
- package/src/core/math/hash/xxh3_128.d.ts +10 -0
- package/src/core/math/hash/xxh3_128.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_128.js +341 -0
- package/src/core/math/hash/xxh3_64.d.ts +9 -0
- package/src/core/math/hash/xxh3_64.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_64.js +241 -0
- package/src/core/math/hash/xxh3_common.d.ts +224 -0
- package/src/core/math/hash/xxh3_common.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_common.js +476 -0
- package/src/core/math/lookup/ParameterLookupTable.js +2 -2
- package/src/core/model/node-graph/node/NodeInstancePortReference.js +2 -2
- package/src/core/model/reactive/model/ReactiveBinaryExpression.js +2 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -2
- package/src/engine/Engine.d.ts.map +1 -1
- package/src/engine/Engine.js +9 -4
- package/src/engine/asset/AssetDescription.js +2 -2
- package/src/engine/ecs/animation/Animation.js +2 -2
- package/src/engine/ecs/animation/AnimationClip.d.ts.map +1 -1
- package/src/engine/ecs/animation/AnimationClip.js +7 -5
- package/src/engine/ecs/gui/GUIElement.d.ts.map +1 -1
- package/src/engine/ecs/gui/GUIElement.js +7 -5
- package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +2 -2
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.js +11 -7
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +10 -0
- package/src/engine/ecs/transform/Transform64.d.ts +1 -1
- package/src/engine/ecs/transform/Transform64.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform64.js +5 -4
- package/src/engine/ecs/transform/t64_look_rotation.d.ts +4 -4
- package/src/engine/ecs/transform/t64_look_rotation.d.ts.map +1 -1
- package/src/engine/ecs/transform/t64_look_rotation.js +7 -18
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.js +8 -5
- package/src/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +8 -5
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts.map +1 -1
- package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +30 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.js +9 -8
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.js +9 -6
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +6 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +72 -29
- package/src/engine/graphics3/ParticipatingMedia.js +204 -204
- package/src/engine/graphics3/animation/AnimationClips.d.ts +5 -0
- package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -1
- package/src/engine/graphics3/animation/AnimationClips.js +5 -0
- package/src/engine/grid/obstacle/GridObstacle.js +2 -2
- package/src/engine/input/devices/KeyboardDevice.d.ts +1 -0
- package/src/engine/input/devices/KeyboardDevice.d.ts.map +1 -1
- package/src/engine/input/devices/KeyboardDevice.js +7 -6
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +2 -2
- package/src/engine/interpolation/Interpolated.js +2 -2
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.d.ts.map +1 -1
- package/src/engine/navigation/ecs/path_following/PathFollowingSystem.js +15 -2
- package/src/engine/network/CONGESTION_CONTROL.md +9 -9
- package/src/engine/network/MESSAGE_TRANSPORT.md +364 -0
- package/src/engine/network/NetworkSession.d.ts +31 -11
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +453 -286
- package/src/engine/network/README.md +77 -27
- package/src/engine/network/SMOOTHNESS_DESIGN.md +13 -5
- package/src/engine/network/diagnostics/BandwidthMeter.d.ts +1 -1
- package/src/engine/network/diagnostics/BandwidthMeter.js +1 -1
- package/src/engine/network/orchestrator/HostJoin.d.ts +111 -0
- package/src/engine/network/orchestrator/HostJoin.d.ts.map +1 -0
- package/src/engine/network/orchestrator/HostJoin.js +271 -0
- package/src/engine/network/orchestrator/NetworkPeer.d.ts +151 -112
- package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +450 -499
- package/src/engine/network/orchestrator/PendingSlices.d.ts +30 -0
- package/src/engine/network/orchestrator/PendingSlices.d.ts.map +1 -0
- package/src/engine/network/orchestrator/PendingSlices.js +83 -0
- package/src/engine/network/orchestrator/ReliableFrames.d.ts +34 -0
- package/src/engine/network/orchestrator/ReliableFrames.d.ts.map +1 -0
- package/src/engine/network/orchestrator/ReliableFrames.js +96 -0
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts +77 -10
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +236 -61
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts +20 -6
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +33 -8
- package/src/engine/network/replication/Replicator.d.ts.map +1 -1
- package/src/engine/network/replication/Replicator.js +7 -1
- package/src/engine/network/sim/ActionLog.d.ts +32 -5
- package/src/engine/network/sim/ActionLog.d.ts.map +1 -1
- package/src/engine/network/sim/ActionLog.js +47 -5
- package/src/engine/network/sim/SimActionExecutor.d.ts +42 -2
- package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
- package/src/engine/network/sim/SimActionExecutor.js +100 -4
- package/src/engine/network/sim/Snapshotter.d.ts +12 -0
- package/src/engine/network/sim/Snapshotter.d.ts.map +1 -1
- package/src/engine/network/sim/Snapshotter.js +43 -0
- package/src/engine/network/state/Baseline.d.ts +1 -1
- package/src/engine/network/state/Baseline.js +1 -1
- package/src/engine/network/state/FrameBufferRing.d.ts +25 -6
- package/src/engine/network/state/FrameBufferRing.d.ts.map +1 -1
- package/src/engine/network/state/FrameBufferRing.js +51 -6
- package/src/engine/network/state/InputRing.d.ts +4 -0
- package/src/engine/network/state/InputRing.d.ts.map +1 -1
- package/src/engine/network/state/InputRing.js +7 -0
- package/src/engine/network/transport/DeferredTransport.d.ts.map +1 -1
- package/src/engine/network/transport/DeferredTransport.js +1 -0
- package/src/engine/network/transport/LoopbackTransport.d.ts.map +1 -1
- package/src/engine/network/transport/LoopbackTransport.js +4 -2
- package/src/engine/network/transport/Transport.d.ts +7 -0
- package/src/engine/network/transport/Transport.d.ts.map +1 -1
- package/src/engine/network/transport/Transport.js +8 -0
- package/src/engine/network/transport/adapters/NodeUDPTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/NodeUDPTransport.js +20 -5
- package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/WebRTCDataChannelTransport.js +8 -0
- package/src/engine/network/transport/adapters/WebTransportTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/WebTransportTransport.js +6 -0
- package/src/engine/network/transport/connection/Connection.d.ts +191 -0
- package/src/engine/network/transport/connection/Connection.d.ts.map +1 -0
- package/src/engine/network/transport/connection/Connection.js +1262 -0
- package/src/engine/network/transport/connection/RangeSet.d.ts +94 -0
- package/src/engine/network/transport/connection/RangeSet.d.ts.map +1 -0
- package/src/engine/network/transport/connection/RangeSet.js +260 -0
- package/src/engine/network/transport/connection/RxStream.d.ts +48 -0
- package/src/engine/network/transport/connection/RxStream.d.ts.map +1 -0
- package/src/engine/network/transport/connection/RxStream.js +211 -0
- package/src/engine/network/transport/connection/TxStream.d.ts +90 -0
- package/src/engine/network/transport/connection/TxStream.d.ts.map +1 -0
- package/src/engine/network/transport/connection/TxStream.js +243 -0
- package/src/engine/network/transport/connection/bytes_copy.d.ts +17 -0
- package/src/engine/network/transport/connection/bytes_copy.d.ts.map +1 -0
- package/src/engine/network/transport/connection/bytes_copy.js +34 -0
- package/src/engine/network/transport/connection/varint.d.ts +46 -0
- package/src/engine/network/transport/connection/varint.d.ts.map +1 -0
- package/src/engine/network/transport/connection/varint.js +107 -0
- package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/Cloth.js +7 -5
- package/src/engine/physics/cloth/ecs/ClothCollider.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothCollider.js +7 -5
- package/src/engine/physics/cloth/ecs/ClothDynamics.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothDynamics.js +20 -11
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +7 -5
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidComponent.js +19 -11
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +2 -2
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +2 -2
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +11 -7
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +11 -7
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.js +16 -9
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts +38 -7
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitter.js +47 -14
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationAdapter.js +5 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts +18 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSerializationUpgrader_0_1.js +48 -0
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +12 -2
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +173 -9
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +9 -3
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +28 -8
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts +8 -0
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.js +192 -191
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationAdapter.js +5 -1
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts +18 -0
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSerializationUpgrader_0_1.js +51 -0
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTriggerSystem.js +15 -1
- package/src/engine/sound/simulation/core/AcousticMedium.js +2 -2
- package/src/engine/sound/simulation/definition/AcousticDirectivity.js +2 -2
- package/src/engine/sound/simulation/definition/AcousticMaterial.d.ts.map +1 -1
- package/src/engine/sound/simulation/definition/AcousticMaterial.js +11 -7
- package/src/engine/sound/sopra/README.md +768 -644
- package/src/engine/sound/sopra/SopraEngine.d.ts +104 -8
- package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -1
- package/src/engine/sound/sopra/SopraEngine.js +327 -12
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/BusDefinition.js +5 -4
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/DuckingRule.js +7 -5
- package/src/engine/sound/sopra/definition/EventDescription.d.ts +28 -2
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/EventDescription.js +77 -17
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts +10 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationAdapter.js +77 -55
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts +31 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.d.ts.map +1 -0
- package/src/engine/sound/sopra/definition/EventDescriptionSerializationUpgrader_0_1.js +75 -0
- package/src/engine/sound/sopra/definition/MixerSnapshot.js +2 -2
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/ParameterDefinition.js +7 -5
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +4 -3
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +3 -3
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +16 -9
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +38 -9
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +34 -5
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts +7 -2
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +137 -120
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts +3 -1
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +146 -128
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts +1 -0
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +8 -3
- package/src/engine/sound/sopra/legacy/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/sopra/legacy/SoundEmitter.js +357 -352
- package/src/engine/sound/sopra/legacy/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/sopra/legacy/SoundTrack.js +281 -278
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts +44 -2
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/BusGraph.js +83 -43
- package/src/engine/sound/sopra/runtime/EffectChain.d.ts +96 -0
- package/src/engine/sound/sopra/runtime/EffectChain.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/EffectChain.js +286 -0
- package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts +123 -0
- package/src/engine/sound/sopra/runtime/EffectParamOverrides.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/EffectParamOverrides.js +320 -0
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +55 -5
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.js +201 -26
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts +2 -1
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -1
- package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +6 -1
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts +15 -0
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.d.ts.map +1 -1
- package/src/engine/sound/sopra/serialization/sopraSerializationHarness.js +32 -0
- package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -1
- package/src/engine/sound/sopra/util/MockAudioContext.js +3 -0
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts +13 -3
- package/src/engine/sound/sopra/util/fadeOutAndStop.d.ts.map +1 -1
- package/src/engine/sound/sopra/util/fadeOutAndStop.js +25 -13
- package/src/format/image/png/PNGReader.js +644 -644
- package/src/format/image/png/crc32.d.ts +1 -1
- package/src/format/image/png/crc32.js +7 -8
- package/src/shade/RENDERER_CONTRACT.md +6 -3
- package/src/shade/descriptor/binding/BindGroupLayoutDescriptor.js +2 -2
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.d.ts.map +1 -1
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.js +12 -8
- package/src/shade/descriptor/binding/StorageTextureBindingLayout.js +2 -2
- package/src/shade/descriptor/binding/TextureBindingLayout.js +2 -2
- package/src/shade/descriptor/blend/BlendComponent.js +2 -2
- package/src/shade/descriptor/pipeline/PipelineDescriptorBase.js +2 -2
- package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +2 -2
- package/src/shade/descriptor/pipeline/ProgrammableStage.js +2 -2
- package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.js +2 -2
- package/src/shade/descriptor/pipeline/render/ColorTargetState.js +2 -2
- package/src/shade/descriptor/pipeline/render/FragmentState.js +2 -2
- package/src/shade/descriptor/pipeline/render/PrimitiveState.js +2 -2
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.js +8 -5
- package/src/shade/descriptor/pipeline/render/VertexAttribute.js +2 -2
- package/src/shade/descriptor/texture/SamplerDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/SamplerDescriptor.js +20 -12
- package/src/shade/descriptor/texture/TextureDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/TextureDescriptor.js +11 -7
- package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts +24 -0
- package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -0
- package/src/shade/device/SHADE_DEVICE_FLOOR.js +34 -0
- package/src/shade/device/ShadeDeviceFailure.d.ts +12 -5
- package/src/shade/device/ShadeDeviceFailure.d.ts.map +1 -1
- package/src/shade/device/ShadeDeviceFailure.js +17 -8
- package/src/shade/device/ShadeDeviceFailureReason.d.ts +1 -1
- package/src/shade/device/ShadeDeviceFailureReason.js +2 -2
- package/src/shade/device/graph/BufferResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/BufferResourceDescriptor.js +196 -193
- package/src/shade/device/graph/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/TextureResourceDescriptor.js +178 -173
- package/src/shade/device/shade_device_floor_unmet.d.ts +13 -0
- package/src/shade/device/shade_device_floor_unmet.d.ts.map +1 -0
- package/src/shade/device/shade_device_floor_unmet.js +32 -0
- package/src/shade/device/timing/profile/sgpt_read_header.js +1 -1
- package/src/shade/device/timing/profile/sgpt_read_records.js +1 -1
- package/src/shade/device/timing/profile/sgpt_write_header.js +1 -1
- package/src/shade/device/timing/profile/sgpt_write_record.js +1 -1
- package/src/shade/renderer/Renderer.d.ts +2 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +29 -55
- package/src/shade/renderer/binding/BufferBinding.js +2 -2
- package/src/shade/renderer/buffer/GPUBufferAllocator.d.ts.map +1 -1
- package/src/shade/renderer/buffer/GPUBufferAllocator.js +9 -0
- package/src/shade/renderer/buffer/buffer_pool_ops.d.ts +21 -12
- package/src/shade/renderer/buffer/buffer_pool_ops.d.ts.map +1 -1
- package/src/shade/renderer/buffer/buffer_pool_ops.js +18 -19
- package/src/shade/renderer/camera/Camera.js +2 -2
- package/src/shade/renderer/geometry/Attribute.js +2 -2
- package/src/shade/renderer/geometry/Geometry.js +2 -2
- package/src/shade/renderer/geometry/geometry_deduplicate_vertices.js +2 -2
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +2 -2
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.js +13 -13
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_directory_block_checksum.js +41 -41
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.js +41 -41
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.js +25 -25
- package/src/shade/renderer/gpu_primitive/test/gpu_test.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/test/gpu_test.js +8 -11
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/material/StandardShadeMaterial.d.ts.map +1 -1
- package/src/shade/renderer/material/StandardShadeMaterial.js +13 -8
- package/src/shade/renderer/pool/TransientResourcePool.d.ts +24 -0
- package/src/shade/renderer/pool/TransientResourcePool.d.ts.map +1 -1
- package/src/shade/renderer/pool/TransientResourcePool.js +41 -10
- package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.d.ts.map +1 -1
- package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js +14 -5
- package/src/shade/renderer/scene/optimization/sampler2d_from_image_bitmap.js +1 -1
- package/src/shade/renderer/shader/ComputeShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ComputeShader.js +18 -2
- package/src/shade/renderer/shader/ImageShader.d.ts.map +1 -1
- package/src/shade/renderer/shader/ImageShader.js +230 -218
- package/src/shade/renderer/shader/type/WGSLStructField.js +2 -2
- package/src/shade/renderer/shader/type/WebGPUArray.js +2 -2
- package/src/shade/renderer/shader/type/WebGPUStruct.d.ts.map +1 -1
- package/src/shade/renderer/shader/type/WebGPUStruct.js +9 -6
- package/src/shade/renderer/texture/ShadeTexture.d.ts.map +1 -1
- package/src/shade/renderer/texture/ShadeTexture.js +17 -10
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +2 -2
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -4
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +6 -6
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +46 -55
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts +3 -3
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +14 -4
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +10 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +82 -40
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +4 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +8 -4
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +98 -86
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/shader_water_particles.js +440 -298
- package/src/view/common/HTMLElementCacheKey.d.ts.map +1 -1
- package/src/view/common/HTMLElementCacheKey.js +4 -3
- package/src/view/graphics/GraphicsContextFailureView.d.ts +1 -2
- package/src/view/graphics/GraphicsContextFailureView.d.ts.map +1 -1
- package/src/view/graphics/GraphicsContextFailureView.js +1 -2
- package/src/view/minimap/MinimapMarker.js +2 -2
- package/src/engine/network/transport/Channel.js +0 -336
- package/src/engine/network/transport/ReliableCommandPipeline.js +0 -335
- package/src/engine/network/transport/fragments/FragmentAssembler.js +0 -350
- package/src/engine/network/transport/fragments/FragmentRetention.js +0 -191
- package/src/engine/network/transport/fragments/fragment_send.js +0 -157
- package/src/engine/network/transport/fragments/packet_size.js +0 -107
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HTMLElementCacheKey.d.ts","sourceRoot":"","sources":["../../../../src/view/common/HTMLElementCacheKey.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HTMLElementCacheKey.d.ts","sourceRoot":"","sources":["../../../../src/view/common/HTMLElementCacheKey.js"],"names":[],"mappings":"AAiDA;IAsOI;;;OAGG;IACH,uBAFW,WAAW,uBAQrB;IA9OD;;;OAGG;IACH,YAFU,wBAAc,CAER;IAEhB;;;OAGG;IACH,OAFU,wBAAc,CAEb;IAEX;;;OAGG;IACH,KAFU,MAAM,CAEP;IAET;;;;OAIG;IACH,eAAY;IAEZ;;;;OAIG;IACH,mBAHW,MAAM,SACN,MAAM,QAkBhB;IAED;;;;OAIG;IACH,mBAHW,MAAM,GACJ,MAAM,GAAC,IAAI,CAUvB;IA8BD,eAGC;IAED;;;MAqBC;IAED;;;OAGG;IACH,0BAFW,WAAW,QA+DrB;IAoBD,eAEC;IAED;;;;OAIG;IACH,cAHW,mBAAmB,GACjB,OAAO,CAOnB;IAED,cAMC;IAcD;;;OAGG;IACH,oCAwBC;;CACJ;6BA5T4B,uCAAuC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash_mix2 } from "../../core/math/hash/hash_mix2.js";
|
|
2
|
+
import { hash_mix3 } from "../../core/math/hash/hash_mix3.js";
|
|
2
3
|
import { computeHashArray } from "../../core/collection/array/computeHashArray.js";
|
|
3
4
|
import { isArrayEqual } from "../../core/collection/array/isArrayEqual.js";
|
|
4
5
|
import { KeyValuePair } from "../../core/collection/KeyValuePair.js";
|
|
@@ -9,7 +10,7 @@ import { computeStringHash } from "../../core/primitives/strings/computeStringHa
|
|
|
9
10
|
* @param {KeyValuePair<string,string>} pair
|
|
10
11
|
*/
|
|
11
12
|
function computeStringPairHash(pair) {
|
|
12
|
-
return
|
|
13
|
+
return hash_mix2(
|
|
13
14
|
computeStringHash(pair.key),
|
|
14
15
|
computeStringHash(pair.value)
|
|
15
16
|
);
|
|
@@ -245,7 +246,7 @@ export class HTMLElementCacheKey {
|
|
|
245
246
|
const tagHash = computeStringHash(this.tag);
|
|
246
247
|
|
|
247
248
|
|
|
248
|
-
this.__hash =
|
|
249
|
+
this.__hash = hash_mix3(
|
|
249
250
|
styleHash,
|
|
250
251
|
attributeHash,
|
|
251
252
|
tagHash
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shown when
|
|
3
|
-
* black canvas.
|
|
2
|
+
* Shown when there will be no rendering, so the person sees an explanation instead of a black canvas.
|
|
4
3
|
*
|
|
5
4
|
* Strings are supplied by the caller. They default to English because this view exists precisely for the
|
|
6
5
|
* case where the renderer is dead, which is not a good moment to depend on the localization pipeline
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphicsContextFailureView.d.ts","sourceRoot":"","sources":["../../../../src/view/graphics/GraphicsContextFailureView.js"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"GraphicsContextFailureView.d.ts","sourceRoot":"","sources":["../../../../src/view/graphics/GraphicsContextFailureView.js"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH;IACI;;;;;;OAMG;IACH;QAL4B,KAAK,GAAtB,MAAM;QACW,IAAI,GAArB,MAAM;QACW,YAAY,GAA7B,MAAM;QACa,MAAM;OAyDnC;CACJ;sBA1EqB,0BAA0B"}
|
|
@@ -3,8 +3,7 @@ import EmptyView from "../elements/EmptyView.js";
|
|
|
3
3
|
import LabelView from "../common/LabelView.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Shown when
|
|
7
|
-
* black canvas.
|
|
6
|
+
* Shown when there will be no rendering, so the person sees an explanation instead of a black canvas.
|
|
8
7
|
*
|
|
9
8
|
* Strings are supplied by the caller. They default to English because this view exists precisely for the
|
|
10
9
|
* case where the renderer is dead, which is not a good moment to depend on the localization pipeline
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash_mix3 } from "../../core/math/hash/hash_mix3.js";
|
|
2
2
|
import Vector2 from "../../core/geom/Vector2.js";
|
|
3
3
|
import ObservedString from "../../core/model/ObservedString.js";
|
|
4
4
|
|
|
@@ -43,7 +43,7 @@ class MinimapMarker {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
hash() {
|
|
46
|
-
return
|
|
46
|
+
return hash_mix3(
|
|
47
47
|
this.iconURL.hash(),
|
|
48
48
|
this.size.hash(),
|
|
49
49
|
this.zIndex
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import { assert } from "../../../core/assert.js";
|
|
2
|
-
import Signal from "../../../core/events/signal/Signal.js";
|
|
3
|
-
import { ack_bitfield_build, ack_bitfield_for_each, } from "../core/sequence/ack_bitfield.js";
|
|
4
|
-
import { seq16_advance, seq16_distance, seq16_greater_than, SEQ16_HALF_RANGE } from "../core/sequence/seq16.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Reliability-notification layer over a {@link Transport}.
|
|
8
|
-
*
|
|
9
|
-
* Adds a 9-byte header to every packet:
|
|
10
|
-
* ```
|
|
11
|
-
* uint16: outgoing_seq
|
|
12
|
-
* uint16: ack_latest (most recent seq received from peer; 0 when ack_present=0)
|
|
13
|
-
* uint32: ack_bitfield (the previous 32 seqs: bit i set => latest-1-i was received)
|
|
14
|
-
* uint8: ack_present (1 if this packet carries ack info; 0 if the sender has
|
|
15
|
-
* received nothing yet)
|
|
16
|
-
* ```
|
|
17
|
-
*
|
|
18
|
-
* The `ack_present` flag exists because a sender that has received nothing would
|
|
19
|
-
* otherwise emit `(ack_latest=0, ack_bitfield=0)`, which is wire-indistinguishable
|
|
20
|
-
* from "I have received exactly seq 0" and would spuriously ack the peer's
|
|
21
|
-
* outstanding seq 0 — silently breaking the action-stream back-fill and the
|
|
22
|
-
* reliable-command retransmit for that seq. The receiver skips all ack/loss
|
|
23
|
-
* processing when `ack_present` is 0.
|
|
24
|
-
*
|
|
25
|
-
* The header gives positive acknowledgement of up to 33 packets per inbound
|
|
26
|
-
* packet — robust enough that a single dropped ack-bearing packet typically
|
|
27
|
-
* doesn't matter (a later one carries the same info).
|
|
28
|
-
*
|
|
29
|
-
* Channel does NOT retransmit. It surfaces:
|
|
30
|
-
* - `onPacketAcked(seq)` when a peer's ack indicates an outgoing packet arrived
|
|
31
|
-
* - `onPacketLost(seq)` when an outgoing packet falls outside the 33-seq ack
|
|
32
|
-
* window without ever being acked (peer has acked 32 newer packets, so this
|
|
33
|
-
* one is presumed lost)
|
|
34
|
-
* - `onPayload(bytes, length)` for the payload portion of received packets,
|
|
35
|
-
* with the header stripped
|
|
36
|
-
*
|
|
37
|
-
* Reliability-by-retransmission lives in a higher-level pipeline (separate file,
|
|
38
|
-
* yet to build). Channel just provides the notification primitive.
|
|
39
|
-
*
|
|
40
|
-
* @author Alex Goldring
|
|
41
|
-
* @copyright Company Named Limited (c) 2026
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
const HEADER_SIZE = 9;
|
|
45
|
-
|
|
46
|
-
export class Channel {
|
|
47
|
-
#next_outgoing_seq;
|
|
48
|
-
#unacked_outgoing;
|
|
49
|
-
#latest_received_seq;
|
|
50
|
-
#received_seqs;
|
|
51
|
-
#send_buffer;
|
|
52
|
-
#send_view;
|
|
53
|
-
#lost_scratch;
|
|
54
|
-
#max_in_flight;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @param {{
|
|
59
|
-
* transport: { send(bytes: Uint8Array, length: number): void, onReceive: Signal },
|
|
60
|
-
* max_in_flight?: number,
|
|
61
|
-
* }} options
|
|
62
|
-
* `max_in_flight` hard-caps the number of unacked outgoing seqs. It exists
|
|
63
|
-
* to keep the in-flight span well below the seq16 half-range (32768): once
|
|
64
|
-
* an unacked seq falls more than half-range behind the newest sent, the
|
|
65
|
-
* signed `seq16_distance` used for loss detection wraps and the entry can
|
|
66
|
-
* neither be acked nor declared lost — a permanent leak (and a downstream
|
|
67
|
-
* `seq_to_pending` leak in the orchestrator). Capping in-flight makes
|
|
68
|
-
* that lap impossible. Default 1024 ≫ any realistic in-flight window
|
|
69
|
-
* (RTT × send-rate) yet ≪ 32768. Only reached under a sustained one-way
|
|
70
|
-
* stall, where eviction-as-lost is the correct verdict anyway.
|
|
71
|
-
*/
|
|
72
|
-
constructor({ transport, max_in_flight = 1024 }) {
|
|
73
|
-
assert.ok(transport && typeof transport.send === 'function', 'transport must implement send()');
|
|
74
|
-
assert.ok(transport.onReceive, 'transport must expose onReceive signal');
|
|
75
|
-
assert.isPositiveInteger(max_in_flight, 'max_in_flight');
|
|
76
|
-
assert.lessThan(max_in_flight, SEQ16_HALF_RANGE, 'max_in_flight must stay below the seq16 half-range');
|
|
77
|
-
|
|
78
|
-
/** @type {number} @private */
|
|
79
|
-
this.#max_in_flight = max_in_flight;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @type {{ send(bytes: Uint8Array, length: number): void, onReceive: Signal }}
|
|
83
|
-
*/
|
|
84
|
-
this.transport = transport;
|
|
85
|
-
this.transport.onReceive.add(this.#handle_inbound, this);
|
|
86
|
-
|
|
87
|
-
/** @type {number} @private */
|
|
88
|
-
this.#next_outgoing_seq = 0;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Outgoing seqs waiting on ack from the peer.
|
|
92
|
-
* @type {Set<number>}
|
|
93
|
-
* @private
|
|
94
|
-
*/
|
|
95
|
-
this.#unacked_outgoing = new Set();
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Most recent seq we've received from the peer; -1 if none yet.
|
|
99
|
-
* @type {number}
|
|
100
|
-
* @private
|
|
101
|
-
*/
|
|
102
|
-
this.#latest_received_seq = -1;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Seqs we have received. Used to build the ack bitfield piggyback.
|
|
106
|
-
* Pruned when entries fall outside the 64-seq window.
|
|
107
|
-
* @type {Set<number>}
|
|
108
|
-
* @private
|
|
109
|
-
*/
|
|
110
|
-
this.#received_seqs = new Set();
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Pre-allocated send buffer. Resized only if a payload exceeds capacity.
|
|
114
|
-
* @type {Uint8Array}
|
|
115
|
-
* @private
|
|
116
|
-
*/
|
|
117
|
-
this.#send_buffer = new Uint8Array(1500);
|
|
118
|
-
/** @type {DataView} @private */
|
|
119
|
-
this.#send_view = new DataView(this.#send_buffer.buffer);
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Scratch list for collecting "to be marked lost" outgoing seqs during
|
|
123
|
-
* an inbound handler (avoids modifying the Set while iterating).
|
|
124
|
-
* @type {number[]}
|
|
125
|
-
* @private
|
|
126
|
-
*/
|
|
127
|
-
this.#lost_scratch = [];
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Fired when an outgoing seq has been positively acknowledged by the peer.
|
|
131
|
-
* @type {Signal}
|
|
132
|
-
*/
|
|
133
|
-
this.onPacketAcked = new Signal();
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Fired when an outgoing seq has aged out of the ack window without being acked.
|
|
137
|
-
* @type {Signal}
|
|
138
|
-
*/
|
|
139
|
-
this.onPacketLost = new Signal();
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Fired when an inbound packet's payload is ready (header already stripped).
|
|
143
|
-
* Handler args: (payload: Uint8Array starting at offset 0, length: number).
|
|
144
|
-
* The Uint8Array is owned by the Channel and may be reused after the handler returns.
|
|
145
|
-
* @type {Signal}
|
|
146
|
-
*/
|
|
147
|
-
this.onPayload = new Signal();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Wrap and send a payload. Returns the seq number assigned to it.
|
|
152
|
-
*
|
|
153
|
-
* @param {Uint8Array} payload
|
|
154
|
-
* @param {number} length payload length in bytes
|
|
155
|
-
* @returns {number} seq
|
|
156
|
-
*/
|
|
157
|
-
send(payload, length) {
|
|
158
|
-
assert.isNonNegativeInteger(length, 'length');
|
|
159
|
-
|
|
160
|
-
const total_size = HEADER_SIZE + length;
|
|
161
|
-
if (total_size > this.#send_buffer.length) {
|
|
162
|
-
this.#send_buffer = new Uint8Array(Math.max(total_size, this.#send_buffer.length * 2));
|
|
163
|
-
this.#send_view = new DataView(this.#send_buffer.buffer);
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const seq = this.#next_outgoing_seq;
|
|
167
|
-
this.#next_outgoing_seq = seq16_advance(seq);
|
|
168
|
-
|
|
169
|
-
const has_received = this.#latest_received_seq >= 0;
|
|
170
|
-
const ack_latest = has_received ? this.#latest_received_seq : 0;
|
|
171
|
-
const ack_bitfield = has_received
|
|
172
|
-
? ack_bitfield_build(this.#latest_received_seq, s => this.#received_seqs.has(s))
|
|
173
|
-
: 0;
|
|
174
|
-
|
|
175
|
-
this.#send_view.setUint16(0, seq, true);
|
|
176
|
-
this.#send_view.setUint16(2, ack_latest, true);
|
|
177
|
-
this.#send_view.setUint32(4, ack_bitfield, true);
|
|
178
|
-
this.#send_view.setUint8(8, has_received ? 1 : 0);
|
|
179
|
-
if (length > 0) {
|
|
180
|
-
this.#send_buffer.set(payload.subarray(0, length), HEADER_SIZE);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
this.transport.send(this.#send_buffer, total_size);
|
|
184
|
-
this.#unacked_outgoing.add(seq);
|
|
185
|
-
|
|
186
|
-
// Enforce the in-flight bound. `#unacked_outgoing` is a Set, so its
|
|
187
|
-
// iteration order is insertion order = send order = ascending seq; the
|
|
188
|
-
// first entry is therefore the oldest unacked. When we exceed the cap
|
|
189
|
-
// (only possible under a sustained one-way stall where acks have
|
|
190
|
-
// stopped advancing the window), evict the oldest as lost. This keeps
|
|
191
|
-
// the in-flight span below the seq16 half-range so loss detection can't
|
|
192
|
-
// alias, and frees the entry (and its orchestrator-side mapping, via
|
|
193
|
-
// the onPacketLost handler) instead of leaking it. In a stall the
|
|
194
|
-
// oldest is an action-stream packet, whose loss handler does not
|
|
195
|
-
// retransmit; reliable-command retransmits are independently bounded by
|
|
196
|
-
// ReliableCommandPipeline.max_unacked (≪ this cap), so this cannot loop.
|
|
197
|
-
if (this.#unacked_outgoing.size > this.#max_in_flight) {
|
|
198
|
-
const oldest = this.#unacked_outgoing.values().next().value;
|
|
199
|
-
this.#unacked_outgoing.delete(oldest);
|
|
200
|
-
this.onPacketLost.send1(oldest);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return seq;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* Number of outgoing packets sent but not yet acked or marked lost.
|
|
208
|
-
* @returns {number}
|
|
209
|
-
*/
|
|
210
|
-
unacked_count() {
|
|
211
|
-
return this.#unacked_outgoing.size;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* Most recent seq received from the peer, or -1 if none yet.
|
|
216
|
-
* @returns {number}
|
|
217
|
-
*/
|
|
218
|
-
latest_received_seq() {
|
|
219
|
-
return this.#latest_received_seq;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Test-only: seed the next outgoing seq number. Used to fast-forward
|
|
224
|
-
* the seq counter so the seq16 wraparound can be exercised in
|
|
225
|
-
* unit tests without sending 65k packets. Do not call from production.
|
|
226
|
-
* @param {number} seq
|
|
227
|
-
*/
|
|
228
|
-
seed_outgoing_seq_for_testing(seq) {
|
|
229
|
-
this.#next_outgoing_seq = seq;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* @param {Uint8Array} bytes
|
|
234
|
-
* @param {number} length
|
|
235
|
-
* @private
|
|
236
|
-
*/
|
|
237
|
-
#handle_inbound(bytes, length) {
|
|
238
|
-
if (length < HEADER_SIZE) {
|
|
239
|
-
// Malformed: too short to contain a header. Drop silently.
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const view = new DataView(bytes.buffer, bytes.byteOffset, length);
|
|
244
|
-
const seq = view.getUint16(0, true);
|
|
245
|
-
const ack_latest = view.getUint16(2, true);
|
|
246
|
-
const ack_bitfield = view.getUint32(4, true);
|
|
247
|
-
const ack_present = view.getUint8(8);
|
|
248
|
-
|
|
249
|
-
// Record receipt of this seq.
|
|
250
|
-
if (this.#latest_received_seq < 0 || seq16_greater_than(seq, this.#latest_received_seq)) {
|
|
251
|
-
this.#latest_received_seq = seq;
|
|
252
|
-
}
|
|
253
|
-
this.#received_seqs.add(seq);
|
|
254
|
-
this.#prune_received_seqs();
|
|
255
|
-
|
|
256
|
-
// Process acks/loss only when the peer actually carries ack info. A peer
|
|
257
|
-
// that has received nothing sends ack_present=0 with (ack_latest=0,
|
|
258
|
-
// ack_bitfield=0); reading that as an ack would spuriously confirm our
|
|
259
|
-
// seq 0 (see the seq-0 ambiguity note in the class header).
|
|
260
|
-
if (ack_present === 1) {
|
|
261
|
-
this.#process_acks(ack_latest, ack_bitfield);
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
// Strip header and surface the payload.
|
|
265
|
-
const payload_length = length - HEADER_SIZE;
|
|
266
|
-
const payload = bytes.subarray(HEADER_SIZE, HEADER_SIZE + payload_length);
|
|
267
|
-
this.onPayload.send2(payload, payload_length);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**
|
|
271
|
-
* Apply the ack header of an inbound packet: fire `onPacketAcked` for each
|
|
272
|
-
* newly-acknowledged outgoing seq, and `onPacketLost` for any unacked seq
|
|
273
|
-
* that has aged out of the 33-seq ack window. Only invoked when the inbound
|
|
274
|
-
* header sets `ack_present` (the peer has received at least one packet from
|
|
275
|
-
* us), so `ack_latest` is a genuine acknowledgement rather than the
|
|
276
|
-
* "nothing received yet" sentinel.
|
|
277
|
-
*
|
|
278
|
-
* @param {number} ack_latest
|
|
279
|
-
* @param {number} ack_bitfield
|
|
280
|
-
* @private
|
|
281
|
-
*/
|
|
282
|
-
#process_acks(ack_latest, ack_bitfield) {
|
|
283
|
-
// Mark each acknowledged outgoing seq.
|
|
284
|
-
ack_bitfield_for_each(ack_latest, ack_bitfield, acked_seq => {
|
|
285
|
-
if (this.#unacked_outgoing.delete(acked_seq)) {
|
|
286
|
-
this.onPacketAcked.send1(acked_seq);
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
// Anything older than (ack_latest - 32) that is still unacked is presumed lost.
|
|
291
|
-
// Sanity: if `d` ever approaches half-range we're flying so many
|
|
292
|
-
// unacked packets that distance is about to wrap to negative and the
|
|
293
|
-
// loss-detection would silently break. Non-goal to support; assert.
|
|
294
|
-
this.#lost_scratch.length = 0;
|
|
295
|
-
for (const out_seq of this.#unacked_outgoing) {
|
|
296
|
-
const d = seq16_distance(out_seq, ack_latest);
|
|
297
|
-
assert.lessThan(d, SEQ16_HALF_RANGE / 2, `Channel: outgoing seq ${out_seq} is ${d} packets behind ack_latest ${ack_latest} — approaching seq16 half-range wraparound`);
|
|
298
|
-
if (d > 32) {
|
|
299
|
-
this.#lost_scratch.push(out_seq);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
for (let i = 0; i < this.#lost_scratch.length; i++) {
|
|
303
|
-
const lost = this.#lost_scratch[i];
|
|
304
|
-
this.#unacked_outgoing.delete(lost);
|
|
305
|
-
this.onPacketLost.send1(lost);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
/**
|
|
310
|
-
* Detach this Channel from its transport. The transport.onReceive subscription
|
|
311
|
-
* is removed so the Channel stops processing inbound bytes; the Channel's own
|
|
312
|
-
* Signals are left in place (callers usually hold no references to them after
|
|
313
|
-
* dispose, so they GC with the Channel). Required before discarding a Channel
|
|
314
|
-
* whose transport will be reused — otherwise the old Channel keeps consuming
|
|
315
|
-
* inbound packets in parallel with whatever replaces it.
|
|
316
|
-
*/
|
|
317
|
-
dispose() {
|
|
318
|
-
this.transport.onReceive.remove(this.#handle_inbound, this);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* Drop received-seq entries that are too old to matter for the next ack bitfield.
|
|
323
|
-
* Keeps a window slightly larger than the 33-seq bitfield to absorb out-of-order arrival.
|
|
324
|
-
* @private
|
|
325
|
-
*/
|
|
326
|
-
#prune_received_seqs() {
|
|
327
|
-
const latest = this.#latest_received_seq;
|
|
328
|
-
if (latest < 0) return;
|
|
329
|
-
// Window: 64 seqs back. Anything farther can be dropped.
|
|
330
|
-
for (const s of this.#received_seqs) {
|
|
331
|
-
if (seq16_distance(s, latest) > 64) {
|
|
332
|
-
this.#received_seqs.delete(s);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
}
|