1681-engine 0.0.0-stage → 0.5.8
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 +304 -0
- package/LICENSE +21 -0
- package/README.md +164 -2
- package/dist/1681-engine.js +417 -0
- package/dist/1681-engine.js.map +1 -0
- package/dist/ambient/ColorGrade.js +41 -0
- package/dist/ambient/ColorGrade.js.map +1 -0
- package/dist/ambient/DayClock.js +57 -0
- package/dist/ambient/DayClock.js.map +1 -0
- package/dist/ambient/WeatherLayer.js +91 -0
- package/dist/ambient/WeatherLayer.js.map +1 -0
- package/dist/ambient/grade.js +13 -0
- package/dist/ambient/grade.js.map +1 -0
- package/dist/ambient/weather.js +52 -0
- package/dist/ambient/weather.js.map +1 -0
- package/dist/anim/AnimStateMachine.js +164 -0
- package/dist/anim/AnimStateMachine.js.map +1 -0
- package/dist/anim/Animator.js +67 -0
- package/dist/anim/Animator.js.map +1 -0
- package/dist/anim/animStateCompile.js +113 -0
- package/dist/anim/animStateCompile.js.map +1 -0
- package/dist/anim/animStateSystem.js +17 -0
- package/dist/anim/animStateSystem.js.map +1 -0
- package/dist/anim/animationSystem.js +15 -0
- package/dist/anim/animationSystem.js.map +1 -0
- package/dist/anim/asepriteSlices.js +22 -0
- package/dist/anim/asepriteSlices.js.map +1 -0
- package/dist/anim/asepriteTags.js +35 -0
- package/dist/anim/asepriteTags.js.map +1 -0
- package/dist/anim/parseAseprite.js +83 -0
- package/dist/anim/parseAseprite.js.map +1 -0
- package/dist/assets/AssetLoader.js +104 -0
- package/dist/assets/AssetLoader.js.map +1 -0
- package/dist/assets/loadAseprite.js +50 -0
- package/dist/assets/loadAseprite.js.map +1 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js +31 -0
- package/dist/assets/takeCleanerWorker-DTcI_Jqr.js.map +1 -0
- package/dist/audio/Footsteps.js +26 -0
- package/dist/audio/Footsteps.js.map +1 -0
- package/dist/audio/MusicPlayer.js +78 -0
- package/dist/audio/MusicPlayer.js.map +1 -0
- package/dist/audio/SoundEngine.js +119 -0
- package/dist/audio/SoundEngine.js.map +1 -0
- package/dist/audio/cleanTake.js +30 -0
- package/dist/audio/cleanTake.js.map +1 -0
- package/dist/audio/music/ElementVoice.js +35 -0
- package/dist/audio/music/ElementVoice.js.map +1 -0
- package/dist/audio/music/GraphVoice.js +39 -0
- package/dist/audio/music/GraphVoice.js.map +1 -0
- package/dist/audio/music/MusicChannel.js +58 -0
- package/dist/audio/music/MusicChannel.js.map +1 -0
- package/dist/audio/music/musicVoice.js +13 -0
- package/dist/audio/music/musicVoice.js.map +1 -0
- package/dist/audio/sampleBank.js +82 -0
- package/dist/audio/sampleBank.js.map +1 -0
- package/dist/audio/soundTable.js +9 -0
- package/dist/audio/soundTable.js.map +1 -0
- package/dist/audio/synth.js +36 -0
- package/dist/audio/synth.js.map +1 -0
- package/dist/core/BitmapLabel.js +49 -0
- package/dist/core/BitmapLabel.js.map +1 -0
- package/dist/core/Camera.js +150 -0
- package/dist/core/Camera.js.map +1 -0
- package/dist/core/Clock.js +30 -0
- package/dist/core/Clock.js.map +1 -0
- package/dist/core/Graphics.js +69 -0
- package/dist/core/Graphics.js.map +1 -0
- package/dist/core/Group.js +29 -0
- package/dist/core/Group.js.map +1 -0
- package/dist/core/Image.js +51 -0
- package/dist/core/Image.js.map +1 -0
- package/dist/core/ObjectFactory.js +55 -0
- package/dist/core/ObjectFactory.js.map +1 -0
- package/dist/core/Pointer.js +58 -0
- package/dist/core/Pointer.js.map +1 -0
- package/dist/core/Rectangle.js +51 -0
- package/dist/core/Rectangle.js.map +1 -0
- package/dist/core/Stage.js +86 -0
- package/dist/core/Stage.js.map +1 -0
- package/dist/core/Text.js +22 -0
- package/dist/core/Text.js.map +1 -0
- package/dist/core/TextureRegistry.js +111 -0
- package/dist/core/TextureRegistry.js.map +1 -0
- package/dist/core/Timeline.js +211 -0
- package/dist/core/Timeline.js.map +1 -0
- package/dist/core/TimelineBuilder.js +73 -0
- package/dist/core/TimelineBuilder.js.map +1 -0
- package/dist/core/TimelineChild.js +84 -0
- package/dist/core/TimelineChild.js.map +1 -0
- package/dist/core/Tweener.js +136 -0
- package/dist/core/Tweener.js.map +1 -0
- package/dist/core/atlas.js +38 -0
- package/dist/core/atlas.js.map +1 -0
- package/dist/core/atlasPlan.js +22 -0
- package/dist/core/atlasPlan.js.map +1 -0
- package/dist/core/eases.js +21 -0
- package/dist/core/eases.js.map +1 -0
- package/dist/core/gameObject.js +115 -0
- package/dist/core/gameObject.js.map +1 -0
- package/dist/core/pixiPatches.js +18 -0
- package/dist/core/pixiPatches.js.map +1 -0
- package/dist/core/timelinePlace.js +24 -0
- package/dist/core/timelinePlace.js.map +1 -0
- package/dist/core/tweenProps.js +12 -0
- package/dist/core/tweenProps.js.map +1 -0
- package/dist/debug/DebugOverlay.js +94 -0
- package/dist/debug/DebugOverlay.js.map +1 -0
- package/dist/debug/DrawCallCounter.js +41 -0
- package/dist/debug/DrawCallCounter.js.map +1 -0
- package/dist/debug/ErrorLog.js +22 -0
- package/dist/debug/ErrorLog.js.map +1 -0
- package/dist/debug/FrameStats.js +42 -0
- package/dist/debug/FrameStats.js.map +1 -0
- package/dist/debug/inspectWorld.js +29 -0
- package/dist/debug/inspectWorld.js.map +1 -0
- package/dist/diagnostics/ErrorDeduper.js +27 -0
- package/dist/diagnostics/ErrorDeduper.js.map +1 -0
- package/dist/diagnostics/FrameSampler.js +42 -0
- package/dist/diagnostics/FrameSampler.js.map +1 -0
- package/dist/diagnostics/bootWatch.js +21 -0
- package/dist/diagnostics/bootWatch.js.map +1 -0
- package/dist/diagnostics/captureErrors.js +27 -0
- package/dist/diagnostics/captureErrors.js.map +1 -0
- package/dist/diagnostics/contextLoss.js +25 -0
- package/dist/diagnostics/contextLoss.js.map +1 -0
- package/dist/diagnostics/frameStats.js +31 -0
- package/dist/diagnostics/frameStats.js.map +1 -0
- package/dist/diagnostics/gpuInfo.js +22 -0
- package/dist/diagnostics/gpuInfo.js.map +1 -0
- package/dist/diagnostics/renderGuard.js +24 -0
- package/dist/diagnostics/renderGuard.js.map +1 -0
- package/dist/ecs/SparseSet.js +55 -0
- package/dist/ecs/SparseSet.js.map +1 -0
- package/dist/ecs/World.js +307 -0
- package/dist/ecs/World.js.map +1 -0
- package/dist/ecs/fields.js +26 -0
- package/dist/ecs/fields.js.map +1 -0
- package/dist/engine/Engine.js +82 -0
- package/dist/engine/Engine.js.map +1 -0
- package/dist/engine/FixedLoop.js +37 -0
- package/dist/engine/FixedLoop.js.map +1 -0
- package/dist/engine/Scene.js +79 -0
- package/dist/engine/Scene.js.map +1 -0
- package/dist/engine/SceneManager.js +73 -0
- package/dist/engine/SceneManager.js.map +1 -0
- package/dist/events/EventBus.js +42 -0
- package/dist/events/EventBus.js.map +1 -0
- package/dist/fx/FloatingText.js +72 -0
- package/dist/fx/FloatingText.js.map +1 -0
- package/dist/fx/hitStop.js +28 -0
- package/dist/fx/hitStop.js.map +1 -0
- package/dist/fx/viewCull.js +10 -0
- package/dist/fx/viewCull.js.map +1 -0
- package/dist/i18n/Translator.js +72 -0
- package/dist/i18n/Translator.js.map +1 -0
- package/dist/i18n/extractStrings.js +58 -0
- package/dist/i18n/extractStrings.js.map +1 -0
- package/dist/i18n/formatMessage.js +19 -0
- package/dist/i18n/formatMessage.js.map +1 -0
- package/dist/input/Actions.js +131 -0
- package/dist/input/Actions.js.map +1 -0
- package/dist/input/AimGesture.js +75 -0
- package/dist/input/AimGesture.js.map +1 -0
- package/dist/input/Keyboard.js +54 -0
- package/dist/input/Keyboard.js.map +1 -0
- package/dist/input/Keymap.js +171 -0
- package/dist/input/Keymap.js.map +1 -0
- package/dist/input/TargetLock.js +73 -0
- package/dist/input/TargetLock.js.map +1 -0
- package/dist/input/aimAxis.js +8 -0
- package/dist/input/aimAxis.js.map +1 -0
- package/dist/input/keyChord.js +29 -0
- package/dist/input/keyChord.js.map +1 -0
- package/dist/input/longPress.js +32 -0
- package/dist/input/longPress.js.map +1 -0
- package/dist/input/stickAxis.js +23 -0
- package/dist/input/stickAxis.js.map +1 -0
- package/dist/input/touchDetect.js +7 -0
- package/dist/input/touchDetect.js.map +1 -0
- package/dist/light/LightLayer.js +84 -0
- package/dist/light/LightLayer.js.map +1 -0
- package/dist/nav/MinHeap.js +39 -0
- package/dist/nav/MinHeap.js.map +1 -0
- package/dist/nav/findPath.js +78 -0
- package/dist/nav/findPath.js.map +1 -0
- package/dist/nav/navGrid.js +36 -0
- package/dist/nav/navGrid.js.map +1 -0
- package/dist/nav/nearestOpen.js +19 -0
- package/dist/nav/nearestOpen.js.map +1 -0
- package/dist/nav/straightenPath.js +51 -0
- package/dist/nav/straightenPath.js.map +1 -0
- package/dist/net/Connection.js +84 -0
- package/dist/net/Connection.js.map +1 -0
- package/dist/net/InterpolationBuffer.js +57 -0
- package/dist/net/InterpolationBuffer.js.map +1 -0
- package/dist/net/PredictedMover.js +61 -0
- package/dist/net/PredictedMover.js.map +1 -0
- package/dist/net/Room.js +92 -0
- package/dist/net/Room.js.map +1 -0
- package/dist/net/RoomHost.js +101 -0
- package/dist/net/RoomHost.js.map +1 -0
- package/dist/net/cadence.js +22 -0
- package/dist/net/cadence.js.map +1 -0
- package/dist/net/constants.js +11 -0
- package/dist/net/constants.js.map +1 -0
- package/dist/net/lobby/LobbyClient.js +124 -0
- package/dist/net/lobby/LobbyClient.js.map +1 -0
- package/dist/net/lobby/LobbyHost.js +366 -0
- package/dist/net/lobby/LobbyHost.js.map +1 -0
- package/dist/net/lobby/LobbyRooms.js +66 -0
- package/dist/net/lobby/LobbyRooms.js.map +1 -0
- package/dist/net/lobby/Matchmaker.js +106 -0
- package/dist/net/lobby/Matchmaker.js.map +1 -0
- package/dist/net/movement.js +83 -0
- package/dist/net/movement.js.map +1 -0
- package/dist/net/protocol.js +11 -0
- package/dist/net/protocol.js.map +1 -0
- package/dist/net/serverClock.js +22 -0
- package/dist/net/serverClock.js.map +1 -0
- package/dist/net/snapshotCodec.js +92 -0
- package/dist/net/snapshotCodec.js.map +1 -0
- package/dist/parallax/Parallax.js +32 -0
- package/dist/parallax/Parallax.js.map +1 -0
- package/dist/parallax/ParallaxLayer.js +70 -0
- package/dist/parallax/ParallaxLayer.js.map +1 -0
- package/dist/parallax/parallaxMath.js +27 -0
- package/dist/parallax/parallaxMath.js.map +1 -0
- package/dist/particles/Emitter.js +108 -0
- package/dist/particles/Emitter.js.map +1 -0
- package/dist/particles/ParticleBudget.js +32 -0
- package/dist/particles/ParticleBudget.js.map +1 -0
- package/dist/particles/ParticleSim.js +60 -0
- package/dist/particles/ParticleSim.js.map +1 -0
- package/dist/particles/particleCurves.js +48 -0
- package/dist/particles/particleCurves.js.map +1 -0
- package/dist/particles/particleSampling.js +30 -0
- package/dist/particles/particleSampling.js.map +1 -0
- package/dist/physics/Body.js +202 -0
- package/dist/physics/Body.js.map +1 -0
- package/dist/physics/BroadPhase.js +56 -0
- package/dist/physics/BroadPhase.js.map +1 -0
- package/dist/physics/Contact.js +76 -0
- package/dist/physics/Contact.js.map +1 -0
- package/dist/physics/ContactSolver.js +70 -0
- package/dist/physics/ContactSolver.js.map +1 -0
- package/dist/physics/PhysicsWorld.js +221 -0
- package/dist/physics/PhysicsWorld.js.map +1 -0
- package/dist/physics/SpatialHash.js +39 -0
- package/dist/physics/SpatialHash.js.map +1 -0
- package/dist/physics/collide.js +76 -0
- package/dist/physics/collide.js.map +1 -0
- package/dist/physics/collidePolygon.js +94 -0
- package/dist/physics/collidePolygon.js.map +1 -0
- package/dist/physics/contactReport.js +14 -0
- package/dist/physics/contactReport.js.map +1 -0
- package/dist/physics/drawColliders.js +31 -0
- package/dist/physics/drawColliders.js.map +1 -0
- package/dist/physics/physicsSystem.js +8 -0
- package/dist/physics/physicsSystem.js.map +1 -0
- package/dist/physics/polygon.js +80 -0
- package/dist/physics/polygon.js.map +1 -0
- package/dist/physics/raycast.js +62 -0
- package/dist/physics/raycast.js.map +1 -0
- package/dist/physics/syncToBody.js +19 -0
- package/dist/physics/syncToBody.js.map +1 -0
- package/dist/physics/tileBodies.js +59 -0
- package/dist/physics/tileBodies.js.map +1 -0
- package/dist/physics/types.js +8 -0
- package/dist/physics/types.js.map +1 -0
- package/dist/pixel/Darkness.js +166 -0
- package/dist/pixel/Darkness.js.map +1 -0
- package/dist/pixel/DitherVignette.js +57 -0
- package/dist/pixel/DitherVignette.js.map +1 -0
- package/dist/pixel/Evaporation.js +85 -0
- package/dist/pixel/Evaporation.js.map +1 -0
- package/dist/pixel/NightShade.js +34 -0
- package/dist/pixel/NightShade.js.map +1 -0
- package/dist/pixel/PixelLayer.js +211 -0
- package/dist/pixel/PixelLayer.js.map +1 -0
- package/dist/pixel/SwayProp.js +75 -0
- package/dist/pixel/SwayProp.js.map +1 -0
- package/dist/pixel/lights.js +44 -0
- package/dist/pixel/lights.js.map +1 -0
- package/dist/pixel/nineSlice.js +62 -0
- package/dist/pixel/nineSlice.js.map +1 -0
- package/dist/pixel/paintLayer.js +36 -0
- package/dist/pixel/paintLayer.js.map +1 -0
- package/dist/pixel/palette.js +57 -0
- package/dist/pixel/palette.js.map +1 -0
- package/dist/pixel/pixel.js +278 -0
- package/dist/pixel/pixel.js.map +1 -0
- package/dist/pixel/pixelPaint.js +194 -0
- package/dist/pixel/pixelPaint.js.map +1 -0
- package/dist/pixel/pixelTone.js +164 -0
- package/dist/pixel/pixelTone.js.map +1 -0
- package/dist/pixel/propKit.js +41 -0
- package/dist/pixel/propKit.js.map +1 -0
- package/dist/pixel/ramp.js +102 -0
- package/dist/pixel/ramp.js.map +1 -0
- package/dist/pixel/selout.js +35 -0
- package/dist/pixel/selout.js.map +1 -0
- package/dist/pixel/spritePixels.js +59 -0
- package/dist/pixel/spritePixels.js.map +1 -0
- package/dist/pixel/swayRig.js +87 -0
- package/dist/pixel/swayRig.js.map +1 -0
- package/dist/pixel/vignetteMask.js +24 -0
- package/dist/pixel/vignetteMask.js.map +1 -0
- package/dist/pixel/weatherArt.js +61 -0
- package/dist/pixel/weatherArt.js.map +1 -0
- package/dist/pixel.js +90 -0
- package/dist/pixel.js.map +1 -0
- package/dist/platform/touch.js +33 -0
- package/dist/platform/touch.js.map +1 -0
- package/dist/postfx/BloomFilter.js +65 -0
- package/dist/postfx/BloomFilter.js.map +1 -0
- package/dist/postfx/ChromaticAberrationFilter.js +25 -0
- package/dist/postfx/ChromaticAberrationFilter.js.map +1 -0
- package/dist/postfx/ColorAdjustFilter.js +76 -0
- package/dist/postfx/ColorAdjustFilter.js.map +1 -0
- package/dist/postfx/CrtFilter.js +42 -0
- package/dist/postfx/CrtFilter.js.map +1 -0
- package/dist/postfx/PixelateFilter.js +27 -0
- package/dist/postfx/PixelateFilter.js.map +1 -0
- package/dist/postfx/PostFx.js +123 -0
- package/dist/postfx/PostFx.js.map +1 -0
- package/dist/postfx/ShockwaveFilter.js +49 -0
- package/dist/postfx/ShockwaveFilter.js.map +1 -0
- package/dist/postfx/VignetteFilter.js +37 -0
- package/dist/postfx/VignetteFilter.js.map +1 -0
- package/dist/postfx/fxAnimator.js +38 -0
- package/dist/postfx/fxAnimator.js.map +1 -0
- package/dist/postfx/fxShader.js +128 -0
- package/dist/postfx/fxShader.js.map +1 -0
- package/dist/postfx.js +26 -0
- package/dist/postfx.js.map +1 -0
- package/dist/react/ChoiceDialog.js +51 -0
- package/dist/react/ChoiceDialog.js.map +1 -0
- package/dist/react/ConfirmDialog.js +53 -0
- package/dist/react/ConfirmDialog.js.map +1 -0
- package/dist/react/Glyph.js +63 -0
- package/dist/react/Glyph.js.map +1 -0
- package/dist/react/Modal.js +38 -0
- package/dist/react/Modal.js.map +1 -0
- package/dist/react/Panel.js +24 -0
- package/dist/react/Panel.js.map +1 -0
- package/dist/react/PixelImage.js +24 -0
- package/dist/react/PixelImage.js.map +1 -0
- package/dist/react/Select.js +99 -0
- package/dist/react/Select.js.map +1 -0
- package/dist/react/Slider.js +62 -0
- package/dist/react/Slider.js.map +1 -0
- package/dist/react/SplitPane.js +24 -0
- package/dist/react/SplitPane.js.map +1 -0
- package/dist/react/TabStrip.js +32 -0
- package/dist/react/TabStrip.js.map +1 -0
- package/dist/react/TitleTips.js +42 -0
- package/dist/react/TitleTips.js.map +1 -0
- package/dist/react/Tooltip.js +28 -0
- package/dist/react/Tooltip.js.map +1 -0
- package/dist/react/UiProvider.js +50 -0
- package/dist/react/UiProvider.js.map +1 -0
- package/dist/react/baseCss.js +222 -0
- package/dist/react/baseCss.js.map +1 -0
- package/dist/react/choiceStore.js +23 -0
- package/dist/react/choiceStore.js.map +1 -0
- package/dist/react/classNames.js +19 -0
- package/dist/react/classNames.js.map +1 -0
- package/dist/react/confirmStore.js +30 -0
- package/dist/react/confirmStore.js.map +1 -0
- package/dist/react/labels.js +18 -0
- package/dist/react/labels.js.map +1 -0
- package/dist/react/placement.js +49 -0
- package/dist/react/placement.js.map +1 -0
- package/dist/react/useFillSheet.js +23 -0
- package/dist/react/useFillSheet.js.map +1 -0
- package/dist/react/useFitToViewport.js +29 -0
- package/dist/react/useFitToViewport.js.map +1 -0
- package/dist/react/usePicked.js +13 -0
- package/dist/react/usePicked.js.map +1 -0
- package/dist/react/useStore.js +9 -0
- package/dist/react/useStore.js.map +1 -0
- package/dist/react/useViewport.js +17 -0
- package/dist/react/useViewport.js.map +1 -0
- package/dist/react.js +78 -0
- package/dist/react.js.map +1 -0
- package/dist/rig/PosePlayer.js +92 -0
- package/dist/rig/PosePlayer.js.map +1 -0
- package/dist/rig/RigView.js +125 -0
- package/dist/rig/RigView.js.map +1 -0
- package/dist/rig/Skeleton.js +31 -0
- package/dist/rig/Skeleton.js.map +1 -0
- package/dist/rig/humanoid.js +6 -0
- package/dist/rig/humanoid.js.map +1 -0
- package/dist/rig/humanoid.json.js +30 -0
- package/dist/rig/humanoid.json.js.map +1 -0
- package/dist/rig/humanoidPoses.js +30 -0
- package/dist/rig/humanoidPoses.js.map +1 -0
- package/dist/rig/poseMath.js +54 -0
- package/dist/rig/poseMath.js.map +1 -0
- package/dist/rig/poses.json.js +150 -0
- package/dist/rig/poses.json.js.map +1 -0
- package/dist/save/Autosaver.js +54 -0
- package/dist/save/Autosaver.js.map +1 -0
- package/dist/save/MemoryBackend.js +19 -0
- package/dist/save/MemoryBackend.js.map +1 -0
- package/dist/save/SaveStore.js +103 -0
- package/dist/save/SaveStore.js.map +1 -0
- package/dist/save/WebStorageBackend.js +27 -0
- package/dist/save/WebStorageBackend.js.map +1 -0
- package/dist/save/checksum.js +10 -0
- package/dist/save/checksum.js.map +1 -0
- package/dist/save/migrateSave.js +27 -0
- package/dist/save/migrateSave.js.map +1 -0
- package/dist/settings.js +27 -0
- package/dist/settings.js.map +1 -0
- package/dist/tilemap/TilemapView.js +69 -0
- package/dist/tilemap/TilemapView.js.map +1 -0
- package/dist/tilemap/collision.js +25 -0
- package/dist/tilemap/collision.js.map +1 -0
- package/dist/tilemap/tiled.js +138 -0
- package/dist/tilemap/tiled.js.map +1 -0
- package/dist/transitions/CrossfadeTransition.js +24 -0
- package/dist/transitions/CrossfadeTransition.js.map +1 -0
- package/dist/transitions/DitherWipeTransition.js +70 -0
- package/dist/transitions/DitherWipeTransition.js.map +1 -0
- package/dist/transitions/FadeTransition.js +34 -0
- package/dist/transitions/FadeTransition.js.map +1 -0
- package/dist/transitions/Letterbox.js +42 -0
- package/dist/transitions/Letterbox.js.map +1 -0
- package/dist/transitions/ditherMask.js +15 -0
- package/dist/transitions/ditherMask.js.map +1 -0
- package/dist/transitions/transitionTo.js +28 -0
- package/dist/transitions/transitionTo.js.map +1 -0
- package/dist/transitions/tweenDone.js +15 -0
- package/dist/transitions/tweenDone.js.map +1 -0
- package/dist/types/ambient/ColorGrade.d.ts +41 -0
- package/dist/types/ambient/ColorGrade.d.ts.map +1 -0
- package/dist/types/ambient/DayClock.d.ts +80 -0
- package/dist/types/ambient/DayClock.d.ts.map +1 -0
- package/dist/types/ambient/WeatherLayer.d.ts +78 -0
- package/dist/types/ambient/WeatherLayer.d.ts.map +1 -0
- package/dist/types/ambient/grade.d.ts +22 -0
- package/dist/types/ambient/grade.d.ts.map +1 -0
- package/dist/types/ambient/weather.d.ts +49 -0
- package/dist/types/ambient/weather.d.ts.map +1 -0
- package/dist/types/anim/AnimStateMachine.d.ts +80 -0
- package/dist/types/anim/AnimStateMachine.d.ts.map +1 -0
- package/dist/types/anim/Animator.d.ts +50 -0
- package/dist/types/anim/Animator.d.ts.map +1 -0
- package/dist/types/anim/animStateCompile.d.ts +52 -0
- package/dist/types/anim/animStateCompile.d.ts.map +1 -0
- package/dist/types/anim/animStateSystem.d.ts +10 -0
- package/dist/types/anim/animStateSystem.d.ts.map +1 -0
- package/dist/types/anim/animStateTypes.d.ts +50 -0
- package/dist/types/anim/animStateTypes.d.ts.map +1 -0
- package/dist/types/anim/animationSystem.d.ts +13 -0
- package/dist/types/anim/animationSystem.d.ts.map +1 -0
- package/dist/types/anim/asepriteSlices.d.ts +19 -0
- package/dist/types/anim/asepriteSlices.d.ts.map +1 -0
- package/dist/types/anim/asepriteTags.d.ts +16 -0
- package/dist/types/anim/asepriteTags.d.ts.map +1 -0
- package/dist/types/anim/asepriteTypes.d.ts +159 -0
- package/dist/types/anim/asepriteTypes.d.ts.map +1 -0
- package/dist/types/anim/parseAseprite.d.ts +21 -0
- package/dist/types/anim/parseAseprite.d.ts.map +1 -0
- package/dist/types/assets/AssetLoader.d.ts +85 -0
- package/dist/types/assets/AssetLoader.d.ts.map +1 -0
- package/dist/types/assets/loadAseprite.d.ts +27 -0
- package/dist/types/assets/loadAseprite.d.ts.map +1 -0
- package/dist/types/audio/Footsteps.d.ts +33 -0
- package/dist/types/audio/Footsteps.d.ts.map +1 -0
- package/dist/types/audio/MusicPlayer.d.ts +65 -0
- package/dist/types/audio/MusicPlayer.d.ts.map +1 -0
- package/dist/types/audio/SoundEngine.d.ts +42 -0
- package/dist/types/audio/SoundEngine.d.ts.map +1 -0
- package/dist/types/audio/cleanTake.d.ts +3 -0
- package/dist/types/audio/cleanTake.d.ts.map +1 -0
- package/dist/types/audio/music/ElementVoice.d.ts +14 -0
- package/dist/types/audio/music/ElementVoice.d.ts.map +1 -0
- package/dist/types/audio/music/GraphVoice.d.ts +22 -0
- package/dist/types/audio/music/GraphVoice.d.ts.map +1 -0
- package/dist/types/audio/music/MusicChannel.d.ts +35 -0
- package/dist/types/audio/music/MusicChannel.d.ts.map +1 -0
- package/dist/types/audio/music/musicVoice.d.ts +26 -0
- package/dist/types/audio/music/musicVoice.d.ts.map +1 -0
- package/dist/types/audio/sampleBank.d.ts +27 -0
- package/dist/types/audio/sampleBank.d.ts.map +1 -0
- package/dist/types/audio/soundTable.d.ts +14 -0
- package/dist/types/audio/soundTable.d.ts.map +1 -0
- package/dist/types/audio/synth.d.ts +34 -0
- package/dist/types/audio/synth.d.ts.map +1 -0
- package/dist/types/audio/takeCleanerWorker.d.ts +2 -0
- package/dist/types/audio/takeCleanerWorker.d.ts.map +1 -0
- package/dist/types/core/BitmapLabel.d.ts +36 -0
- package/dist/types/core/BitmapLabel.d.ts.map +1 -0
- package/dist/types/core/Camera.d.ts +115 -0
- package/dist/types/core/Camera.d.ts.map +1 -0
- package/dist/types/core/Clock.d.ts +11 -0
- package/dist/types/core/Clock.d.ts.map +1 -0
- package/dist/types/core/Graphics.d.ts +37 -0
- package/dist/types/core/Graphics.d.ts.map +1 -0
- package/dist/types/core/Group.d.ts +15 -0
- package/dist/types/core/Group.d.ts.map +1 -0
- package/dist/types/core/Image.d.ts +25 -0
- package/dist/types/core/Image.d.ts.map +1 -0
- package/dist/types/core/ObjectFactory.d.ts +34 -0
- package/dist/types/core/ObjectFactory.d.ts.map +1 -0
- package/dist/types/core/Pointer.d.ts +27 -0
- package/dist/types/core/Pointer.d.ts.map +1 -0
- package/dist/types/core/Rectangle.d.ts +26 -0
- package/dist/types/core/Rectangle.d.ts.map +1 -0
- package/dist/types/core/Stage.d.ts +58 -0
- package/dist/types/core/Stage.d.ts.map +1 -0
- package/dist/types/core/Text.d.ts +22 -0
- package/dist/types/core/Text.d.ts.map +1 -0
- package/dist/types/core/TextureRegistry.d.ts +51 -0
- package/dist/types/core/TextureRegistry.d.ts.map +1 -0
- package/dist/types/core/Timeline.d.ts +115 -0
- package/dist/types/core/Timeline.d.ts.map +1 -0
- package/dist/types/core/TimelineBuilder.d.ts +53 -0
- package/dist/types/core/TimelineBuilder.d.ts.map +1 -0
- package/dist/types/core/TimelineChild.d.ts +51 -0
- package/dist/types/core/TimelineChild.d.ts.map +1 -0
- package/dist/types/core/Tweener.d.ts +70 -0
- package/dist/types/core/Tweener.d.ts.map +1 -0
- package/dist/types/core/atlas.d.ts +16 -0
- package/dist/types/core/atlas.d.ts.map +1 -0
- package/dist/types/core/atlasPlan.d.ts +34 -0
- package/dist/types/core/atlasPlan.d.ts.map +1 -0
- package/dist/types/core/eases.d.ts +3 -0
- package/dist/types/core/eases.d.ts.map +1 -0
- package/dist/types/core/gameObject.d.ts +42 -0
- package/dist/types/core/gameObject.d.ts.map +1 -0
- package/dist/types/core/pixiPatches.d.ts +9 -0
- package/dist/types/core/pixiPatches.d.ts.map +1 -0
- package/dist/types/core/timelinePlace.d.ts +23 -0
- package/dist/types/core/timelinePlace.d.ts.map +1 -0
- package/dist/types/core/tweenProps.d.ts +8 -0
- package/dist/types/core/tweenProps.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +4 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/debug/DebugOverlay.d.ts +63 -0
- package/dist/types/debug/DebugOverlay.d.ts.map +1 -0
- package/dist/types/debug/DrawCallCounter.d.ts +20 -0
- package/dist/types/debug/DrawCallCounter.d.ts.map +1 -0
- package/dist/types/debug/ErrorLog.d.ts +20 -0
- package/dist/types/debug/ErrorLog.d.ts.map +1 -0
- package/dist/types/debug/FrameStats.d.ts +21 -0
- package/dist/types/debug/FrameStats.d.ts.map +1 -0
- package/dist/types/debug/inspectWorld.d.ts +14 -0
- package/dist/types/debug/inspectWorld.d.ts.map +1 -0
- package/dist/types/diagnostics/ErrorDeduper.d.ts +17 -0
- package/dist/types/diagnostics/ErrorDeduper.d.ts.map +1 -0
- package/dist/types/diagnostics/FrameSampler.d.ts +37 -0
- package/dist/types/diagnostics/FrameSampler.d.ts.map +1 -0
- package/dist/types/diagnostics/bootWatch.d.ts +25 -0
- package/dist/types/diagnostics/bootWatch.d.ts.map +1 -0
- package/dist/types/diagnostics/captureErrors.d.ts +24 -0
- package/dist/types/diagnostics/captureErrors.d.ts.map +1 -0
- package/dist/types/diagnostics/contextLoss.d.ts +35 -0
- package/dist/types/diagnostics/contextLoss.d.ts.map +1 -0
- package/dist/types/diagnostics/frameStats.d.ts +30 -0
- package/dist/types/diagnostics/frameStats.d.ts.map +1 -0
- package/dist/types/diagnostics/gpuInfo.d.ts +9 -0
- package/dist/types/diagnostics/gpuInfo.d.ts.map +1 -0
- package/dist/types/diagnostics/renderGuard.d.ts +12 -0
- package/dist/types/diagnostics/renderGuard.d.ts.map +1 -0
- package/dist/types/ecs/SparseSet.d.ts +25 -0
- package/dist/types/ecs/SparseSet.d.ts.map +1 -0
- package/dist/types/ecs/World.d.ts +137 -0
- package/dist/types/ecs/World.d.ts.map +1 -0
- package/dist/types/ecs/fields.d.ts +34 -0
- package/dist/types/ecs/fields.d.ts.map +1 -0
- package/dist/types/engine/Engine.d.ts +80 -0
- package/dist/types/engine/Engine.d.ts.map +1 -0
- package/dist/types/engine/FixedLoop.d.ts +32 -0
- package/dist/types/engine/FixedLoop.d.ts.map +1 -0
- package/dist/types/engine/Scene.d.ts +67 -0
- package/dist/types/engine/Scene.d.ts.map +1 -0
- package/dist/types/engine/SceneManager.d.ts +36 -0
- package/dist/types/engine/SceneManager.d.ts.map +1 -0
- package/dist/types/events/EventBus.d.ts +20 -0
- package/dist/types/events/EventBus.d.ts.map +1 -0
- package/dist/types/fx/FloatingText.d.ts +71 -0
- package/dist/types/fx/FloatingText.d.ts.map +1 -0
- package/dist/types/fx/hitStop.d.ts +20 -0
- package/dist/types/fx/hitStop.d.ts.map +1 -0
- package/dist/types/fx/viewCull.d.ts +14 -0
- package/dist/types/fx/viewCull.d.ts.map +1 -0
- package/dist/types/i18n/Translator.d.ts +52 -0
- package/dist/types/i18n/Translator.d.ts.map +1 -0
- package/dist/types/i18n/extractStrings.d.ts +25 -0
- package/dist/types/i18n/extractStrings.d.ts.map +1 -0
- package/dist/types/i18n/formatMessage.d.ts +10 -0
- package/dist/types/i18n/formatMessage.d.ts.map +1 -0
- package/dist/types/index.d.ts +149 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/input/Actions.d.ts +94 -0
- package/dist/types/input/Actions.d.ts.map +1 -0
- package/dist/types/input/AimGesture.d.ts +106 -0
- package/dist/types/input/AimGesture.d.ts.map +1 -0
- package/dist/types/input/Keyboard.d.ts +30 -0
- package/dist/types/input/Keyboard.d.ts.map +1 -0
- package/dist/types/input/Keymap.d.ts +85 -0
- package/dist/types/input/Keymap.d.ts.map +1 -0
- package/dist/types/input/TargetLock.d.ts +56 -0
- package/dist/types/input/TargetLock.d.ts.map +1 -0
- package/dist/types/input/aimAxis.d.ts +9 -0
- package/dist/types/input/aimAxis.d.ts.map +1 -0
- package/dist/types/input/keyChord.d.ts +15 -0
- package/dist/types/input/keyChord.d.ts.map +1 -0
- package/dist/types/input/longPress.d.ts +21 -0
- package/dist/types/input/longPress.d.ts.map +1 -0
- package/dist/types/input/stickAxis.d.ts +26 -0
- package/dist/types/input/stickAxis.d.ts.map +1 -0
- package/dist/types/input/touchDetect.d.ts +18 -0
- package/dist/types/input/touchDetect.d.ts.map +1 -0
- package/dist/types/light/LightLayer.d.ts +65 -0
- package/dist/types/light/LightLayer.d.ts.map +1 -0
- package/dist/types/nav/MinHeap.d.ts +15 -0
- package/dist/types/nav/MinHeap.d.ts.map +1 -0
- package/dist/types/nav/findPath.d.ts +38 -0
- package/dist/types/nav/findPath.d.ts.map +1 -0
- package/dist/types/nav/navGrid.d.ts +48 -0
- package/dist/types/nav/navGrid.d.ts.map +1 -0
- package/dist/types/nav/nearestOpen.d.ts +8 -0
- package/dist/types/nav/nearestOpen.d.ts.map +1 -0
- package/dist/types/nav/straightenPath.d.ts +13 -0
- package/dist/types/nav/straightenPath.d.ts.map +1 -0
- package/dist/types/net/Connection.d.ts +66 -0
- package/dist/types/net/Connection.d.ts.map +1 -0
- package/dist/types/net/InterpolationBuffer.d.ts +36 -0
- package/dist/types/net/InterpolationBuffer.d.ts.map +1 -0
- package/dist/types/net/PredictedMover.d.ts +43 -0
- package/dist/types/net/PredictedMover.d.ts.map +1 -0
- package/dist/types/net/Room.d.ts +69 -0
- package/dist/types/net/Room.d.ts.map +1 -0
- package/dist/types/net/RoomHost.d.ts +74 -0
- package/dist/types/net/RoomHost.d.ts.map +1 -0
- package/dist/types/net/cadence.d.ts +22 -0
- package/dist/types/net/cadence.d.ts.map +1 -0
- package/dist/types/net/constants.d.ts +24 -0
- package/dist/types/net/constants.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyClient.d.ts +107 -0
- package/dist/types/net/lobby/LobbyClient.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyHost.d.ts +147 -0
- package/dist/types/net/lobby/LobbyHost.d.ts.map +1 -0
- package/dist/types/net/lobby/LobbyRooms.d.ts +56 -0
- package/dist/types/net/lobby/LobbyRooms.d.ts.map +1 -0
- package/dist/types/net/lobby/Matchmaker.d.ts +57 -0
- package/dist/types/net/lobby/Matchmaker.d.ts.map +1 -0
- package/dist/types/net/lobby/index.d.ts +6 -0
- package/dist/types/net/lobby/index.d.ts.map +1 -0
- package/dist/types/net/lobby/lobbyProtocol.d.ts +143 -0
- package/dist/types/net/lobby/lobbyProtocol.d.ts.map +1 -0
- package/dist/types/net/movement.d.ts +50 -0
- package/dist/types/net/movement.d.ts.map +1 -0
- package/dist/types/net/protocol.d.ts +59 -0
- package/dist/types/net/protocol.d.ts.map +1 -0
- package/dist/types/net/serverClock.d.ts +14 -0
- package/dist/types/net/serverClock.d.ts.map +1 -0
- package/dist/types/net/snapshotCodec.d.ts +55 -0
- package/dist/types/net/snapshotCodec.d.ts.map +1 -0
- package/dist/types/parallax/Parallax.d.ts +37 -0
- package/dist/types/parallax/Parallax.d.ts.map +1 -0
- package/dist/types/parallax/ParallaxLayer.d.ts +80 -0
- package/dist/types/parallax/ParallaxLayer.d.ts.map +1 -0
- package/dist/types/parallax/parallaxMath.d.ts +50 -0
- package/dist/types/parallax/parallaxMath.d.ts.map +1 -0
- package/dist/types/particles/Emitter.d.ts +97 -0
- package/dist/types/particles/Emitter.d.ts.map +1 -0
- package/dist/types/particles/ParticleBudget.d.ts +28 -0
- package/dist/types/particles/ParticleBudget.d.ts.map +1 -0
- package/dist/types/particles/ParticleSim.d.ts +38 -0
- package/dist/types/particles/ParticleSim.d.ts.map +1 -0
- package/dist/types/particles/particleCurves.d.ts +21 -0
- package/dist/types/particles/particleCurves.d.ts.map +1 -0
- package/dist/types/particles/particleSampling.d.ts +20 -0
- package/dist/types/particles/particleSampling.d.ts.map +1 -0
- package/dist/types/physics/Body.d.ts +130 -0
- package/dist/types/physics/Body.d.ts.map +1 -0
- package/dist/types/physics/BroadPhase.d.ts +26 -0
- package/dist/types/physics/BroadPhase.d.ts.map +1 -0
- package/dist/types/physics/Contact.d.ts +62 -0
- package/dist/types/physics/Contact.d.ts.map +1 -0
- package/dist/types/physics/ContactSolver.d.ts +29 -0
- package/dist/types/physics/ContactSolver.d.ts.map +1 -0
- package/dist/types/physics/PhysicsWorld.d.ts +78 -0
- package/dist/types/physics/PhysicsWorld.d.ts.map +1 -0
- package/dist/types/physics/PhysicsWorldOptions.d.ts +24 -0
- package/dist/types/physics/PhysicsWorldOptions.d.ts.map +1 -0
- package/dist/types/physics/SpatialHash.d.ts +23 -0
- package/dist/types/physics/SpatialHash.d.ts.map +1 -0
- package/dist/types/physics/collide.d.ts +27 -0
- package/dist/types/physics/collide.d.ts.map +1 -0
- package/dist/types/physics/collidePolygon.d.ts +14 -0
- package/dist/types/physics/collidePolygon.d.ts.map +1 -0
- package/dist/types/physics/contactReport.d.ts +8 -0
- package/dist/types/physics/contactReport.d.ts.map +1 -0
- package/dist/types/physics/drawColliders.d.ts +43 -0
- package/dist/types/physics/drawColliders.d.ts.map +1 -0
- package/dist/types/physics/physicsSystem.d.ts +5 -0
- package/dist/types/physics/physicsSystem.d.ts.map +1 -0
- package/dist/types/physics/polygon.d.ts +28 -0
- package/dist/types/physics/polygon.d.ts.map +1 -0
- package/dist/types/physics/raycast.d.ts +19 -0
- package/dist/types/physics/raycast.d.ts.map +1 -0
- package/dist/types/physics/syncToBody.d.ts +16 -0
- package/dist/types/physics/syncToBody.d.ts.map +1 -0
- package/dist/types/physics/tileBodies.d.ts +36 -0
- package/dist/types/physics/tileBodies.d.ts.map +1 -0
- package/dist/types/physics/types.d.ts +116 -0
- package/dist/types/physics/types.d.ts.map +1 -0
- package/dist/types/pixel/Darkness.d.ts +78 -0
- package/dist/types/pixel/Darkness.d.ts.map +1 -0
- package/dist/types/pixel/DitherVignette.d.ts +35 -0
- package/dist/types/pixel/DitherVignette.d.ts.map +1 -0
- package/dist/types/pixel/Evaporation.d.ts +30 -0
- package/dist/types/pixel/Evaporation.d.ts.map +1 -0
- package/dist/types/pixel/NightShade.d.ts +38 -0
- package/dist/types/pixel/NightShade.d.ts.map +1 -0
- package/dist/types/pixel/PixelLayer.d.ts +85 -0
- package/dist/types/pixel/PixelLayer.d.ts.map +1 -0
- package/dist/types/pixel/SwayProp.d.ts +52 -0
- package/dist/types/pixel/SwayProp.d.ts.map +1 -0
- package/dist/types/pixel/index.d.ts +31 -0
- package/dist/types/pixel/index.d.ts.map +1 -0
- package/dist/types/pixel/lights.d.ts +34 -0
- package/dist/types/pixel/lights.d.ts.map +1 -0
- package/dist/types/pixel/nineSlice.d.ts +71 -0
- package/dist/types/pixel/nineSlice.d.ts.map +1 -0
- package/dist/types/pixel/paintLayer.d.ts +35 -0
- package/dist/types/pixel/paintLayer.d.ts.map +1 -0
- package/dist/types/pixel/palette.d.ts +58 -0
- package/dist/types/pixel/palette.d.ts.map +1 -0
- package/dist/types/pixel/pixel.d.ts +80 -0
- package/dist/types/pixel/pixel.d.ts.map +1 -0
- package/dist/types/pixel/pixelPaint.d.ts +43 -0
- package/dist/types/pixel/pixelPaint.d.ts.map +1 -0
- package/dist/types/pixel/pixelTone.d.ts +51 -0
- package/dist/types/pixel/pixelTone.d.ts.map +1 -0
- package/dist/types/pixel/propKit.d.ts +26 -0
- package/dist/types/pixel/propKit.d.ts.map +1 -0
- package/dist/types/pixel/ramp.d.ts +57 -0
- package/dist/types/pixel/ramp.d.ts.map +1 -0
- package/dist/types/pixel/selout.d.ts +3 -0
- package/dist/types/pixel/selout.d.ts.map +1 -0
- package/dist/types/pixel/spritePixels.d.ts +29 -0
- package/dist/types/pixel/spritePixels.d.ts.map +1 -0
- package/dist/types/pixel/swayRig.d.ts +72 -0
- package/dist/types/pixel/swayRig.d.ts.map +1 -0
- package/dist/types/pixel/vignetteMask.d.ts +16 -0
- package/dist/types/pixel/vignetteMask.d.ts.map +1 -0
- package/dist/types/pixel/weatherArt.d.ts +29 -0
- package/dist/types/pixel/weatherArt.d.ts.map +1 -0
- package/dist/types/platform/touch.d.ts +10 -0
- package/dist/types/platform/touch.d.ts.map +1 -0
- package/dist/types/postfx/BloomFilter.d.ts +33 -0
- package/dist/types/postfx/BloomFilter.d.ts.map +1 -0
- package/dist/types/postfx/ChromaticAberrationFilter.d.ts +11 -0
- package/dist/types/postfx/ChromaticAberrationFilter.d.ts.map +1 -0
- package/dist/types/postfx/ColorAdjustFilter.d.ts +32 -0
- package/dist/types/postfx/ColorAdjustFilter.d.ts.map +1 -0
- package/dist/types/postfx/CrtFilter.d.ts +16 -0
- package/dist/types/postfx/CrtFilter.d.ts.map +1 -0
- package/dist/types/postfx/PixelateFilter.d.ts +8 -0
- package/dist/types/postfx/PixelateFilter.d.ts.map +1 -0
- package/dist/types/postfx/PostFx.d.ts +92 -0
- package/dist/types/postfx/PostFx.d.ts.map +1 -0
- package/dist/types/postfx/ShockwaveFilter.d.ts +20 -0
- package/dist/types/postfx/ShockwaveFilter.d.ts.map +1 -0
- package/dist/types/postfx/VignetteFilter.d.ts +19 -0
- package/dist/types/postfx/VignetteFilter.d.ts.map +1 -0
- package/dist/types/postfx/fxAnimator.d.ts +32 -0
- package/dist/types/postfx/fxAnimator.d.ts.map +1 -0
- package/dist/types/postfx/fxShader.d.ts +49 -0
- package/dist/types/postfx/fxShader.d.ts.map +1 -0
- package/dist/types/postfx/index.d.ts +11 -0
- package/dist/types/postfx/index.d.ts.map +1 -0
- package/dist/types/react/ChoiceDialog.d.ts +8 -0
- package/dist/types/react/ChoiceDialog.d.ts.map +1 -0
- package/dist/types/react/ConfirmDialog.d.ts +9 -0
- package/dist/types/react/ConfirmDialog.d.ts.map +1 -0
- package/dist/types/react/Glyph.d.ts +54 -0
- package/dist/types/react/Glyph.d.ts.map +1 -0
- package/dist/types/react/Modal.d.ts +22 -0
- package/dist/types/react/Modal.d.ts.map +1 -0
- package/dist/types/react/Panel.d.ts +29 -0
- package/dist/types/react/Panel.d.ts.map +1 -0
- package/dist/types/react/PixelImage.d.ts +19 -0
- package/dist/types/react/PixelImage.d.ts.map +1 -0
- package/dist/types/react/Select.d.ts +27 -0
- package/dist/types/react/Select.d.ts.map +1 -0
- package/dist/types/react/Slider.d.ts +24 -0
- package/dist/types/react/Slider.d.ts.map +1 -0
- package/dist/types/react/SplitPane.d.ts +26 -0
- package/dist/types/react/SplitPane.d.ts.map +1 -0
- package/dist/types/react/TabStrip.d.ts +31 -0
- package/dist/types/react/TabStrip.d.ts.map +1 -0
- package/dist/types/react/TitleTips.d.ts +15 -0
- package/dist/types/react/TitleTips.d.ts.map +1 -0
- package/dist/types/react/Tooltip.d.ts +22 -0
- package/dist/types/react/Tooltip.d.ts.map +1 -0
- package/dist/types/react/UiProvider.d.ts +52 -0
- package/dist/types/react/UiProvider.d.ts.map +1 -0
- package/dist/types/react/baseCss.d.ts +27 -0
- package/dist/types/react/baseCss.d.ts.map +1 -0
- package/dist/types/react/choiceStore.d.ts +34 -0
- package/dist/types/react/choiceStore.d.ts.map +1 -0
- package/dist/types/react/classNames.d.ts +12 -0
- package/dist/types/react/classNames.d.ts.map +1 -0
- package/dist/types/react/confirmStore.d.ts +30 -0
- package/dist/types/react/confirmStore.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +33 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/react/labels.d.ts +24 -0
- package/dist/types/react/labels.d.ts.map +1 -0
- package/dist/types/react/placement.d.ts +59 -0
- package/dist/types/react/placement.d.ts.map +1 -0
- package/dist/types/react/useFillSheet.d.ts +9 -0
- package/dist/types/react/useFillSheet.d.ts.map +1 -0
- package/dist/types/react/useFitToViewport.d.ts +20 -0
- package/dist/types/react/useFitToViewport.d.ts.map +1 -0
- package/dist/types/react/usePicked.d.ts +9 -0
- package/dist/types/react/usePicked.d.ts.map +1 -0
- package/dist/types/react/useStore.d.ts +8 -0
- package/dist/types/react/useStore.d.ts.map +1 -0
- package/dist/types/react/useViewport.d.ts +4 -0
- package/dist/types/react/useViewport.d.ts.map +1 -0
- package/dist/types/rig/PosePlayer.d.ts +64 -0
- package/dist/types/rig/PosePlayer.d.ts.map +1 -0
- package/dist/types/rig/RigView.d.ts +68 -0
- package/dist/types/rig/RigView.d.ts.map +1 -0
- package/dist/types/rig/Skeleton.d.ts +14 -0
- package/dist/types/rig/Skeleton.d.ts.map +1 -0
- package/dist/types/rig/humanoid.d.ts +4 -0
- package/dist/types/rig/humanoid.d.ts.map +1 -0
- package/dist/types/rig/humanoidPoses.d.ts +117 -0
- package/dist/types/rig/humanoidPoses.d.ts.map +1 -0
- package/dist/types/rig/poseMath.d.ts +14 -0
- package/dist/types/rig/poseMath.d.ts.map +1 -0
- package/dist/types/rig/rigTypes.d.ts +82 -0
- package/dist/types/rig/rigTypes.d.ts.map +1 -0
- package/dist/types/save/Autosaver.d.ts +43 -0
- package/dist/types/save/Autosaver.d.ts.map +1 -0
- package/dist/types/save/MemoryBackend.d.ts +10 -0
- package/dist/types/save/MemoryBackend.d.ts.map +1 -0
- package/dist/types/save/SaveBackend.d.ts +14 -0
- package/dist/types/save/SaveBackend.d.ts.map +1 -0
- package/dist/types/save/SaveStore.d.ts +73 -0
- package/dist/types/save/SaveStore.d.ts.map +1 -0
- package/dist/types/save/WebStorageBackend.d.ts +14 -0
- package/dist/types/save/WebStorageBackend.d.ts.map +1 -0
- package/dist/types/save/checksum.d.ts +7 -0
- package/dist/types/save/checksum.d.ts.map +1 -0
- package/dist/types/save/migrateSave.d.ts +17 -0
- package/dist/types/save/migrateSave.d.ts.map +1 -0
- package/dist/types/settings.d.ts +25 -0
- package/dist/types/settings.d.ts.map +1 -0
- package/dist/types/tilemap/TilemapView.d.ts +42 -0
- package/dist/types/tilemap/TilemapView.d.ts.map +1 -0
- package/dist/types/tilemap/collision.d.ts +16 -0
- package/dist/types/tilemap/collision.d.ts.map +1 -0
- package/dist/types/tilemap/tiled.d.ts +104 -0
- package/dist/types/tilemap/tiled.d.ts.map +1 -0
- package/dist/types/transitions/CrossfadeTransition.d.ts +20 -0
- package/dist/types/transitions/CrossfadeTransition.d.ts.map +1 -0
- package/dist/types/transitions/DitherWipeTransition.d.ts +35 -0
- package/dist/types/transitions/DitherWipeTransition.d.ts.map +1 -0
- package/dist/types/transitions/FadeTransition.d.ts +20 -0
- package/dist/types/transitions/FadeTransition.d.ts.map +1 -0
- package/dist/types/transitions/Letterbox.d.ts +33 -0
- package/dist/types/transitions/Letterbox.d.ts.map +1 -0
- package/dist/types/transitions/Transition.d.ts +22 -0
- package/dist/types/transitions/Transition.d.ts.map +1 -0
- package/dist/types/transitions/ditherMask.d.ts +13 -0
- package/dist/types/transitions/ditherMask.d.ts.map +1 -0
- package/dist/types/transitions/transitionTo.d.ts +16 -0
- package/dist/types/transitions/transitionTo.d.ts.map +1 -0
- package/dist/types/transitions/tweenDone.d.ts +5 -0
- package/dist/types/transitions/tweenDone.d.ts.map +1 -0
- package/dist/types/ui/Bar.d.ts +41 -0
- package/dist/types/ui/Bar.d.ts.map +1 -0
- package/dist/types/ui/Button.d.ts +47 -0
- package/dist/types/ui/Button.d.ts.map +1 -0
- package/dist/types/ui/Dialog.d.ts +47 -0
- package/dist/types/ui/Dialog.d.ts.map +1 -0
- package/dist/types/ui/FocusManager.d.ts +53 -0
- package/dist/types/ui/FocusManager.d.ts.map +1 -0
- package/dist/types/ui/Label.d.ts +24 -0
- package/dist/types/ui/Label.d.ts.map +1 -0
- package/dist/types/ui/List.d.ts +23 -0
- package/dist/types/ui/List.d.ts.map +1 -0
- package/dist/types/ui/Panel.d.ts +38 -0
- package/dist/types/ui/Panel.d.ts.map +1 -0
- package/dist/types/ui/ScrollView.d.ts +56 -0
- package/dist/types/ui/ScrollView.d.ts.map +1 -0
- package/dist/types/ui/Slider.d.ts +47 -0
- package/dist/types/ui/Slider.d.ts.map +1 -0
- package/dist/types/ui/Stack.d.ts +16 -0
- package/dist/types/ui/Stack.d.ts.map +1 -0
- package/dist/types/ui/Toggle.d.ts +31 -0
- package/dist/types/ui/Toggle.d.ts.map +1 -0
- package/dist/types/ui/UiHost.d.ts +18 -0
- package/dist/types/ui/UiHost.d.ts.map +1 -0
- package/dist/types/ui/UiPointerGate.d.ts +17 -0
- package/dist/types/ui/UiPointerGate.d.ts.map +1 -0
- package/dist/types/ui/UiRoot.d.ts +73 -0
- package/dist/types/ui/UiRoot.d.ts.map +1 -0
- package/dist/types/ui/Widget.d.ts +56 -0
- package/dist/types/ui/Widget.d.ts.map +1 -0
- package/dist/types/ui/dom/DomOverlay.d.ts +52 -0
- package/dist/types/ui/dom/DomOverlay.d.ts.map +1 -0
- package/dist/types/ui/dom/DomWorldAnchors.d.ts +50 -0
- package/dist/types/ui/dom/DomWorldAnchors.d.ts.map +1 -0
- package/dist/types/ui/dom/InputShield.d.ts +20 -0
- package/dist/types/ui/dom/InputShield.d.ts.map +1 -0
- package/dist/types/ui/dom/createStore.d.ts +22 -0
- package/dist/types/ui/dom/createStore.d.ts.map +1 -0
- package/dist/types/ui/dom/shieldDecision.d.ts +34 -0
- package/dist/types/ui/dom/shieldDecision.d.ts.map +1 -0
- package/dist/types/ui/dom/worldToScreen.d.ts +24 -0
- package/dist/types/ui/dom/worldToScreen.d.ts.map +1 -0
- package/dist/types/ui/index.d.ts +38 -0
- package/dist/types/ui/index.d.ts.map +1 -0
- package/dist/types/ui/layout/anchor.d.ts +9 -0
- package/dist/types/ui/layout/anchor.d.ts.map +1 -0
- package/dist/types/ui/layout/barDrain.d.ts +25 -0
- package/dist/types/ui/layout/barDrain.d.ts.map +1 -0
- package/dist/types/ui/layout/fitToViewport.d.ts +32 -0
- package/dist/types/ui/layout/fitToViewport.d.ts.map +1 -0
- package/dist/types/ui/layout/focusNav.d.ts +13 -0
- package/dist/types/ui/layout/focusNav.d.ts.map +1 -0
- package/dist/types/ui/layout/geometry.d.ts +35 -0
- package/dist/types/ui/layout/geometry.d.ts.map +1 -0
- package/dist/types/ui/layout/listWidth.d.ts +13 -0
- package/dist/types/ui/layout/listWidth.d.ts.map +1 -0
- package/dist/types/ui/layout/placeTooltip.d.ts +23 -0
- package/dist/types/ui/layout/placeTooltip.d.ts.map +1 -0
- package/dist/types/ui/layout/scroll.d.ts +17 -0
- package/dist/types/ui/layout/scroll.d.ts.map +1 -0
- package/dist/types/ui/layout/slider.d.ts +7 -0
- package/dist/types/ui/layout/slider.d.ts.map +1 -0
- package/dist/types/ui/layout/stack.d.ts +26 -0
- package/dist/types/ui/layout/stack.d.ts.map +1 -0
- package/dist/types/ui/layout/wrapRow.d.ts +6 -0
- package/dist/types/ui/layout/wrapRow.d.ts.map +1 -0
- package/dist/ui/Bar.js +54 -0
- package/dist/ui/Bar.js.map +1 -0
- package/dist/ui/Button.js +58 -0
- package/dist/ui/Button.js.map +1 -0
- package/dist/ui/Dialog.js +56 -0
- package/dist/ui/Dialog.js.map +1 -0
- package/dist/ui/FocusManager.js +97 -0
- package/dist/ui/FocusManager.js.map +1 -0
- package/dist/ui/Label.js +36 -0
- package/dist/ui/Label.js.map +1 -0
- package/dist/ui/List.js +45 -0
- package/dist/ui/List.js.map +1 -0
- package/dist/ui/Panel.js +38 -0
- package/dist/ui/Panel.js.map +1 -0
- package/dist/ui/ScrollView.js +96 -0
- package/dist/ui/ScrollView.js.map +1 -0
- package/dist/ui/Slider.js +55 -0
- package/dist/ui/Slider.js.map +1 -0
- package/dist/ui/Stack.js +28 -0
- package/dist/ui/Stack.js.map +1 -0
- package/dist/ui/Toggle.js +37 -0
- package/dist/ui/Toggle.js.map +1 -0
- package/dist/ui/UiHost.js +9 -0
- package/dist/ui/UiHost.js.map +1 -0
- package/dist/ui/UiPointerGate.js +25 -0
- package/dist/ui/UiPointerGate.js.map +1 -0
- package/dist/ui/UiRoot.js +93 -0
- package/dist/ui/UiRoot.js.map +1 -0
- package/dist/ui/Widget.js +90 -0
- package/dist/ui/Widget.js.map +1 -0
- package/dist/ui/dom/DomOverlay.js +59 -0
- package/dist/ui/dom/DomOverlay.js.map +1 -0
- package/dist/ui/dom/DomWorldAnchors.js +59 -0
- package/dist/ui/dom/DomWorldAnchors.js.map +1 -0
- package/dist/ui/dom/InputShield.js +27 -0
- package/dist/ui/dom/InputShield.js.map +1 -0
- package/dist/ui/dom/createStore.js +42 -0
- package/dist/ui/dom/createStore.js.map +1 -0
- package/dist/ui/dom/shieldDecision.js +36 -0
- package/dist/ui/dom/shieldDecision.js.map +1 -0
- package/dist/ui/dom/worldToScreen.js +11 -0
- package/dist/ui/dom/worldToScreen.js.map +1 -0
- package/dist/ui/layout/anchor.js +20 -0
- package/dist/ui/layout/anchor.js.map +1 -0
- package/dist/ui/layout/barDrain.js +25 -0
- package/dist/ui/layout/barDrain.js.map +1 -0
- package/dist/ui/layout/fitToViewport.js +17 -0
- package/dist/ui/layout/fitToViewport.js.map +1 -0
- package/dist/ui/layout/focusNav.js +42 -0
- package/dist/ui/layout/focusNav.js.map +1 -0
- package/dist/ui/layout/geometry.js +21 -0
- package/dist/ui/layout/geometry.js.map +1 -0
- package/dist/ui/layout/listWidth.js +10 -0
- package/dist/ui/layout/listWidth.js.map +1 -0
- package/dist/ui/layout/placeTooltip.js +28 -0
- package/dist/ui/layout/placeTooltip.js.map +1 -0
- package/dist/ui/layout/scroll.js +24 -0
- package/dist/ui/layout/scroll.js.map +1 -0
- package/dist/ui/layout/slider.js +20 -0
- package/dist/ui/layout/slider.js.map +1 -0
- package/dist/ui/layout/stack.js +27 -0
- package/dist/ui/layout/stack.js.map +1 -0
- package/dist/ui/layout/wrapRow.js +13 -0
- package/dist/ui/layout/wrapRow.js.map +1 -0
- package/dist/ui.js +85 -0
- package/dist/ui.js.map +1 -0
- package/package.json +115 -4
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { InputStep, MovementParams } from './constants.js';
|
|
2
|
+
import { type CollisionGrid, type MoverState } from './movement.js';
|
|
3
|
+
import { type MoverWire } from './protocol.js';
|
|
4
|
+
/**
|
|
5
|
+
* Client-side prediction for the local player's body. Every input step is applied at once (the player sees their
|
|
6
|
+
* own move with no lag) and kept until the server acknowledges it. When a snapshot says where the server has the
|
|
7
|
+
* body as of step `ack`, the body is put there and every step after `ack` is replayed on top.
|
|
8
|
+
*
|
|
9
|
+
* Movement is deterministic (`stepMover`), so with the same steps, params and grid the replay lands exactly where
|
|
10
|
+
* the prediction was and nothing moves. When it does not (the server refused a step, a collision only it knew of),
|
|
11
|
+
* the difference is `correction`: draw the body at `drawX/drawY`, which ease that jump out over a few frames instead
|
|
12
|
+
* of snapping.
|
|
13
|
+
*/
|
|
14
|
+
export declare class PredictedMover {
|
|
15
|
+
private params;
|
|
16
|
+
private grid;
|
|
17
|
+
readonly mover: MoverState;
|
|
18
|
+
private pending;
|
|
19
|
+
private nextSeq;
|
|
20
|
+
/** The jump the last reconciliation made, still being eased out (world px). */
|
|
21
|
+
private offsetX;
|
|
22
|
+
private offsetY;
|
|
23
|
+
/** How big the last correction was (0 when the prediction was right). */
|
|
24
|
+
correction: number;
|
|
25
|
+
/** Share of a visual correction left after each 60th of a second (default 0.8). */
|
|
26
|
+
smoothing: number;
|
|
27
|
+
constructor(x: number, y: number, params: MovementParams, grid: CollisionGrid);
|
|
28
|
+
/** Applies one input step now and keeps it for replay; returns its sequence number (send it with the step). */
|
|
29
|
+
step(step: InputStep): number;
|
|
30
|
+
/** Steps sent but not yet acknowledged. */
|
|
31
|
+
get unacknowledged(): number;
|
|
32
|
+
/** The server's word: the body as of step `ack`. Rewinds there and replays the rest. */
|
|
33
|
+
reconcile(ack: number, server: MoverWire): void;
|
|
34
|
+
/** Eases the visual correction out; call once a frame with its length in seconds. */
|
|
35
|
+
smooth(dt: number): void;
|
|
36
|
+
/** Where to draw the body: the predicted place plus the correction still being eased out. */
|
|
37
|
+
get drawX(): number;
|
|
38
|
+
get drawY(): number;
|
|
39
|
+
/** New movement rules (a buff, a slow): applied to future steps and to replays. */
|
|
40
|
+
setParams(params: MovementParams): void;
|
|
41
|
+
setGrid(grid: CollisionGrid): void;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=PredictedMover.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PredictedMover.d.ts","sourceRoot":"","sources":["../../../src/net/PredictedMover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAA0B,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAiB,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;;;;GASG;AACH,qBAAa,cAAc;IAevB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,IAAI;IAfd,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,OAAO,CAAC,OAAO,CAA0C;IACzD,OAAO,CAAC,OAAO,CAAK;IACpB,+EAA+E;IAC/E,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAAK;IACpB,yEAAyE;IACzE,UAAU,SAAK;IACf,mFAAmF;IACnF,SAAS,SAAO;gBAGd,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACD,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,aAAa;IAK7B,+GAA+G;IAC/G,IAAI,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAO7B,2CAA2C;IAC3C,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,wFAAwF;IACxF,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI;IAoB/C,qFAAqF;IACrF,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQxB,6FAA6F;IAC7F,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,mFAAmF;IACnF,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG,IAAI;IAIvC,OAAO,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;CAGnC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { InputStep, MovementParams } from './constants.js';
|
|
2
|
+
import { type CollisionGrid, type MoverState } from './movement.js';
|
|
3
|
+
import { type Snapshot } from './protocol.js';
|
|
4
|
+
export interface RoomPlayer<D = unknown> {
|
|
5
|
+
readonly id: number;
|
|
6
|
+
readonly mover: MoverState;
|
|
7
|
+
/** The game's own data for this player (sent to others in `sp` when they first see it). */
|
|
8
|
+
data: D;
|
|
9
|
+
params: MovementParams;
|
|
10
|
+
/** The last input step applied (-1 before any): what snapshots acknowledge. */
|
|
11
|
+
ack: number;
|
|
12
|
+
/** Steps received and not yet applied. */
|
|
13
|
+
readonly queue: InputStep[];
|
|
14
|
+
/** What the snapshot's update record carries beside the position; the game sets them. */
|
|
15
|
+
aim: number;
|
|
16
|
+
anim: number;
|
|
17
|
+
hp: number;
|
|
18
|
+
flags: number;
|
|
19
|
+
/** Refused inputs (nonsense numbers, a flood): a game may kick past some count. */
|
|
20
|
+
strikes: number;
|
|
21
|
+
}
|
|
22
|
+
export interface RoomOptions<D> {
|
|
23
|
+
grid: CollisionGrid;
|
|
24
|
+
/** Movement rules a new player starts with. */
|
|
25
|
+
params: MovementParams;
|
|
26
|
+
/** Where a player who joins stands. */
|
|
27
|
+
spawn: (id: number, data: D) => {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
/** Steps a player may have waiting before more are refused (default 30: half a second at 60). */
|
|
32
|
+
maxQueue?: number;
|
|
33
|
+
/** A player with more than `backlog` waiting catches up by running up to `maxStepsPerTick` a tick (default 3, 4). */
|
|
34
|
+
maxStepsPerTick?: number;
|
|
35
|
+
backlog?: number;
|
|
36
|
+
/** Called after each step a player takes (set aim, anim, flags from it). */
|
|
37
|
+
onStep?: (player: RoomPlayer<D>, step: InputStep) => void;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* An authoritative room for a server: players send input steps, the room applies them with the same `stepMover` the
|
|
41
|
+
* clients predict with, and builds each player a snapshot of everyone (with their own body whole, so their
|
|
42
|
+
* prediction can rewind to it). Transport-free: wire `input`, `step` and `snapshotFor` to any socket library.
|
|
43
|
+
*
|
|
44
|
+
* Every step a player sends is applied once, in order; a client cannot move faster by sending more (the queue is
|
|
45
|
+
* capped and drained at most `maxStepsPerTick` a tick), and nonsense input is refused and counted.
|
|
46
|
+
*/
|
|
47
|
+
export declare class Room<D = unknown> {
|
|
48
|
+
private readonly options;
|
|
49
|
+
readonly players: Map<number, RoomPlayer<D>>;
|
|
50
|
+
tick: number;
|
|
51
|
+
private readonly known;
|
|
52
|
+
private readonly maxQueue;
|
|
53
|
+
private readonly maxSteps;
|
|
54
|
+
private readonly backlog;
|
|
55
|
+
constructor(options: RoomOptions<D>);
|
|
56
|
+
join(id: number, data: D): RoomPlayer<D>;
|
|
57
|
+
leave(id: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Input steps `seq`, `seq + 1`, … from a player. Steps already received are skipped (a resend), any step with
|
|
60
|
+
* numbers no client sends refuses the whole message, and steps past a full queue are dropped. Returns false when
|
|
61
|
+
* something was refused.
|
|
62
|
+
*/
|
|
63
|
+
input(id: number, seq: number, steps: readonly InputStep[]): boolean;
|
|
64
|
+
/** One simulation step for everyone. */
|
|
65
|
+
step(): void;
|
|
66
|
+
/** The snapshot player `id` should get now. `time` is the server's wall clock (ms). */
|
|
67
|
+
snapshotFor(id: number, time: number): Snapshot | null;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=Room.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Room.d.ts","sourceRoot":"","sources":["../../../src/net/Room.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgB,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAA0B,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAe,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,OAAO;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,2FAA2F;IAC3F,IAAI,EAAE,CAAC,CAAC;IACR,MAAM,EAAE,cAAc,CAAC;IACvB,+EAA+E;IAC/E,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC;IAC5B,yFAAyF;IACzF,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,aAAa,CAAC;IACpB,+CAA+C;I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AAI;CA2BvD"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { Room } from './Room.js';
|
|
2
|
+
import type { ServerMessage } from './protocol.js';
|
|
3
|
+
/** The least a server socket must do; a `ws` WebSocket, a uWebSockets one or a test double all fit. */
|
|
4
|
+
export interface HostSocket {
|
|
5
|
+
send(data: string | Uint8Array): void;
|
|
6
|
+
close(code?: number, reason?: string): void;
|
|
7
|
+
}
|
|
8
|
+
export interface RoomHostOptions<D> {
|
|
9
|
+
/** Simulation steps a second (default 60) and snapshots a second (default 20). */
|
|
10
|
+
stepRate?: number;
|
|
11
|
+
snapRate?: number;
|
|
12
|
+
/** Turns a hello's data into the player's data (validate it here); throw to refuse the player. */
|
|
13
|
+
admit?: (data: unknown, id: number) => D;
|
|
14
|
+
/** Refused inputs before the player is disconnected (default 20). */
|
|
15
|
+
maxStrikes?: number;
|
|
16
|
+
/** The game's own messages (anything the engine does not handle). */
|
|
17
|
+
onMessage?: (id: number, msg: {
|
|
18
|
+
t: string;
|
|
19
|
+
[k: string]: unknown;
|
|
20
|
+
}) => void;
|
|
21
|
+
/** Called when a player joins or leaves. */
|
|
22
|
+
onJoin?: (id: number) => void;
|
|
23
|
+
onLeave?: (id: number) => void;
|
|
24
|
+
/** Wall clock, for tests (default Date.now). */
|
|
25
|
+
now?: () => number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Runs a `Room` for connected sockets: a socket says hello and joins, its input goes to the room, the room steps at
|
|
29
|
+
* `stepRate`, and every player gets its own snapshot at `snapRate` (binary when it carries bodies). Pings are
|
|
30
|
+
* answered with the server's time. A player who keeps sending nonsense is disconnected.
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* const host = new RoomHost(room);
|
|
34
|
+
* wss.on('connection', (ws) => {
|
|
35
|
+
* const id = host.connect(ws);
|
|
36
|
+
* ws.on('message', (data, binary) => host.message(id, binary ? data : data.toString()));
|
|
37
|
+
* ws.on('close', () => host.disconnect(id));
|
|
38
|
+
* });
|
|
39
|
+
* host.start();
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class RoomHost<D = unknown> {
|
|
43
|
+
readonly room: Room<D>;
|
|
44
|
+
private readonly options;
|
|
45
|
+
private readonly sockets;
|
|
46
|
+
private readonly joined;
|
|
47
|
+
private nextId;
|
|
48
|
+
private stepTimer;
|
|
49
|
+
private lastStepAt;
|
|
50
|
+
private stepsDue;
|
|
51
|
+
private readonly stepMs;
|
|
52
|
+
private readonly snapEvery;
|
|
53
|
+
private readonly now;
|
|
54
|
+
constructor(room: Room<D>, options?: RoomHostOptions<D>);
|
|
55
|
+
/** A socket connected; returns the id its messages and its close are reported under. */
|
|
56
|
+
connect(socket: HostSocket): number;
|
|
57
|
+
/** A message arrived from socket `id` (text as a string, binary as bytes). */
|
|
58
|
+
message(id: number, data: string | ArrayBuffer | Uint8Array): void;
|
|
59
|
+
/** Socket `id` closed. */
|
|
60
|
+
disconnect(id: number): void;
|
|
61
|
+
/** Sends one of the game's own messages to a player. */
|
|
62
|
+
sendTo(id: number, msg: ServerMessage | {
|
|
63
|
+
t: string;
|
|
64
|
+
[k: string]: unknown;
|
|
65
|
+
}): void;
|
|
66
|
+
/** Starts stepping on a timer. Steps are counted by the clock, so a late timer runs the steps it owes. */
|
|
67
|
+
start(): void;
|
|
68
|
+
stop(): void;
|
|
69
|
+
/** One step, and the snapshots when they are due. Exposed for tests and for servers that drive their own loop. */
|
|
70
|
+
stepOnce(): void;
|
|
71
|
+
private strike;
|
|
72
|
+
private checkStrikes;
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=RoomHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RoomHost.d.ts","sourceRoot":"","sources":["../../../src/net/RoomHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEnC,OAAO,KAAK,EAAiB,aAAa,EAAY,MAAM,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,CAAK;IACvB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;gBAGxB,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,EACL,OAAO,GAAE,eAAe,CAAC,CAAC,CAAM;IAOnD,wFAAwF;IACxF,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM;IAMnC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI;IAyClE,0BAA0B;IAC1B,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQ5B,wDAAwD;IACxD,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI;IAOlF,0GAA0G;IAC1G,KAAK,IAAI,IAAI;IAgBb,IAAI,IAAI,IAAI;IAKZ,kHAAkH;IAClH,QAAQ,IAAI,IAAI;IAUhB,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,YAAY;CAOrB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every repeated player action with a timer — the basic attack, a skill's cooldown, the cast and attack locks, a
|
|
3
|
+
* potion — runs on a **schedule**, not on "the last time plus some slack". An action may arrive up to its slack
|
|
4
|
+
* early (network jitter bunches packets), but the next one is then due a whole interval after the later of the
|
|
5
|
+
* arrival and the time this one was due, so the slack never adds up: a client sending every 0.8 of an interval
|
|
6
|
+
* lands at most one per interval (67 in 100), not 100. A server must run the same arithmetic.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CADENCE: {
|
|
9
|
+
/** A basic attack may arrive this share of its interval early. */
|
|
10
|
+
readonly attackEarlyShare: 0.2;
|
|
11
|
+
/** The cast lock and the attack lock a cast leaves may be cut this short. */
|
|
12
|
+
readonly lockSlackMs: 60;
|
|
13
|
+
/** A skill may be cast this long before its cooldown ends. */
|
|
14
|
+
readonly cooldownSlackMs: 40;
|
|
15
|
+
/** A potion may be drunk this long before its kind's cooldown ends. */
|
|
16
|
+
readonly potionSlackMs: 150;
|
|
17
|
+
};
|
|
18
|
+
/** Whether an action arriving at `now` is earlier than its slack allows; `due` undefined = never taken, due at once. */
|
|
19
|
+
export declare function cadenceEarly(now: number, due: number | undefined, slack: number): boolean;
|
|
20
|
+
/** When the action after one accepted at `now` is due: a whole interval after the later of `now` and `due`. */
|
|
21
|
+
export declare function cadenceNext(now: number, due: number | undefined, interval: number): number;
|
|
22
|
+
//# sourceMappingURL=cadence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cadence.d.ts","sourceRoot":"","sources":["../../../src/net/cadence.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,OAAO;IAClB,kEAAkE;;IAElE,6EAA6E;;IAE7E,8DAA8D;;IAE9D,uEAAuE;;CAE/D,CAAC;AAEX,wHAAwH;AACxH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEzF;AAED,+GAA+G;AAC/G,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1F"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** World and movement constants. A game that needs other numbers forks these; client and server must agree. */
|
|
2
|
+
export declare const TILE_SIZE = 16;
|
|
3
|
+
/** Fixed input steps a second; movement is simulated per step on both sides. */
|
|
4
|
+
export declare const INPUT_STEP_RATE = 60;
|
|
5
|
+
export declare const INPUT_STEP_DT: number;
|
|
6
|
+
/** Bit of an input step's flags that asks for a dodge roll. */
|
|
7
|
+
export declare const INPUT_FLAG_DASH = 1;
|
|
8
|
+
/** The body's collision box, half extents (px). */
|
|
9
|
+
export declare const BODY_HALF_WIDTH = 5;
|
|
10
|
+
export declare const BODY_HALF_HEIGHT = 3;
|
|
11
|
+
export declare const COLLISION_EPSILON = 0.01;
|
|
12
|
+
/** One fixed input step: [axisX, axisY, flags]. */
|
|
13
|
+
export type InputStep = [number, number, number];
|
|
14
|
+
export interface MovementParams {
|
|
15
|
+
speed: number;
|
|
16
|
+
dashSpeed: number;
|
|
17
|
+
dashSteps: number;
|
|
18
|
+
dashCooldownSteps: number;
|
|
19
|
+
canMove: boolean;
|
|
20
|
+
canDash: boolean;
|
|
21
|
+
}
|
|
22
|
+
/** One body's state in a snapshot: [id, x, y, aim, anim, hp, flags]. */
|
|
23
|
+
export type EntityUpdate = [number, number, number, number, number, number, number];
|
|
24
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/net/constants.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAE/G,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B,gFAAgF;AAChF,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,aAAa,QAAsB,CAAC;AAEjD,+DAA+D;AAC/D,eAAO,MAAM,eAAe,IAAI,CAAC;AAEjC,mDAAmD;AACnD,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,mDAAmD;AACnD,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wEAAwE;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { EventBus } from '../../events/EventBus.js';
|
|
2
|
+
import type { LobbyClientMessage, LobbyErrorCode, MatchPlayer, RoomState, RoomSummary } from './lobbyProtocol.js';
|
|
3
|
+
/** What a `LobbyClient` sends through and hears from: a `Connection` fits. */
|
|
4
|
+
export interface LobbyLink {
|
|
5
|
+
send(msg: {
|
|
6
|
+
t: string;
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
}): void;
|
|
9
|
+
readonly events: {
|
|
10
|
+
on(event: 'message', fn: (msg: {
|
|
11
|
+
t: string;
|
|
12
|
+
[k: string]: unknown;
|
|
13
|
+
}) => void): () => void;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export interface PendingMatch {
|
|
17
|
+
id: string;
|
|
18
|
+
mode: string;
|
|
19
|
+
players: MatchPlayer[];
|
|
20
|
+
expiresAt: number;
|
|
21
|
+
accepted: number[];
|
|
22
|
+
/** You answered already. */
|
|
23
|
+
answered: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface LobbyClientEvents {
|
|
26
|
+
/** Anything in the client's state changed: redraw the lobby screen. */
|
|
27
|
+
change: undefined;
|
|
28
|
+
chat: {
|
|
29
|
+
from: number;
|
|
30
|
+
text: string;
|
|
31
|
+
};
|
|
32
|
+
error: {
|
|
33
|
+
code: LobbyErrorCode;
|
|
34
|
+
message: string;
|
|
35
|
+
};
|
|
36
|
+
kicked: undefined;
|
|
37
|
+
found: PendingMatch;
|
|
38
|
+
cancelled: {
|
|
39
|
+
match: string;
|
|
40
|
+
reason: 'declined' | 'timeout' | 'left';
|
|
41
|
+
requeued: boolean;
|
|
42
|
+
};
|
|
43
|
+
/** Go and play: `data` is what the server's `onStart` gave you. */
|
|
44
|
+
start: {
|
|
45
|
+
match: string;
|
|
46
|
+
mode: string;
|
|
47
|
+
players: MatchPlayer[];
|
|
48
|
+
data: unknown;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The lobby as a client sees it: the room list, your room, your place in the queue and a match waiting for your
|
|
53
|
+
* answer, kept up to date from the server's messages, with a method for everything a lobby screen does. Hand it the
|
|
54
|
+
* game's `Connection` (or anything that sends JSON and emits the messages it does not handle):
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* const conn = new Connection('wss://lobby.example.com', { hello: () => ({ name }) }).connect();
|
|
58
|
+
* const lobby = new LobbyClient(conn);
|
|
59
|
+
* lobby.events.on('change', () => drawLobby(lobby));
|
|
60
|
+
* lobby.events.on('start', ({ data }) => joinGame(data));
|
|
61
|
+
* lobby.queue('duel');
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
64
|
+
export declare class LobbyClient {
|
|
65
|
+
private readonly link;
|
|
66
|
+
readonly events: EventBus<LobbyClientEvents>;
|
|
67
|
+
/** Your id in the lobby (-1 until welcomed). */
|
|
68
|
+
id: number;
|
|
69
|
+
modes: string[];
|
|
70
|
+
rooms: RoomSummary[];
|
|
71
|
+
room: RoomState | null;
|
|
72
|
+
/** Your queue: the mode, since when (server ms) and how many other groups wait for it. */
|
|
73
|
+
queued: {
|
|
74
|
+
mode: string;
|
|
75
|
+
since: number;
|
|
76
|
+
waiting: number;
|
|
77
|
+
} | null;
|
|
78
|
+
/** Kept out of the queue until then (server ms), after a declined match. */
|
|
79
|
+
lockedUntil: number;
|
|
80
|
+
match: PendingMatch | null;
|
|
81
|
+
private readonly off;
|
|
82
|
+
constructor(link: LobbyLink);
|
|
83
|
+
get isHost(): boolean;
|
|
84
|
+
/** Every member of your room but the host has said ready. */
|
|
85
|
+
get roomReady(): boolean;
|
|
86
|
+
list(): void;
|
|
87
|
+
create(options?: Omit<Extract<LobbyClientMessage, {
|
|
88
|
+
t: 'lobby/create';
|
|
89
|
+
}>, 't'>): void;
|
|
90
|
+
join(room: string): void;
|
|
91
|
+
joinByCode(code: string): void;
|
|
92
|
+
leave(): void;
|
|
93
|
+
setReady(ready: boolean): void;
|
|
94
|
+
kick(player: number): void;
|
|
95
|
+
promote(player: number): void;
|
|
96
|
+
setSettings(settings: unknown): void;
|
|
97
|
+
chat(text: string): void;
|
|
98
|
+
startRoom(): void;
|
|
99
|
+
queue(mode: string): void;
|
|
100
|
+
leaveQueue(): void;
|
|
101
|
+
accept(): void;
|
|
102
|
+
decline(): void;
|
|
103
|
+
destroy(): void;
|
|
104
|
+
private send;
|
|
105
|
+
private receive;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=LobbyClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LobbyClient.d.ts","sourceRoot":"","sources":["../../../../src/net/lobby/LobbyClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAsB,WAAW,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnI,8EAA8E;AAC9E,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,GAAG,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE;QAAE,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO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|
|
3
|
+
import type { LobbyServerMessage, MatchPlayer } from './lobbyProtocol.js';
|
|
4
|
+
import { Matchmaker, type MatchMode } from './Matchmaker.js';
|
|
5
|
+
/** A match the lobby made (from the queue or a room's start), as `onStart` is given it. */
|
|
6
|
+
export interface LobbyMatch<D> {
|
|
7
|
+
id: string;
|
|
8
|
+
mode: string;
|
|
9
|
+
players: (MatchPlayer & {
|
|
10
|
+
data: D;
|
|
11
|
+
})[];
|
|
12
|
+
/** The lobby room it was started from, for a room's own game. */
|
|
13
|
+
room?: string;
|
|
14
|
+
/** That room's settings. */
|
|
15
|
+
settings?: unknown;
|
|
16
|
+
}
|
|
17
|
+
export interface LobbyHostOptions<D> {
|
|
18
|
+
/** Modes the queue fills (none: rooms only). */
|
|
19
|
+
modes?: readonly MatchMode[];
|
|
20
|
+
/** Turns a hello's data into the player's public data (validate it here); throw to refuse the player. */
|
|
21
|
+
admit?: (data: unknown, id: number) => D;
|
|
22
|
+
/** A player's rating in a mode (default 1000 for everyone). A party queues at its members' mean. */
|
|
23
|
+
ratingOf?: (id: number, data: D, mode: string) => number;
|
|
24
|
+
/**
|
|
25
|
+
* Called when a match starts (everyone accepted, or a room's host started). Return what each player is told to go
|
|
26
|
+
* to — a game server's address and a ticket, a room id on this server — as one value for all, or a function of
|
|
27
|
+
* the player's id. Throw to cancel the start (everyone is told it was cancelled and requeued).
|
|
28
|
+
*/
|
|
29
|
+
onStart?: (match: LobbyMatch<D>) => unknown;
|
|
30
|
+
/** Time to accept a found match (default 15 s); 0 starts it at once. */
|
|
31
|
+
readyCheckMs?: number;
|
|
32
|
+
/** How long one who declined or let the check lapse is kept out of the queue (default 30 s). */
|
|
33
|
+
declineLockMs?: number;
|
|
34
|
+
/** Most players a room may hold (default 8), and rooms listed at once (default 50). */
|
|
35
|
+
maxRoomPlayers?: number;
|
|
36
|
+
listLimit?: number;
|
|
37
|
+
/** Characters of a chat line (default 200) and of a room name (default 32). */
|
|
38
|
+
chatMax?: number;
|
|
39
|
+
nameMax?: number;
|
|
40
|
+
/** Messages a player may send a second before they are refused (default 20); three times it closes the socket. */
|
|
41
|
+
ratePerSecond?: number;
|
|
42
|
+
/** How often the queue is searched (default 1000 ms). */
|
|
43
|
+
matchEveryMs?: number;
|
|
44
|
+
/** The game's own messages (anything the lobby does not handle). */
|
|
45
|
+
onMessage?: (id: number, msg: {
|
|
46
|
+
t: string;
|
|
47
|
+
[k: string]: unknown;
|
|
48
|
+
}) => void;
|
|
49
|
+
onJoin?: (id: number) => void;
|
|
50
|
+
onLeave?: (id: number) => void;
|
|
51
|
+
/** Clock and dice, for tests. */
|
|
52
|
+
now?: () => number;
|
|
53
|
+
random?: () => number;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The front room of an online game, transport-free like `RoomHost`: players say hello and browse rooms; a room has a
|
|
57
|
+
* host, a code to share, ready flags, chat and the game's own settings; a player alone or a whole room queues for a
|
|
58
|
+
* mode, the `Matchmaker` finds matches by rating, and each match goes through a ready check before `onStart` turns it
|
|
59
|
+
* into a game. Someone who declines (or lets the check lapse) is locked out of the queue for a while; everyone else
|
|
60
|
+
* goes back to their old place in it.
|
|
61
|
+
*
|
|
62
|
+
* ```ts
|
|
63
|
+
* const lobby = new LobbyHost({
|
|
64
|
+
* modes: [{ id: 'duel', teams: 2, teamSize: 1 }, { id: '2v2', teams: 2, teamSize: 2 }],
|
|
65
|
+
* admit: (d) => ({ name: String((d as { name?: unknown })?.name ?? 'player').slice(0, 16) }),
|
|
66
|
+
* ratingOf: (id) => ratings.get(id) ?? 1000,
|
|
67
|
+
* onStart: (match) => ({ server: 'wss://eu1.example.com', ticket: issueTicket(match) }),
|
|
68
|
+
* });
|
|
69
|
+
* wss.on('connection', (ws) => {
|
|
70
|
+
* const id = lobby.connect(ws);
|
|
71
|
+
* ws.on('message', (data, binary) => lobby.message(id, binary ? '' : data.toString()));
|
|
72
|
+
* ws.on('close', () => lobby.disconnect(id));
|
|
73
|
+
* });
|
|
74
|
+
* lobby.start();
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare class LobbyHost<D = unknown> {
|
|
78
|
+
private readonly options;
|
|
79
|
+
readonly rooms: LobbyRooms;
|
|
80
|
+
readonly matchmaker: Matchmaker;
|
|
81
|
+
private readonly sockets;
|
|
82
|
+
private readonly members;
|
|
83
|
+
private readonly pending;
|
|
84
|
+
/** Rooms whose match started, by match id, so `finish` can open them again. */
|
|
85
|
+
private readonly playing;
|
|
86
|
+
private nextId;
|
|
87
|
+
private nextMatch;
|
|
88
|
+
private listDirty;
|
|
89
|
+
private timer;
|
|
90
|
+
private readonly now;
|
|
91
|
+
constructor(options?: LobbyHostOptions<D>);
|
|
92
|
+
/** A socket connected; returns the id its messages and its close are reported under. */
|
|
93
|
+
connect(socket: HostSocket): number;
|
|
94
|
+
/** Socket `id` closed: out of its room, the queue and any match being accepted. */
|
|
95
|
+
disconnect(id: number): void;
|
|
96
|
+
/** A message arrived from socket `id`. */
|
|
97
|
+
message(id: number, data: string | ArrayBuffer | Uint8Array): void;
|
|
98
|
+
/** A player's public data (what `admit` returned). */
|
|
99
|
+
dataOf(id: number): D | undefined;
|
|
100
|
+
/** Sends one of the game's own messages to a player. */
|
|
101
|
+
send(id: number, msg: LobbyServerMessage | {
|
|
102
|
+
t: string;
|
|
103
|
+
[k: string]: unknown;
|
|
104
|
+
}): void;
|
|
105
|
+
/** Searches the queue and runs the ready checks on a timer. */
|
|
106
|
+
start(): void;
|
|
107
|
+
stop(): void;
|
|
108
|
+
/** One round: lapsed ready checks cancelled, the queue searched, the room list pushed if it changed. */
|
|
109
|
+
update(now?: number): void;
|
|
110
|
+
/** A started match is over: its rooms open again, their members not ready. */
|
|
111
|
+
finish(matchId: string): void;
|
|
112
|
+
private hello;
|
|
113
|
+
/** True when the lobby handled it (or refused it). */
|
|
114
|
+
private handle;
|
|
115
|
+
private create;
|
|
116
|
+
private join;
|
|
117
|
+
private ready;
|
|
118
|
+
private kick;
|
|
119
|
+
private promote;
|
|
120
|
+
/** The room `m` hosts, or an error to them. */
|
|
121
|
+
private hostRoom;
|
|
122
|
+
private startRoom;
|
|
123
|
+
private queue;
|
|
124
|
+
private ratingOf;
|
|
125
|
+
/** Takes `m` (or its whole room) out of the queue. */
|
|
126
|
+
private leaveQueue;
|
|
127
|
+
private dequeueRoom;
|
|
128
|
+
private pushQueue;
|
|
129
|
+
private found;
|
|
130
|
+
private answer;
|
|
131
|
+
private startFound;
|
|
132
|
+
/** Calls `onStart` and tells everyone where to go; false (nothing sent) when it threw. */
|
|
133
|
+
private begin;
|
|
134
|
+
/** A ready check failed: whoever did not accept is locked out, every group that did goes back to its place. */
|
|
135
|
+
private cancel;
|
|
136
|
+
/** Back into the queue at its old place (its old `since`). */
|
|
137
|
+
private requeue;
|
|
138
|
+
private cancelPendingFor;
|
|
139
|
+
private leaveRoom;
|
|
140
|
+
private pushRoom;
|
|
141
|
+
/** The list, to everyone browsing (in no room). */
|
|
142
|
+
private pushList;
|
|
143
|
+
private error;
|
|
144
|
+
/** A per-second allowance; three times over closes the socket. */
|
|
145
|
+
private allow;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=LobbyHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LobbyHost.d.ts","sourceRoot":"","sources":["../../../../src/net/lobby/LobbyHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAsC,kBAAkB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,UAAU,EAAmB,KAAK,SAAS,EAAe,MAAM,cAAc,CAAC;AAExF,2FAA2F;AAC3F,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,CAAC,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AAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI;IAIrF,+DAA+D;IAC/D,KAAK,IAAI,IAAI;IAKb,IAAI,IAAI,IAAI;IAKZ,wGAAwG;IACxG,MAAM,CAAC,GAAG,SAAa,GAAG,IAAI;IAM9B,8EAA8E;IAC9E,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAe7B,OAAO,CAAC,KAAK;IAeb,sDAAsD;IACtD,OAAO,CAAC,MAAM;IAmEd,OAAO,CAAC,MAAM;IAad,OAAO,CAAC,IAAI;IAaZ,OAAO,CAAC,KAAK;IASb,OAAO,CAAC,IAAI;IAUZ,OAAO,CAAC,OAAO;IAQf,+CAA+C;IAC/C,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,SAAS;IAkBjB,OAAO,CAAC,KAAK;IAgCb,OAAO,CAAC,QAAQ;IAQhB,sDAAsD;IACtD,OAAO,CAAC,UAAU;IAYlB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,KAAK;IAoBb,OAAO,CAAC,MAAM;IAgBd,OAAO,CAAC,UAAU;IAkBlB,0FAA0F;IAC1F,OAAO,CAAC,KAAK;IA4Bb,+GAA+G;IAC/G,OAAO,CAAC,MAAM;IAgCd,8DAA8D;IAC9D,OAAO,CAAC,OAAO;IAYf,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,QAAQ;IAMhB,mDAAmD;IACnD,OAAO,CAAC,QAAQ;IAMhB,OAAO,CAAC,KAAK;IAIb,kEAAkE;IAClE,OAAO,CAAC,KAAK;CAed"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { RoomState, RoomSummary } from './lobbyProtocol.js';
|
|
2
|
+
/** A lobby room on the server. */
|
|
3
|
+
export interface LobbyRoom {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly code: string;
|
|
6
|
+
name: string;
|
|
7
|
+
mode: string;
|
|
8
|
+
maxPlayers: number;
|
|
9
|
+
private: boolean;
|
|
10
|
+
host: number;
|
|
11
|
+
/** In the order they came: the next host is the first left. */
|
|
12
|
+
readonly members: number[];
|
|
13
|
+
readonly ready: Set<number>;
|
|
14
|
+
settings: unknown;
|
|
15
|
+
/** In the matchmaking queue as one group. */
|
|
16
|
+
queued: boolean;
|
|
17
|
+
/** Its game is being played (or its match is being accepted): nobody joins until `LobbyHost.finish`. */
|
|
18
|
+
playing: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The rooms of a lobby and who is in which, with no sockets: create, join by id or code, leave (the host's place
|
|
22
|
+
* passing to the next member, an empty room closing), kick, ready. `LobbyHost` speaks for it.
|
|
23
|
+
*/
|
|
24
|
+
export declare class LobbyRooms {
|
|
25
|
+
private readonly random;
|
|
26
|
+
private readonly rooms;
|
|
27
|
+
private readonly byCode;
|
|
28
|
+
private readonly roomOf;
|
|
29
|
+
private nextId;
|
|
30
|
+
constructor(random?: () => number);
|
|
31
|
+
get count(): number;
|
|
32
|
+
get(id: string): LobbyRoom | undefined;
|
|
33
|
+
byInvite(code: string): LobbyRoom | undefined;
|
|
34
|
+
of(player: number): LobbyRoom | undefined;
|
|
35
|
+
all(): IterableIterator<LobbyRoom>;
|
|
36
|
+
create(host: number, o: {
|
|
37
|
+
name: string;
|
|
38
|
+
mode: string;
|
|
39
|
+
maxPlayers: number;
|
|
40
|
+
private: boolean;
|
|
41
|
+
settings: unknown;
|
|
42
|
+
}): LobbyRoom;
|
|
43
|
+
join(player: number, room: LobbyRoom): void;
|
|
44
|
+
/** Takes a player out of their room; returns the room (closed when it emptied, `closed` true). */
|
|
45
|
+
leave(player: number): {
|
|
46
|
+
room: LobbyRoom;
|
|
47
|
+
closed: boolean;
|
|
48
|
+
} | null;
|
|
49
|
+
/** Everyone but the host has said they are ready. */
|
|
50
|
+
allReady(room: LobbyRoom): boolean;
|
|
51
|
+
summary(room: LobbyRoom): RoomSummary;
|
|
52
|
+
state(room: LobbyRoom, dataOf: (id: number) => unknown): RoomState;
|
|
53
|
+
/** The rooms anyone may browse: public, open, not full; the fullest first, so players gather. */
|
|
54
|
+
listed(limit: number): RoomSummary[];
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=LobbyRooms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LobbyRooms.d.ts","sourceRoot":"","sources":["../../../../src/net/lobby/LobbyRooms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE1E,kCAAkC;AAClC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,6CAA6C;IAC7C,MAAM,EAAE,OAAO,CAAC;IAChB,wGAAwG;IACxG,OAAO,EAAE,OAAO,CAAC;CAClB;AAID;;;GAGG;AACH,qBAAa,UAAU;IAMT,OAAO,CAAC,QAAQ,CAAC,MAAM;IALnC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAgC;IACtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,MAAM,CAAK;gBAEU,MAAM,GAAE,MAAM,MAAoB;IAE/D,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAItC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAI7C,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIzC,GAAG,IAAI,gBAAgB,CAAC,SAAS,CAAC;IAIlC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS;IAY3H,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,IAAI;IAM3C,kGAAkG;IAClG,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;IAoBlE,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,OAAO;IAIlC,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,WAAW;IAIrC,KAAK,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,GAAG,SAAS;IAKlE,iGAAiG;IACjG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE;CAOrC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/** A mode the matchmaker fills: `teams` sides of `teamSize` players. */
|
|
2
|
+
export interface MatchMode {
|
|
3
|
+
id: string;
|
|
4
|
+
teams: number;
|
|
5
|
+
teamSize: number;
|
|
6
|
+
/** Rating difference allowed at once (default 100), widened by `widenPerSecond` (default 10) up to `maxWindow` (default 600). */
|
|
7
|
+
window?: number;
|
|
8
|
+
widenPerSecond?: number;
|
|
9
|
+
maxWindow?: number;
|
|
10
|
+
}
|
|
11
|
+
/** One group waiting together: a player alone, or a party that must not be split. */
|
|
12
|
+
export interface Ticket {
|
|
13
|
+
id: string;
|
|
14
|
+
mode: string;
|
|
15
|
+
members: readonly number[];
|
|
16
|
+
/** The group's rating (the game's own: Elo, a level, a power score). */
|
|
17
|
+
rating: number;
|
|
18
|
+
/** When it joined the queue (ms): the oldest waits least. */
|
|
19
|
+
since: number;
|
|
20
|
+
}
|
|
21
|
+
export interface FoundMatch {
|
|
22
|
+
mode: string;
|
|
23
|
+
tickets: Ticket[];
|
|
24
|
+
/** Each team's player ids, in the order the teams are numbered. */
|
|
25
|
+
teams: number[][];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* The matchmaking queue, pure: tickets in, matches out, no clock of its own and no sockets. Each `find(now)` takes
|
|
29
|
+
* the oldest ticket of a mode as the anchor, gathers the groups within its rating window (and each within theirs,
|
|
30
|
+
* so a newcomer is not thrown in with veterans because a veteran waited), and fills the teams from the closest
|
|
31
|
+
* ratings first, never splitting a party; the teams are then balanced by rating. A window grows with the wait, so
|
|
32
|
+
* anyone is matched in the end; a ticket nothing fits waits for the next call.
|
|
33
|
+
*/
|
|
34
|
+
export declare class Matchmaker {
|
|
35
|
+
private readonly modes;
|
|
36
|
+
private readonly tickets;
|
|
37
|
+
constructor(modes: readonly MatchMode[]);
|
|
38
|
+
get size(): number;
|
|
39
|
+
mode(id: string): MatchMode | undefined;
|
|
40
|
+
/** Adds a ticket (replacing one of the same id); throws on an unknown mode or a group too big for a team. */
|
|
41
|
+
add(ticket: Ticket): void;
|
|
42
|
+
remove(id: string): Ticket | undefined;
|
|
43
|
+
get(id: string): Ticket | undefined;
|
|
44
|
+
/** The tickets waiting for a mode, oldest first. */
|
|
45
|
+
waiting(mode: string): Ticket[];
|
|
46
|
+
/** How far a ticket's rating window reaches now. */
|
|
47
|
+
windowOf(t: Ticket, now: number): number;
|
|
48
|
+
/** Every match that can be made now; their tickets leave the queue. */
|
|
49
|
+
find(now: number): FoundMatch[];
|
|
50
|
+
private tryAnchor;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Splits groups into `teams` of exactly `size` players, parties whole, ratings as even as it can: the largest groups
|
|
54
|
+
* first, each into the team with room whose rating total is lowest. Returns null when the sizes cannot be packed.
|
|
55
|
+
*/
|
|
56
|
+
export declare function balanceTeams(groups: readonly Ticket[], teams: number, size: number): number[][] | null;
|
|
57
|
+
//# sourceMappingURL=Matchmaker.d.ts.map
|