@nice2dev/game-engine 1.3.15 → 1.3.16

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.
Files changed (434) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/dist/cjs/accessibility/Accessibility.js +152 -165
  3. package/dist/cjs/ai/AI.js +292 -294
  4. package/dist/cjs/ai/BehaviorTree.js +1029 -1113
  5. package/dist/cjs/ai/StateMachine.js +694 -756
  6. package/dist/cjs/animation/Animation.js +232 -241
  7. package/dist/cjs/audio/AudioAdvanced.js +221 -236
  8. package/dist/cjs/audio/AudioBridge.js +441 -435
  9. package/dist/cjs/audio/AudioManager.js +242 -259
  10. package/dist/cjs/build-cloud/BuildOrchestration.js +1059 -1098
  11. package/dist/cjs/build-cloud/GodotBuildCloud.js +641 -670
  12. package/dist/cjs/build-cloud/UnityBuildCloud.js +563 -610
  13. package/dist/cjs/build-cloud/UnrealBuildCloud.js +610 -635
  14. package/dist/cjs/core/EventBus.js +51 -56
  15. package/dist/cjs/core/GameClock.js +62 -66
  16. package/dist/cjs/core/GameConfig.js +72 -79
  17. package/dist/cjs/core/GameLoop.js +80 -89
  18. package/dist/cjs/core/ServiceLocator.js +61 -65
  19. package/dist/cjs/core/Validation.js +72 -82
  20. package/dist/cjs/core/math.js +108 -112
  21. package/dist/cjs/devtools/DevTools.js +542 -563
  22. package/dist/cjs/devtools/DeveloperExperience.js +521 -559
  23. package/dist/cjs/devtools/GameplayAnalytics.js +636 -646
  24. package/dist/cjs/dialogue/DialogueSystem.js +984 -986
  25. package/dist/cjs/docs/DocGenerator.js +339 -364
  26. package/dist/cjs/ecs/World.js +355 -371
  27. package/dist/cjs/editor/AchievementEditor.js +580 -636
  28. package/dist/cjs/editor/AdvancedEditor.js +184 -191
  29. package/dist/cjs/editor/AnimationRetargeting.js +696 -741
  30. package/dist/cjs/editor/AssetBrowser.js +1072 -1160
  31. package/dist/cjs/editor/AssetManager.js +187 -192
  32. package/dist/cjs/editor/ConsolePro.js +971 -1061
  33. package/dist/cjs/editor/CraftingEditor.js +680 -730
  34. package/dist/cjs/editor/DebugTools.js +187 -185
  35. package/dist/cjs/editor/DialogueSystem.js +844 -901
  36. package/dist/cjs/editor/LeaderboardSystem.js +429 -483
  37. package/dist/cjs/editor/NiceGameEditor.js +1903 -1201
  38. package/dist/cjs/editor/PrefabSystem.js +772 -838
  39. package/dist/cjs/editor/ProfilerPanel.js +649 -700
  40. package/dist/cjs/editor/QuestEditor.js +792 -839
  41. package/dist/cjs/editor/ReplaySystem.js +585 -634
  42. package/dist/cjs/editor/SceneEditor.js +176 -200
  43. package/dist/cjs/editor/ScreenshotMode.js +621 -688
  44. package/dist/cjs/editor/ShaderGraph.js +1556 -1582
  45. package/dist/cjs/editor/TimelineEditor.js +715 -778
  46. package/dist/cjs/editor/UndoRedoPro.js +830 -904
  47. package/dist/cjs/editor/VRARMode.js +582 -645
  48. package/dist/cjs/engine/NiceGameEngine.js +141 -164
  49. package/dist/cjs/engine/SaveSystem.js +441 -495
  50. package/dist/cjs/enterprise/Enterprise.js +254 -261
  51. package/dist/cjs/export/BevyExporter.js +927 -967
  52. package/dist/cjs/export/CocosExporter.js +644 -673
  53. package/dist/cjs/export/Construct3Exporter.js +783 -794
  54. package/dist/cjs/export/DefoldExporter.js +1028 -1069
  55. package/dist/cjs/export/GDevelopExporter.js +674 -708
  56. package/dist/cjs/export/GameMakerExporter.js +791 -805
  57. package/dist/cjs/export/GodotExporter.js +1003 -1045
  58. package/dist/cjs/export/MinecraftBedrockExporter.js +573 -578
  59. package/dist/cjs/export/MonoGameExporter.js +1265 -1293
  60. package/dist/cjs/export/Pico8Exporter.js +766 -812
  61. package/dist/cjs/export/PlatformExporter.js +188 -206
  62. package/dist/cjs/export/RPGMakerExporter.js +860 -879
  63. package/dist/cjs/export/RobloxExporter.js +883 -919
  64. package/dist/cjs/export/Solar2DExporter.js +1218 -1256
  65. package/dist/cjs/export/ThreeJSExporter.js +1006 -1073
  66. package/dist/cjs/export/Tic80Exporter.js +1210 -1267
  67. package/dist/cjs/export/UnityExporter.js +1116 -1131
  68. package/dist/cjs/export/UnrealExporter.js +889 -919
  69. package/dist/cjs/export/WebExporter.js +931 -970
  70. package/dist/cjs/export/index.js +42 -65
  71. package/dist/cjs/godot-integration/GodotAssetLibrary.js +659 -692
  72. package/dist/cjs/godot-integration/GodotImport.js +929 -1027
  73. package/dist/cjs/godot-integration/GodotLiveLink.js +915 -945
  74. package/dist/cjs/godot-integration/components/GodotProjectBrowser.js +911 -611
  75. package/dist/cjs/i18n/I18n.js +860 -900
  76. package/dist/cjs/i18n/useTranslation.js +84 -89
  77. package/dist/cjs/import/AsepriteImporter.js +658 -716
  78. package/dist/cjs/import/DragonBonesImporter.js +437 -461
  79. package/dist/cjs/import/GameMakerImporter.js +511 -521
  80. package/dist/cjs/import/GodotSceneImporter.js +788 -822
  81. package/dist/cjs/import/LDtkImporter.js +436 -454
  82. package/dist/cjs/import/Live2DImporter.js +497 -518
  83. package/dist/cjs/import/NdgFormat.js +424 -457
  84. package/dist/cjs/import/OgmoImporter.js +466 -493
  85. package/dist/cjs/import/RPGMakerImporter.js +451 -477
  86. package/dist/cjs/import/SceneImporter.js +378 -423
  87. package/dist/cjs/import/SpineImporter.js +511 -546
  88. package/dist/cjs/import/SpriterImporter.js +590 -613
  89. package/dist/cjs/import/TiledMapImporter.js +811 -846
  90. package/dist/cjs/import/UnitySceneImporter.js +687 -703
  91. package/dist/cjs/import/index.js +206 -251
  92. package/dist/cjs/index.js +275 -278
  93. package/dist/cjs/input/GamepadNavigation.js +185 -205
  94. package/dist/cjs/input/InputManager.js +397 -421
  95. package/dist/cjs/input/useGamepads.js +70 -81
  96. package/dist/cjs/integration/IconSprite.js +129 -256
  97. package/dist/cjs/inventory/InventorySystem.js +920 -995
  98. package/dist/cjs/kids/KidMode.js +997 -1022
  99. package/dist/cjs/kids/KidTools.js +570 -594
  100. package/dist/cjs/monetization/Monetization.js +170 -177
  101. package/dist/cjs/multiplayer/LocalMultiplayer.js +287 -287
  102. package/dist/cjs/multiplayer/MiniGameTypes.js +49 -59
  103. package/dist/cjs/native-engine/AnimationSystem.js +731 -806
  104. package/dist/cjs/native-engine/AssetPipeline.js +454 -515
  105. package/dist/cjs/native-engine/AudioEngine.js +763 -804
  106. package/dist/cjs/native-engine/InputSystem.js +1075 -1145
  107. package/dist/cjs/native-engine/NetworkingSystem.js +733 -793
  108. package/dist/cjs/native-engine/PhysicsEngine.js +583 -607
  109. package/dist/cjs/native-engine/RenderingEngine.js +302 -350
  110. package/dist/cjs/native-engine/SceneGraph.js +769 -808
  111. package/dist/cjs/network/MultiplayerTransport.js +97 -132
  112. package/dist/cjs/network/Networking.js +549 -564
  113. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AbortController.js +21 -29
  114. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +40 -48
  115. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +35 -43
  116. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +10 -15
  117. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Errors.js +103 -135
  118. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +131 -158
  119. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +39 -53
  120. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +5 -8
  121. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +40 -48
  122. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +494 -572
  123. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +826 -953
  124. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +125 -146
  125. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +13 -23
  126. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ILogger.js +11 -25
  127. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ITransport.js +13 -24
  128. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +108 -121
  129. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Loggers.js +10 -14
  130. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +150 -185
  131. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +158 -196
  132. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +90 -105
  133. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Subject.js +30 -35
  134. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +16 -21
  135. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/Utils.js +215 -248
  136. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +135 -157
  137. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +76 -85
  138. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/index.js +24 -27
  139. package/dist/cjs/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +3 -4
  140. package/dist/cjs/pathfinding/Pathfinding.js +245 -263
  141. package/dist/cjs/performance/AssetStreaming.js +561 -635
  142. package/dist/cjs/performance/BenchmarkSuite.js +283 -311
  143. package/dist/cjs/performance/DeltaCompression.js +467 -526
  144. package/dist/cjs/performance/DeterministicPhysics.js +450 -498
  145. package/dist/cjs/performance/ECSOptimization.js +644 -695
  146. package/dist/cjs/performance/GameSaveSystem.js +509 -556
  147. package/dist/cjs/performance/HotReload.js +447 -500
  148. package/dist/cjs/performance/InputRecording.js +511 -561
  149. package/dist/cjs/performance/InterestManagement.js +453 -500
  150. package/dist/cjs/performance/LocalizationRuntime.js +376 -423
  151. package/dist/cjs/performance/MemoryManagement.js +410 -470
  152. package/dist/cjs/performance/ModSupport.js +445 -496
  153. package/dist/cjs/performance/MultiThreadedPhysics.js +400 -443
  154. package/dist/cjs/performance/NetworkPrediction.js +424 -482
  155. package/dist/cjs/performance/ObjectPooling.js +569 -617
  156. package/dist/cjs/performance/Performance.js +174 -190
  157. package/dist/cjs/performance/PerformanceAdvanced.js +614 -637
  158. package/dist/cjs/performance/WebGPURenderer.js +656 -683
  159. package/dist/cjs/physics/PhysicsAdvanced.js +345 -379
  160. package/dist/cjs/physics/PhysicsEngine2D.js +391 -427
  161. package/dist/cjs/plugins/PluginSDK.js +432 -466
  162. package/dist/cjs/plugins/PluginTestKit.js +307 -330
  163. package/dist/cjs/procedural/Procedural.js +243 -254
  164. package/dist/cjs/procedural/WorldBuilding.js +297 -314
  165. package/dist/cjs/quest/QuestSystem.js +975 -932
  166. package/dist/cjs/release/MobileExport.js +157 -163
  167. package/dist/cjs/release/Release.js +225 -238
  168. package/dist/cjs/rendering/Camera2D.js +121 -124
  169. package/dist/cjs/rendering/Renderer2D.js +321 -335
  170. package/dist/cjs/rendering/WebGPURenderPipeline.js +632 -651
  171. package/dist/cjs/runtime3d/Runtime3D.js +359 -378
  172. package/dist/cjs/runtime3d/SceneEditor3D.js +252 -263
  173. package/dist/cjs/scene/SceneManager.js +177 -193
  174. package/dist/cjs/scripting/GraphToAST.js +574 -547
  175. package/dist/cjs/scripting/LanguageExporter.js +254 -279
  176. package/dist/cjs/scripting/NodeGraph.js +546 -570
  177. package/dist/cjs/scripting/ScriptAST.js +31 -39
  178. package/dist/cjs/scripting/VisualScripting2.js +1016 -1065
  179. package/dist/cjs/scripting/exporters/CSharpExporter.js +464 -496
  180. package/dist/cjs/scripting/exporters/GDScriptExporter.js +390 -442
  181. package/dist/cjs/scripting/exporters/LuaExporter.js +406 -447
  182. package/dist/cjs/scripting/exporters/PythonExporter.js +484 -549
  183. package/dist/cjs/scripting/exporters/RustExporter.js +459 -512
  184. package/dist/cjs/scripting/exporters/TypeScriptExporter.js +505 -556
  185. package/dist/cjs/social/Social.js +72 -80
  186. package/dist/cjs/systems/LightingSystem.js +844 -931
  187. package/dist/cjs/systems/ParticleSystem2.js +1447 -1451
  188. package/dist/cjs/systems/PhysicsDebugSystem.js +1070 -1141
  189. package/dist/cjs/systems/TerrainSystem.js +985 -1098
  190. package/dist/cjs/templates/ActionTemplates.js +296 -309
  191. package/dist/cjs/templates/FightingTemplate.js +417 -463
  192. package/dist/cjs/templates/MetroidvaniaTemplate.js +353 -405
  193. package/dist/cjs/templates/PartyTemplates.js +190 -202
  194. package/dist/cjs/templates/PuzzleTemplates.js +245 -261
  195. package/dist/cjs/templates/RPGTemplates.js +160 -178
  196. package/dist/cjs/templates/SportsTemplates.js +237 -250
  197. package/dist/cjs/templates/StrategyTemplates.js +143 -153
  198. package/dist/cjs/templates/SurvivalTemplate.js +336 -380
  199. package/dist/cjs/templates/WaveDefense.js +499 -526
  200. package/dist/cjs/tilemap/Tilemap.js +207 -214
  201. package/dist/cjs/tutorials/TutorialBranching.js +396 -417
  202. package/dist/cjs/tutorials/TutorialEngine.js +888 -931
  203. package/dist/cjs/tutorials/TutorialOverlay.js +602 -640
  204. package/dist/cjs/tutorials/content/Tutorials_T05_T08.js +787 -809
  205. package/dist/cjs/tutorials/content/Tutorials_T09_T11.js +736 -756
  206. package/dist/cjs/tutorials/content/Tutorials_T12_T15.js +754 -778
  207. package/dist/cjs/ui/GameUI.js +295 -312
  208. package/dist/cjs/unity-integration/UnityAssetStore.js +700 -741
  209. package/dist/cjs/unity-integration/UnityImport.js +1066 -1176
  210. package/dist/cjs/unity-integration/UnityLiveLink.js +934 -981
  211. package/dist/cjs/unity-integration/components/UnityAssetStoreBrowser.js +1233 -757
  212. package/dist/cjs/unity-integration/components/UnityProjectBrowser.js +1240 -768
  213. package/dist/cjs/unreal-integration/UnrealImport.js +391 -412
  214. package/dist/cjs/unreal-integration/UnrealLiveLink.js +1102 -1137
  215. package/dist/cjs/unreal-integration/UnrealMarketplace.js +436 -473
  216. package/dist/cjs/unreal-integration/components/UnrealProjectBrowser.js +1150 -767
  217. package/dist/cjs/xr/ARVR.js +167 -175
  218. package/dist/esm/accessibility/Accessibility.js +160 -164
  219. package/dist/esm/ai/AI.js +310 -293
  220. package/dist/esm/ai/BehaviorTree.js +1057 -1112
  221. package/dist/esm/ai/StateMachine.js +709 -755
  222. package/dist/esm/animation/Animation.js +237 -240
  223. package/dist/esm/audio/AudioAdvanced.js +239 -235
  224. package/dist/esm/audio/AudioBridge.js +448 -434
  225. package/dist/esm/audio/AudioManager.js +243 -258
  226. package/dist/esm/build-cloud/BuildOrchestration.js +1071 -1097
  227. package/dist/esm/build-cloud/GodotBuildCloud.js +647 -669
  228. package/dist/esm/build-cloud/UnityBuildCloud.js +571 -609
  229. package/dist/esm/build-cloud/UnrealBuildCloud.js +615 -634
  230. package/dist/esm/core/EventBus.js +52 -55
  231. package/dist/esm/core/GameClock.js +63 -65
  232. package/dist/esm/core/GameConfig.js +77 -78
  233. package/dist/esm/core/GameLoop.js +81 -88
  234. package/dist/esm/core/ServiceLocator.js +63 -64
  235. package/dist/esm/core/Validation.js +82 -81
  236. package/dist/esm/core/math.js +109 -111
  237. package/dist/esm/devtools/DevTools.js +546 -562
  238. package/dist/esm/devtools/DeveloperExperience.js +535 -558
  239. package/dist/esm/devtools/GameplayAnalytics.js +647 -645
  240. package/dist/esm/dialogue/DialogueSystem.js +998 -985
  241. package/dist/esm/docs/DocGenerator.js +342 -363
  242. package/dist/esm/ecs/World.js +358 -370
  243. package/dist/esm/editor/AchievementEditor.js +584 -635
  244. package/dist/esm/editor/AdvancedEditor.js +191 -190
  245. package/dist/esm/editor/AnimationRetargeting.js +700 -740
  246. package/dist/esm/editor/AssetBrowser.js +1078 -1159
  247. package/dist/esm/editor/AssetManager.js +188 -191
  248. package/dist/esm/editor/ConsolePro.js +977 -1060
  249. package/dist/esm/editor/CraftingEditor.js +684 -729
  250. package/dist/esm/editor/DebugTools.js +194 -184
  251. package/dist/esm/editor/DialogueSystem.js +849 -900
  252. package/dist/esm/editor/LeaderboardSystem.js +433 -482
  253. package/dist/esm/editor/NiceGameEditor.js +1908 -1200
  254. package/dist/esm/editor/PrefabSystem.js +777 -837
  255. package/dist/esm/editor/ProfilerPanel.js +654 -699
  256. package/dist/esm/editor/QuestEditor.js +795 -838
  257. package/dist/esm/editor/ReplaySystem.js +591 -633
  258. package/dist/esm/editor/SceneEditor.js +189 -199
  259. package/dist/esm/editor/ScreenshotMode.js +628 -687
  260. package/dist/esm/editor/ShaderGraph.js +1565 -1581
  261. package/dist/esm/editor/TimelineEditor.js +733 -777
  262. package/dist/esm/editor/UndoRedoPro.js +835 -903
  263. package/dist/esm/editor/VRARMode.js +586 -644
  264. package/dist/esm/engine/NiceGameEngine.js +142 -163
  265. package/dist/esm/engine/SaveSystem.js +447 -494
  266. package/dist/esm/enterprise/Enterprise.js +265 -260
  267. package/dist/esm/export/BevyExporter.js +929 -966
  268. package/dist/esm/export/CocosExporter.js +646 -672
  269. package/dist/esm/export/Construct3Exporter.js +785 -793
  270. package/dist/esm/export/DefoldExporter.js +1030 -1068
  271. package/dist/esm/export/GDevelopExporter.js +676 -707
  272. package/dist/esm/export/GameMakerExporter.js +793 -804
  273. package/dist/esm/export/GodotExporter.js +1004 -1044
  274. package/dist/esm/export/MinecraftBedrockExporter.js +575 -577
  275. package/dist/esm/export/MonoGameExporter.js +1267 -1292
  276. package/dist/esm/export/Pico8Exporter.js +768 -811
  277. package/dist/esm/export/PlatformExporter.js +193 -205
  278. package/dist/esm/export/RPGMakerExporter.js +862 -878
  279. package/dist/esm/export/RobloxExporter.js +885 -918
  280. package/dist/esm/export/Solar2DExporter.js +1220 -1255
  281. package/dist/esm/export/ThreeJSExporter.js +1007 -1072
  282. package/dist/esm/export/Tic80Exporter.js +1212 -1266
  283. package/dist/esm/export/UnityExporter.js +1117 -1130
  284. package/dist/esm/export/UnrealExporter.js +891 -918
  285. package/dist/esm/export/WebExporter.js +933 -969
  286. package/dist/esm/export/index.js +86 -71
  287. package/dist/esm/godot-integration/GodotAssetLibrary.js +663 -691
  288. package/dist/esm/godot-integration/GodotImport.js +935 -1026
  289. package/dist/esm/godot-integration/GodotLiveLink.js +918 -944
  290. package/dist/esm/godot-integration/components/GodotProjectBrowser.js +912 -610
  291. package/dist/esm/i18n/I18n.js +871 -899
  292. package/dist/esm/i18n/useTranslation.js +88 -88
  293. package/dist/esm/import/AsepriteImporter.js +637 -715
  294. package/dist/esm/import/DragonBonesImporter.js +417 -460
  295. package/dist/esm/import/GameMakerImporter.js +491 -520
  296. package/dist/esm/import/GodotSceneImporter.js +767 -821
  297. package/dist/esm/import/LDtkImporter.js +415 -453
  298. package/dist/esm/import/Live2DImporter.js +477 -517
  299. package/dist/esm/import/NdgFormat.js +410 -456
  300. package/dist/esm/import/OgmoImporter.js +446 -492
  301. package/dist/esm/import/RPGMakerImporter.js +431 -476
  302. package/dist/esm/import/SceneImporter.js +385 -422
  303. package/dist/esm/import/SpineImporter.js +491 -545
  304. package/dist/esm/import/SpriterImporter.js +570 -612
  305. package/dist/esm/import/TiledMapImporter.js +790 -845
  306. package/dist/esm/import/UnitySceneImporter.js +666 -702
  307. package/dist/esm/import/index.js +247 -258
  308. package/dist/esm/index.js +1332 -188
  309. package/dist/esm/input/GamepadNavigation.js +187 -204
  310. package/dist/esm/input/InputManager.js +401 -420
  311. package/dist/esm/input/useGamepads.js +72 -80
  312. package/dist/esm/integration/IconSprite.js +143 -255
  313. package/dist/esm/inventory/InventorySystem.js +925 -994
  314. package/dist/esm/kids/KidMode.js +1003 -1021
  315. package/dist/esm/kids/KidTools.js +573 -593
  316. package/dist/esm/monetization/Monetization.js +180 -176
  317. package/dist/esm/multiplayer/LocalMultiplayer.js +290 -286
  318. package/dist/esm/multiplayer/MiniGameTypes.js +58 -58
  319. package/dist/esm/native-engine/AnimationSystem.js +735 -805
  320. package/dist/esm/native-engine/AssetPipeline.js +456 -514
  321. package/dist/esm/native-engine/AudioEngine.js +765 -803
  322. package/dist/esm/native-engine/InputSystem.js +1079 -1144
  323. package/dist/esm/native-engine/NetworkingSystem.js +740 -792
  324. package/dist/esm/native-engine/PhysicsEngine.js +585 -606
  325. package/dist/esm/native-engine/RenderingEngine.js +304 -349
  326. package/dist/esm/native-engine/SceneGraph.js +773 -807
  327. package/dist/esm/network/MultiplayerTransport.js +99 -131
  328. package/dist/esm/network/Networking.js +556 -563
  329. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AbortController.js +22 -28
  330. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/AccessTokenHttpClient.js +41 -47
  331. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +36 -42
  332. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +11 -14
  333. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Errors.js +111 -134
  334. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +132 -157
  335. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +40 -52
  336. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +6 -7
  337. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +42 -47
  338. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +496 -571
  339. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +828 -952
  340. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +126 -145
  341. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +14 -23
  342. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ILogger.js +12 -25
  343. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ITransport.js +15 -24
  344. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +109 -120
  345. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Loggers.js +11 -13
  346. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +151 -184
  347. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/MessageBuffer.js +159 -195
  348. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +91 -104
  349. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Subject.js +31 -34
  350. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +17 -20
  351. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/Utils.js +230 -248
  352. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +136 -156
  353. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +77 -84
  354. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/index.js +31 -12
  355. package/dist/esm/node_modules/@microsoft/signalr/dist/esm/pkg-version.js +4 -3
  356. package/dist/esm/pathfinding/Pathfinding.js +249 -262
  357. package/dist/esm/performance/AssetStreaming.js +567 -634
  358. package/dist/esm/performance/BenchmarkSuite.js +285 -310
  359. package/dist/esm/performance/DeltaCompression.js +478 -525
  360. package/dist/esm/performance/DeterministicPhysics.js +479 -497
  361. package/dist/esm/performance/ECSOptimization.js +653 -694
  362. package/dist/esm/performance/GameSaveSystem.js +515 -555
  363. package/dist/esm/performance/HotReload.js +454 -499
  364. package/dist/esm/performance/InputRecording.js +520 -560
  365. package/dist/esm/performance/InterestManagement.js +460 -499
  366. package/dist/esm/performance/LocalizationRuntime.js +382 -422
  367. package/dist/esm/performance/MemoryManagement.js +415 -469
  368. package/dist/esm/performance/ModSupport.js +455 -495
  369. package/dist/esm/performance/MultiThreadedPhysics.js +408 -442
  370. package/dist/esm/performance/NetworkPrediction.js +436 -481
  371. package/dist/esm/performance/ObjectPooling.js +582 -616
  372. package/dist/esm/performance/Performance.js +182 -189
  373. package/dist/esm/performance/PerformanceAdvanced.js +621 -636
  374. package/dist/esm/performance/WebGPURenderer.js +660 -682
  375. package/dist/esm/physics/PhysicsAdvanced.js +359 -378
  376. package/dist/esm/physics/PhysicsEngine2D.js +393 -426
  377. package/dist/esm/plugins/PluginSDK.js +435 -465
  378. package/dist/esm/plugins/PluginTestKit.js +315 -329
  379. package/dist/esm/procedural/Procedural.js +248 -253
  380. package/dist/esm/procedural/WorldBuilding.js +316 -313
  381. package/dist/esm/quest/QuestSystem.js +982 -931
  382. package/dist/esm/release/MobileExport.js +163 -162
  383. package/dist/esm/release/Release.js +234 -237
  384. package/dist/esm/rendering/Camera2D.js +122 -123
  385. package/dist/esm/rendering/Renderer2D.js +323 -334
  386. package/dist/esm/rendering/WebGPURenderPipeline.js +647 -650
  387. package/dist/esm/runtime3d/Runtime3D.js +368 -377
  388. package/dist/esm/runtime3d/SceneEditor3D.js +268 -262
  389. package/dist/esm/scene/SceneManager.js +178 -192
  390. package/dist/esm/scripting/GraphToAST.js +576 -546
  391. package/dist/esm/scripting/LanguageExporter.js +263 -278
  392. package/dist/esm/scripting/NodeGraph.js +550 -569
  393. package/dist/esm/scripting/ScriptAST.js +45 -38
  394. package/dist/esm/scripting/VisualScripting2.js +1025 -1064
  395. package/dist/esm/scripting/exporters/CSharpExporter.js +465 -495
  396. package/dist/esm/scripting/exporters/GDScriptExporter.js +391 -441
  397. package/dist/esm/scripting/exporters/LuaExporter.js +407 -446
  398. package/dist/esm/scripting/exporters/PythonExporter.js +485 -548
  399. package/dist/esm/scripting/exporters/RustExporter.js +460 -511
  400. package/dist/esm/scripting/exporters/TypeScriptExporter.js +506 -555
  401. package/dist/esm/social/Social.js +77 -79
  402. package/dist/esm/systems/LightingSystem.js +855 -930
  403. package/dist/esm/systems/ParticleSystem2.js +1453 -1450
  404. package/dist/esm/systems/PhysicsDebugSystem.js +1078 -1140
  405. package/dist/esm/systems/TerrainSystem.js +996 -1097
  406. package/dist/esm/templates/ActionTemplates.js +307 -308
  407. package/dist/esm/templates/FightingTemplate.js +439 -462
  408. package/dist/esm/templates/MetroidvaniaTemplate.js +391 -404
  409. package/dist/esm/templates/PartyTemplates.js +206 -201
  410. package/dist/esm/templates/PuzzleTemplates.js +260 -260
  411. package/dist/esm/templates/RPGTemplates.js +172 -177
  412. package/dist/esm/templates/SportsTemplates.js +251 -249
  413. package/dist/esm/templates/StrategyTemplates.js +158 -152
  414. package/dist/esm/templates/SurvivalTemplate.js +367 -379
  415. package/dist/esm/templates/WaveDefense.js +501 -525
  416. package/dist/esm/tilemap/Tilemap.js +209 -213
  417. package/dist/esm/tutorials/TutorialBranching.js +399 -416
  418. package/dist/esm/tutorials/TutorialEngine.js +893 -930
  419. package/dist/esm/tutorials/TutorialOverlay.js +603 -639
  420. package/dist/esm/tutorials/content/Tutorials_T05_T08.js +792 -808
  421. package/dist/esm/tutorials/content/Tutorials_T09_T11.js +740 -755
  422. package/dist/esm/tutorials/content/Tutorials_T12_T15.js +759 -777
  423. package/dist/esm/ui/GameUI.js +296 -311
  424. package/dist/esm/unity-integration/UnityAssetStore.js +704 -740
  425. package/dist/esm/unity-integration/UnityImport.js +1071 -1175
  426. package/dist/esm/unity-integration/UnityLiveLink.js +938 -980
  427. package/dist/esm/unity-integration/components/UnityAssetStoreBrowser.js +1234 -756
  428. package/dist/esm/unity-integration/components/UnityProjectBrowser.js +1241 -767
  429. package/dist/esm/unreal-integration/UnrealImport.js +395 -411
  430. package/dist/esm/unreal-integration/UnrealLiveLink.js +1105 -1136
  431. package/dist/esm/unreal-integration/UnrealMarketplace.js +442 -472
  432. package/dist/esm/unreal-integration/components/UnrealProjectBrowser.js +1151 -766
  433. package/dist/esm/xr/ARVR.js +181 -174
  434. package/package.json +7 -12
