@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,843 +1,832 @@
1
- import { PlatformExporter } from './PlatformExporter.js';
2
-
3
- /* ────────────────────────────────────────────────────────────────
4
- GameMaker Exporter — GameMaker Studio 2 Project Export
5
-
6
- Exports Nice2Dev projects to GameMaker Studio 2 format including:
7
- - GML scripts (.gml)
8
- - Object files (.yy)
9
- - Room files (.yy)
10
- - Sprite assets (.yy)
11
- - Project file (.yyp)
12
- ──────────────────────────────────────────────────────────────── */
13
- /* ── GameMaker UUID Generator ─────────────────────────────────── */
1
+ import { PlatformExporter } from "./PlatformExporter.js";
14
2
  function generateGMUUID() {
15
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {
16
- const r = (Math.random() * 16) | 0;
17
- const v = c === 'x' ? r : (r & 0x3) | 0x8;
18
- return v.toString(16);
19
- });
3
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
4
+ const r = Math.random() * 16 | 0;
5
+ const v = c === "x" ? r : r & 3 | 8;
6
+ return v.toString(16);
7
+ });
20
8
  }
21
- /* ── GameMaker Event Types ────────────────────────────────────── */
22
9
  const GM_EVENTS = {
23
- CREATE: { type: 0, num: 0 },
24
- STEP: { type: 3, num: 0 },
25
- DRAW: { type: 8, num: 0 }};
26
- /* ── GameMaker Exporter Implementation ────────────────────────── */
10
+ CREATE: { type: 0, num: 0 },
11
+ STEP: { type: 3, num: 0 },
12
+ DRAW: { type: 8, num: 0 }
13
+ };
27
14
  class GameMakerExporter extends PlatformExporter {
28
- constructor() {
29
- super(...arguments);
30
- this.platformId = 'gamemaker';
31
- this.platformInfo = {
32
- id: 'gamemaker',
33
- name: 'GameMaker Studio 2',
34
- description: 'YoYo Games GameMaker Studio 2 with GML scripting',
35
- website: 'https://gamemaker.io',
36
- features: [
37
- '2d-rendering',
38
- 'physics-2d',
39
- 'audio',
40
- 'networking',
41
- 'ui-system',
42
- 'tilemaps',
43
- 'particles',
44
- 'animation',
45
- ],
46
- supportedAssets: [
47
- 'sprite',
48
- 'tileset',
49
- 'audio',
50
- 'font',
51
- 'script',
52
- 'scene',
53
- 'prefab',
54
- 'particleSystem',
55
- 'data',
56
- ],
57
- exportFormats: ['.yyp', '.yy', '.gml'],
58
- };
59
- this.projectName = 'Nice2DevGame';
60
- this.resourceTree = [];
61
- this.objectScripts = new Map();
15
+ constructor() {
16
+ super(...arguments);
17
+ this.platformId = "gamemaker";
18
+ this.platformInfo = {
19
+ id: "gamemaker",
20
+ name: "GameMaker Studio 2",
21
+ description: "YoYo Games GameMaker Studio 2 with GML scripting",
22
+ website: "https://gamemaker.io",
23
+ features: [
24
+ "2d-rendering",
25
+ "physics-2d",
26
+ "audio",
27
+ "networking",
28
+ "ui-system",
29
+ "tilemaps",
30
+ "particles",
31
+ "animation"
32
+ ],
33
+ supportedAssets: [
34
+ "sprite",
35
+ "tileset",
36
+ "audio",
37
+ "font",
38
+ "script",
39
+ "scene",
40
+ "prefab",
41
+ "particleSystem",
42
+ "data"
43
+ ],
44
+ exportFormats: [".yyp", ".yy", ".gml"]
45
+ };
46
+ this.projectName = "Nice2DevGame";
47
+ this.resourceTree = [];
48
+ this.objectScripts = /* @__PURE__ */ new Map();
49
+ }
50
+ async doExport(project, options) {
51
+ this.projectName = (options.projectName ?? project.name).replace(/[^a-zA-Z0-9_]/g, "_");
52
+ this.resourceTree = [];
53
+ this.objectScripts.clear();
54
+ const platformOpts = options.platformOptions ?? {};
55
+ platformOpts.enablePhysics ?? project.settings.physics.enabled;
56
+ await this.generateProjectFile(project, options);
57
+ await this.generateScripts(project, options);
58
+ await this.generateObjects(project, options);
59
+ for (const scene of project.scenes) {
60
+ await this.generateRoom(scene, project, options);
61
+ }
62
+ for (const asset of project.assets) {
63
+ if (asset.type === "sprite" || asset.type === "texture") {
64
+ await this.generateSprite(asset, options);
65
+ } else if (asset.type === "audio") {
66
+ await this.generateSound(asset, options);
67
+ }
62
68
  }
63
- async doExport(project, options) {
64
- this.projectName = (options.projectName ?? project.name).replace(/[^a-zA-Z0-9_]/g, '_');
65
- this.resourceTree = [];
66
- this.objectScripts.clear();
67
- const platformOpts = options.platformOptions ?? {};
68
- platformOpts.enablePhysics ?? project.settings.physics.enabled;
69
- // Generate project file
70
- await this.generateProjectFile(project, options);
71
- // Generate scripts
72
- await this.generateScripts(project, options);
73
- // Generate objects from prefabs and unique entities
74
- await this.generateObjects(project, options);
75
- // Generate rooms from scenes
76
- for (const scene of project.scenes) {
77
- await this.generateRoom(scene, project, options);
69
+ }
70
+ /* ── Project File ───────────────────────────────────────────── */
71
+ async generateProjectFile(project, _options) {
72
+ const projectFile = {
73
+ resourceType: "GMProject",
74
+ resourceVersion: "1.6",
75
+ name: this.projectName,
76
+ AudioGroups: [
77
+ {
78
+ resourceType: "GMAudioGroup",
79
+ resourceVersion: "1.3",
80
+ name: "audiogroup_default",
81
+ targets: -1
78
82
  }
79
- // Generate sprite assets
80
- for (const asset of project.assets) {
81
- if (asset.type === 'sprite' || asset.type === 'texture') {
82
- await this.generateSprite(asset, options);
83
- }
84
- else if (asset.type === 'audio') {
85
- await this.generateSound(asset, options);
86
- }
83
+ ],
84
+ configs: {
85
+ children: [],
86
+ name: "Default"
87
+ },
88
+ defaultScriptType: 1,
89
+ // GML
90
+ Folders: this.generateFolderStructure(),
91
+ IncludedFiles: [],
92
+ isEcma: false,
93
+ LibaryEmitters: [],
94
+ MetaData: {
95
+ IDEVersion: "2024.2.0.132"
96
+ },
97
+ resources: this.resourceTree,
98
+ RoomOrderNodes: project.scenes.map((s) => ({
99
+ roomId: { name: `rm_${s.name}`, path: `rooms/rm_${s.name}/rm_${s.name}.yy` }
100
+ })),
101
+ templateType: null,
102
+ TextureGroups: [
103
+ {
104
+ resourceType: "GMTextureGroup",
105
+ resourceVersion: "1.3",
106
+ name: "Default",
107
+ autocrop: true,
108
+ border: 2,
109
+ compressFormat: "bz2",
110
+ directory: "",
111
+ groupParent: null,
112
+ isScaled: true,
113
+ loadType: "default",
114
+ mipsToGenerate: 0,
115
+ targets: -1
87
116
  }
117
+ ]
118
+ };
119
+ this.addTextFile(`${this.projectName}.yyp`, JSON.stringify(projectFile, null, 2));
120
+ }
121
+ generateFolderStructure() {
122
+ return [
123
+ this.createFolder("Sprites", "sprites"),
124
+ this.createFolder("Sounds", "sounds"),
125
+ this.createFolder("Scripts", "scripts"),
126
+ this.createFolder("Objects", "objects"),
127
+ this.createFolder("Rooms", "rooms")
128
+ ];
129
+ }
130
+ createFolder(name, _folderPath) {
131
+ return {
132
+ resourceType: "GMFolder",
133
+ resourceVersion: "1.0",
134
+ name,
135
+ folderPath: `folders/${name}.yy`,
136
+ order: 0
137
+ };
138
+ }
139
+ /* ── Scripts ────────────────────────────────────────────────── */
140
+ async generateScripts(_project, _options) {
141
+ const utilScript = `/// @description Nice2Dev Utility Functions
142
+
143
+ /// @function n2d_move_towards(target_x, target_y, speed)
144
+ /// @param target_x
145
+ /// @param target_y
146
+ /// @param speed
147
+ function n2d_move_towards(_target_x, _target_y, _speed) {
148
+ var _dir = point_direction(x, y, _target_x, _target_y);
149
+ var _dist = point_distance(x, y, _target_x, _target_y);
150
+
151
+ if (_dist <= _speed) {
152
+ x = _target_x;
153
+ y = _target_y;
154
+ } else {
155
+ x += lengthdir_x(_speed, _dir);
156
+ y += lengthdir_y(_speed, _dir);
88
157
  }
89
- /* ── Project File ───────────────────────────────────────────── */
90
- async generateProjectFile(project, _options) {
91
- const projectFile = {
92
- resourceType: 'GMProject',
93
- resourceVersion: '1.6',
94
- name: this.projectName,
95
- AudioGroups: [
96
- {
97
- resourceType: 'GMAudioGroup',
98
- resourceVersion: '1.3',
99
- name: 'audiogroup_default',
100
- targets: -1,
101
- },
102
- ],
103
- configs: {
104
- children: [],
105
- name: 'Default',
106
- },
107
- defaultScriptType: 1, // GML
108
- Folders: this.generateFolderStructure(),
109
- IncludedFiles: [],
110
- isEcma: false,
111
- LibaryEmitters: [],
112
- MetaData: {
113
- IDEVersion: '2024.2.0.132',
114
- },
115
- resources: this.resourceTree,
116
- RoomOrderNodes: project.scenes.map((s) => ({
117
- roomId: { name: `rm_${s.name}`, path: `rooms/rm_${s.name}/rm_${s.name}.yy` },
118
- })),
119
- templateType: null,
120
- TextureGroups: [
121
- {
122
- resourceType: 'GMTextureGroup',
123
- resourceVersion: '1.3',
124
- name: 'Default',
125
- autocrop: true,
126
- border: 2,
127
- compressFormat: 'bz2',
128
- directory: '',
129
- groupParent: null,
130
- isScaled: true,
131
- loadType: 'default',
132
- mipsToGenerate: 0,
133
- targets: -1,
134
- },
135
- ],
136
- };
137
- this.addTextFile(`${this.projectName}.yyp`, JSON.stringify(projectFile, null, 2));
138
- }
139
- generateFolderStructure() {
140
- return [
141
- this.createFolder('Sprites', 'sprites'),
142
- this.createFolder('Sounds', 'sounds'),
143
- this.createFolder('Scripts', 'scripts'),
144
- this.createFolder('Objects', 'objects'),
145
- this.createFolder('Rooms', 'rooms'),
146
- ];
147
- }
148
- createFolder(name, _folderPath) {
149
- return {
150
- resourceType: 'GMFolder',
151
- resourceVersion: '1.0',
152
- name,
153
- folderPath: `folders/${name}.yy`,
154
- order: 0,
155
- };
158
+ }
159
+
160
+ /// @function n2d_look_at(target_x, target_y)
161
+ /// @param target_x
162
+ /// @param target_y
163
+ function n2d_look_at(_target_x, _target_y) {
164
+ image_angle = point_direction(x, y, _target_x, _target_y);
165
+ }
166
+
167
+ /// @function n2d_random_point_in_circle(center_x, center_y, radius)
168
+ /// @param center_x
169
+ /// @param center_y
170
+ /// @param radius
171
+ function n2d_random_point_in_circle(_cx, _cy, _radius) {
172
+ var _angle = random(360);
173
+ var _dist = sqrt(random(1)) * _radius;
174
+ return {
175
+ x: _cx + lengthdir_x(_dist, _angle),
176
+ y: _cy + lengthdir_y(_dist, _angle)
177
+ };
178
+ }
179
+
180
+ /// @function n2d_spawn_entity(object, x_, y_)
181
+ /// @param object
182
+ /// @param x_
183
+ /// @param y_
184
+ function n2d_spawn_entity(_object, _x, _y) {
185
+ return instance_create_layer(_x, _y, "Instances", _object);
186
+ }
187
+
188
+ /// @function n2d_find_by_tag(tag)
189
+ /// @param tag
190
+ function n2d_find_by_tag(_tag) {
191
+ var _result = [];
192
+ with (obj_nice2dev_base) {
193
+ if (variable_instance_exists(id, "tags")) {
194
+ for (var i = 0; i < array_length(tags); i++) {
195
+ if (tags[i] == _tag) {
196
+ array_push(_result, id);
197
+ break;
198
+ }
199
+ }
200
+ }
156
201
  }
157
- /* ── Scripts ────────────────────────────────────────────────── */
158
- async generateScripts(_project, _options) {
159
- // Utility script
160
- const utilScript = `/// @description Nice2Dev Utility Functions
161
-
162
- /// @function n2d_move_towards(target_x, target_y, speed)
163
- /// @param target_x
164
- /// @param target_y
165
- /// @param speed
166
- function n2d_move_towards(_target_x, _target_y, _speed) {
167
- var _dir = point_direction(x, y, _target_x, _target_y);
168
- var _dist = point_distance(x, y, _target_x, _target_y);
169
-
170
- if (_dist <= _speed) {
171
- x = _target_x;
172
- y = _target_y;
173
- } else {
174
- x += lengthdir_x(_speed, _dir);
175
- y += lengthdir_y(_speed, _dir);
176
- }
177
- }
178
-
179
- /// @function n2d_look_at(target_x, target_y)
180
- /// @param target_x
181
- /// @param target_y
182
- function n2d_look_at(_target_x, _target_y) {
183
- image_angle = point_direction(x, y, _target_x, _target_y);
184
- }
185
-
186
- /// @function n2d_random_point_in_circle(center_x, center_y, radius)
187
- /// @param center_x
188
- /// @param center_y
189
- /// @param radius
190
- function n2d_random_point_in_circle(_cx, _cy, _radius) {
191
- var _angle = random(360);
192
- var _dist = sqrt(random(1)) * _radius;
193
- return {
194
- x: _cx + lengthdir_x(_dist, _angle),
195
- y: _cy + lengthdir_y(_dist, _angle)
196
- };
197
- }
198
-
199
- /// @function n2d_spawn_entity(object, x_, y_)
200
- /// @param object
201
- /// @param x_
202
- /// @param y_
203
- function n2d_spawn_entity(_object, _x, _y) {
204
- return instance_create_layer(_x, _y, "Instances", _object);
205
- }
206
-
207
- /// @function n2d_find_by_tag(tag)
208
- /// @param tag
209
- function n2d_find_by_tag(_tag) {
210
- var _result = [];
211
- with (obj_nice2dev_base) {
212
- if (variable_instance_exists(id, "tags")) {
213
- for (var i = 0; i < array_length(tags); i++) {
214
- if (tags[i] == _tag) {
215
- array_push(_result, id);
216
- break;
217
- }
218
- }
219
- }
220
- }
221
- return _result;
222
- }
202
+ return _result;
203
+ }
223
204
  `;
224
- this.addTextFile('scripts/scr_nice2dev_utils/scr_nice2dev_utils.gml', utilScript);
225
- this.addTextFile('scripts/scr_nice2dev_utils/scr_nice2dev_utils.yy', JSON.stringify({
226
- resourceType: 'GMScript',
227
- resourceVersion: '1.0',
228
- name: 'scr_nice2dev_utils',
229
- isCompatibility: false,
230
- isDnD: false,
231
- parent: { name: 'Scripts', path: 'folders/Scripts.yy' },
232
- }, null, 2));
233
- this.resourceTree.push({
234
- id: { name: 'scr_nice2dev_utils', path: 'scripts/scr_nice2dev_utils/scr_nice2dev_utils.yy' },
235
- });
236
- // Game controller script
237
- const gameScript = `/// @description Game Controller Functions
238
-
239
- globalvar game_paused;
240
- game_paused = false;
241
-
242
- /// @function game_pause()
243
- function game_pause() {
244
- game_paused = true;
245
- // Deactivate all instances except UI
246
- instance_deactivate_all(true);
247
- // Keep UI active
248
- // instance_activate_object(obj_ui_controller);
249
- }
250
-
251
- /// @function game_resume()
252
- function game_resume() {
253
- game_paused = false;
254
- instance_activate_all();
255
- }
256
-
257
- /// @function game_goto_room(room_name)
258
- /// @param room_name
259
- function game_goto_room(_room_name) {
260
- room_goto(asset_get_index(_room_name));
261
- }
262
-
263
- /// @function game_save(slot)
264
- /// @param slot
265
- function game_save(_slot) {
266
- var _save_data = {
267
- room: room_get_name(room),
268
- // Add more save data as needed
269
- };
270
-
271
- var _filename = "save_" + string(_slot) + ".json";
272
- var _file = file_text_open_write(_filename);
273
- file_text_write_string(_file, json_stringify(_save_data));
274
- file_text_close(_file);
275
- }
276
-
277
- /// @function game_load(slot)
278
- /// @param slot
279
- function game_load(_slot) {
280
- var _filename = "save_" + string(_slot) + ".json";
281
- if (file_exists(_filename)) {
282
- var _file = file_text_open_read(_filename);
283
- var _json = file_text_read_string(_file);
284
- file_text_close(_file);
285
-
286
- var _data = json_parse(_json);
287
- room_goto(asset_get_index(_data.room));
288
- }
289
- }
205
+ this.addTextFile("scripts/scr_nice2dev_utils/scr_nice2dev_utils.gml", utilScript);
206
+ this.addTextFile(
207
+ "scripts/scr_nice2dev_utils/scr_nice2dev_utils.yy",
208
+ JSON.stringify(
209
+ {
210
+ resourceType: "GMScript",
211
+ resourceVersion: "1.0",
212
+ name: "scr_nice2dev_utils",
213
+ isCompatibility: false,
214
+ isDnD: false,
215
+ parent: { name: "Scripts", path: "folders/Scripts.yy" }
216
+ },
217
+ null,
218
+ 2
219
+ )
220
+ );
221
+ this.resourceTree.push({
222
+ id: { name: "scr_nice2dev_utils", path: "scripts/scr_nice2dev_utils/scr_nice2dev_utils.yy" }
223
+ });
224
+ const gameScript = `/// @description Game Controller Functions
225
+
226
+ globalvar game_paused;
227
+ game_paused = false;
228
+
229
+ /// @function game_pause()
230
+ function game_pause() {
231
+ game_paused = true;
232
+ // Deactivate all instances except UI
233
+ instance_deactivate_all(true);
234
+ // Keep UI active
235
+ // instance_activate_object(obj_ui_controller);
236
+ }
237
+
238
+ /// @function game_resume()
239
+ function game_resume() {
240
+ game_paused = false;
241
+ instance_activate_all();
242
+ }
243
+
244
+ /// @function game_goto_room(room_name)
245
+ /// @param room_name
246
+ function game_goto_room(_room_name) {
247
+ room_goto(asset_get_index(_room_name));
248
+ }
249
+
250
+ /// @function game_save(slot)
251
+ /// @param slot
252
+ function game_save(_slot) {
253
+ var _save_data = {
254
+ room: room_get_name(room),
255
+ // Add more save data as needed
256
+ };
257
+
258
+ var _filename = "save_" + string(_slot) + ".json";
259
+ var _file = file_text_open_write(_filename);
260
+ file_text_write_string(_file, json_stringify(_save_data));
261
+ file_text_close(_file);
262
+ }
263
+
264
+ /// @function game_load(slot)
265
+ /// @param slot
266
+ function game_load(_slot) {
267
+ var _filename = "save_" + string(_slot) + ".json";
268
+ if (file_exists(_filename)) {
269
+ var _file = file_text_open_read(_filename);
270
+ var _json = file_text_read_string(_file);
271
+ file_text_close(_file);
272
+
273
+ var _data = json_parse(_json);
274
+ room_goto(asset_get_index(_data.room));
275
+ }
276
+ }
290
277
  `;
291
- this.addTextFile('scripts/scr_game_controller/scr_game_controller.gml', gameScript);
292
- this.addTextFile('scripts/scr_game_controller/scr_game_controller.yy', JSON.stringify({
293
- resourceType: 'GMScript',
294
- resourceVersion: '1.0',
295
- name: 'scr_game_controller',
296
- isCompatibility: false,
297
- isDnD: false,
298
- parent: { name: 'Scripts', path: 'folders/Scripts.yy' },
299
- }, null, 2));
300
- this.resourceTree.push({
301
- id: {
302
- name: 'scr_game_controller',
303
- path: 'scripts/scr_game_controller/scr_game_controller.yy',
304
- },
305
- });
278
+ this.addTextFile("scripts/scr_game_controller/scr_game_controller.gml", gameScript);
279
+ this.addTextFile(
280
+ "scripts/scr_game_controller/scr_game_controller.yy",
281
+ JSON.stringify(
282
+ {
283
+ resourceType: "GMScript",
284
+ resourceVersion: "1.0",
285
+ name: "scr_game_controller",
286
+ isCompatibility: false,
287
+ isDnD: false,
288
+ parent: { name: "Scripts", path: "folders/Scripts.yy" }
289
+ },
290
+ null,
291
+ 2
292
+ )
293
+ );
294
+ this.resourceTree.push({
295
+ id: {
296
+ name: "scr_game_controller",
297
+ path: "scripts/scr_game_controller/scr_game_controller.yy"
298
+ }
299
+ });
300
+ }
301
+ /* ── Objects ────────────────────────────────────────────────── */
302
+ async generateObjects(project, options) {
303
+ await this.generateBaseObject();
304
+ for (const prefab of project.prefabs) {
305
+ await this.generateObjectFromEntity(prefab.entity, `obj_${prefab.name}`, options);
306
306
  }
307
- /* ── Objects ────────────────────────────────────────────────── */
308
- async generateObjects(project, options) {
309
- // Base object for Nice2Dev entities
310
- await this.generateBaseObject();
311
- // Generate objects from prefabs
312
- for (const prefab of project.prefabs) {
313
- await this.generateObjectFromEntity(prefab.entity, `obj_${prefab.name}`, options);
307
+ const entityTypes = /* @__PURE__ */ new Set();
308
+ for (const scene of project.scenes) {
309
+ for (const entity of scene.entities) {
310
+ if (entity.type && !project.prefabs.find((p) => p.name === entity.type)) {
311
+ entityTypes.add(entity.type);
314
312
  }
315
- // Generate unique entity type objects
316
- const entityTypes = new Set();
317
- for (const scene of project.scenes) {
318
- for (const entity of scene.entities) {
319
- if (entity.type && !project.prefabs.find((p) => p.name === entity.type)) {
320
- entityTypes.add(entity.type);
321
- }
322
- }
313
+ }
314
+ }
315
+ for (const entityType of entityTypes) {
316
+ const templateEntity = this.findEntityByType(project, entityType);
317
+ if (templateEntity) {
318
+ await this.generateObjectFromEntity(templateEntity, `obj_${entityType}`, options);
319
+ }
320
+ }
321
+ }
322
+ findEntityByType(project, type) {
323
+ for (const scene of project.scenes) {
324
+ const found = scene.entities.find((e) => e.type === type);
325
+ if (found) {
326
+ return found;
327
+ }
328
+ }
329
+ return null;
330
+ }
331
+ async generateBaseObject() {
332
+ const objectDef = {
333
+ resourceType: "GMObject",
334
+ resourceVersion: "1.0",
335
+ name: "obj_nice2dev_base",
336
+ solid: false,
337
+ visible: true,
338
+ managed: true,
339
+ persistent: false,
340
+ physicsObject: false,
341
+ physicsShape: 1,
342
+ eventList: [
343
+ {
344
+ resourceType: "GMEvent",
345
+ resourceVersion: "1.0",
346
+ isDnD: false,
347
+ eventNum: GM_EVENTS.CREATE.num,
348
+ eventType: GM_EVENTS.CREATE.type
323
349
  }
324
- for (const entityType of entityTypes) {
325
- const templateEntity = this.findEntityByType(project, entityType);
326
- if (templateEntity) {
327
- await this.generateObjectFromEntity(templateEntity, `obj_${entityType}`, options);
328
- }
350
+ ],
351
+ properties: [
352
+ {
353
+ resourceType: "GMObjectProperty",
354
+ resourceVersion: "1.0",
355
+ name: "entity_id",
356
+ varType: 1,
357
+ // String
358
+ value: '""'
359
+ },
360
+ {
361
+ resourceType: "GMObjectProperty",
362
+ resourceVersion: "1.0",
363
+ name: "tags",
364
+ varType: 5,
365
+ // Array
366
+ value: "[]"
329
367
  }
368
+ ],
369
+ overriddenProperties: [],
370
+ parent: { name: "Objects", path: "folders/Objects.yy" }
371
+ };
372
+ this.addTextFile(
373
+ "objects/obj_nice2dev_base/obj_nice2dev_base.yy",
374
+ JSON.stringify(objectDef, null, 2)
375
+ );
376
+ const createEvent = `/// @description Initialize base Nice2Dev entity
377
+ entity_id = "";
378
+ tags = [];
379
+
380
+ // Override in child objects
381
+ event_inherited();
382
+ `;
383
+ this.addTextFile("objects/obj_nice2dev_base/Create_0.gml", createEvent);
384
+ this.resourceTree.push({
385
+ id: { name: "obj_nice2dev_base", path: "objects/obj_nice2dev_base/obj_nice2dev_base.yy" }
386
+ });
387
+ }
388
+ async generateObjectFromEntity(entity, objectName, _options) {
389
+ const safeName = objectName.replace(/[^a-zA-Z0-9_]/g, "_");
390
+ const hasPhysics = entity.components.some((c) => c.type === "rigidbody");
391
+ const spriteComp = entity.components.find((c) => c.type === "sprite");
392
+ const spriteName = spriteComp?.properties?.["texture"];
393
+ const objectDef = {
394
+ resourceType: "GMObject",
395
+ resourceVersion: "1.0",
396
+ name: safeName,
397
+ spriteId: spriteName ? { name: `spr_${spriteName}`, path: `sprites/spr_${spriteName}/spr_${spriteName}.yy` } : void 0,
398
+ solid: entity.components.some(
399
+ (c) => c.type === "boxCollider" && !c.properties?.["isTrigger"]
400
+ ),
401
+ visible: entity.active !== false,
402
+ managed: true,
403
+ persistent: false,
404
+ parentObjectId: {
405
+ name: "obj_nice2dev_base",
406
+ path: "objects/obj_nice2dev_base/obj_nice2dev_base.yy"
407
+ },
408
+ physicsObject: hasPhysics,
409
+ physicsShape: 1,
410
+ eventList: this.generateEventList(entity),
411
+ properties: this.extractEntityProperties(entity),
412
+ overriddenProperties: [],
413
+ parent: { name: "Objects", path: "folders/Objects.yy" }
414
+ };
415
+ this.addTextFile(`objects/${safeName}/${safeName}.yy`, JSON.stringify(objectDef, null, 2));
416
+ await this.generateEventScripts(entity, safeName);
417
+ this.resourceTree.push({
418
+ id: { name: safeName, path: `objects/${safeName}/${safeName}.yy` }
419
+ });
420
+ }
421
+ generateEventList(entity) {
422
+ const events = [
423
+ {
424
+ resourceType: "GMEvent",
425
+ resourceVersion: "1.0",
426
+ isDnD: false,
427
+ eventNum: GM_EVENTS.CREATE.num,
428
+ eventType: GM_EVENTS.CREATE.type
429
+ },
430
+ {
431
+ resourceType: "GMEvent",
432
+ resourceVersion: "1.0",
433
+ isDnD: false,
434
+ eventNum: GM_EVENTS.STEP.num,
435
+ eventType: GM_EVENTS.STEP.type
436
+ }
437
+ ];
438
+ if (entity.components.some((c) => c.type === "sprite")) {
439
+ events.push({
440
+ resourceType: "GMEvent",
441
+ resourceVersion: "1.0",
442
+ isDnD: false,
443
+ eventNum: GM_EVENTS.DRAW.num,
444
+ eventType: GM_EVENTS.DRAW.type
445
+ });
330
446
  }
331
- findEntityByType(project, type) {
332
- for (const scene of project.scenes) {
333
- const found = scene.entities.find((e) => e.type === type);
334
- if (found) {
335
- return found;
336
- }
447
+ return events;
448
+ }
449
+ extractEntityProperties(entity) {
450
+ const props = [];
451
+ for (const comp of entity.components) {
452
+ if (comp.properties) {
453
+ for (const [key, value] of Object.entries(comp.properties)) {
454
+ const varType = this.getGMLVarType(value);
455
+ props.push({
456
+ resourceType: "GMObjectProperty",
457
+ resourceVersion: "1.0",
458
+ name: `${comp.type}_${key}`,
459
+ varType,
460
+ value: this.valueToGML(value)
461
+ });
337
462
  }
338
- return null;
463
+ }
339
464
  }
340
- async generateBaseObject() {
341
- const objectDef = {
342
- resourceType: 'GMObject',
343
- resourceVersion: '1.0',
344
- name: 'obj_nice2dev_base',
345
- solid: false,
346
- visible: true,
347
- managed: true,
348
- persistent: false,
349
- physicsObject: false,
350
- physicsShape: 1,
351
- eventList: [
352
- {
353
- resourceType: 'GMEvent',
354
- resourceVersion: '1.0',
355
- isDnD: false,
356
- eventNum: GM_EVENTS.CREATE.num,
357
- eventType: GM_EVENTS.CREATE.type,
358
- },
359
- ],
360
- properties: [
361
- {
362
- resourceType: 'GMObjectProperty',
363
- resourceVersion: '1.0',
364
- name: 'entity_id',
365
- varType: 1, // String
366
- value: '""',
367
- },
368
- {
369
- resourceType: 'GMObjectProperty',
370
- resourceVersion: '1.0',
371
- name: 'tags',
372
- varType: 5, // Array
373
- value: '[]',
374
- },
375
- ],
376
- overriddenProperties: [],
377
- parent: { name: 'Objects', path: 'folders/Objects.yy' },
378
- };
379
- this.addTextFile('objects/obj_nice2dev_base/obj_nice2dev_base.yy', JSON.stringify(objectDef, null, 2));
380
- // Create event
381
- const createEvent = `/// @description Initialize base Nice2Dev entity
382
- entity_id = "";
383
- tags = [];
384
-
385
- // Override in child objects
386
- event_inherited();
387
- `;
388
- this.addTextFile('objects/obj_nice2dev_base/Create_0.gml', createEvent);
389
- this.resourceTree.push({
390
- id: { name: 'obj_nice2dev_base', path: 'objects/obj_nice2dev_base/obj_nice2dev_base.yy' },
391
- });
465
+ return props;
466
+ }
467
+ getGMLVarType(value) {
468
+ if (typeof value === "number") {
469
+ return Number.isInteger(value) ? 0 : 2;
392
470
  }
393
- async generateObjectFromEntity(entity, objectName, _options) {
394
- const safeName = objectName.replace(/[^a-zA-Z0-9_]/g, '_');
395
- const hasPhysics = entity.components.some((c) => c.type === 'rigidbody');
396
- // Find sprite component
397
- const spriteComp = entity.components.find((c) => c.type === 'sprite');
398
- const spriteName = spriteComp?.properties?.['texture'];
399
- const objectDef = {
400
- resourceType: 'GMObject',
401
- resourceVersion: '1.0',
402
- name: safeName,
403
- spriteId: spriteName
404
- ? { name: `spr_${spriteName}`, path: `sprites/spr_${spriteName}/spr_${spriteName}.yy` }
405
- : undefined,
406
- solid: entity.components.some((c) => c.type === 'boxCollider' && !c.properties?.['isTrigger']),
407
- visible: entity.active !== false,
408
- managed: true,
409
- persistent: false,
410
- parentObjectId: {
411
- name: 'obj_nice2dev_base',
412
- path: 'objects/obj_nice2dev_base/obj_nice2dev_base.yy',
413
- },
414
- physicsObject: hasPhysics,
415
- physicsShape: 1,
416
- eventList: this.generateEventList(entity),
417
- properties: this.extractEntityProperties(entity),
418
- overriddenProperties: [],
419
- parent: { name: 'Objects', path: 'folders/Objects.yy' },
420
- };
421
- this.addTextFile(`objects/${safeName}/${safeName}.yy`, JSON.stringify(objectDef, null, 2));
422
- // Generate event scripts
423
- await this.generateEventScripts(entity, safeName);
424
- this.resourceTree.push({
425
- id: { name: safeName, path: `objects/${safeName}/${safeName}.yy` },
426
- });
471
+ if (typeof value === "string") {
472
+ return 1;
427
473
  }
428
- generateEventList(entity) {
429
- const events = [
430
- {
431
- resourceType: 'GMEvent',
432
- resourceVersion: '1.0',
433
- isDnD: false,
434
- eventNum: GM_EVENTS.CREATE.num,
435
- eventType: GM_EVENTS.CREATE.type,
436
- },
437
- {
438
- resourceType: 'GMEvent',
439
- resourceVersion: '1.0',
440
- isDnD: false,
441
- eventNum: GM_EVENTS.STEP.num,
442
- eventType: GM_EVENTS.STEP.type,
443
- },
444
- ];
445
- // Add draw event if sprite
446
- if (entity.components.some((c) => c.type === 'sprite')) {
447
- events.push({
448
- resourceType: 'GMEvent',
449
- resourceVersion: '1.0',
450
- isDnD: false,
451
- eventNum: GM_EVENTS.DRAW.num,
452
- eventType: GM_EVENTS.DRAW.type,
453
- });
454
- }
455
- return events;
474
+ if (typeof value === "boolean") {
475
+ return 3;
456
476
  }
457
- extractEntityProperties(entity) {
458
- const props = [];
459
- // Add common properties
460
- for (const comp of entity.components) {
461
- if (comp.properties) {
462
- for (const [key, value] of Object.entries(comp.properties)) {
463
- const varType = this.getGMLVarType(value);
464
- props.push({
465
- resourceType: 'GMObjectProperty',
466
- resourceVersion: '1.0',
467
- name: `${comp.type}_${key}`,
468
- varType,
469
- value: this.valueToGML(value),
470
- });
471
- }
472
- }
473
- }
474
- return props;
477
+ if (Array.isArray(value)) {
478
+ return 5;
475
479
  }
476
- getGMLVarType(value) {
477
- if (typeof value === 'number') {
478
- return Number.isInteger(value) ? 0 : 2;
479
- } // Int or Real
480
- if (typeof value === 'string') {
481
- return 1;
482
- } // String
483
- if (typeof value === 'boolean') {
484
- return 3;
485
- } // Bool
486
- if (Array.isArray(value)) {
487
- return 5;
488
- } // Array
489
- return 1; // Default to string
480
+ return 1;
481
+ }
482
+ valueToGML(value) {
483
+ if (typeof value === "string") {
484
+ return `"${value}"`;
490
485
  }
491
- valueToGML(value) {
492
- if (typeof value === 'string') {
493
- return `"${value}"`;
494
- }
495
- if (typeof value === 'boolean') {
496
- return value ? 'true' : 'false';
497
- }
498
- if (Array.isArray(value)) {
499
- return JSON.stringify(value);
500
- }
501
- if (typeof value === 'object' && value !== null) {
502
- return JSON.stringify(value);
503
- }
504
- return String(value);
486
+ if (typeof value === "boolean") {
487
+ return value ? "true" : "false";
505
488
  }
506
- async generateEventScripts(entity, objectName) {
507
- // Create event
508
- let createScript = `/// @description Initialize ${entity.name ?? objectName}
509
- event_inherited();
510
-
511
- entity_id = "${entity.id}";
489
+ if (Array.isArray(value)) {
490
+ return JSON.stringify(value);
491
+ }
492
+ if (typeof value === "object" && value !== null) {
493
+ return JSON.stringify(value);
494
+ }
495
+ return String(value);
496
+ }
497
+ async generateEventScripts(entity, objectName) {
498
+ let createScript = `/// @description Initialize ${entity.name ?? objectName}
499
+ event_inherited();
500
+
501
+ entity_id = "${entity.id}";
512
502
  `;
513
- // Add tag initialization
514
- if (entity.tags && entity.tags.length > 0) {
515
- createScript += `tags = ${JSON.stringify(entity.tags)};\n`;
516
- }
517
- // Add component-specific initialization
518
- for (const comp of entity.components) {
519
- createScript += this.generateComponentInit(comp);
520
- }
521
- this.addTextFile(`objects/${objectName}/Create_0.gml`, createScript);
522
- // Step event
523
- const stepScript = `/// @description Step event for ${entity.name ?? objectName}
524
-
525
- // Add update logic here
503
+ if (entity.tags && entity.tags.length > 0) {
504
+ createScript += `tags = ${JSON.stringify(entity.tags)};
526
505
  `;
527
- this.addTextFile(`objects/${objectName}/Step_0.gml`, stepScript);
528
- // Draw event (if has sprite)
529
- if (entity.components.some((c) => c.type === 'sprite')) {
530
- const drawScript = `/// @description Draw event
531
- draw_self();
506
+ }
507
+ for (const comp of entity.components) {
508
+ createScript += this.generateComponentInit(comp);
509
+ }
510
+ this.addTextFile(`objects/${objectName}/Create_0.gml`, createScript);
511
+ const stepScript = `/// @description Step event for ${entity.name ?? objectName}
512
+
513
+ // Add update logic here
532
514
  `;
533
- this.addTextFile(`objects/${objectName}/Draw_0.gml`, drawScript);
534
- }
515
+ this.addTextFile(`objects/${objectName}/Step_0.gml`, stepScript);
516
+ if (entity.components.some((c) => c.type === "sprite")) {
517
+ const drawScript = `/// @description Draw event
518
+ draw_self();
519
+ `;
520
+ this.addTextFile(`objects/${objectName}/Draw_0.gml`, drawScript);
535
521
  }
536
- generateComponentInit(comp) {
537
- let code = `\n// ${comp.type} component\n`;
538
- switch (comp.type) {
539
- case 'sprite': {
540
- const color = comp.properties?.['color'];
541
- if (color) {
542
- code += `image_blend = ${this.colorToGML(color)};\n`;
543
- }
544
- break;
545
- }
546
- case 'rigidbody':
547
- code += `phy_active = true;\n`;
548
- if (comp.properties?.['mass']) {
549
- code += `phy_mass = ${comp.properties['mass']};\n`;
550
- }
551
- if (comp.properties?.['linearDamping']) {
552
- code += `phy_linear_damping = ${comp.properties['linearDamping']};\n`;
553
- }
554
- break;
555
- case 'audioSource':
556
- if (comp.properties?.['playOnAwake']) {
557
- const clip = comp.properties['clip'];
558
- if (clip) {
559
- code += `audio_play_sound(snd_${clip}, 1, ${comp.properties['loop'] ? 'true' : 'false'});\n`;
560
- }
561
- }
562
- break;
522
+ }
523
+ generateComponentInit(comp) {
524
+ let code = `
525
+ // ${comp.type} component
526
+ `;
527
+ switch (comp.type) {
528
+ case "sprite": {
529
+ const color = comp.properties?.["color"];
530
+ if (color) {
531
+ code += `image_blend = ${this.colorToGML(color)};
532
+ `;
563
533
  }
564
- return code;
565
- }
566
- colorToGML(color) {
567
- if (color.startsWith('#')) {
568
- // Convert hex to GML color (BGR format)
569
- const hex = color.replace('#', '');
570
- const r = parseInt(hex.substr(0, 2), 16);
571
- const g = parseInt(hex.substr(2, 2), 16);
572
- const b = parseInt(hex.substr(4, 2), 16);
573
- return `make_colour_rgb(${r}, ${g}, ${b})`;
534
+ break;
535
+ }
536
+ case "rigidbody":
537
+ code += `phy_active = true;
538
+ `;
539
+ if (comp.properties?.["mass"]) {
540
+ code += `phy_mass = ${comp.properties["mass"]};
541
+ `;
574
542
  }
575
- return 'c_white';
576
- }
577
- /* ── Rooms ──────────────────────────────────────────────────── */
578
- async generateRoom(scene, project, options) {
579
- const roomName = `rm_${scene.name.replace(/[^a-zA-Z0-9_]/g, '_')}`;
580
- const width = project.settings.resolution.width;
581
- const height = project.settings.resolution.height;
582
- const platformOpts = options.platformOptions ?? {};
583
- const instances = [];
584
- const instanceOrder = [];
585
- // Generate instances from entities
586
- for (const entity of scene.entities) {
587
- const objName = entity.prefabId
588
- ? `obj_${entity.prefabId}`
589
- : entity.type
590
- ? `obj_${entity.type}`
591
- : 'obj_nice2dev_base';
592
- const instanceName = `inst_${generateGMUUID().substr(0, 8)}`;
593
- const pos = entity.position ?? { x: 0, y: 0 };
594
- instances.push({
595
- resourceType: 'GMRoomInstance',
596
- resourceVersion: '1.0',
597
- name: instanceName,
598
- properties: [],
599
- isDnd: false,
600
- objectId: { name: objName, path: `objects/${objName}/${objName}.yy` },
601
- inheritCode: false,
602
- hasCreationCode: false,
603
- colour: 4294967295,
604
- rotation: entity.rotation ?? 0,
605
- scaleX: entity.scale?.x ?? 1,
606
- scaleY: entity.scale?.y ?? 1,
607
- x: pos.x,
608
- y: pos.y,
609
- });
610
- instanceOrder.push({ name: instanceName, path: `rooms/${roomName}/${roomName}.yy` });
543
+ if (comp.properties?.["linearDamping"]) {
544
+ code += `phy_linear_damping = ${comp.properties["linearDamping"]};
545
+ `;
611
546
  }
612
- // Build layers
613
- const layers = [
614
- {
615
- resourceType: 'GMRLayer',
616
- resourceVersion: '1.0',
617
- name: 'Instances',
618
- visible: true,
619
- depth: 0,
620
- userdefinedDepth: false,
621
- inheritLayerDepth: false,
622
- inheritLayerSettings: false,
623
- instances,
624
- },
625
- {
626
- resourceType: 'GMRBackgroundLayer',
627
- resourceVersion: '1.0',
628
- name: 'Background',
629
- visible: true,
630
- depth: 100,
631
- userdefinedDepth: false,
632
- inheritLayerDepth: false,
633
- inheritLayerSettings: false,
634
- },
635
- ];
636
- // Add tile layers from tilemaps
637
- if (scene.tilemaps) {
638
- for (const tilemap of scene.tilemaps) {
639
- layers.push(this.createTileLayer(tilemap, project));
640
- }
547
+ break;
548
+ case "audioSource":
549
+ if (comp.properties?.["playOnAwake"]) {
550
+ const clip = comp.properties["clip"];
551
+ if (clip) {
552
+ code += `audio_play_sound(snd_${clip}, 1, ${comp.properties["loop"] ? "true" : "false"});
553
+ `;
554
+ }
641
555
  }
642
- const room = {
643
- resourceType: 'GMRoom',
644
- resourceVersion: '1.0',
645
- name: roomName,
646
- isDnd: false,
647
- creationCodeFile: '',
648
- inheritCode: false,
649
- inheritCreationOrder: false,
650
- inheritLayers: false,
651
- instanceCreationOrder: instanceOrder,
652
- layers,
653
- parent: { name: 'Rooms', path: 'folders/Rooms.yy' },
654
- roomSettings: {
655
- inheritRoomSettings: false,
656
- Width: width,
657
- Height: height,
658
- persistent: false,
659
- },
660
- viewSettings: {
661
- inheritViewSettings: false,
662
- enableViews: true,
663
- clearViewBackground: true,
664
- clearDisplayBuffer: true,
665
- },
666
- physicsSettings: {
667
- inheritPhysicsSettings: false,
668
- PhysicsWorld: platformOpts.enablePhysics ?? project.settings.physics.enabled,
669
- PhysicsWorldGravityX: project.settings.physics.gravity.x,
670
- PhysicsWorldGravityY: project.settings.physics.gravity.y,
671
- PhysicsWorldPixToMetres: 0.1,
672
- },
673
- };
674
- this.addTextFile(`rooms/${roomName}/${roomName}.yy`, JSON.stringify(room, null, 2));
675
- this.resourceTree.push({
676
- id: { name: roomName, path: `rooms/${roomName}/${roomName}.yy` },
677
- });
556
+ break;
678
557
  }
679
- createTileLayer(tilemap, _project) {
680
- return {
681
- resourceType: 'GMRTileLayer',
682
- resourceVersion: '1.1',
683
- name: tilemap.name,
684
- visible: true,
685
- depth: 50,
686
- userdefinedDepth: false,
687
- inheritLayerDepth: false,
688
- inheritLayerSettings: false,
689
- tiles: {
690
- SerialiseWidth: tilemap.width,
691
- SerialiseHeight: tilemap.height,
692
- TileSerialiseData: tilemap.layers[0]?.data ?? [],
693
- },
694
- };
558
+ return code;
559
+ }
560
+ colorToGML(color) {
561
+ if (color.startsWith("#")) {
562
+ const hex = color.replace("#", "");
563
+ const r = parseInt(hex.substr(0, 2), 16);
564
+ const g = parseInt(hex.substr(2, 2), 16);
565
+ const b = parseInt(hex.substr(4, 2), 16);
566
+ return `make_colour_rgb(${r}, ${g}, ${b})`;
695
567
  }
696
- /* ── Sprites ────────────────────────────────────────────────── */
697
- async generateSprite(asset, options) {
698
- const spriteName = `spr_${asset.name.replace(/[^a-zA-Z0-9_]/g, '_')}`;
699
- const platformOpts = options.platformOptions ?? {};
700
- // Determine origin based on options
701
- let originX = 0, originY = 0;
702
- switch (platformOpts.spriteOrigin) {
703
- case 'center':
704
- originX = 0.5;
705
- originY = 0.5;
706
- break;
707
- case 'bottom-center':
708
- originX = 0.5;
709
- originY = 1;
710
- break;
711
- default: // top-left
712
- originX = 0;
713
- originY = 0;
714
- }
715
- const spriteDef = {
716
- resourceType: 'GMSprite',
717
- resourceVersion: '1.0',
718
- name: spriteName,
719
- bboxMode: 0,
720
- bbox_bottom: 31,
721
- bbox_left: 0,
722
- bbox_right: 31,
723
- bbox_top: 0,
724
- collisionKind: 1,
725
- collisionTolerance: 0,
726
- DynamicTexturePage: false,
727
- edgeFiltering: false,
728
- For3D: false,
729
- frames: [
730
- {
731
- resourceType: 'GMSpriteFrame',
732
- resourceVersion: '1.1',
733
- name: generateGMUUID(),
734
- },
735
- ],
736
- gridX: 0,
737
- gridY: 0,
738
- height: 32,
739
- HTile: false,
740
- layers: [
741
- {
742
- resourceType: 'GMImageLayer',
743
- resourceVersion: '1.0',
744
- name: generateGMUUID(),
745
- blendMode: 0,
746
- displayName: 'default',
747
- isLocked: false,
748
- opacity: 100,
749
- visible: true,
750
- },
751
- ],
752
- nineSlice: null,
753
- origin: platformOpts.spriteOrigin === 'center'
754
- ? 4
755
- : platformOpts.spriteOrigin === 'bottom-center'
756
- ? 7
757
- : 0,
758
- parent: { name: 'Sprites', path: 'folders/Sprites.yy' },
759
- preMultiplyAlpha: false,
760
- sequence: {
761
- resourceType: 'GMSequence',
762
- resourceVersion: '1.4',
763
- name: spriteName,
764
- autoRecord: true,
765
- backdropHeight: 768,
766
- backdropImageOpacity: 0.5,
767
- backdropImagePath: '',
768
- backdropWidth: 1366,
769
- backdropXOffset: 0.0,
770
- backdropYOffset: 0.0,
771
- events: {
772
- Keyframes: [],
773
- resourceType: 'KeyframeStore<MessageEventKeyframe>',
774
- resourceVersion: '1.0',
775
- },
776
- eventStubScript: null,
777
- eventToFunction: {},
778
- length: 1.0,
779
- lockOrigin: false,
780
- moments: {
781
- Keyframes: [],
782
- resourceType: 'KeyframeStore<MomentsEventKeyframe>',
783
- resourceVersion: '1.0',
784
- },
785
- playback: 1,
786
- playbackSpeed: 15.0,
787
- playbackSpeedType: 0,
788
- showBackdrop: true,
789
- showBackdropImage: false,
790
- spriteId: { name: spriteName, path: `sprites/${spriteName}/${spriteName}.yy` },
791
- timeUnits: 1,
792
- tracks: [],
793
- volume: 1.0,
794
- xorigin: Math.floor(32 * originX),
795
- yorigin: Math.floor(32 * originY),
796
- },
797
- swatchColours: null,
798
- swfPrecision: 2.525,
799
- textureGroupId: { name: 'Default', path: 'texturegroups/Default' },
800
- type: 0,
801
- VTile: false,
802
- width: 32,
803
- };
804
- this.addTextFile(`sprites/${spriteName}/${spriteName}.yy`, JSON.stringify(spriteDef, null, 2));
805
- // Add warning for actual image file
806
- this.addWarning('SPRITE_MANUAL', `Sprite "${asset.name}" requires manual image import`, `Copy sprite image to sprites/${spriteName}/ folder`);
807
- this.resourceTree.push({
808
- id: { name: spriteName, path: `sprites/${spriteName}/${spriteName}.yy` },
809
- });
568
+ return "c_white";
569
+ }
570
+ /* ── Rooms ──────────────────────────────────────────────────── */
571
+ async generateRoom(scene, project, options) {
572
+ const roomName = `rm_${scene.name.replace(/[^a-zA-Z0-9_]/g, "_")}`;
573
+ const width = project.settings.resolution.width;
574
+ const height = project.settings.resolution.height;
575
+ const platformOpts = options.platformOptions ?? {};
576
+ const instances = [];
577
+ const instanceOrder = [];
578
+ for (const entity of scene.entities) {
579
+ const objName = entity.prefabId ? `obj_${entity.prefabId}` : entity.type ? `obj_${entity.type}` : "obj_nice2dev_base";
580
+ const instanceName = `inst_${generateGMUUID().substr(0, 8)}`;
581
+ const pos = entity.position ?? { x: 0, y: 0 };
582
+ instances.push({
583
+ resourceType: "GMRoomInstance",
584
+ resourceVersion: "1.0",
585
+ name: instanceName,
586
+ properties: [],
587
+ isDnd: false,
588
+ objectId: { name: objName, path: `objects/${objName}/${objName}.yy` },
589
+ inheritCode: false,
590
+ hasCreationCode: false,
591
+ colour: 4294967295,
592
+ rotation: entity.rotation ?? 0,
593
+ scaleX: entity.scale?.x ?? 1,
594
+ scaleY: entity.scale?.y ?? 1,
595
+ x: pos.x,
596
+ y: pos.y
597
+ });
598
+ instanceOrder.push({ name: instanceName, path: `rooms/${roomName}/${roomName}.yy` });
810
599
  }
811
- /* ── Sounds ─────────────────────────────────────────────────── */
812
- async generateSound(asset, _options) {
813
- const soundName = `snd_${asset.name.replace(/[^a-zA-Z0-9_]/g, '_')}`;
814
- const soundDef = {
815
- resourceType: 'GMSound',
816
- resourceVersion: '1.0',
817
- name: soundName,
818
- audioGroupId: { name: 'audiogroup_default', path: 'audiogroups/audiogroup_default' },
819
- bitDepth: 1,
820
- bitRate: 128,
821
- compression: 0,
822
- conversionMode: 0,
823
- duration: 1.0,
824
- parent: { name: 'Sounds', path: 'folders/Sounds.yy' },
825
- preload: false,
826
- sampleRate: 44100,
827
- soundFile: `${soundName}.ogg`,
828
- type: 0,
829
- volume: 1.0,
830
- };
831
- this.addTextFile(`sounds/${soundName}/${soundName}.yy`, JSON.stringify(soundDef, null, 2));
832
- this.addWarning('SOUND_MANUAL', `Sound "${asset.name}" requires manual audio import`, `Copy audio file to sounds/${soundName}/ folder as ${soundName}.ogg`);
833
- this.resourceTree.push({
834
- id: { name: soundName, path: `sounds/${soundName}/${soundName}.yy` },
835
- });
600
+ const layers = [
601
+ {
602
+ resourceType: "GMRLayer",
603
+ resourceVersion: "1.0",
604
+ name: "Instances",
605
+ visible: true,
606
+ depth: 0,
607
+ userdefinedDepth: false,
608
+ inheritLayerDepth: false,
609
+ inheritLayerSettings: false,
610
+ instances
611
+ },
612
+ {
613
+ resourceType: "GMRBackgroundLayer",
614
+ resourceVersion: "1.0",
615
+ name: "Background",
616
+ visible: true,
617
+ depth: 100,
618
+ userdefinedDepth: false,
619
+ inheritLayerDepth: false,
620
+ inheritLayerSettings: false
621
+ }
622
+ ];
623
+ if (scene.tilemaps) {
624
+ for (const tilemap of scene.tilemaps) {
625
+ layers.push(this.createTileLayer(tilemap, project));
626
+ }
627
+ }
628
+ const room = {
629
+ resourceType: "GMRoom",
630
+ resourceVersion: "1.0",
631
+ name: roomName,
632
+ isDnd: false,
633
+ creationCodeFile: "",
634
+ inheritCode: false,
635
+ inheritCreationOrder: false,
636
+ inheritLayers: false,
637
+ instanceCreationOrder: instanceOrder,
638
+ layers,
639
+ parent: { name: "Rooms", path: "folders/Rooms.yy" },
640
+ roomSettings: {
641
+ inheritRoomSettings: false,
642
+ Width: width,
643
+ Height: height,
644
+ persistent: false
645
+ },
646
+ viewSettings: {
647
+ inheritViewSettings: false,
648
+ enableViews: true,
649
+ clearViewBackground: true,
650
+ clearDisplayBuffer: true
651
+ },
652
+ physicsSettings: {
653
+ inheritPhysicsSettings: false,
654
+ PhysicsWorld: platformOpts.enablePhysics ?? project.settings.physics.enabled,
655
+ PhysicsWorldGravityX: project.settings.physics.gravity.x,
656
+ PhysicsWorldGravityY: project.settings.physics.gravity.y,
657
+ PhysicsWorldPixToMetres: 0.1
658
+ }
659
+ };
660
+ this.addTextFile(`rooms/${roomName}/${roomName}.yy`, JSON.stringify(room, null, 2));
661
+ this.resourceTree.push({
662
+ id: { name: roomName, path: `rooms/${roomName}/${roomName}.yy` }
663
+ });
664
+ }
665
+ createTileLayer(tilemap, _project) {
666
+ return {
667
+ resourceType: "GMRTileLayer",
668
+ resourceVersion: "1.1",
669
+ name: tilemap.name,
670
+ visible: true,
671
+ depth: 50,
672
+ userdefinedDepth: false,
673
+ inheritLayerDepth: false,
674
+ inheritLayerSettings: false,
675
+ tiles: {
676
+ SerialiseWidth: tilemap.width,
677
+ SerialiseHeight: tilemap.height,
678
+ TileSerialiseData: tilemap.layers[0]?.data ?? []
679
+ }
680
+ };
681
+ }
682
+ /* ── Sprites ────────────────────────────────────────────────── */
683
+ async generateSprite(asset, options) {
684
+ const spriteName = `spr_${asset.name.replace(/[^a-zA-Z0-9_]/g, "_")}`;
685
+ const platformOpts = options.platformOptions ?? {};
686
+ let originX = 0, originY = 0;
687
+ switch (platformOpts.spriteOrigin) {
688
+ case "center":
689
+ originX = 0.5;
690
+ originY = 0.5;
691
+ break;
692
+ case "bottom-center":
693
+ originX = 0.5;
694
+ originY = 1;
695
+ break;
696
+ default:
697
+ originX = 0;
698
+ originY = 0;
836
699
  }
700
+ const spriteDef = {
701
+ resourceType: "GMSprite",
702
+ resourceVersion: "1.0",
703
+ name: spriteName,
704
+ bboxMode: 0,
705
+ bbox_bottom: 31,
706
+ bbox_left: 0,
707
+ bbox_right: 31,
708
+ bbox_top: 0,
709
+ collisionKind: 1,
710
+ collisionTolerance: 0,
711
+ DynamicTexturePage: false,
712
+ edgeFiltering: false,
713
+ For3D: false,
714
+ frames: [
715
+ {
716
+ resourceType: "GMSpriteFrame",
717
+ resourceVersion: "1.1",
718
+ name: generateGMUUID()
719
+ }
720
+ ],
721
+ gridX: 0,
722
+ gridY: 0,
723
+ height: 32,
724
+ HTile: false,
725
+ layers: [
726
+ {
727
+ resourceType: "GMImageLayer",
728
+ resourceVersion: "1.0",
729
+ name: generateGMUUID(),
730
+ blendMode: 0,
731
+ displayName: "default",
732
+ isLocked: false,
733
+ opacity: 100,
734
+ visible: true
735
+ }
736
+ ],
737
+ nineSlice: null,
738
+ origin: platformOpts.spriteOrigin === "center" ? 4 : platformOpts.spriteOrigin === "bottom-center" ? 7 : 0,
739
+ parent: { name: "Sprites", path: "folders/Sprites.yy" },
740
+ preMultiplyAlpha: false,
741
+ sequence: {
742
+ resourceType: "GMSequence",
743
+ resourceVersion: "1.4",
744
+ name: spriteName,
745
+ autoRecord: true,
746
+ backdropHeight: 768,
747
+ backdropImageOpacity: 0.5,
748
+ backdropImagePath: "",
749
+ backdropWidth: 1366,
750
+ backdropXOffset: 0,
751
+ backdropYOffset: 0,
752
+ events: {
753
+ Keyframes: [],
754
+ resourceType: "KeyframeStore<MessageEventKeyframe>",
755
+ resourceVersion: "1.0"
756
+ },
757
+ eventStubScript: null,
758
+ eventToFunction: {},
759
+ length: 1,
760
+ lockOrigin: false,
761
+ moments: {
762
+ Keyframes: [],
763
+ resourceType: "KeyframeStore<MomentsEventKeyframe>",
764
+ resourceVersion: "1.0"
765
+ },
766
+ playback: 1,
767
+ playbackSpeed: 15,
768
+ playbackSpeedType: 0,
769
+ showBackdrop: true,
770
+ showBackdropImage: false,
771
+ spriteId: { name: spriteName, path: `sprites/${spriteName}/${spriteName}.yy` },
772
+ timeUnits: 1,
773
+ tracks: [],
774
+ volume: 1,
775
+ xorigin: Math.floor(32 * originX),
776
+ yorigin: Math.floor(32 * originY)
777
+ },
778
+ swatchColours: null,
779
+ swfPrecision: 2.525,
780
+ textureGroupId: { name: "Default", path: "texturegroups/Default" },
781
+ type: 0,
782
+ VTile: false,
783
+ width: 32
784
+ };
785
+ this.addTextFile(`sprites/${spriteName}/${spriteName}.yy`, JSON.stringify(spriteDef, null, 2));
786
+ this.addWarning(
787
+ "SPRITE_MANUAL",
788
+ `Sprite "${asset.name}" requires manual image import`,
789
+ `Copy sprite image to sprites/${spriteName}/ folder`
790
+ );
791
+ this.resourceTree.push({
792
+ id: { name: spriteName, path: `sprites/${spriteName}/${spriteName}.yy` }
793
+ });
794
+ }
795
+ /* ── Sounds ─────────────────────────────────────────────────── */
796
+ async generateSound(asset, _options) {
797
+ const soundName = `snd_${asset.name.replace(/[^a-zA-Z0-9_]/g, "_")}`;
798
+ const soundDef = {
799
+ resourceType: "GMSound",
800
+ resourceVersion: "1.0",
801
+ name: soundName,
802
+ audioGroupId: { name: "audiogroup_default", path: "audiogroups/audiogroup_default" },
803
+ bitDepth: 1,
804
+ bitRate: 128,
805
+ compression: 0,
806
+ conversionMode: 0,
807
+ duration: 1,
808
+ parent: { name: "Sounds", path: "folders/Sounds.yy" },
809
+ preload: false,
810
+ sampleRate: 44100,
811
+ soundFile: `${soundName}.ogg`,
812
+ type: 0,
813
+ volume: 1
814
+ };
815
+ this.addTextFile(`sounds/${soundName}/${soundName}.yy`, JSON.stringify(soundDef, null, 2));
816
+ this.addWarning(
817
+ "SOUND_MANUAL",
818
+ `Sound "${asset.name}" requires manual audio import`,
819
+ `Copy audio file to sounds/${soundName}/ folder as ${soundName}.ogg`
820
+ );
821
+ this.resourceTree.push({
822
+ id: { name: soundName, path: `sounds/${soundName}/${soundName}.yy` }
823
+ });
824
+ }
837
825
  }
838
- /* ── Factory ──────────────────────────────────────────────────── */
839
826
  function createGameMakerExporter() {
840
- return new GameMakerExporter();
827
+ return new GameMakerExporter();
841
828
  }
842
-
843
- export { GameMakerExporter, createGameMakerExporter };
829
+ export {
830
+ GameMakerExporter,
831
+ createGameMakerExporter
832
+ };