@nice2dev/game-engine 1.3.15 → 1.3.17
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 +13 -0
- package/dist/cjs/accessibility/Accessibility.js +152 -165
- package/dist/cjs/ai/AI.js +292 -294
- package/dist/cjs/ai/BehaviorTree.js +1029 -1113
- package/dist/cjs/ai/StateMachine.js +694 -756
- package/dist/cjs/animation/Animation.js +232 -241
- package/dist/cjs/audio/AudioAdvanced.js +221 -236
- package/dist/cjs/audio/AudioBridge.js +441 -435
- package/dist/cjs/audio/AudioManager.js +242 -259
- package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
- package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
- package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
- package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
- package/dist/cjs/core/EventBus.js +51 -56
- package/dist/cjs/core/GameClock.js +62 -66
- package/dist/cjs/core/GameConfig.js +72 -79
- package/dist/cjs/core/GameLoop.js +80 -89
- package/dist/cjs/core/ServiceLocator.js +61 -65
- package/dist/cjs/core/Validation.js +72 -82
- package/dist/cjs/core/math.js +108 -112
- package/dist/cjs/devtools/DevTools.js +542 -563
- package/dist/cjs/devtools/DeveloperExperience.js +521 -559
- package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
- package/dist/cjs/dialogue/DialogueSystem.js +984 -986
- package/dist/cjs/docs/DocGenerator.js +339 -364
- package/dist/cjs/ecs/World.js +355 -371
- package/dist/cjs/editor/AchievementEditor.js +580 -636
- package/dist/cjs/editor/AdvancedEditor.js +184 -191
- package/dist/cjs/editor/AnimationRetargeting.js +696 -741
- package/dist/cjs/editor/AssetBrowser.js +1072 -1160
- package/dist/cjs/editor/AssetManager.js +187 -192
- package/dist/cjs/editor/ConsolePro.js +971 -1061
- package/dist/cjs/editor/CraftingEditor.js +680 -730
- package/dist/cjs/editor/DebugTools.js +187 -185
- package/dist/cjs/editor/DialogueSystem.js +844 -901
- package/dist/cjs/editor/LeaderboardSystem.js +429 -483
- package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
- package/dist/cjs/editor/PrefabSystem.js +772 -838
- package/dist/cjs/editor/ProfilerPanel.js +649 -700
- package/dist/cjs/editor/QuestEditor.js +792 -839
- package/dist/cjs/editor/ReplaySystem.js +585 -634
- package/dist/cjs/editor/SceneEditor.js +176 -200
- package/dist/cjs/editor/ScreenshotMode.js +621 -688
- package/dist/cjs/editor/ShaderGraph.js +1556 -1582
- package/dist/cjs/editor/TimelineEditor.js +715 -778
- package/dist/cjs/editor/UndoRedoPro.js +830 -904
- package/dist/cjs/editor/VRARMode.js +582 -645
- package/dist/cjs/engine/NiceGameEngine.js +141 -164
- package/dist/cjs/engine/SaveSystem.js +441 -495
- package/dist/cjs/enterprise/Enterprise.js +254 -261
- package/dist/cjs/export/BevyExporter.js +927 -967
- package/dist/cjs/export/CocosExporter.js +644 -673
- package/dist/cjs/export/Construct3Exporter.js +783 -794
- package/dist/cjs/export/DefoldExporter.js +1028 -1069
- package/dist/cjs/export/GDevelopExporter.js +674 -708
- package/dist/cjs/export/GameMakerExporter.js +791 -805
- package/dist/cjs/export/GodotExporter.js +1003 -1045
- package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
- package/dist/cjs/export/MonoGameExporter.js +1265 -1293
- package/dist/cjs/export/Pico8Exporter.js +766 -812
- package/dist/cjs/export/PlatformExporter.js +188 -206
- package/dist/cjs/export/RPGMakerExporter.js +860 -879
- package/dist/cjs/export/RobloxExporter.js +883 -919
- package/dist/cjs/export/Solar2DExporter.js +1218 -1256
- package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
- package/dist/cjs/export/Tic80Exporter.js +1210 -1267
- package/dist/cjs/export/UnityExporter.js +1116 -1131
- package/dist/cjs/export/UnrealExporter.js +889 -919
- package/dist/cjs/export/WebExporter.js +931 -970
- package/dist/cjs/export/index.js +42 -65
- package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
- package/dist/cjs/godot-integration/GodotImport.js +929 -1027
- package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
- package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
- package/dist/cjs/i18n/I18n.js +860 -900
- package/dist/cjs/i18n/useTranslation.js +84 -89
- package/dist/cjs/import/AsepriteImporter.js +658 -716
- package/dist/cjs/import/DragonBonesImporter.js +437 -461
- package/dist/cjs/import/GameMakerImporter.js +511 -521
- package/dist/cjs/import/GodotSceneImporter.js +788 -822
- package/dist/cjs/import/LDtkImporter.js +436 -454
- package/dist/cjs/import/Live2DImporter.js +497 -518
- package/dist/cjs/import/NdgFormat.js +424 -457
- package/dist/cjs/import/OgmoImporter.js +466 -493
- package/dist/cjs/import/RPGMakerImporter.js +451 -477
- package/dist/cjs/import/SceneImporter.js +378 -423
- package/dist/cjs/import/SpineImporter.js +511 -546
- package/dist/cjs/import/SpriterImporter.js +590 -613
- package/dist/cjs/import/TiledMapImporter.js +811 -846
- package/dist/cjs/import/UnitySceneImporter.js +687 -703
- package/dist/cjs/import/index.js +206 -251
- package/dist/cjs/index.js +275 -278
- package/dist/cjs/input/GamepadNavigation.js +185 -205
- package/dist/cjs/input/InputManager.js +397 -421
- package/dist/cjs/input/useGamepads.js +70 -81
- package/dist/cjs/integration/IconSprite.js +129 -256
- package/dist/cjs/inventory/InventorySystem.js +920 -995
- package/dist/cjs/kids/KidMode.js +997 -1022
- package/dist/cjs/kids/KidTools.js +570 -594
- package/dist/cjs/monetization/Monetization.js +170 -177
- package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
- package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
- package/dist/cjs/native-engine/AnimationSystem.js +731 -806
- package/dist/cjs/native-engine/AssetPipeline.js +454 -515
- package/dist/cjs/native-engine/AudioEngine.js +763 -804
- package/dist/cjs/native-engine/InputSystem.js +1075 -1145
- package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
- package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
- package/dist/cjs/native-engine/RenderingEngine.js +302 -350
- package/dist/cjs/native-engine/SceneGraph.js +769 -808
- package/dist/cjs/network/MultiplayerTransport.js +97 -132
- package/dist/cjs/network/Networking.js +549 -564
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
- package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
- package/dist/cjs/pathfinding/Pathfinding.js +245 -263
- package/dist/cjs/performance/AssetStreaming.js +561 -635
- package/dist/cjs/performance/BenchmarkSuite.js +283 -311
- package/dist/cjs/performance/DeltaCompression.js +467 -526
- package/dist/cjs/performance/DeterministicPhysics.js +450 -498
- package/dist/cjs/performance/ECSOptimization.js +644 -695
- package/dist/cjs/performance/GameSaveSystem.js +509 -556
- package/dist/cjs/performance/HotReload.js +447 -500
- package/dist/cjs/performance/InputRecording.js +511 -561
- package/dist/cjs/performance/InterestManagement.js +453 -500
- package/dist/cjs/performance/LocalizationRuntime.js +376 -423
- package/dist/cjs/performance/MemoryManagement.js +410 -470
- package/dist/cjs/performance/ModSupport.js +445 -496
- package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
- package/dist/cjs/performance/NetworkPrediction.js +424 -482
- package/dist/cjs/performance/ObjectPooling.js +569 -617
- package/dist/cjs/performance/Performance.js +174 -190
- package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
- package/dist/cjs/performance/WebGPURenderer.js +656 -683
- package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
- package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
- package/dist/cjs/plugins/PluginSDK.js +432 -466
- package/dist/cjs/plugins/PluginTestKit.js +307 -330
- package/dist/cjs/procedural/Procedural.js +243 -254
- package/dist/cjs/procedural/WorldBuilding.js +297 -314
- package/dist/cjs/quest/QuestSystem.js +975 -932
- package/dist/cjs/release/MobileExport.js +157 -163
- package/dist/cjs/release/Release.js +225 -238
- package/dist/cjs/rendering/Camera2D.js +121 -124
- package/dist/cjs/rendering/Renderer2D.js +321 -335
- package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
- package/dist/cjs/runtime3d/Runtime3D.js +359 -378
- package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
- package/dist/cjs/scene/SceneManager.js +177 -193
- package/dist/cjs/scripting/GraphToAST.js +574 -547
- package/dist/cjs/scripting/LanguageExporter.js +254 -279
- package/dist/cjs/scripting/NodeGraph.js +546 -570
- package/dist/cjs/scripting/ScriptAST.js +31 -39
- package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
- package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
- package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
- package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
- package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
- package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
- package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
- package/dist/cjs/social/Social.js +72 -80
- package/dist/cjs/systems/LightingSystem.js +844 -931
- package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
- package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
- package/dist/cjs/systems/TerrainSystem.js +985 -1098
- package/dist/cjs/templates/ActionTemplates.js +296 -309
- package/dist/cjs/templates/FightingTemplate.js +417 -463
- package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
- package/dist/cjs/templates/PartyTemplates.js +190 -202
- package/dist/cjs/templates/PuzzleTemplates.js +245 -261
- package/dist/cjs/templates/RPGTemplates.js +160 -178
- package/dist/cjs/templates/SportsTemplates.js +237 -250
- package/dist/cjs/templates/StrategyTemplates.js +143 -153
- package/dist/cjs/templates/SurvivalTemplate.js +336 -380
- package/dist/cjs/templates/WaveDefense.js +499 -526
- package/dist/cjs/tilemap/Tilemap.js +207 -214
- package/dist/cjs/tutorials/TutorialBranching.js +396 -417
- package/dist/cjs/tutorials/TutorialEngine.js +888 -931
- package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
- package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
- package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
- package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
- package/dist/cjs/ui/GameUI.js +295 -312
- package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
- package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
- package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
- package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
- package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
- package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
- package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
- package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
- package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
- package/dist/cjs/xr/ARVR.js +167 -175
- package/dist/esm/accessibility/Accessibility.js +160 -164
- package/dist/esm/ai/AI.js +310 -293
- package/dist/esm/ai/BehaviorTree.js +1057 -1112
- package/dist/esm/ai/StateMachine.js +709 -755
- package/dist/esm/animation/Animation.js +237 -240
- package/dist/esm/audio/AudioAdvanced.js +239 -235
- package/dist/esm/audio/AudioBridge.js +448 -434
- package/dist/esm/audio/AudioManager.js +243 -258
- package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
- package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
- package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
- package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
- package/dist/esm/core/EventBus.js +52 -55
- package/dist/esm/core/GameClock.js +63 -65
- package/dist/esm/core/GameConfig.js +77 -78
- package/dist/esm/core/GameLoop.js +81 -88
- package/dist/esm/core/ServiceLocator.js +63 -64
- package/dist/esm/core/Validation.js +82 -81
- package/dist/esm/core/math.js +109 -111
- package/dist/esm/devtools/DevTools.js +546 -562
- package/dist/esm/devtools/DeveloperExperience.js +535 -558
- package/dist/esm/devtools/GameplayAnalytics.js +647 -645
- package/dist/esm/dialogue/DialogueSystem.js +998 -985
- package/dist/esm/docs/DocGenerator.js +342 -363
- package/dist/esm/ecs/World.js +358 -370
- package/dist/esm/editor/AchievementEditor.js +584 -635
- package/dist/esm/editor/AdvancedEditor.js +191 -190
- package/dist/esm/editor/AnimationRetargeting.js +700 -740
- package/dist/esm/editor/AssetBrowser.js +1078 -1159
- package/dist/esm/editor/AssetManager.js +188 -191
- package/dist/esm/editor/ConsolePro.js +977 -1060
- package/dist/esm/editor/CraftingEditor.js +684 -729
- package/dist/esm/editor/DebugTools.js +194 -184
- package/dist/esm/editor/DialogueSystem.js +849 -900
- package/dist/esm/editor/LeaderboardSystem.js +433 -482
- package/dist/esm/editor/NiceGameEditor.js +1908 -1200
- package/dist/esm/editor/PrefabSystem.js +777 -837
- package/dist/esm/editor/ProfilerPanel.js +654 -699
- package/dist/esm/editor/QuestEditor.js +795 -838
- package/dist/esm/editor/ReplaySystem.js +591 -633
- package/dist/esm/editor/SceneEditor.js +189 -199
- package/dist/esm/editor/ScreenshotMode.js +628 -687
- package/dist/esm/editor/ShaderGraph.js +1565 -1581
- package/dist/esm/editor/TimelineEditor.js +733 -777
- package/dist/esm/editor/UndoRedoPro.js +835 -903
- package/dist/esm/editor/VRARMode.js +586 -644
- package/dist/esm/engine/NiceGameEngine.js +142 -163
- package/dist/esm/engine/SaveSystem.js +447 -494
- package/dist/esm/enterprise/Enterprise.js +265 -260
- package/dist/esm/export/BevyExporter.js +929 -966
- package/dist/esm/export/CocosExporter.js +646 -672
- package/dist/esm/export/Construct3Exporter.js +785 -793
- package/dist/esm/export/DefoldExporter.js +1030 -1068
- package/dist/esm/export/GDevelopExporter.js +676 -707
- package/dist/esm/export/GameMakerExporter.js +793 -804
- package/dist/esm/export/GodotExporter.js +1004 -1044
- package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
- package/dist/esm/export/MonoGameExporter.js +1267 -1292
- package/dist/esm/export/Pico8Exporter.js +768 -811
- package/dist/esm/export/PlatformExporter.js +193 -205
- package/dist/esm/export/RPGMakerExporter.js +862 -878
- package/dist/esm/export/RobloxExporter.js +885 -918
- package/dist/esm/export/Solar2DExporter.js +1220 -1255
- package/dist/esm/export/ThreeJSExporter.js +1007 -1072
- package/dist/esm/export/Tic80Exporter.js +1212 -1266
- package/dist/esm/export/UnityExporter.js +1117 -1130
- package/dist/esm/export/UnrealExporter.js +891 -918
- package/dist/esm/export/WebExporter.js +933 -969
- package/dist/esm/export/index.js +86 -71
- package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
- package/dist/esm/godot-integration/GodotImport.js +935 -1026
- package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
- package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
- package/dist/esm/i18n/I18n.js +871 -899
- package/dist/esm/i18n/useTranslation.js +88 -88
- package/dist/esm/import/AsepriteImporter.js +637 -715
- package/dist/esm/import/DragonBonesImporter.js +417 -460
- package/dist/esm/import/GameMakerImporter.js +491 -520
- package/dist/esm/import/GodotSceneImporter.js +767 -821
- package/dist/esm/import/LDtkImporter.js +415 -453
- package/dist/esm/import/Live2DImporter.js +477 -517
- package/dist/esm/import/NdgFormat.js +410 -456
- package/dist/esm/import/OgmoImporter.js +446 -492
- package/dist/esm/import/RPGMakerImporter.js +431 -476
- package/dist/esm/import/SceneImporter.js +385 -422
- package/dist/esm/import/SpineImporter.js +491 -545
- package/dist/esm/import/SpriterImporter.js +570 -612
- package/dist/esm/import/TiledMapImporter.js +790 -845
- package/dist/esm/import/UnitySceneImporter.js +666 -702
- package/dist/esm/import/index.js +247 -258
- package/dist/esm/index.js +1332 -188
- package/dist/esm/input/GamepadNavigation.js +187 -204
- package/dist/esm/input/InputManager.js +401 -420
- package/dist/esm/input/useGamepads.js +72 -80
- package/dist/esm/integration/IconSprite.js +143 -255
- package/dist/esm/inventory/InventorySystem.js +925 -994
- package/dist/esm/kids/KidMode.js +1003 -1021
- package/dist/esm/kids/KidTools.js +573 -593
- package/dist/esm/monetization/Monetization.js +180 -176
- package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
- package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
- package/dist/esm/native-engine/AnimationSystem.js +735 -805
- package/dist/esm/native-engine/AssetPipeline.js +456 -514
- package/dist/esm/native-engine/AudioEngine.js +765 -803
- package/dist/esm/native-engine/InputSystem.js +1079 -1144
- package/dist/esm/native-engine/NetworkingSystem.js +740 -792
- package/dist/esm/native-engine/PhysicsEngine.js +585 -606
- package/dist/esm/native-engine/RenderingEngine.js +304 -349
- package/dist/esm/native-engine/SceneGraph.js +773 -807
- package/dist/esm/network/MultiplayerTransport.js +99 -131
- package/dist/esm/network/Networking.js +556 -563
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
- package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
- package/dist/esm/pathfinding/Pathfinding.js +249 -262
- package/dist/esm/performance/AssetStreaming.js +567 -634
- package/dist/esm/performance/BenchmarkSuite.js +285 -310
- package/dist/esm/performance/DeltaCompression.js +478 -525
- package/dist/esm/performance/DeterministicPhysics.js +479 -497
- package/dist/esm/performance/ECSOptimization.js +653 -694
- package/dist/esm/performance/GameSaveSystem.js +515 -555
- package/dist/esm/performance/HotReload.js +454 -499
- package/dist/esm/performance/InputRecording.js +520 -560
- package/dist/esm/performance/InterestManagement.js +460 -499
- package/dist/esm/performance/LocalizationRuntime.js +382 -422
- package/dist/esm/performance/MemoryManagement.js +415 -469
- package/dist/esm/performance/ModSupport.js +455 -495
- package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
- package/dist/esm/performance/NetworkPrediction.js +436 -481
- package/dist/esm/performance/ObjectPooling.js +582 -616
- package/dist/esm/performance/Performance.js +182 -189
- package/dist/esm/performance/PerformanceAdvanced.js +621 -636
- package/dist/esm/performance/WebGPURenderer.js +660 -682
- package/dist/esm/physics/PhysicsAdvanced.js +359 -378
- package/dist/esm/physics/PhysicsEngine2D.js +393 -426
- package/dist/esm/plugins/PluginSDK.js +435 -465
- package/dist/esm/plugins/PluginTestKit.js +315 -329
- package/dist/esm/procedural/Procedural.js +248 -253
- package/dist/esm/procedural/WorldBuilding.js +316 -313
- package/dist/esm/quest/QuestSystem.js +982 -931
- package/dist/esm/release/MobileExport.js +163 -162
- package/dist/esm/release/Release.js +234 -237
- package/dist/esm/rendering/Camera2D.js +122 -123
- package/dist/esm/rendering/Renderer2D.js +323 -334
- package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
- package/dist/esm/runtime3d/Runtime3D.js +368 -377
- package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
- package/dist/esm/scene/SceneManager.js +178 -192
- package/dist/esm/scripting/GraphToAST.js +576 -546
- package/dist/esm/scripting/LanguageExporter.js +263 -278
- package/dist/esm/scripting/NodeGraph.js +550 -569
- package/dist/esm/scripting/ScriptAST.js +45 -38
- package/dist/esm/scripting/VisualScripting2.js +1025 -1064
- package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
- package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
- package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
- package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
- package/dist/esm/scripting/exporters/RustExporter.js +460 -511
- package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
- package/dist/esm/social/Social.js +77 -79
- package/dist/esm/systems/LightingSystem.js +855 -930
- package/dist/esm/systems/ParticleSystem2.js +1453 -1450
- package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
- package/dist/esm/systems/TerrainSystem.js +996 -1097
- package/dist/esm/templates/ActionTemplates.js +307 -308
- package/dist/esm/templates/FightingTemplate.js +439 -462
- package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
- package/dist/esm/templates/PartyTemplates.js +206 -201
- package/dist/esm/templates/PuzzleTemplates.js +260 -260
- package/dist/esm/templates/RPGTemplates.js +172 -177
- package/dist/esm/templates/SportsTemplates.js +251 -249
- package/dist/esm/templates/StrategyTemplates.js +158 -152
- package/dist/esm/templates/SurvivalTemplate.js +367 -379
- package/dist/esm/templates/WaveDefense.js +501 -525
- package/dist/esm/tilemap/Tilemap.js +209 -213
- package/dist/esm/tutorials/TutorialBranching.js +399 -416
- package/dist/esm/tutorials/TutorialEngine.js +893 -930
- package/dist/esm/tutorials/TutorialOverlay.js +603 -639
- package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
- package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
- package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
- package/dist/esm/ui/GameUI.js +296 -311
- package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
- package/dist/esm/unity-integration/UnityImport.js +1071 -1175
- package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
- package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
- package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
- package/dist/esm/unreal-integration/UnrealImport.js +395 -411
- package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
- package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
- package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
- package/dist/esm/xr/ARVR.js +181 -174
- package/package.json +7 -12
|
@@ -1,553 +1,506 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file DeltaCompression.ts
|
|
3
|
-
* @description Network bandwidth optimization using delta compression
|
|
4
|
-
* PRO-1.5: Runtime & Performance
|
|
5
|
-
*
|
|
6
|
-
* Features:
|
|
7
|
-
* - Delta encoding for state updates
|
|
8
|
-
* - Variable-length encoding
|
|
9
|
-
* - Bit packing
|
|
10
|
-
* - Huffman compression
|
|
11
|
-
* - Quantization
|
|
12
|
-
* - Interest-based filtering
|
|
13
|
-
*/
|
|
14
|
-
// ============================================================
|
|
15
|
-
// Default Configuration
|
|
16
|
-
// ============================================================
|
|
17
1
|
const DEFAULT_QUANTIZATION = {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
position: { min: -1e4, max: 1e4, bits: 16 },
|
|
3
|
+
rotation: { min: -Math.PI, max: Math.PI, bits: 10 },
|
|
4
|
+
velocity: { min: -100, max: 100, bits: 12 },
|
|
5
|
+
health: { min: 0, max: 1e3, bits: 10 },
|
|
6
|
+
custom: {}
|
|
23
7
|
};
|
|
24
|
-
// ============================================================
|
|
25
|
-
// Bit Writer
|
|
26
|
-
// ============================================================
|
|
27
8
|
class BitWriter {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
9
|
+
constructor(initialSize = 1024) {
|
|
10
|
+
this.bitPosition = 0;
|
|
11
|
+
this.bytePosition = 0;
|
|
12
|
+
this.currentByte = 0;
|
|
13
|
+
this.buffer = new Uint8Array(initialSize);
|
|
14
|
+
}
|
|
15
|
+
writeBits(value, bits) {
|
|
16
|
+
value = value >>> 0;
|
|
17
|
+
while (bits > 0) {
|
|
18
|
+
const remainingBits = 8 - this.bitPosition;
|
|
19
|
+
const bitsToWrite = Math.min(remainingBits, bits);
|
|
20
|
+
const mask = (1 << bitsToWrite) - 1;
|
|
21
|
+
const shifted = value >> bits - bitsToWrite & mask;
|
|
22
|
+
this.currentByte |= shifted << remainingBits - bitsToWrite;
|
|
23
|
+
this.bitPosition += bitsToWrite;
|
|
24
|
+
bits -= bitsToWrite;
|
|
25
|
+
if (this.bitPosition === 8) {
|
|
26
|
+
this.flushByte();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
writeBool(value) {
|
|
31
|
+
this.writeBits(value ? 1 : 0, 1);
|
|
32
|
+
}
|
|
33
|
+
writeInt8(value) {
|
|
34
|
+
this.writeBits(value & 255, 8);
|
|
35
|
+
}
|
|
36
|
+
writeInt16(value) {
|
|
37
|
+
this.writeBits(value & 65535, 16);
|
|
38
|
+
}
|
|
39
|
+
writeInt32(value) {
|
|
40
|
+
this.writeBits(value >>> 0, 32);
|
|
41
|
+
}
|
|
42
|
+
writeFloat16(value) {
|
|
43
|
+
const half = floatToHalf(value);
|
|
44
|
+
this.writeBits(half, 16);
|
|
45
|
+
}
|
|
46
|
+
writeFloat32(value) {
|
|
47
|
+
const view = new DataView(new ArrayBuffer(4));
|
|
48
|
+
view.setFloat32(0, value);
|
|
49
|
+
this.writeBits(view.getUint32(0), 32);
|
|
50
|
+
}
|
|
51
|
+
writeString(str) {
|
|
52
|
+
const encoded = new TextEncoder().encode(str);
|
|
53
|
+
this.writeVarInt(encoded.length);
|
|
54
|
+
for (const byte of encoded) {
|
|
55
|
+
this.writeInt8(byte);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
writeVarInt(value) {
|
|
59
|
+
value = value >>> 0;
|
|
60
|
+
while (value >= 128) {
|
|
61
|
+
this.writeInt8(value & 127 | 128);
|
|
62
|
+
value >>>= 7;
|
|
63
|
+
}
|
|
64
|
+
this.writeInt8(value);
|
|
65
|
+
}
|
|
66
|
+
flushByte() {
|
|
67
|
+
this.ensureCapacity(this.bytePosition + 1);
|
|
68
|
+
this.buffer[this.bytePosition++] = this.currentByte;
|
|
69
|
+
this.currentByte = 0;
|
|
70
|
+
this.bitPosition = 0;
|
|
71
|
+
}
|
|
72
|
+
ensureCapacity(bytes) {
|
|
73
|
+
if (bytes > this.buffer.length) {
|
|
74
|
+
const newBuffer = new Uint8Array(this.buffer.length * 2);
|
|
75
|
+
newBuffer.set(this.buffer);
|
|
76
|
+
this.buffer = newBuffer;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
finish() {
|
|
80
|
+
if (this.bitPosition > 0) {
|
|
81
|
+
this.flushByte();
|
|
82
|
+
}
|
|
83
|
+
return this.buffer.slice(0, this.bytePosition);
|
|
84
|
+
}
|
|
85
|
+
getBitCount() {
|
|
86
|
+
return this.bytePosition * 8 + this.bitPosition;
|
|
87
|
+
}
|
|
108
88
|
}
|
|
109
|
-
// ============================================================
|
|
110
|
-
// Bit Reader
|
|
111
|
-
// ============================================================
|
|
112
89
|
class BitReader {
|
|
113
|
-
|
|
90
|
+
constructor(buffer) {
|
|
91
|
+
this.bitPosition = 0;
|
|
92
|
+
this.bytePosition = 0;
|
|
93
|
+
this.buffer = buffer;
|
|
94
|
+
this.currentByte = buffer[0] || 0;
|
|
95
|
+
}
|
|
96
|
+
readBits(bits) {
|
|
97
|
+
let value = 0;
|
|
98
|
+
while (bits > 0) {
|
|
99
|
+
const remainingBits = 8 - this.bitPosition;
|
|
100
|
+
const bitsToRead = Math.min(remainingBits, bits);
|
|
101
|
+
const mask = (1 << bitsToRead) - 1;
|
|
102
|
+
const shifted = this.currentByte >> remainingBits - bitsToRead & mask;
|
|
103
|
+
value |= shifted << bits - bitsToRead;
|
|
104
|
+
this.bitPosition += bitsToRead;
|
|
105
|
+
bits -= bitsToRead;
|
|
106
|
+
if (this.bitPosition === 8) {
|
|
107
|
+
this.bytePosition++;
|
|
108
|
+
this.currentByte = this.buffer[this.bytePosition] || 0;
|
|
114
109
|
this.bitPosition = 0;
|
|
115
|
-
|
|
116
|
-
this.buffer = buffer;
|
|
117
|
-
this.currentByte = buffer[0] || 0;
|
|
118
|
-
}
|
|
119
|
-
readBits(bits) {
|
|
120
|
-
let value = 0;
|
|
121
|
-
while (bits > 0) {
|
|
122
|
-
const remainingBits = 8 - this.bitPosition;
|
|
123
|
-
const bitsToRead = Math.min(remainingBits, bits);
|
|
124
|
-
const mask = (1 << bitsToRead) - 1;
|
|
125
|
-
const shifted = (this.currentByte >> (remainingBits - bitsToRead)) & mask;
|
|
126
|
-
value |= shifted << (bits - bitsToRead);
|
|
127
|
-
this.bitPosition += bitsToRead;
|
|
128
|
-
bits -= bitsToRead;
|
|
129
|
-
if (this.bitPosition === 8) {
|
|
130
|
-
this.bytePosition++;
|
|
131
|
-
this.currentByte = this.buffer[this.bytePosition] || 0;
|
|
132
|
-
this.bitPosition = 0;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return value;
|
|
136
|
-
}
|
|
137
|
-
readBool() {
|
|
138
|
-
return this.readBits(1) === 1;
|
|
139
|
-
}
|
|
140
|
-
readInt8() {
|
|
141
|
-
return this.readBits(8);
|
|
142
|
-
}
|
|
143
|
-
readInt16() {
|
|
144
|
-
return this.readBits(16);
|
|
145
|
-
}
|
|
146
|
-
readInt32() {
|
|
147
|
-
return this.readBits(32);
|
|
148
|
-
}
|
|
149
|
-
readFloat16() {
|
|
150
|
-
const half = this.readBits(16);
|
|
151
|
-
return halfToFloat(half);
|
|
152
|
-
}
|
|
153
|
-
readFloat32() {
|
|
154
|
-
const bits = this.readBits(32);
|
|
155
|
-
const view = new DataView(new ArrayBuffer(4));
|
|
156
|
-
view.setUint32(0, bits);
|
|
157
|
-
return view.getFloat32(0);
|
|
158
|
-
}
|
|
159
|
-
readString() {
|
|
160
|
-
const length = this.readVarInt();
|
|
161
|
-
const bytes = new Uint8Array(length);
|
|
162
|
-
for (let i = 0; i < length; i++) {
|
|
163
|
-
bytes[i] = this.readInt8();
|
|
164
|
-
}
|
|
165
|
-
return new TextDecoder().decode(bytes);
|
|
166
|
-
}
|
|
167
|
-
readVarInt() {
|
|
168
|
-
let value = 0;
|
|
169
|
-
let shift = 0;
|
|
170
|
-
let byte;
|
|
171
|
-
do {
|
|
172
|
-
byte = this.readInt8();
|
|
173
|
-
value |= (byte & 0x7f) << shift;
|
|
174
|
-
shift += 7;
|
|
175
|
-
} while (byte & 0x80);
|
|
176
|
-
return value;
|
|
177
|
-
}
|
|
178
|
-
hasMore() {
|
|
179
|
-
return this.bytePosition < this.buffer.length;
|
|
110
|
+
}
|
|
180
111
|
}
|
|
112
|
+
return value;
|
|
113
|
+
}
|
|
114
|
+
readBool() {
|
|
115
|
+
return this.readBits(1) === 1;
|
|
116
|
+
}
|
|
117
|
+
readInt8() {
|
|
118
|
+
return this.readBits(8);
|
|
119
|
+
}
|
|
120
|
+
readInt16() {
|
|
121
|
+
return this.readBits(16);
|
|
122
|
+
}
|
|
123
|
+
readInt32() {
|
|
124
|
+
return this.readBits(32);
|
|
125
|
+
}
|
|
126
|
+
readFloat16() {
|
|
127
|
+
const half = this.readBits(16);
|
|
128
|
+
return halfToFloat(half);
|
|
129
|
+
}
|
|
130
|
+
readFloat32() {
|
|
131
|
+
const bits = this.readBits(32);
|
|
132
|
+
const view = new DataView(new ArrayBuffer(4));
|
|
133
|
+
view.setUint32(0, bits);
|
|
134
|
+
return view.getFloat32(0);
|
|
135
|
+
}
|
|
136
|
+
readString() {
|
|
137
|
+
const length = this.readVarInt();
|
|
138
|
+
const bytes = new Uint8Array(length);
|
|
139
|
+
for (let i = 0; i < length; i++) {
|
|
140
|
+
bytes[i] = this.readInt8();
|
|
141
|
+
}
|
|
142
|
+
return new TextDecoder().decode(bytes);
|
|
143
|
+
}
|
|
144
|
+
readVarInt() {
|
|
145
|
+
let value = 0;
|
|
146
|
+
let shift = 0;
|
|
147
|
+
let byte;
|
|
148
|
+
do {
|
|
149
|
+
byte = this.readInt8();
|
|
150
|
+
value |= (byte & 127) << shift;
|
|
151
|
+
shift += 7;
|
|
152
|
+
} while (byte & 128);
|
|
153
|
+
return value;
|
|
154
|
+
}
|
|
155
|
+
hasMore() {
|
|
156
|
+
return this.bytePosition < this.buffer.length;
|
|
157
|
+
}
|
|
181
158
|
}
|
|
182
|
-
// ============================================================
|
|
183
|
-
// Float16 Conversion
|
|
184
|
-
// ============================================================
|
|
185
159
|
function floatToHalf(value) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
return (sign << 15) | ((exponent + 15) << 10) | (mantissa >> 13);
|
|
160
|
+
const view = new DataView(new ArrayBuffer(4));
|
|
161
|
+
view.setFloat32(0, value);
|
|
162
|
+
const bits = view.getUint32(0);
|
|
163
|
+
const sign = bits >>> 31 & 1;
|
|
164
|
+
let exponent = bits >>> 23 & 255;
|
|
165
|
+
let mantissa = bits & 8388607;
|
|
166
|
+
if (exponent === 255) {
|
|
167
|
+
return sign << 15 | 31744 | (mantissa ? 512 : 0);
|
|
168
|
+
}
|
|
169
|
+
exponent -= 127;
|
|
170
|
+
if (exponent < -24) {
|
|
171
|
+
return sign << 15;
|
|
172
|
+
}
|
|
173
|
+
if (exponent < -14) {
|
|
174
|
+
mantissa = (mantissa | 8388608) >> -14 - exponent;
|
|
175
|
+
return sign << 15 | mantissa >> 13;
|
|
176
|
+
}
|
|
177
|
+
if (exponent > 15) {
|
|
178
|
+
return sign << 15 | 31744;
|
|
179
|
+
}
|
|
180
|
+
return sign << 15 | exponent + 15 << 10 | mantissa >> 13;
|
|
208
181
|
}
|
|
209
182
|
function halfToFloat(half) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return value;
|
|
183
|
+
const sign = half >>> 15 & 1;
|
|
184
|
+
const exponent = half >>> 10 & 31;
|
|
185
|
+
const mantissa = half & 1023;
|
|
186
|
+
let value;
|
|
187
|
+
if (exponent === 0) {
|
|
188
|
+
if (mantissa === 0) {
|
|
189
|
+
value = sign ? -0 : 0;
|
|
190
|
+
} else {
|
|
191
|
+
value = Math.pow(2, -14) * (mantissa / 1024);
|
|
192
|
+
if (sign) {
|
|
193
|
+
value = -value;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
} else if (exponent === 31) {
|
|
197
|
+
value = mantissa ? NaN : sign ? -Infinity : Infinity;
|
|
198
|
+
} else {
|
|
199
|
+
value = Math.pow(2, exponent - 15) * (1 + mantissa / 1024);
|
|
200
|
+
if (sign) {
|
|
201
|
+
value = -value;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return value;
|
|
235
205
|
}
|
|
236
|
-
// ============================================================
|
|
237
|
-
// Quantization
|
|
238
|
-
// ============================================================
|
|
239
206
|
function quantize(value, min, max, bits) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
207
|
+
const range = max - min;
|
|
208
|
+
const maxValue = (1 << bits) - 1;
|
|
209
|
+
const normalized = Math.max(0, Math.min(1, (value - min) / range));
|
|
210
|
+
return Math.round(normalized * maxValue);
|
|
244
211
|
}
|
|
245
212
|
function dequantize(quantized, min, max, bits) {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
213
|
+
const range = max - min;
|
|
214
|
+
const maxValue = (1 << bits) - 1;
|
|
215
|
+
return min + quantized / maxValue * range;
|
|
249
216
|
}
|
|
250
|
-
// ============================================================
|
|
251
|
-
// Delta Encoder
|
|
252
|
-
// ============================================================
|
|
253
217
|
class DeltaEncoder {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
const compressedBytes = bytes.length;
|
|
423
|
-
return {
|
|
424
|
-
rawBytes,
|
|
425
|
-
compressedBytes,
|
|
426
|
-
compressionRatio: rawBytes / Math.max(1, compressedBytes),
|
|
427
|
-
entitiesEncoded: delta.entities.length,
|
|
428
|
-
fieldsChanged: delta.entities.reduce((sum, e) => sum + e.changedFields.length, 0),
|
|
429
|
-
bitsUsed: writer.getBitCount(),
|
|
430
|
-
};
|
|
431
|
-
}
|
|
432
|
-
reset() {
|
|
433
|
-
this.previousStates.clear();
|
|
434
|
-
}
|
|
218
|
+
constructor(quantization) {
|
|
219
|
+
this.previousStates = /* @__PURE__ */ new Map();
|
|
220
|
+
this.quantization = { ...DEFAULT_QUANTIZATION, ...quantization };
|
|
221
|
+
}
|
|
222
|
+
encode(currentState) {
|
|
223
|
+
const writer = new BitWriter();
|
|
224
|
+
const delta = {
|
|
225
|
+
frame: 0,
|
|
226
|
+
timestamp: Date.now(),
|
|
227
|
+
entities: [],
|
|
228
|
+
deletedEntities: [],
|
|
229
|
+
events: []
|
|
230
|
+
};
|
|
231
|
+
const currentIds = new Set(Object.keys(currentState));
|
|
232
|
+
for (const id of this.previousStates.keys()) {
|
|
233
|
+
if (!currentIds.has(id)) {
|
|
234
|
+
delta.deletedEntities.push(id);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
for (const [id, state] of Object.entries(currentState)) {
|
|
238
|
+
const previous = this.previousStates.get(id);
|
|
239
|
+
const isNew = !previous;
|
|
240
|
+
const deltaEntity = {
|
|
241
|
+
id,
|
|
242
|
+
isNew,
|
|
243
|
+
changedFields: [],
|
|
244
|
+
values: {}
|
|
245
|
+
};
|
|
246
|
+
for (const [field, value] of Object.entries(state)) {
|
|
247
|
+
const prevValue = previous?.[field];
|
|
248
|
+
if (isNew || !this.valuesEqual(value, prevValue)) {
|
|
249
|
+
deltaEntity.changedFields.push(field);
|
|
250
|
+
deltaEntity.values[field] = this.encodeValue(field, value);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (deltaEntity.changedFields.length > 0 || isNew) {
|
|
254
|
+
delta.entities.push(deltaEntity);
|
|
255
|
+
}
|
|
256
|
+
this.previousStates.set(id, { ...state });
|
|
257
|
+
}
|
|
258
|
+
for (const id of delta.deletedEntities) {
|
|
259
|
+
this.previousStates.delete(id);
|
|
260
|
+
}
|
|
261
|
+
this.writeDelta(writer, delta);
|
|
262
|
+
const bytes = writer.finish();
|
|
263
|
+
const stats = this.calculateStats(currentState, bytes, delta, writer);
|
|
264
|
+
return { delta, bytes, stats };
|
|
265
|
+
}
|
|
266
|
+
valuesEqual(a, b) {
|
|
267
|
+
if (a === b) {
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
if (typeof a !== typeof b) {
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
274
|
+
return Math.abs(a - b) < 1e-4;
|
|
275
|
+
}
|
|
276
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
277
|
+
}
|
|
278
|
+
encodeValue(field, value) {
|
|
279
|
+
if (typeof value === "boolean") {
|
|
280
|
+
return { type: "bool", value, bits: 1 };
|
|
281
|
+
}
|
|
282
|
+
if (typeof value === "string") {
|
|
283
|
+
return { type: "string", value };
|
|
284
|
+
}
|
|
285
|
+
if (typeof value === "number") {
|
|
286
|
+
const config = this.getQuantizationConfig(field);
|
|
287
|
+
if (config) {
|
|
288
|
+
const quantized = quantize(value, config.min, config.max, config.bits);
|
|
289
|
+
return { type: "uint16", value, quantized, bits: config.bits };
|
|
290
|
+
}
|
|
291
|
+
return { type: "float16", value, bits: 16 };
|
|
292
|
+
}
|
|
293
|
+
return { type: "string", value: JSON.stringify(value) };
|
|
294
|
+
}
|
|
295
|
+
getQuantizationConfig(field) {
|
|
296
|
+
const lower = field.toLowerCase();
|
|
297
|
+
if (lower.includes("position") || lower.includes("pos")) {
|
|
298
|
+
return this.quantization.position;
|
|
299
|
+
}
|
|
300
|
+
if (lower.includes("rotation") || lower.includes("angle")) {
|
|
301
|
+
return this.quantization.rotation;
|
|
302
|
+
}
|
|
303
|
+
if (lower.includes("velocity") || lower.includes("speed")) {
|
|
304
|
+
return this.quantization.velocity;
|
|
305
|
+
}
|
|
306
|
+
if (lower.includes("health") || lower.includes("hp")) {
|
|
307
|
+
return this.quantization.health;
|
|
308
|
+
}
|
|
309
|
+
return this.quantization.custom[field];
|
|
310
|
+
}
|
|
311
|
+
writeDelta(writer, delta) {
|
|
312
|
+
writer.writeInt32(delta.timestamp);
|
|
313
|
+
writer.writeVarInt(delta.deletedEntities.length);
|
|
314
|
+
for (const id of delta.deletedEntities) {
|
|
315
|
+
writer.writeString(id);
|
|
316
|
+
}
|
|
317
|
+
writer.writeVarInt(delta.entities.length);
|
|
318
|
+
for (const entity of delta.entities) {
|
|
319
|
+
writer.writeString(entity.id);
|
|
320
|
+
writer.writeBool(entity.isNew);
|
|
321
|
+
writer.writeVarInt(entity.changedFields.length);
|
|
322
|
+
for (const field of entity.changedFields) {
|
|
323
|
+
writer.writeString(field);
|
|
324
|
+
this.writeValue(writer, entity.values[field]);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
writeValue(writer, value) {
|
|
329
|
+
const typeIndex = [
|
|
330
|
+
"bool",
|
|
331
|
+
"int8",
|
|
332
|
+
"int16",
|
|
333
|
+
"int32",
|
|
334
|
+
"uint8",
|
|
335
|
+
"uint16",
|
|
336
|
+
"float16",
|
|
337
|
+
"float32",
|
|
338
|
+
"string"
|
|
339
|
+
].indexOf(value.type);
|
|
340
|
+
writer.writeBits(typeIndex, 4);
|
|
341
|
+
switch (value.type) {
|
|
342
|
+
case "bool":
|
|
343
|
+
writer.writeBool(value.value);
|
|
344
|
+
break;
|
|
345
|
+
case "int8":
|
|
346
|
+
case "uint8":
|
|
347
|
+
writer.writeInt8(value.value);
|
|
348
|
+
break;
|
|
349
|
+
case "int16":
|
|
350
|
+
case "uint16":
|
|
351
|
+
if (value.quantized !== void 0 && value.bits) {
|
|
352
|
+
writer.writeBits(value.quantized, value.bits);
|
|
353
|
+
} else {
|
|
354
|
+
writer.writeInt16(value.value);
|
|
355
|
+
}
|
|
356
|
+
break;
|
|
357
|
+
case "int32":
|
|
358
|
+
writer.writeInt32(value.value);
|
|
359
|
+
break;
|
|
360
|
+
case "float16":
|
|
361
|
+
writer.writeFloat16(value.value);
|
|
362
|
+
break;
|
|
363
|
+
case "float32":
|
|
364
|
+
writer.writeFloat32(value.value);
|
|
365
|
+
break;
|
|
366
|
+
case "string":
|
|
367
|
+
writer.writeString(value.value);
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
calculateStats(state, bytes, delta, writer) {
|
|
372
|
+
const rawBytes = JSON.stringify(state).length;
|
|
373
|
+
const compressedBytes = bytes.length;
|
|
374
|
+
return {
|
|
375
|
+
rawBytes,
|
|
376
|
+
compressedBytes,
|
|
377
|
+
compressionRatio: rawBytes / Math.max(1, compressedBytes),
|
|
378
|
+
entitiesEncoded: delta.entities.length,
|
|
379
|
+
fieldsChanged: delta.entities.reduce((sum, e) => sum + e.changedFields.length, 0),
|
|
380
|
+
bitsUsed: writer.getBitCount()
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
reset() {
|
|
384
|
+
this.previousStates.clear();
|
|
385
|
+
}
|
|
435
386
|
}
|
|
436
|
-
// ============================================================
|
|
437
|
-
// Delta Decoder
|
|
438
|
-
// ============================================================
|
|
439
387
|
class DeltaDecoder {
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
getState() {
|
|
534
|
-
return Object.fromEntries(this.currentState);
|
|
535
|
-
}
|
|
388
|
+
constructor(quantization) {
|
|
389
|
+
this.currentState = /* @__PURE__ */ new Map();
|
|
390
|
+
this.quantization = { ...DEFAULT_QUANTIZATION, ...quantization };
|
|
391
|
+
}
|
|
392
|
+
decode(bytes) {
|
|
393
|
+
const reader = new BitReader(bytes);
|
|
394
|
+
reader.readInt32();
|
|
395
|
+
const deletedCount = reader.readVarInt();
|
|
396
|
+
for (let i = 0; i < deletedCount; i++) {
|
|
397
|
+
const id = reader.readString();
|
|
398
|
+
this.currentState.delete(id);
|
|
399
|
+
}
|
|
400
|
+
const entityCount = reader.readVarInt();
|
|
401
|
+
for (let i = 0; i < entityCount; i++) {
|
|
402
|
+
const id = reader.readString();
|
|
403
|
+
const isNew = reader.readBool();
|
|
404
|
+
const fieldCount = reader.readVarInt();
|
|
405
|
+
let entity = this.currentState.get(id);
|
|
406
|
+
if (!entity || isNew) {
|
|
407
|
+
entity = {};
|
|
408
|
+
this.currentState.set(id, entity);
|
|
409
|
+
}
|
|
410
|
+
for (let j = 0; j < fieldCount; j++) {
|
|
411
|
+
const field = reader.readString();
|
|
412
|
+
const value = this.readValue(reader, field);
|
|
413
|
+
entity[field] = value;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return Object.fromEntries(this.currentState);
|
|
417
|
+
}
|
|
418
|
+
readValue(reader, field) {
|
|
419
|
+
const typeIndex = reader.readBits(4);
|
|
420
|
+
const types = [
|
|
421
|
+
"bool",
|
|
422
|
+
"int8",
|
|
423
|
+
"int16",
|
|
424
|
+
"int32",
|
|
425
|
+
"uint8",
|
|
426
|
+
"uint16",
|
|
427
|
+
"float16",
|
|
428
|
+
"float32",
|
|
429
|
+
"string"
|
|
430
|
+
];
|
|
431
|
+
const type = types[typeIndex];
|
|
432
|
+
switch (type) {
|
|
433
|
+
case "bool":
|
|
434
|
+
return reader.readBool();
|
|
435
|
+
case "int8":
|
|
436
|
+
case "uint8":
|
|
437
|
+
return reader.readInt8();
|
|
438
|
+
case "int16":
|
|
439
|
+
case "uint16": {
|
|
440
|
+
const config = this.getQuantizationConfig(field);
|
|
441
|
+
if (config) {
|
|
442
|
+
const quantized = reader.readBits(config.bits);
|
|
443
|
+
return dequantize(quantized, config.min, config.max, config.bits);
|
|
444
|
+
}
|
|
445
|
+
return reader.readInt16();
|
|
446
|
+
}
|
|
447
|
+
case "int32":
|
|
448
|
+
return reader.readInt32();
|
|
449
|
+
case "float16":
|
|
450
|
+
return reader.readFloat16();
|
|
451
|
+
case "float32":
|
|
452
|
+
return reader.readFloat32();
|
|
453
|
+
case "string":
|
|
454
|
+
return reader.readString();
|
|
455
|
+
default:
|
|
456
|
+
return null;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
getQuantizationConfig(field) {
|
|
460
|
+
const lower = field.toLowerCase();
|
|
461
|
+
if (lower.includes("position") || lower.includes("pos")) {
|
|
462
|
+
return this.quantization.position;
|
|
463
|
+
}
|
|
464
|
+
if (lower.includes("rotation") || lower.includes("angle")) {
|
|
465
|
+
return this.quantization.rotation;
|
|
466
|
+
}
|
|
467
|
+
if (lower.includes("velocity") || lower.includes("speed")) {
|
|
468
|
+
return this.quantization.velocity;
|
|
469
|
+
}
|
|
470
|
+
if (lower.includes("health") || lower.includes("hp")) {
|
|
471
|
+
return this.quantization.health;
|
|
472
|
+
}
|
|
473
|
+
return this.quantization.custom[field];
|
|
474
|
+
}
|
|
475
|
+
reset() {
|
|
476
|
+
this.currentState.clear();
|
|
477
|
+
}
|
|
478
|
+
getState() {
|
|
479
|
+
return Object.fromEntries(this.currentState);
|
|
480
|
+
}
|
|
536
481
|
}
|
|
537
|
-
// ============================================================
|
|
538
|
-
// Factory Functions
|
|
539
|
-
// ============================================================
|
|
540
482
|
function createDeltaEncoder(quantization) {
|
|
541
|
-
|
|
483
|
+
return new DeltaEncoder(quantization);
|
|
542
484
|
}
|
|
543
485
|
function createDeltaDecoder(quantization) {
|
|
544
|
-
|
|
486
|
+
return new DeltaDecoder(quantization);
|
|
545
487
|
}
|
|
546
488
|
function createBitWriter(initialSize) {
|
|
547
|
-
|
|
489
|
+
return new BitWriter(initialSize);
|
|
548
490
|
}
|
|
549
491
|
function createBitReader(buffer) {
|
|
550
|
-
|
|
492
|
+
return new BitReader(buffer);
|
|
551
493
|
}
|
|
552
|
-
|
|
553
|
-
|
|
494
|
+
export {
|
|
495
|
+
BitReader,
|
|
496
|
+
BitWriter,
|
|
497
|
+
DEFAULT_QUANTIZATION,
|
|
498
|
+
DeltaDecoder,
|
|
499
|
+
DeltaEncoder,
|
|
500
|
+
createBitReader,
|
|
501
|
+
createBitWriter,
|
|
502
|
+
createDeltaDecoder,
|
|
503
|
+
createDeltaEncoder,
|
|
504
|
+
dequantize,
|
|
505
|
+
quantize
|
|
506
|
+
};
|