@@ -1,588 +1,565 @@
1
- /* ────────────────────────────────────────────────────────────────
2
- DeveloperExperience — LEGENDARY DX improvements
3
-
4
- Features:
5
- • Rich error messages with suggestions and docs links
6
- • API usage hints / auto-complete metadata
7
- • Performance dashboard data collection
8
- • Engine health check
9
- • Debug overlay system
10
- ──────────────────────────────────────────────────────────────── */
11
- /** Error code registry with friendly messages */
12
1
  const ERROR_REGISTRY = {
13
- E001: {
14
- message: 'Entity not found',
15
- suggestion: 'Check that the entity ID exists. Use world.hasEntity(id) before accessing.',
16
- docsSection: 'ecs/entities',
17
- severity: 'error',
18
- },
19
- E002: {
20
- message: 'Component not found on entity',
21
- suggestion: 'Use world.hasComponent(entityId, type) to check before getComponent().',
22
- docsSection: 'ecs/components',
23
- severity: 'error',
24
- },
25
- E003: {
26
- message: 'Scene not registered',
27
- suggestion: 'Register the scene with sceneManager.register(id, config) before loading it.',
28
- docsSection: 'scenes/management',
29
- severity: 'error',
30
- },
31
- E004: {
32
- message: 'Canvas not found',
33
- suggestion: 'Ensure the canvas element exists in the DOM before creating the engine. Use document.getElementById("your-canvas-id").',
34
- docsSection: 'getting-started',
35
- severity: 'error',
36
- },
37
- E005: {
38
- message: 'Physics body has NaN values',
39
- suggestion: 'A velocity or position component has NaN. Check for division by zero or uninitialized values.',
40
- docsSection: 'physics/debugging',
41
- severity: 'error',
42
- },
43
- E006: {
44
- message: 'Asset not loaded',
45
- suggestion: 'Load assets before using them: await assetManager.load(id, url). Check assetManager.isLoaded(id).',
46
- docsSection: 'assets/loading',
47
- severity: 'error',
48
- },
49
- E007: {
50
- message: 'System priority conflict',
51
- suggestion: 'Two systems have the same priority. Assign unique priority values to control execution order.',
52
- docsSection: 'ecs/systems',
53
- severity: 'warning',
54
- },
55
- E008: {
56
- message: 'Maximum entity count exceeded',
57
- suggestion: 'You have too many entities. Consider using object pooling (ObjectPool) or destroying unused entities.',
58
- docsSection: 'performance/pooling',
59
- severity: 'warning',
60
- },
61
- E009: {
62
- message: 'Circular parent reference detected',
63
- suggestion: 'Entity A is a child of B which is a child of A. Remove the circular parent-child relationship.',
64
- docsSection: 'ecs/hierarchy',
65
- severity: 'error',
66
- },
67
- E010: {
68
- message: 'WebGL context lost',
69
- suggestion: 'The browser lost the rendering context. This usually happens with GPU memory issues. Try reducing texture sizes.',
70
- docsSection: 'rendering/troubleshooting',
71
- severity: 'error',
72
- },
73
- W001: {
74
- message: 'Frame time exceeds budget',
75
- suggestion: 'The frame took longer than 16.67ms (60 FPS). Profile your systems to find the bottleneck.',
76
- docsSection: 'performance/profiling',
77
- severity: 'warning',
78
- },
79
- W002: {
80
- message: 'Orphaned event listener',
81
- suggestion: 'An event listener was registered but never unsubscribed. Store the unsubscribe function and call it in dispose().',
82
- docsSection: 'patterns/cleanup',
83
- severity: 'warning',
84
- },
85
- W003: {
86
- message: 'Deprecated API usage',
87
- suggestion: 'This API is deprecated and will be removed in a future version. Check the migration guide.',
88
- docsSection: 'migration',
89
- severity: 'warning',
90
- },
91
- W004: {
92
- message: 'Large texture detected',
93
- suggestion: 'Texture exceeds 2048x2048. Consider using texture atlases or lower resolution for better performance.',
94
- docsSection: 'assets/optimization',
95
- severity: 'warning',
96
- },
97
- I001: {
98
- message: 'Engine initialized successfully',
99
- suggestion: '',
100
- docsSection: 'getting-started',
101
- severity: 'info',
102
- },
103
- I002: {
104
- message: 'Hot module replacement active',
105
- suggestion: 'Changes to game scripts will be applied without restarting the engine.',
106
- docsSection: 'development/hmr',
107
- severity: 'info',
108
- },
2
+ E001: {
3
+ message: "Entity not found",
4
+ suggestion: "Check that the entity ID exists. Use world.hasEntity(id) before accessing.",
5
+ docsSection: "ecs/entities",
6
+ severity: "error"
7
+ },
8
+ E002: {
9
+ message: "Component not found on entity",
10
+ suggestion: "Use world.hasComponent(entityId, type) to check before getComponent().",
11
+ docsSection: "ecs/components",
12
+ severity: "error"
13
+ },
14
+ E003: {
15
+ message: "Scene not registered",
16
+ suggestion: "Register the scene with sceneManager.register(id, config) before loading it.",
17
+ docsSection: "scenes/management",
18
+ severity: "error"
19
+ },
20
+ E004: {
21
+ message: "Canvas not found",
22
+ suggestion: 'Ensure the canvas element exists in the DOM before creating the engine. Use document.getElementById("your-canvas-id").',
23
+ docsSection: "getting-started",
24
+ severity: "error"
25
+ },
26
+ E005: {
27
+ message: "Physics body has NaN values",
28
+ suggestion: "A velocity or position component has NaN. Check for division by zero or uninitialized values.",
29
+ docsSection: "physics/debugging",
30
+ severity: "error"
31
+ },
32
+ E006: {
33
+ message: "Asset not loaded",
34
+ suggestion: "Load assets before using them: await assetManager.load(id, url). Check assetManager.isLoaded(id).",
35
+ docsSection: "assets/loading",
36
+ severity: "error"
37
+ },
38
+ E007: {
39
+ message: "System priority conflict",
40
+ suggestion: "Two systems have the same priority. Assign unique priority values to control execution order.",
41
+ docsSection: "ecs/systems",
42
+ severity: "warning"
43
+ },
44
+ E008: {
45
+ message: "Maximum entity count exceeded",
46
+ suggestion: "You have too many entities. Consider using object pooling (ObjectPool) or destroying unused entities.",
47
+ docsSection: "performance/pooling",
48
+ severity: "warning"
49
+ },
50
+ E009: {
51
+ message: "Circular parent reference detected",
52
+ suggestion: "Entity A is a child of B which is a child of A. Remove the circular parent-child relationship.",
53
+ docsSection: "ecs/hierarchy",
54
+ severity: "error"
55
+ },
56
+ E010: {
57
+ message: "WebGL context lost",
58
+ suggestion: "The browser lost the rendering context. This usually happens with GPU memory issues. Try reducing texture sizes.",
59
+ docsSection: "rendering/troubleshooting",
60
+ severity: "error"
61
+ },
62
+ W001: {
63
+ message: "Frame time exceeds budget",
64
+ suggestion: "The frame took longer than 16.67ms (60 FPS). Profile your systems to find the bottleneck.",
65
+ docsSection: "performance/profiling",
66
+ severity: "warning"
67
+ },
68
+ W002: {
69
+ message: "Orphaned event listener",
70
+ suggestion: "An event listener was registered but never unsubscribed. Store the unsubscribe function and call it in dispose().",
71
+ docsSection: "patterns/cleanup",
72
+ severity: "warning"
73
+ },
74
+ W003: {
75
+ message: "Deprecated API usage",
76
+ suggestion: "This API is deprecated and will be removed in a future version. Check the migration guide.",
77
+ docsSection: "migration",
78
+ severity: "warning"
79
+ },
80
+ W004: {
81
+ message: "Large texture detected",
82
+ suggestion: "Texture exceeds 2048x2048. Consider using texture atlases or lower resolution for better performance.",
83
+ docsSection: "assets/optimization",
84
+ severity: "warning"
85
+ },
86
+ I001: {
87
+ message: "Engine initialized successfully",
88
+ suggestion: "",
89
+ docsSection: "getting-started",
90
+ severity: "info"
91
+ },
92
+ I002: {
93
+ message: "Hot module replacement active",
94
+ suggestion: "Changes to game scripts will be applied without restarting the engine.",
95
+ docsSection: "development/hmr",
96
+ severity: "info"
97
+ }
109
98
  };
110
- /** Get a rich engine error by code */
111
99
  function getEngineError(code, context) {
112
- const entry = ERROR_REGISTRY[code];
113
- if (!entry) {
114
- return {
115
- code,
116
- message: `Unknown engine error: ${code}`,
117
- suggestion: 'Report this issue at github.com/nicetdev/game-engine/issues',
118
- severity: 'error',
119
- context,
120
- };
121
- }
122
- return { code, ...entry, context };
100
+ const entry = ERROR_REGISTRY[code];
101
+ if (!entry) {
102
+ return {
103
+ code,
104
+ message: `Unknown engine error: ${code}`,
105
+ suggestion: "Report this issue at github.com/nicetdev/game-engine/issues",
106
+ severity: "error",
107
+ context
108
+ };
109
+ }
110
+ return { code, ...entry, context };
123
111
  }
124
- /** Format an engine error for console output */
125
112
  function formatEngineError(err) {
126
- const label = err.severity === 'error' ? 'Error' : err.severity === 'warning' ? 'Warning' : 'Info';
127
- const lines = [`${label}: [Nice2Dev ${err.code}] ${err.message}`];
128
- if (err.suggestion) {
129
- lines.push(` Tip: ${err.suggestion}`);
130
- }
131
- if (err.docsSection) {
132
- lines.push(` Docs: https://nice2dev.com/docs/game-engine/${err.docsSection}`);
133
- }
134
- if (err.context) {
135
- lines.push(` Context: ${JSON.stringify(err.context)}`);
136
- }
137
- return lines.join('\n');
113
+ const label = err.severity === "error" ? "Error" : err.severity === "warning" ? "Warning" : "Info";
114
+ const lines = [`${label}: [Nice2Dev ${err.code}] ${err.message}`];
115
+ if (err.suggestion) {
116
+ lines.push(` Tip: ${err.suggestion}`);
117
+ }
118
+ if (err.docsSection) {
119
+ lines.push(` Docs: https://nice2dev.com/docs/game-engine/${err.docsSection}`);
120
+ }
121
+ if (err.context) {
122
+ lines.push(` Context: ${JSON.stringify(err.context)}`);
123
+ }
124
+ return lines.join("\n");
138
125
  }
139
- /** Throw a rich engine error */
140
126
  function throwEngineError(code, context) {
141
- const err = getEngineError(code, context);
142
- throw new Error(formatEngineError(err));
127
+ const err = getEngineError(code, context);
128
+ throw new Error(formatEngineError(err));
143
129
  }
144
- /** Log a rich engine warning */
145
130
  function warnEngine(code, context) {
146
- const err = getEngineError(code, context);
147
- console.warn(formatEngineError(err));
131
+ const err = getEngineError(code, context);
132
+ console.warn(formatEngineError(err));
148
133
  }
149
- /** Core API hints for auto-complete and intellisense */
150
134
  const API_HINTS = [
151
- {
152
- method: 'world.createEntity',
153
- module: 'ECS',
154
- signature: 'world.createEntity(name?: string): EntityId',
155
- description: 'Create a new entity in the world',
156
- example: 'const player = world.createEntity("Player");',
157
- params: [
158
- { name: 'name', type: 'string', description: 'Optional display name', optional: true },
159
- ],
160
- returns: 'EntityId — unique numeric ID',
161
- since: '0.1.0',
162
- tags: ['ecs', 'entity', 'create'],
163
- },
164
- {
165
- method: 'world.addComponent',
166
- module: 'ECS',
167
- signature: 'world.addComponent<K>(entityId, type: K, data?: Partial<ComponentMap[K]>): ComponentMap[K]',
168
- description: 'Add a component to an entity',
169
- example: 'world.addComponent(player, "Transform", { x: 100, y: 200 });',
170
- params: [
171
- { name: 'entityId', type: 'EntityId', description: 'Entity to add component to' },
172
- {
173
- name: 'type',
174
- type: 'string',
175
- description: 'Component type name (e.g., "Transform", "Sprite")',
176
- },
177
- {
178
- name: 'data',
179
- type: 'Partial<ComponentMap[K]>',
180
- description: 'Initial component data',
181
- optional: true,
182
- },
183
- ],
184
- returns: 'The created component instance',
185
- since: '0.1.0',
186
- tags: ['ecs', 'component', 'add'],
187
- },
188
- {
189
- method: 'world.getComponent',
190
- module: 'ECS',
191
- signature: 'world.getComponent<K>(entityId, type: K): ComponentMap[K]',
192
- description: 'Get a component from an entity',
193
- example: 'const pos = world.getComponent(player, "Transform");',
194
- params: [
195
- { name: 'entityId', type: 'EntityId', description: 'Entity to get from' },
196
- { name: 'type', type: 'string', description: 'Component type name' },
197
- ],
198
- returns: 'The component data',
199
- since: '0.1.0',
200
- tags: ['ecs', 'component', 'get'],
201
- },
202
- {
203
- method: 'world.query',
204
- module: 'ECS',
205
- signature: 'world.query(...types: string[]): EntityId[]',
206
- description: 'Find all entities with ALL specified components',
207
- example: 'const movers = world.query("Transform", "RigidBody2D");',
208
- params: [
209
- { name: 'types', type: '...string[]', description: 'Component types to match (spread)' },
210
- ],
211
- returns: 'Array of matching EntityIds',
212
- since: '0.1.0',
213
- tags: ['ecs', 'query', 'search'],
214
- },
215
- {
216
- method: 'engine.start',
217
- module: 'Engine',
218
- signature: 'engine.start(): void',
219
- description: 'Start the game loop',
220
- example: 'engine.start();',
221
- params: [],
222
- returns: 'void',
223
- since: '0.1.0',
224
- tags: ['engine', 'start', 'loop'],
225
- },
226
- {
227
- method: 'input.isKeyDown',
228
- module: 'Input',
229
- signature: 'input.isKeyDown(key: string): boolean',
230
- description: 'Check if a key is currently held down (continuous)',
231
- example: 'if (input.isKeyDown("ArrowRight")) { /* move */ }',
232
- params: [
233
- { name: 'key', type: 'string', description: 'Key code (e.g., "ArrowLeft", "Space", "KeyA")' },
234
- ],
235
- returns: 'boolean',
236
- since: '0.1.0',
237
- tags: ['input', 'keyboard', 'continuous'],
238
- },
239
- {
240
- method: 'input.isKeyPressed',
241
- module: 'Input',
242
- signature: 'input.isKeyPressed(key: string): boolean',
243
- description: 'Check if a key was just pressed this frame (single-frame)',
244
- example: 'if (input.isKeyPressed("Space")) { /* jump */ }',
245
- params: [{ name: 'key', type: 'string', description: 'Key code' }],
246
- returns: 'boolean — true only on the first frame',
247
- since: '0.1.0',
248
- tags: ['input', 'keyboard', 'single-frame'],
249
- },
250
- {
251
- method: 'sceneManager.loadScene',
252
- module: 'Scene',
253
- signature: 'sceneManager.loadScene(id: string, transition?: TransitionType): void',
254
- description: 'Load a registered scene with optional transition',
255
- example: 'sceneManager.loadScene("level2", "fade");',
256
- params: [
257
- { name: 'id', type: 'string', description: 'Scene ID' },
258
- {
259
- name: 'transition',
260
- type: 'TransitionType',
261
- description: 'Transition effect',
262
- optional: true,
263
- },
264
- ],
265
- returns: 'void',
266
- since: '0.1.0',
267
- tags: ['scene', 'load', 'transition'],
268
- },
135
+ {
136
+ method: "world.createEntity",
137
+ module: "ECS",
138
+ signature: "world.createEntity(name?: string): EntityId",
139
+ description: "Create a new entity in the world",
140
+ example: 'const player = world.createEntity("Player");',
141
+ params: [
142
+ { name: "name", type: "string", description: "Optional display name", optional: true }
143
+ ],
144
+ returns: "EntityId — unique numeric ID",
145
+ since: "0.1.0",
146
+ tags: ["ecs", "entity", "create"]
147
+ },
148
+ {
149
+ method: "world.addComponent",
150
+ module: "ECS",
151
+ signature: "world.addComponent<K>(entityId, type: K, data?: Partial<ComponentMap[K]>): ComponentMap[K]",
152
+ description: "Add a component to an entity",
153
+ example: 'world.addComponent(player, "Transform", { x: 100, y: 200 });',
154
+ params: [
155
+ { name: "entityId", type: "EntityId", description: "Entity to add component to" },
156
+ {
157
+ name: "type",
158
+ type: "string",
159
+ description: 'Component type name (e.g., "Transform", "Sprite")'
160
+ },
161
+ {
162
+ name: "data",
163
+ type: "Partial<ComponentMap[K]>",
164
+ description: "Initial component data",
165
+ optional: true
166
+ }
167
+ ],
168
+ returns: "The created component instance",
169
+ since: "0.1.0",
170
+ tags: ["ecs", "component", "add"]
171
+ },
172
+ {
173
+ method: "world.getComponent",
174
+ module: "ECS",
175
+ signature: "world.getComponent<K>(entityId, type: K): ComponentMap[K]",
176
+ description: "Get a component from an entity",
177
+ example: 'const pos = world.getComponent(player, "Transform");',
178
+ params: [
179
+ { name: "entityId", type: "EntityId", description: "Entity to get from" },
180
+ { name: "type", type: "string", description: "Component type name" }
181
+ ],
182
+ returns: "The component data",
183
+ since: "0.1.0",
184
+ tags: ["ecs", "component", "get"]
185
+ },
186
+ {
187
+ method: "world.query",
188
+ module: "ECS",
189
+ signature: "world.query(...types: string[]): EntityId[]",
190
+ description: "Find all entities with ALL specified components",
191
+ example: 'const movers = world.query("Transform", "RigidBody2D");',
192
+ params: [
193
+ { name: "types", type: "...string[]", description: "Component types to match (spread)" }
194
+ ],
195
+ returns: "Array of matching EntityIds",
196
+ since: "0.1.0",
197
+ tags: ["ecs", "query", "search"]
198
+ },
199
+ {
200
+ method: "engine.start",
201
+ module: "Engine",
202
+ signature: "engine.start(): void",
203
+ description: "Start the game loop",
204
+ example: "engine.start();",
205
+ params: [],
206
+ returns: "void",
207
+ since: "0.1.0",
208
+ tags: ["engine", "start", "loop"]
209
+ },
210
+ {
211
+ method: "input.isKeyDown",
212
+ module: "Input",
213
+ signature: "input.isKeyDown(key: string): boolean",
214
+ description: "Check if a key is currently held down (continuous)",
215
+ example: 'if (input.isKeyDown("ArrowRight")) { /* move */ }',
216
+ params: [
217
+ { name: "key", type: "string", description: 'Key code (e.g., "ArrowLeft", "Space", "KeyA")' }
218
+ ],
219
+ returns: "boolean",
220
+ since: "0.1.0",
221
+ tags: ["input", "keyboard", "continuous"]
222
+ },
223
+ {
224
+ method: "input.isKeyPressed",
225
+ module: "Input",
226
+ signature: "input.isKeyPressed(key: string): boolean",
227
+ description: "Check if a key was just pressed this frame (single-frame)",
228
+ example: 'if (input.isKeyPressed("Space")) { /* jump */ }',
229
+ params: [{ name: "key", type: "string", description: "Key code" }],
230
+ returns: "boolean — true only on the first frame",
231
+ since: "0.1.0",
232
+ tags: ["input", "keyboard", "single-frame"]
233
+ },
234
+ {
235
+ method: "sceneManager.loadScene",
236
+ module: "Scene",
237
+ signature: "sceneManager.loadScene(id: string, transition?: TransitionType): void",
238
+ description: "Load a registered scene with optional transition",
239
+ example: 'sceneManager.loadScene("level2", "fade");',
240
+ params: [
241
+ { name: "id", type: "string", description: "Scene ID" },
242
+ {
243
+ name: "transition",
244
+ type: "TransitionType",
245
+ description: "Transition effect",
246
+ optional: true
247
+ }
248
+ ],
249
+ returns: "void",
250
+ since: "0.1.0",
251
+ tags: ["scene", "load", "transition"]
252
+ }
269
253
  ];
270
- /** Search API hints */
271
254
  function searchAPIHints(query) {
272
- const lower = query.toLowerCase();
273
- return API_HINTS.filter((h) => h.method.toLowerCase().includes(lower) ||
274
- h.description.toLowerCase().includes(lower) ||
275
- h.tags.some((t) => t.includes(lower)));
255
+ const lower = query.toLowerCase();
256
+ return API_HINTS.filter(
257
+ (h) => h.method.toLowerCase().includes(lower) || h.description.toLowerCase().includes(lower) || h.tags.some((t) => t.includes(lower))
258
+ );
276
259
  }
277
260
  function createPerfDashboard(maxSnapshots = 300) {
278
- return { snapshots: [], maxSnapshots, warnings: [] };
261
+ return { snapshots: [], maxSnapshots, warnings: [] };
279
262
  }
280
263
  function recordPerfSnapshot(dashboard, snapshot) {
281
- dashboard.snapshots.push(snapshot);
282
- if (dashboard.snapshots.length > dashboard.maxSnapshots) {
283
- dashboard.snapshots.shift();
284
- }
285
- // Auto-detect warnings
286
- if (snapshot.fps < 30) {
287
- dashboard.warnings.push(`Low FPS: ${snapshot.fps.toFixed(1)} at ${new Date(snapshot.timestamp).toISOString()}`);
288
- }
289
- if (snapshot.frameTimeMs > 33) {
290
- dashboard.warnings.push(`Frame time spike: ${snapshot.frameTimeMs.toFixed(1)}ms`);
291
- }
292
- if (snapshot.entityCount > 5000) {
293
- dashboard.warnings.push(`High entity count: ${snapshot.entityCount}`);
294
- }
295
- // Keep last 50 warnings
296
- if (dashboard.warnings.length > 50) {
297
- dashboard.warnings.splice(0, dashboard.warnings.length - 50);
298
- }
264
+ dashboard.snapshots.push(snapshot);
265
+ if (dashboard.snapshots.length > dashboard.maxSnapshots) {
266
+ dashboard.snapshots.shift();
267
+ }
268
+ if (snapshot.fps < 30) {
269
+ dashboard.warnings.push(
270
+ `Low FPS: ${snapshot.fps.toFixed(1)} at ${new Date(snapshot.timestamp).toISOString()}`
271
+ );
272
+ }
273
+ if (snapshot.frameTimeMs > 33) {
274
+ dashboard.warnings.push(`Frame time spike: ${snapshot.frameTimeMs.toFixed(1)}ms`);
275
+ }
276
+ if (snapshot.entityCount > 5e3) {
277
+ dashboard.warnings.push(`High entity count: ${snapshot.entityCount}`);
278
+ }
279
+ if (dashboard.warnings.length > 50) {
280
+ dashboard.warnings.splice(0, dashboard.warnings.length - 50);
281
+ }
299
282
  }
300
- /** Get average FPS from last N snapshots */
301
283
  function getAverageFPS(dashboard, lastN = 60) {
302
- const snapshots = dashboard.snapshots;
303
- const start = Math.max(0, snapshots.length - lastN);
304
- const slice = snapshots.slice(start);
305
- if (slice.length === 0) {
306
- return 0;
307
- }
308
- let sum = 0;
309
- for (const s of slice) {
310
- sum += s.fps;
311
- }
312
- return sum / slice.length;
284
+ const snapshots = dashboard.snapshots;
285
+ const start = Math.max(0, snapshots.length - lastN);
286
+ const slice = snapshots.slice(start);
287
+ if (slice.length === 0) {
288
+ return 0;
289
+ }
290
+ let sum = 0;
291
+ for (const s of slice) {
292
+ sum += s.fps;
293
+ }
294
+ return sum / slice.length;
313
295
  }
314
- /** Get performance summary */
315
296
  function getPerfSummary(dashboard) {
316
- const snaps = dashboard.snapshots;
317
- if (snaps.length === 0) {
318
- return { avgFPS: 0, minFPS: 0, maxFPS: 0, avgFrameTime: 0, peakFrameTime: 0, totalWarnings: 0 };
319
- }
320
- let sumFPS = 0;
321
- let minFPS = Infinity;
322
- let maxFPS = 0;
323
- let sumFrameTime = 0;
324
- let peakFrameTime = 0;
325
- for (const s of snaps) {
326
- sumFPS += s.fps;
327
- sumFrameTime += s.frameTimeMs;
328
- if (s.fps < minFPS) {
329
- minFPS = s.fps;
330
- }
331
- if (s.fps > maxFPS) {
332
- maxFPS = s.fps;
333
- }
334
- if (s.frameTimeMs > peakFrameTime) {
335
- peakFrameTime = s.frameTimeMs;
336
- }
337
- }
338
- return {
339
- avgFPS: sumFPS / snaps.length,
340
- minFPS,
341
- maxFPS,
342
- avgFrameTime: sumFrameTime / snaps.length,
343
- peakFrameTime,
344
- totalWarnings: dashboard.warnings.length,
345
- };
297
+ const snaps = dashboard.snapshots;
298
+ if (snaps.length === 0) {
299
+ return { avgFPS: 0, minFPS: 0, maxFPS: 0, avgFrameTime: 0, peakFrameTime: 0, totalWarnings: 0 };
300
+ }
301
+ let sumFPS = 0;
302
+ let minFPS = Infinity;
303
+ let maxFPS = 0;
304
+ let sumFrameTime = 0;
305
+ let peakFrameTime = 0;
306
+ for (const s of snaps) {
307
+ sumFPS += s.fps;
308
+ sumFrameTime += s.frameTimeMs;
309
+ if (s.fps < minFPS) {
310
+ minFPS = s.fps;
311
+ }
312
+ if (s.fps > maxFPS) {
313
+ maxFPS = s.fps;
314
+ }
315
+ if (s.frameTimeMs > peakFrameTime) {
316
+ peakFrameTime = s.frameTimeMs;
317
+ }
318
+ }
319
+ return {
320
+ avgFPS: sumFPS / snaps.length,
321
+ minFPS,
322
+ maxFPS,
323
+ avgFrameTime: sumFrameTime / snaps.length,
324
+ peakFrameTime,
325
+ totalWarnings: dashboard.warnings.length
326
+ };
346
327
  }
347
- /** Run a health check on common engine misconfigurations */
348
328
  function runHealthCheck(config) {
349
- const results = [];
350
- // Canvas size check
351
- if (config.canvasWidth > 3840 || config.canvasHeight > 2160) {
352
- results.push({
353
- category: 'Rendering',
354
- status: 'warning',
355
- message: 'Canvas resolution is very high',
356
- details: `${config.canvasWidth}x${config.canvasHeight} — may cause performance issues on lower-end devices.`,
357
- });
358
- }
359
- else {
360
- results.push({
361
- category: 'Rendering',
362
- status: 'ok',
363
- message: 'Canvas resolution is reasonable',
364
- });
365
- }
366
- // Entity count
367
- if (config.entityCount > 10000) {
368
- results.push({
369
- category: 'ECS',
370
- status: 'error',
371
- message: 'Very high entity count',
372
- details: `${config.entityCount} entities. Consider object pooling or culling.`,
373
- });
374
- }
375
- else if (config.entityCount > 5000) {
376
- results.push({
377
- category: 'ECS',
378
- status: 'warning',
379
- message: 'High entity count',
380
- details: `${config.entityCount} entities. Monitor FPS closely.`,
381
- });
382
- }
383
- else {
384
- results.push({
385
- category: 'ECS',
386
- status: 'ok',
387
- message: `${config.entityCount} entities — healthy`,
388
- });
389
- }
390
- // FPS target
391
- if (config.targetFps > 144) {
392
- results.push({
393
- category: 'Performance',
394
- status: 'warning',
395
- message: 'Target FPS is unusually high',
396
- details: `${config.targetFps} FPS target. Most displays are 60-144Hz.`,
397
- });
398
- }
399
- else {
400
- results.push({
401
- category: 'Performance',
402
- status: 'ok',
403
- message: `Target FPS: ${config.targetFps}`,
404
- });
405
- }
406
- // Physics timestep
407
- if (config.physicsTimestep < 1 / 120) {
408
- results.push({
409
- category: 'Physics',
410
- status: 'warning',
411
- message: 'Physics timestep is very small',
412
- details: `${config.physicsTimestep.toFixed(6)}s — will use more CPU. Standard is 1/60.`,
413
- });
414
- }
415
- else {
416
- results.push({ category: 'Physics', status: 'ok', message: 'Physics timestep is standard' });
417
- }
418
- // Systems
419
- if (config.systemCount === 0) {
420
- results.push({
421
- category: 'ECS',
422
- status: 'warning',
423
- message: 'No systems registered',
424
- details: 'Add systems to process game logic.',
425
- });
426
- }
427
- else {
428
- results.push({
429
- category: 'ECS',
430
- status: 'ok',
431
- message: `${config.systemCount} systems registered`,
432
- });
433
- }
434
- // Texture
435
- if (config.maxTextureDimension > 4096) {
436
- results.push({
437
- category: 'Assets',
438
- status: 'warning',
439
- message: 'Large textures detected',
440
- details: `Max dimension: ${config.maxTextureDimension}px. Consider texture atlasing.`,
441
- });
442
- }
443
- else {
444
- results.push({ category: 'Assets', status: 'ok', message: 'Texture sizes are reasonable' });
445
- }
446
- return results;
329
+ const results = [];
330
+ if (config.canvasWidth > 3840 || config.canvasHeight > 2160) {
331
+ results.push({
332
+ category: "Rendering",
333
+ status: "warning",
334
+ message: "Canvas resolution is very high",
335
+ details: `${config.canvasWidth}x${config.canvasHeight} — may cause performance issues on lower-end devices.`
336
+ });
337
+ } else {
338
+ results.push({
339
+ category: "Rendering",
340
+ status: "ok",
341
+ message: "Canvas resolution is reasonable"
342
+ });
343
+ }
344
+ if (config.entityCount > 1e4) {
345
+ results.push({
346
+ category: "ECS",
347
+ status: "error",
348
+ message: "Very high entity count",
349
+ details: `${config.entityCount} entities. Consider object pooling or culling.`
350
+ });
351
+ } else if (config.entityCount > 5e3) {
352
+ results.push({
353
+ category: "ECS",
354
+ status: "warning",
355
+ message: "High entity count",
356
+ details: `${config.entityCount} entities. Monitor FPS closely.`
357
+ });
358
+ } else {
359
+ results.push({
360
+ category: "ECS",
361
+ status: "ok",
362
+ message: `${config.entityCount} entities — healthy`
363
+ });
364
+ }
365
+ if (config.targetFps > 144) {
366
+ results.push({
367
+ category: "Performance",
368
+ status: "warning",
369
+ message: "Target FPS is unusually high",
370
+ details: `${config.targetFps} FPS target. Most displays are 60-144Hz.`
371
+ });
372
+ } else {
373
+ results.push({
374
+ category: "Performance",
375
+ status: "ok",
376
+ message: `Target FPS: ${config.targetFps}`
377
+ });
378
+ }
379
+ if (config.physicsTimestep < 1 / 120) {
380
+ results.push({
381
+ category: "Physics",
382
+ status: "warning",
383
+ message: "Physics timestep is very small",
384
+ details: `${config.physicsTimestep.toFixed(6)}s — will use more CPU. Standard is 1/60.`
385
+ });
386
+ } else {
387
+ results.push({ category: "Physics", status: "ok", message: "Physics timestep is standard" });
388
+ }
389
+ if (config.systemCount === 0) {
390
+ results.push({
391
+ category: "ECS",
392
+ status: "warning",
393
+ message: "No systems registered",
394
+ details: "Add systems to process game logic."
395
+ });
396
+ } else {
397
+ results.push({
398
+ category: "ECS",
399
+ status: "ok",
400
+ message: `${config.systemCount} systems registered`
401
+ });
402
+ }
403
+ if (config.maxTextureDimension > 4096) {
404
+ results.push({
405
+ category: "Assets",
406
+ status: "warning",
407
+ message: "Large textures detected",
408
+ details: `Max dimension: ${config.maxTextureDimension}px. Consider texture atlasing.`
409
+ });
410
+ } else {
411
+ results.push({ category: "Assets", status: "ok", message: "Texture sizes are reasonable" });
412
+ }
413
+ return results;
447
414
  }
448
415
  const DEFAULT_DEBUG_OVERLAY = {
449
- showFPS: true,
450
- showEntityCount: true,
451
- showDrawCalls: false,
452
- showPhysicsDebug: false,
453
- showGrid: false,
454
- gridSize: 32,
455
- showBoundingBoxes: false,
456
- showOrigins: false,
457
- position: 'top-left',
458
- opacity: 0.85,
416
+ showFPS: true,
417
+ showEntityCount: true,
418
+ showDrawCalls: false,
419
+ showPhysicsDebug: false,
420
+ showGrid: false,
421
+ gridSize: 32,
422
+ showBoundingBoxes: false,
423
+ showOrigins: false,
424
+ position: "top-left",
425
+ opacity: 0.85
459
426
  };
460
- /** Render a debug text overlay onto a canvas context */
461
427
  function renderDebugOverlay(ctx, config, stats, canvasSize) {
462
- const lines = [];
463
- if (config.showFPS) {
464
- lines.push(`FPS: ${stats.fps.toFixed(0)} (${stats.frameTimeMs.toFixed(1)}ms)`);
465
- }
466
- if (config.showEntityCount) {
467
- lines.push(`Entities: ${stats.entityCount}`);
468
- }
469
- if (config.showDrawCalls) {
470
- lines.push(`Draw Calls: ${stats.drawCalls}`);
471
- }
472
- if (lines.length === 0) {
473
- return;
474
- }
475
- const lineHeight = 16;
476
- const padding = 6;
477
- const width = 180;
478
- const height = lines.length * lineHeight + padding * 2;
479
- // Position
480
- let x = padding;
481
- let y = padding;
482
- if (config.position === 'top-right') {
483
- x = canvasSize.x - width - padding;
484
- }
485
- if (config.position === 'bottom-left') {
486
- y = canvasSize.y - height - padding;
487
- }
488
- if (config.position === 'bottom-right') {
489
- x = canvasSize.x - width - padding;
490
- y = canvasSize.y - height - padding;
491
- }
492
- // Background
493
- ctx.save();
494
- ctx.globalAlpha = config.opacity;
495
- ctx.fillStyle = '#000';
496
- ctx.fillRect(x, y, width, height);
497
- ctx.globalAlpha = 1;
498
- // Text
499
- ctx.fillStyle = stats.fps < 30 ? '#ff4444' : stats.fps < 55 ? '#ffaa00' : '#44ff44';
500
- ctx.font = '12px monospace';
501
- ctx.textBaseline = 'top';
502
- for (let i = 0; i < lines.length; i++) {
503
- ctx.fillText(lines[i], x + padding, y + padding + i * lineHeight);
504
- }
505
- ctx.restore();
428
+ const lines = [];
429
+ if (config.showFPS) {
430
+ lines.push(`FPS: ${stats.fps.toFixed(0)} (${stats.frameTimeMs.toFixed(1)}ms)`);
431
+ }
432
+ if (config.showEntityCount) {
433
+ lines.push(`Entities: ${stats.entityCount}`);
434
+ }
435
+ if (config.showDrawCalls) {
436
+ lines.push(`Draw Calls: ${stats.drawCalls}`);
437
+ }
438
+ if (lines.length === 0) {
439
+ return;
440
+ }
441
+ const lineHeight = 16;
442
+ const padding = 6;
443
+ const width = 180;
444
+ const height = lines.length * lineHeight + padding * 2;
445
+ let x = padding;
446
+ let y = padding;
447
+ if (config.position === "top-right") {
448
+ x = canvasSize.x - width - padding;
449
+ }
450
+ if (config.position === "bottom-left") {
451
+ y = canvasSize.y - height - padding;
452
+ }
453
+ if (config.position === "bottom-right") {
454
+ x = canvasSize.x - width - padding;
455
+ y = canvasSize.y - height - padding;
456
+ }
457
+ ctx.save();
458
+ ctx.globalAlpha = config.opacity;
459
+ ctx.fillStyle = "#000";
460
+ ctx.fillRect(x, y, width, height);
461
+ ctx.globalAlpha = 1;
462
+ ctx.fillStyle = stats.fps < 30 ? "#ff4444" : stats.fps < 55 ? "#ffaa00" : "#44ff44";
463
+ ctx.font = "12px monospace";
464
+ ctx.textBaseline = "top";
465
+ for (let i = 0; i < lines.length; i++) {
466
+ ctx.fillText(lines[i], x + padding, y + padding + i * lineHeight);
467
+ }
468
+ ctx.restore();
506
469
  }
507
470
  const QUICK_START_TEMPLATES = [
508
- {
509
- id: 'empty-project',
510
- name: 'Empty Project',
511
- description: 'A blank canvas to start from scratch',
512
- category: 'prototype',
513
- difficulty: 'beginner',
514
- tags: ['empty', 'starter'],
515
- code: `const engine = new NiceGameEngine({
516
- canvas: document.getElementById("game") as HTMLCanvasElement,
517
- settings: { width: 800, height: 600, targetFps: 60 },
518
- });
519
-
520
- engine.start();`,
521
- },
522
- {
523
- id: 'hello-world',
524
- name: 'Hello World',
525
- description: 'A rotating square to verify everything works',
526
- category: 'demo',
527
- difficulty: 'beginner',
528
- tags: ['hello', 'demo', 'beginner'],
529
- code: `const engine = new NiceGameEngine({
530
- canvas: document.getElementById("game") as HTMLCanvasElement,
531
- });
532
-
533
- const entity = engine.world.createEntity("Square");
534
- engine.world.addComponent(entity, "Transform", { x: 400, y: 300 });
535
- engine.world.addComponent(entity, "Sprite", {
536
- shape: "rect", width: 50, height: 50, color: "#00ff88",
537
- });
538
-
539
- // Rotate every frame
540
- engine.events.on("engine:update", () => {
541
- const t = engine.world.getComponent(entity, "Transform");
542
- t.rotation += 2;
543
- });
544
-
545
- engine.start();`,
546
- },
547
- {
548
- id: 'platformer-starter',
549
- name: 'Platformer Starter',
550
- description: 'A basic platformer with player, ground, and gravity',
551
- category: 'game',
552
- difficulty: 'intermediate',
553
- tags: ['platformer', 'physics', '2d'],
554
- code: `const engine = new NiceGameEngine({
555
- canvas: document.getElementById("game") as HTMLCanvasElement,
556
- settings: {
557
- width: 800, height: 600, targetFps: 60,
558
- physics: { gravity: { x: 0, y: 980 } },
559
- },
560
- });
561
-
562
- // Player
563
- const player = engine.world.createEntity("Player");
564
- engine.world.addComponent(player, "Transform", { x: 400, y: 400 });
565
- engine.world.addComponent(player, "Sprite", {
566
- shape: "rect", width: 32, height: 48, color: "#4488ff",
567
- });
568
- engine.world.addComponent(player, "RigidBody2D", { type: "dynamic" });
569
- engine.world.addComponent(player, "Collider2D", {
570
- shape: "box", width: 32, height: 48,
571
- });
572
-
573
- // Ground
574
- const ground = engine.world.createEntity("Ground");
575
- engine.world.addComponent(ground, "Transform", { x: 400, y: 580 });
576
- engine.world.addComponent(ground, "Sprite", {
577
- shape: "rect", width: 800, height: 40, color: "#44aa44",
578
- });
579
- engine.world.addComponent(ground, "RigidBody2D", { type: "static" });
580
- engine.world.addComponent(ground, "Collider2D", {
581
- shape: "box", width: 800, height: 40,
582
- });
583
-
584
- engine.start();`,
585
- },
586
- ];
471
+ {
472
+ id: "empty-project",
473
+ name: "Empty Project",
474
+ description: "A blank canvas to start from scratch",
475
+ category: "prototype",
476
+ difficulty: "beginner",
477
+ tags: ["empty", "starter"],
478
+ code: `const engine = new NiceGameEngine({
479
+ canvas: document.getElementById("game") as HTMLCanvasElement,
480
+ settings: { width: 800, height: 600, targetFps: 60 },
481
+ });
482
+
483
+ engine.start();`
484
+ },
485
+ {
486
+ id: "hello-world",
487
+ name: "Hello World",
488
+ description: "A rotating square to verify everything works",
489
+ category: "demo",
490
+ difficulty: "beginner",
491
+ tags: ["hello", "demo", "beginner"],
492
+ code: `const engine = new NiceGameEngine({
493
+ canvas: document.getElementById("game") as HTMLCanvasElement,
494
+ });
495
+
496
+ const entity = engine.world.createEntity("Square");
497
+ engine.world.addComponent(entity, "Transform", { x: 400, y: 300 });
498
+ engine.world.addComponent(entity, "Sprite", {
499
+ shape: "rect", width: 50, height: 50, color: "#00ff88",
500
+ });
501
+
502
+ // Rotate every frame
503
+ engine.events.on("engine:update", () => {
504
+ const t = engine.world.getComponent(entity, "Transform");
505
+ t.rotation += 2;
506
+ });
587
507
 
588
- export { API_HINTS, DEFAULT_DEBUG_OVERLAY, QUICK_START_TEMPLATES, createPerfDashboard, formatEngineError, getAverageFPS, getEngineError, getPerfSummary, recordPerfSnapshot, renderDebugOverlay, runHealthCheck, searchAPIHints, throwEngineError, warnEngine };
508
+ engine.start();`
509
+ },
510
+ {
511
+ id: "platformer-starter",
512
+ name: "Platformer Starter",
513
+ description: "A basic platformer with player, ground, and gravity",
514
+ category: "game",
515
+ difficulty: "intermediate",
516
+ tags: ["platformer", "physics", "2d"],
517
+ code: `const engine = new NiceGameEngine({
518
+ canvas: document.getElementById("game") as HTMLCanvasElement,
519
+ settings: {
520
+ width: 800, height: 600, targetFps: 60,
521
+ physics: { gravity: { x: 0, y: 980 } },
522
+ },
523
+ });
524
+
525
+ // Player
526
+ const player = engine.world.createEntity("Player");
527
+ engine.world.addComponent(player, "Transform", { x: 400, y: 400 });
528
+ engine.world.addComponent(player, "Sprite", {
529
+ shape: "rect", width: 32, height: 48, color: "#4488ff",
530
+ });
531
+ engine.world.addComponent(player, "RigidBody2D", { type: "dynamic" });
532
+ engine.world.addComponent(player, "Collider2D", {
533
+ shape: "box", width: 32, height: 48,
534
+ });
535
+
536
+ // Ground
537
+ const ground = engine.world.createEntity("Ground");
538
+ engine.world.addComponent(ground, "Transform", { x: 400, y: 580 });
539
+ engine.world.addComponent(ground, "Sprite", {
540
+ shape: "rect", width: 800, height: 40, color: "#44aa44",
541
+ });
542
+ engine.world.addComponent(ground, "RigidBody2D", { type: "static" });
543
+ engine.world.addComponent(ground, "Collider2D", {
544
+ shape: "box", width: 800, height: 40,
545
+ });
546
+
547
+ engine.start();`
548
+ }
549
+ ];
550
+ export {
551
+ API_HINTS,
552
+ DEFAULT_DEBUG_OVERLAY,
553
+ QUICK_START_TEMPLATES,
554
+ createPerfDashboard,
555
+ formatEngineError,
556
+ getAverageFPS,
557
+ getEngineError,
558
+ getPerfSummary,
559
+ recordPerfSnapshot,
560
+ renderDebugOverlay,
561
+ runHealthCheck,
562
+ searchAPIHints,
563
+ throwEngineError,
564
+ warnEngine
565
+ };