@nice2dev/game-engine 1.3.15 → 1.3.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) hide show
  1. package/CHANGELOG.md +13 -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,902 +1,886 @@
1
- import { PlatformExporter } from './PlatformExporter.js';
2
-
3
- /* ────────────────────────────────────────────────────────────────
4
- RPG Maker Exporter — MV/MZ Plugin & Resource Export
5
-
6
- Exports Nice2Dev projects to RPG Maker MV/MZ format:
7
- - Plugin files (.js)
8
- - Map data (JSON)
9
- - Event pages
10
- - Character/Enemy data
11
- - Tileset configurations
12
- ──────────────────────────────────────────────────────────────── */
13
- /* ── RPG Maker Event Codes ────────────────────────────────────── */
1
+ import { PlatformExporter } from "./PlatformExporter.js";
14
2
  const EventCode = {
15
- END: 0,
16
- COMMENT: 108,
17
- SCRIPT: 355,
18
- SCRIPT_DATA: 655};
19
- /* ── Exporter Implementation ──────────────────────────────────── */
3
+ END: 0,
4
+ COMMENT: 108,
5
+ SCRIPT: 355,
6
+ SCRIPT_DATA: 655
7
+ };
20
8
  class RPGMakerExporter extends PlatformExporter {
21
- constructor() {
22
- super(...arguments);
23
- this.platformId = 'rpgmaker';
24
- this.platformInfo = {
25
- id: 'rpgmaker',
26
- name: 'RPG Maker MV/MZ',
27
- description: 'RPG Maker MV and MZ game engine with JavaScript plugins',
28
- website: 'https://www.rpgmakerweb.com/',
29
- features: ['2d-rendering', 'audio', 'particles', 'ui-system', 'animation', 'tilemaps'],
30
- supportedAssets: ['texture', 'audio', 'tilemap', 'animation', 'prefab', 'scene', 'data'],
31
- exportFormats: ['.js', '.json', '.png', '.ogg'],
32
- };
33
- this.version = 'MZ';
34
- this.pluginPrefix = 'N2D';
35
- this.tileSize = 48;
9
+ constructor() {
10
+ super(...arguments);
11
+ this.platformId = "rpgmaker";
12
+ this.platformInfo = {
13
+ id: "rpgmaker",
14
+ name: "RPG Maker MV/MZ",
15
+ description: "RPG Maker MV and MZ game engine with JavaScript plugins",
16
+ website: "https://www.rpgmakerweb.com/",
17
+ features: ["2d-rendering", "audio", "particles", "ui-system", "animation", "tilemaps"],
18
+ supportedAssets: ["texture", "audio", "tilemap", "animation", "prefab", "scene", "data"],
19
+ exportFormats: [".js", ".json", ".png", ".ogg"]
20
+ };
21
+ this.version = "MZ";
22
+ this.pluginPrefix = "N2D";
23
+ this.tileSize = 48;
24
+ }
25
+ async doExport(project, options) {
26
+ const platformOpts = options.platformOptions ?? {};
27
+ this.version = platformOpts.version ?? "MZ";
28
+ this.pluginPrefix = platformOpts.pluginPrefix ?? "N2D";
29
+ this.tileSize = platformOpts.tileSize ?? 48;
30
+ await this.generateMainPlugin(project, options);
31
+ await this.generateUtilityPlugin(project, options);
32
+ for (const scene of project.scenes) {
33
+ await this.exportScene(scene, project, options);
34
+ }
35
+ for (const prefab of project.prefabs) {
36
+ await this.exportPrefab(prefab, options);
37
+ }
38
+ if (platformOpts.generateCommonEvents !== false) {
39
+ await this.generateCommonEvents(project, options);
36
40
  }
37
- async doExport(project, options) {
38
- const platformOpts = options.platformOptions ?? {};
39
- this.version = platformOpts.version ?? 'MZ';
40
- this.pluginPrefix = platformOpts.pluginPrefix ?? 'N2D';
41
- this.tileSize = platformOpts.tileSize ?? 48;
42
- // Generate main plugin
43
- await this.generateMainPlugin(project, options);
44
- // Generate utility plugin
45
- await this.generateUtilityPlugin(project, options);
46
- // Export scenes as maps
47
- for (const scene of project.scenes) {
48
- await this.exportScene(scene, project, options);
41
+ await this.generateDataFiles(project, options);
42
+ }
43
+ /* ── Main Plugin ────────────────────────────────────────────── */
44
+ async generateMainPlugin(project, _options) {
45
+ const versionSpecific = this.version === "MZ" ? this.getMZPluginHeader() : this.getMVPluginHeader();
46
+ const plugin = `/*:
47
+ * @target ${this.version}
48
+ * @plugindesc ${project.name} - Nice2Dev Game Integration
49
+ * @author Nice2Dev Generator
50
+ * @version ${project.version}
51
+ * @url https://nice2dev.com
52
+ *
53
+ ${versionSpecific}
54
+ *
55
+ * @help
56
+ * ============================================================================
57
+ * ${project.name}
58
+ * ============================================================================
59
+ *
60
+ * This plugin was generated from Nice2Dev project.
61
+ *
62
+ * Game Settings:
63
+ * - Resolution: ${project.settings.resolution.width}x${project.settings.resolution.height}
64
+ * - Physics: ${project.settings.physics.enabled ? "Enabled" : "Disabled"}
65
+ * - Gravity: (${project.settings.physics.gravity.x}, ${project.settings.physics.gravity.y})
66
+ *
67
+ * Scenes: ${project.scenes.length}
68
+ * Prefabs: ${project.prefabs.length}
69
+ * Assets: ${project.assets?.length ?? 0}
70
+ *
71
+ * ============================================================================
72
+ * Plugin Commands
73
+ * ============================================================================
74
+ *
75
+ * N2D_LoadScene <sceneName> - Load a Nice2Dev scene
76
+ * N2D_SpawnEntity <prefab> <x> <y> - Spawn an entity from prefab
77
+ * N2D_SetVariable <name> <value> - Set a game variable
78
+ * N2D_GetVariable <name> - Get a game variable
79
+ *
80
+ */
81
+
82
+ (() => {
83
+ 'use strict';
84
+
85
+ const pluginName = '${this.pluginPrefix}_${project.name.replace(/[^a-zA-Z0-9]/g, "")}';
86
+
87
+ //=========================================================================
88
+ // Game State
89
+ //=========================================================================
90
+
91
+ const N2D = window.N2D = window.N2D || {};
92
+
93
+ N2D.State = {
94
+ currentScene: null,
95
+ entities: new Map(),
96
+ globalVariables: new Map(),
97
+ isPaused: false,
98
+ };
99
+
100
+ N2D.Settings = {
101
+ gameWidth: ${project.settings.resolution.width},
102
+ gameHeight: ${project.settings.resolution.height},
103
+ masterVolume: ${project.settings.audio.masterVolume},
104
+ physicsEnabled: ${project.settings.physics.enabled},
105
+ gravityX: ${project.settings.physics.gravity.x},
106
+ gravityY: ${project.settings.physics.gravity.y},
107
+ };
108
+
109
+ //=========================================================================
110
+ // Entity System
111
+ //=========================================================================
112
+
113
+ N2D.Entity = class {
114
+ constructor(id, name) {
115
+ this.id = id;
116
+ this.name = name;
117
+ this.position = { x: 0, y: 0 };
118
+ this.components = [];
119
+ this.tags = [];
120
+ this.active = true;
49
121
  }
50
- // Export prefabs as event templates/actors/enemies
51
- for (const prefab of project.prefabs) {
52
- await this.exportPrefab(prefab, options);
122
+
123
+ addComponent(component) {
124
+ this.components.push(component);
53
125
  }
54
- // Generate common events if requested
55
- if (platformOpts.generateCommonEvents !== false) {
56
- await this.generateCommonEvents(project, options);
126
+
127
+ getComponent(type) {
128
+ return this.components.find(c => c.type === type);
57
129
  }
58
- // Generate data files
59
- await this.generateDataFiles(project, options);
60
- }
61
- /* ── Main Plugin ────────────────────────────────────────────── */
62
- async generateMainPlugin(project, _options) {
63
- const versionSpecific = this.version === 'MZ' ? this.getMZPluginHeader() : this.getMVPluginHeader();
64
- const plugin = `/*:
65
- * @target ${this.version}
66
- * @plugindesc ${project.name} - Nice2Dev Game Integration
67
- * @author Nice2Dev Generator
68
- * @version ${project.version}
69
- * @url https://nice2dev.com
70
- *
71
- ${versionSpecific}
72
- *
73
- * @help
74
- * ============================================================================
75
- * ${project.name}
76
- * ============================================================================
77
- *
78
- * This plugin was generated from Nice2Dev project.
79
- *
80
- * Game Settings:
81
- * - Resolution: ${project.settings.resolution.width}x${project.settings.resolution.height}
82
- * - Physics: ${project.settings.physics.enabled ? 'Enabled' : 'Disabled'}
83
- * - Gravity: (${project.settings.physics.gravity.x}, ${project.settings.physics.gravity.y})
84
- *
85
- * Scenes: ${project.scenes.length}
86
- * Prefabs: ${project.prefabs.length}
87
- * Assets: ${project.assets?.length ?? 0}
88
- *
89
- * ============================================================================
90
- * Plugin Commands
91
- * ============================================================================
92
- *
93
- * N2D_LoadScene <sceneName> - Load a Nice2Dev scene
94
- * N2D_SpawnEntity <prefab> <x> <y> - Spawn an entity from prefab
95
- * N2D_SetVariable <name> <value> - Set a game variable
96
- * N2D_GetVariable <name> - Get a game variable
97
- *
98
- */
99
-
100
- (() => {
101
- 'use strict';
102
-
103
- const pluginName = '${this.pluginPrefix}_${project.name.replace(/[^a-zA-Z0-9]/g, '')}';
104
-
105
- //=========================================================================
106
- // Game State
107
- //=========================================================================
108
-
109
- const N2D = window.N2D = window.N2D || {};
110
-
111
- N2D.State = {
112
- currentScene: null,
113
- entities: new Map(),
114
- globalVariables: new Map(),
115
- isPaused: false,
116
- };
117
-
118
- N2D.Settings = {
119
- gameWidth: ${project.settings.resolution.width},
120
- gameHeight: ${project.settings.resolution.height},
121
- masterVolume: ${project.settings.audio.masterVolume},
122
- physicsEnabled: ${project.settings.physics.enabled},
123
- gravityX: ${project.settings.physics.gravity.x},
124
- gravityY: ${project.settings.physics.gravity.y},
125
- };
126
-
127
- //=========================================================================
128
- // Entity System
129
- //=========================================================================
130
-
131
- N2D.Entity = class {
132
- constructor(id, name) {
133
- this.id = id;
134
- this.name = name;
135
- this.position = { x: 0, y: 0 };
136
- this.components = [];
137
- this.tags = [];
138
- this.active = true;
139
- }
140
-
141
- addComponent(component) {
142
- this.components.push(component);
143
- }
144
-
145
- getComponent(type) {
146
- return this.components.find(c => c.type === type);
147
- }
148
-
149
- hasTag(tag) {
150
- return this.tags.includes(tag);
151
- }
152
-
153
- update(deltaTime) {
154
- if (!this.active) return;
155
- for (const component of this.components) {
156
- if (component.update) {
157
- component.update(deltaTime);
158
- }
159
- }
160
- }
161
-
162
- destroy() {
163
- N2D.State.entities.delete(this.id);
164
- }
165
- };
166
-
167
- //=========================================================================
168
- // Scene Management
169
- //=========================================================================
170
-
171
- N2D.SceneManager = {
172
- scenes: {},
173
-
174
- registerScene(name, sceneData) {
175
- this.scenes[name] = sceneData;
176
- },
177
-
178
- loadScene(name) {
179
- const scene = this.scenes[name];
180
- if (!scene) {
181
- console.error(\`[N2D] Scene not found: \${name}\`);
182
- return false;
183
- }
184
-
185
- // Clear current entities
186
- N2D.State.entities.clear();
187
- N2D.State.currentScene = name;
188
-
189
- // Spawn scene entities
190
- if (scene.entities) {
191
- for (const entityDef of scene.entities) {
192
- this.spawnEntity(entityDef);
193
- }
194
- }
195
-
196
- console.log(\`[N2D] Loaded scene: \${name}\`);
197
- return true;
198
- },
199
-
200
- spawnEntity(definition) {
201
- const entity = new N2D.Entity(definition.id, definition.name);
202
- entity.position = { ...definition.position };
203
- entity.tags = [...(definition.tags || [])];
204
-
205
- if (definition.components) {
206
- for (const compDef of definition.components) {
207
- entity.addComponent({ ...compDef });
208
- }
209
- }
210
-
211
- N2D.State.entities.set(entity.id, entity);
212
- return entity;
213
- },
214
- };
215
-
216
- //=========================================================================
217
- // Variable System
218
- //=========================================================================
219
-
220
- N2D.Variables = {
221
- set(name, value) {
222
- N2D.State.globalVariables.set(name, value);
223
- },
224
-
225
- get(name, defaultValue = null) {
226
- return N2D.State.globalVariables.has(name)
227
- ? N2D.State.globalVariables.get(name)
228
- : defaultValue;
229
- },
230
-
231
- has(name) {
232
- return N2D.State.globalVariables.has(name);
233
- },
234
-
235
- remove(name) {
236
- N2D.State.globalVariables.delete(name);
237
- },
238
-
239
- clear() {
240
- N2D.State.globalVariables.clear();
241
- },
242
- };
243
-
244
- //=========================================================================
245
- // Update Loop Integration
246
- //=========================================================================
247
-
248
- const _Scene_Map_update = Scene_Map.prototype.update;
249
- Scene_Map.prototype.update = function() {
250
- _Scene_Map_update.call(this);
251
-
252
- if (!N2D.State.isPaused) {
253
- const deltaTime = 1 / 60; // Approximate 60 FPS
254
- for (const entity of N2D.State.entities.values()) {
255
- entity.update(deltaTime);
256
- }
257
- }
258
- };
259
-
260
- //=========================================================================
261
- // Plugin Commands
262
- //=========================================================================
263
-
264
- ${this.version === 'MZ' ? this.getMZPluginCommands() : this.getMVPluginCommands()}
265
-
266
- //=========================================================================
267
- // Initialization
268
- //=========================================================================
269
-
270
- console.log(\`[${this.pluginPrefix}] ${project.name} plugin loaded (v${project.version})\`);
271
-
272
- })();
130
+
131
+ hasTag(tag) {
132
+ return this.tags.includes(tag);
133
+ }
134
+
135
+ update(deltaTime) {
136
+ if (!this.active) return;
137
+ for (const component of this.components) {
138
+ if (component.update) {
139
+ component.update(deltaTime);
140
+ }
141
+ }
142
+ }
143
+
144
+ destroy() {
145
+ N2D.State.entities.delete(this.id);
146
+ }
147
+ };
148
+
149
+ //=========================================================================
150
+ // Scene Management
151
+ //=========================================================================
152
+
153
+ N2D.SceneManager = {
154
+ scenes: {},
155
+
156
+ registerScene(name, sceneData) {
157
+ this.scenes[name] = sceneData;
158
+ },
159
+
160
+ loadScene(name) {
161
+ const scene = this.scenes[name];
162
+ if (!scene) {
163
+ console.error(\`[N2D] Scene not found: \${name}\`);
164
+ return false;
165
+ }
166
+
167
+ // Clear current entities
168
+ N2D.State.entities.clear();
169
+ N2D.State.currentScene = name;
170
+
171
+ // Spawn scene entities
172
+ if (scene.entities) {
173
+ for (const entityDef of scene.entities) {
174
+ this.spawnEntity(entityDef);
175
+ }
176
+ }
177
+
178
+ console.log(\`[N2D] Loaded scene: \${name}\`);
179
+ return true;
180
+ },
181
+
182
+ spawnEntity(definition) {
183
+ const entity = new N2D.Entity(definition.id, definition.name);
184
+ entity.position = { ...definition.position };
185
+ entity.tags = [...(definition.tags || [])];
186
+
187
+ if (definition.components) {
188
+ for (const compDef of definition.components) {
189
+ entity.addComponent({ ...compDef });
190
+ }
191
+ }
192
+
193
+ N2D.State.entities.set(entity.id, entity);
194
+ return entity;
195
+ },
196
+ };
197
+
198
+ //=========================================================================
199
+ // Variable System
200
+ //=========================================================================
201
+
202
+ N2D.Variables = {
203
+ set(name, value) {
204
+ N2D.State.globalVariables.set(name, value);
205
+ },
206
+
207
+ get(name, defaultValue = null) {
208
+ return N2D.State.globalVariables.has(name)
209
+ ? N2D.State.globalVariables.get(name)
210
+ : defaultValue;
211
+ },
212
+
213
+ has(name) {
214
+ return N2D.State.globalVariables.has(name);
215
+ },
216
+
217
+ remove(name) {
218
+ N2D.State.globalVariables.delete(name);
219
+ },
220
+
221
+ clear() {
222
+ N2D.State.globalVariables.clear();
223
+ },
224
+ };
225
+
226
+ //=========================================================================
227
+ // Update Loop Integration
228
+ //=========================================================================
229
+
230
+ const _Scene_Map_update = Scene_Map.prototype.update;
231
+ Scene_Map.prototype.update = function() {
232
+ _Scene_Map_update.call(this);
233
+
234
+ if (!N2D.State.isPaused) {
235
+ const deltaTime = 1 / 60; // Approximate 60 FPS
236
+ for (const entity of N2D.State.entities.values()) {
237
+ entity.update(deltaTime);
238
+ }
239
+ }
240
+ };
241
+
242
+ //=========================================================================
243
+ // Plugin Commands
244
+ //=========================================================================
245
+
246
+ ${this.version === "MZ" ? this.getMZPluginCommands() : this.getMVPluginCommands()}
247
+
248
+ //=========================================================================
249
+ // Initialization
250
+ //=========================================================================
251
+
252
+ console.log(\`[${this.pluginPrefix}] ${project.name} plugin loaded (v${project.version})\`);
253
+
254
+ })();
273
255
  `;
274
- this.addTextFile(`js/plugins/${this.pluginPrefix}_${project.name.replace(/[^a-zA-Z0-9]/g, '')}.js`, plugin);
275
- }
276
- getMZPluginHeader() {
277
- return ` * @command loadScene
278
- * @text Load Scene
279
- * @desc Load a Nice2Dev scene by name
280
- *
281
- * @arg sceneName
282
- * @text Scene Name
283
- * @type string
284
- * @desc Name of the scene to load
285
- *
286
- * @command spawnEntity
287
- * @text Spawn Entity
288
- * @desc Spawn an entity from a prefab
289
- *
290
- * @arg prefabName
291
- * @text Prefab Name
292
- * @type string
293
- * @desc Name of the prefab to spawn
294
- *
295
- * @arg x
296
- * @text X Position
297
- * @type number
298
- * @default 0
299
- *
300
- * @arg y
301
- * @text Y Position
302
- * @type number
303
- * @default 0
304
- *
305
- * @command setVariable
306
- * @text Set Variable
307
- * @desc Set a Nice2Dev game variable
308
- *
309
- * @arg varName
310
- * @text Variable Name
311
- * @type string
312
- *
313
- * @arg value
314
- * @text Value
256
+ this.addTextFile(
257
+ `js/plugins/${this.pluginPrefix}_${project.name.replace(/[^a-zA-Z0-9]/g, "")}.js`,
258
+ plugin
259
+ );
260
+ }
261
+ getMZPluginHeader() {
262
+ return ` * @command loadScene
263
+ * @text Load Scene
264
+ * @desc Load a Nice2Dev scene by name
265
+ *
266
+ * @arg sceneName
267
+ * @text Scene Name
268
+ * @type string
269
+ * @desc Name of the scene to load
270
+ *
271
+ * @command spawnEntity
272
+ * @text Spawn Entity
273
+ * @desc Spawn an entity from a prefab
274
+ *
275
+ * @arg prefabName
276
+ * @text Prefab Name
277
+ * @type string
278
+ * @desc Name of the prefab to spawn
279
+ *
280
+ * @arg x
281
+ * @text X Position
282
+ * @type number
283
+ * @default 0
284
+ *
285
+ * @arg y
286
+ * @text Y Position
287
+ * @type number
288
+ * @default 0
289
+ *
290
+ * @command setVariable
291
+ * @text Set Variable
292
+ * @desc Set a Nice2Dev game variable
293
+ *
294
+ * @arg varName
295
+ * @text Variable Name
296
+ * @type string
297
+ *
298
+ * @arg value
299
+ * @text Value
315
300
  * @type string`;
316
- }
317
- getMVPluginHeader() {
318
- return ` * @param gameTitle
319
- * @text Game Title
320
- * @type string
321
- * @default ${this.pluginPrefix} Game
322
- *
323
- * @param debugMode
324
- * @text Debug Mode
325
- * @type boolean
301
+ }
302
+ getMVPluginHeader() {
303
+ return ` * @param gameTitle
304
+ * @text Game Title
305
+ * @type string
306
+ * @default ${this.pluginPrefix} Game
307
+ *
308
+ * @param debugMode
309
+ * @text Debug Mode
310
+ * @type boolean
326
311
  * @default false`;
327
- }
328
- getMZPluginCommands() {
329
- return ` PluginManager.registerCommand(pluginName, 'loadScene', args => {
330
- N2D.SceneManager.loadScene(args.sceneName);
331
- });
332
-
333
- PluginManager.registerCommand(pluginName, 'spawnEntity', args => {
334
- const prefab = N2D.Prefabs[args.prefabName];
335
- if (prefab) {
336
- const entity = N2D.SceneManager.spawnEntity({
337
- id: \`\${args.prefabName}_\${Date.now()}\`,
338
- name: args.prefabName,
339
- position: { x: Number(args.x), y: Number(args.y) },
340
- ...prefab,
341
- });
342
- }
343
- });
344
-
345
- PluginManager.registerCommand(pluginName, 'setVariable', args => {
346
- N2D.Variables.set(args.varName, args.value);
312
+ }
313
+ getMZPluginCommands() {
314
+ return ` PluginManager.registerCommand(pluginName, 'loadScene', args => {
315
+ N2D.SceneManager.loadScene(args.sceneName);
316
+ });
317
+
318
+ PluginManager.registerCommand(pluginName, 'spawnEntity', args => {
319
+ const prefab = N2D.Prefabs[args.prefabName];
320
+ if (prefab) {
321
+ const entity = N2D.SceneManager.spawnEntity({
322
+ id: \`\${args.prefabName}_\${Date.now()}\`,
323
+ name: args.prefabName,
324
+ position: { x: Number(args.x), y: Number(args.y) },
325
+ ...prefab,
326
+ });
327
+ }
328
+ });
329
+
330
+ PluginManager.registerCommand(pluginName, 'setVariable', args => {
331
+ N2D.Variables.set(args.varName, args.value);
347
332
  });`;
348
- }
349
- getMVPluginCommands() {
350
- return ` const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
351
- Game_Interpreter.prototype.pluginCommand = function(command, args) {
352
- _Game_Interpreter_pluginCommand.call(this, command, args);
353
-
354
- if (command === 'N2D_LoadScene') {
355
- N2D.SceneManager.loadScene(args[0]);
356
- }
357
- else if (command === 'N2D_SpawnEntity') {
358
- const prefab = N2D.Prefabs[args[0]];
359
- if (prefab) {
360
- N2D.SceneManager.spawnEntity({
361
- id: \`\${args[0]}_\${Date.now()}\`,
362
- name: args[0],
363
- position: { x: Number(args[1] || 0), y: Number(args[2] || 0) },
364
- ...prefab,
365
- });
366
- }
367
- }
368
- else if (command === 'N2D_SetVariable') {
369
- N2D.Variables.set(args[0], args[1]);
370
- }
371
- else if (command === 'N2D_GetVariable') {
372
- const value = N2D.Variables.get(args[0]);
373
- if (args[1]) {
374
- $gameVariables.setValue(Number(args[1]), value);
375
- }
376
- }
333
+ }
334
+ getMVPluginCommands() {
335
+ return ` const _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
336
+ Game_Interpreter.prototype.pluginCommand = function(command, args) {
337
+ _Game_Interpreter_pluginCommand.call(this, command, args);
338
+
339
+ if (command === 'N2D_LoadScene') {
340
+ N2D.SceneManager.loadScene(args[0]);
341
+ }
342
+ else if (command === 'N2D_SpawnEntity') {
343
+ const prefab = N2D.Prefabs[args[0]];
344
+ if (prefab) {
345
+ N2D.SceneManager.spawnEntity({
346
+ id: \`\${args[0]}_\${Date.now()}\`,
347
+ name: args[0],
348
+ position: { x: Number(args[1] || 0), y: Number(args[2] || 0) },
349
+ ...prefab,
350
+ });
351
+ }
352
+ }
353
+ else if (command === 'N2D_SetVariable') {
354
+ N2D.Variables.set(args[0], args[1]);
355
+ }
356
+ else if (command === 'N2D_GetVariable') {
357
+ const value = N2D.Variables.get(args[0]);
358
+ if (args[1]) {
359
+ $gameVariables.setValue(Number(args[1]), value);
360
+ }
361
+ }
377
362
  };`;
378
- }
379
- /* ── Utility Plugin ─────────────────────────────────────────── */
380
- async generateUtilityPlugin(_project, _options) {
381
- const utility = `/*:
382
- * @target ${this.version}
383
- * @plugindesc Nice2Dev Utility Functions
384
- * @author Nice2Dev Generator
385
- * @version 1.0.0
386
- *
387
- * @help
388
- * Utility functions for Nice2Dev exported games.
389
- */
390
-
391
- (() => {
392
- 'use strict';
393
-
394
- const N2D = window.N2D = window.N2D || {};
395
-
396
- //=========================================================================
397
- // Math Utilities
398
- //=========================================================================
399
-
400
- N2D.Math = {
401
- lerp(a, b, t) {
402
- return a + (b - a) * Math.max(0, Math.min(1, t));
403
- },
404
-
405
- clamp(value, min, max) {
406
- return Math.max(min, Math.min(max, value));
407
- },
408
-
409
- distance(x1, y1, x2, y2) {
410
- const dx = x2 - x1;
411
- const dy = y2 - y1;
412
- return Math.sqrt(dx * dx + dy * dy);
413
- },
414
-
415
- angle(x1, y1, x2, y2) {
416
- return Math.atan2(y2 - y1, x2 - x1);
417
- },
418
-
419
- randomRange(min, max) {
420
- return Math.random() * (max - min) + min;
421
- },
422
-
423
- randomInt(min, max) {
424
- return Math.floor(Math.random() * (max - min + 1)) + min;
425
- },
426
-
427
- degToRad(degrees) {
428
- return degrees * (Math.PI / 180);
429
- },
430
-
431
- radToDeg(radians) {
432
- return radians * (180 / Math.PI);
433
- },
434
- };
435
-
436
- //=========================================================================
437
- // Timer Utilities
438
- //=========================================================================
439
-
440
- N2D.Timer = {
441
- _timers: [],
442
- _nextId: 1,
443
-
444
- setTimeout(callback, frames) {
445
- const id = this._nextId++;
446
- this._timers.push({
447
- id,
448
- callback,
449
- frames,
450
- remaining: frames,
451
- repeat: false,
452
- });
453
- return id;
454
- },
455
-
456
- setInterval(callback, frames) {
457
- const id = this._nextId++;
458
- this._timers.push({
459
- id,
460
- callback,
461
- frames,
462
- remaining: frames,
463
- repeat: true,
464
- });
465
- return id;
466
- },
467
-
468
- clear(id) {
469
- const index = this._timers.findIndex(t => t.id === id);
470
- if (index !== -1) {
471
- this._timers.splice(index, 1);
472
- }
473
- },
474
-
475
- update() {
476
- for (let i = this._timers.length - 1; i >= 0; i--) {
477
- const timer = this._timers[i];
478
- timer.remaining--;
479
-
480
- if (timer.remaining <= 0) {
481
- timer.callback();
482
-
483
- if (timer.repeat) {
484
- timer.remaining = timer.frames;
485
- } else {
486
- this._timers.splice(i, 1);
487
- }
488
- }
489
- }
490
- },
491
- };
492
-
493
- // Update timers in scene
494
- const _Scene_Base_update = Scene_Base.prototype.update;
495
- Scene_Base.prototype.update = function() {
496
- _Scene_Base_update.call(this);
497
- N2D.Timer.update();
498
- };
499
-
500
- //=========================================================================
501
- // Tween System
502
- //=========================================================================
503
-
504
- N2D.Tween = {
505
- _tweens: [],
506
-
507
- create(target, properties, duration, easing = 'linear') {
508
- const tween = {
509
- target,
510
- properties: {},
511
- duration,
512
- elapsed: 0,
513
- easing: this.easings[easing] || this.easings.linear,
514
- };
515
-
516
- for (const [key, endValue] of Object.entries(properties)) {
517
- tween.properties[key] = {
518
- start: target[key],
519
- end: endValue,
520
- };
521
- }
522
-
523
- this._tweens.push(tween);
524
- return tween;
525
- },
526
-
527
- update() {
528
- for (let i = this._tweens.length - 1; i >= 0; i--) {
529
- const tween = this._tweens[i];
530
- tween.elapsed++;
531
-
532
- const t = Math.min(tween.elapsed / tween.duration, 1);
533
- const easedT = tween.easing(t);
534
-
535
- for (const [key, values] of Object.entries(tween.properties)) {
536
- tween.target[key] = N2D.Math.lerp(values.start, values.end, easedT);
537
- }
538
-
539
- if (t >= 1) {
540
- this._tweens.splice(i, 1);
541
- if (tween.onComplete) {
542
- tween.onComplete();
543
- }
544
- }
545
- }
546
- },
547
-
548
- easings: {
549
- linear: t => t,
550
- easeIn: t => t * t,
551
- easeOut: t => t * (2 - t),
552
- easeInOut: t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t,
553
- easeInCubic: t => t * t * t,
554
- easeOutCubic: t => (--t) * t * t + 1,
555
- easeInOutCubic: t => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,
556
- bounce: t => {
557
- const n1 = 7.5625;
558
- const d1 = 2.75;
559
- if (t < 1 / d1) return n1 * t * t;
560
- if (t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
561
- if (t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
562
- return n1 * (t -= 2.625 / d1) * t + 0.984375;
563
- },
564
- },
565
- };
566
-
567
- // Update tweens in scene
568
- const _Scene_Base_update2 = Scene_Base.prototype.update;
569
- Scene_Base.prototype.update = function() {
570
- _Scene_Base_update2.call(this);
571
- N2D.Tween.update();
572
- };
573
-
574
- //=========================================================================
575
- // Array Utilities
576
- //=========================================================================
577
-
578
- N2D.Array = {
579
- shuffle(array) {
580
- const result = [...array];
581
- for (let i = result.length - 1; i > 0; i--) {
582
- const j = Math.floor(Math.random() * (i + 1));
583
- [result[i], result[j]] = [result[j], result[i]];
584
- }
585
- return result;
586
- },
587
-
588
- pick(array) {
589
- return array[Math.floor(Math.random() * array.length)];
590
- },
591
-
592
- remove(array, item) {
593
- const index = array.indexOf(item);
594
- if (index !== -1) {
595
- array.splice(index, 1);
596
- }
597
- return array;
598
- },
599
- };
600
-
601
- console.log('[N2D] Utility plugin loaded');
602
-
603
- })();
363
+ }
364
+ /* ── Utility Plugin ─────────────────────────────────────────── */
365
+ async generateUtilityPlugin(_project, _options) {
366
+ const utility = `/*:
367
+ * @target ${this.version}
368
+ * @plugindesc Nice2Dev Utility Functions
369
+ * @author Nice2Dev Generator
370
+ * @version 1.0.0
371
+ *
372
+ * @help
373
+ * Utility functions for Nice2Dev exported games.
374
+ */
375
+
376
+ (() => {
377
+ 'use strict';
378
+
379
+ const N2D = window.N2D = window.N2D || {};
380
+
381
+ //=========================================================================
382
+ // Math Utilities
383
+ //=========================================================================
384
+
385
+ N2D.Math = {
386
+ lerp(a, b, t) {
387
+ return a + (b - a) * Math.max(0, Math.min(1, t));
388
+ },
389
+
390
+ clamp(value, min, max) {
391
+ return Math.max(min, Math.min(max, value));
392
+ },
393
+
394
+ distance(x1, y1, x2, y2) {
395
+ const dx = x2 - x1;
396
+ const dy = y2 - y1;
397
+ return Math.sqrt(dx * dx + dy * dy);
398
+ },
399
+
400
+ angle(x1, y1, x2, y2) {
401
+ return Math.atan2(y2 - y1, x2 - x1);
402
+ },
403
+
404
+ randomRange(min, max) {
405
+ return Math.random() * (max - min) + min;
406
+ },
407
+
408
+ randomInt(min, max) {
409
+ return Math.floor(Math.random() * (max - min + 1)) + min;
410
+ },
411
+
412
+ degToRad(degrees) {
413
+ return degrees * (Math.PI / 180);
414
+ },
415
+
416
+ radToDeg(radians) {
417
+ return radians * (180 / Math.PI);
418
+ },
419
+ };
420
+
421
+ //=========================================================================
422
+ // Timer Utilities
423
+ //=========================================================================
424
+
425
+ N2D.Timer = {
426
+ _timers: [],
427
+ _nextId: 1,
428
+
429
+ setTimeout(callback, frames) {
430
+ const id = this._nextId++;
431
+ this._timers.push({
432
+ id,
433
+ callback,
434
+ frames,
435
+ remaining: frames,
436
+ repeat: false,
437
+ });
438
+ return id;
439
+ },
440
+
441
+ setInterval(callback, frames) {
442
+ const id = this._nextId++;
443
+ this._timers.push({
444
+ id,
445
+ callback,
446
+ frames,
447
+ remaining: frames,
448
+ repeat: true,
449
+ });
450
+ return id;
451
+ },
452
+
453
+ clear(id) {
454
+ const index = this._timers.findIndex(t => t.id === id);
455
+ if (index !== -1) {
456
+ this._timers.splice(index, 1);
457
+ }
458
+ },
459
+
460
+ update() {
461
+ for (let i = this._timers.length - 1; i >= 0; i--) {
462
+ const timer = this._timers[i];
463
+ timer.remaining--;
464
+
465
+ if (timer.remaining <= 0) {
466
+ timer.callback();
467
+
468
+ if (timer.repeat) {
469
+ timer.remaining = timer.frames;
470
+ } else {
471
+ this._timers.splice(i, 1);
472
+ }
473
+ }
474
+ }
475
+ },
476
+ };
477
+
478
+ // Update timers in scene
479
+ const _Scene_Base_update = Scene_Base.prototype.update;
480
+ Scene_Base.prototype.update = function() {
481
+ _Scene_Base_update.call(this);
482
+ N2D.Timer.update();
483
+ };
484
+
485
+ //=========================================================================
486
+ // Tween System
487
+ //=========================================================================
488
+
489
+ N2D.Tween = {
490
+ _tweens: [],
491
+
492
+ create(target, properties, duration, easing = 'linear') {
493
+ const tween = {
494
+ target,
495
+ properties: {},
496
+ duration,
497
+ elapsed: 0,
498
+ easing: this.easings[easing] || this.easings.linear,
499
+ };
500
+
501
+ for (const [key, endValue] of Object.entries(properties)) {
502
+ tween.properties[key] = {
503
+ start: target[key],
504
+ end: endValue,
505
+ };
506
+ }
507
+
508
+ this._tweens.push(tween);
509
+ return tween;
510
+ },
511
+
512
+ update() {
513
+ for (let i = this._tweens.length - 1; i >= 0; i--) {
514
+ const tween = this._tweens[i];
515
+ tween.elapsed++;
516
+
517
+ const t = Math.min(tween.elapsed / tween.duration, 1);
518
+ const easedT = tween.easing(t);
519
+
520
+ for (const [key, values] of Object.entries(tween.properties)) {
521
+ tween.target[key] = N2D.Math.lerp(values.start, values.end, easedT);
522
+ }
523
+
524
+ if (t >= 1) {
525
+ this._tweens.splice(i, 1);
526
+ if (tween.onComplete) {
527
+ tween.onComplete();
528
+ }
529
+ }
530
+ }
531
+ },
532
+
533
+ easings: {
534
+ linear: t => t,
535
+ easeIn: t => t * t,
536
+ easeOut: t => t * (2 - t),
537
+ easeInOut: t => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t,
538
+ easeInCubic: t => t * t * t,
539
+ easeOutCubic: t => (--t) * t * t + 1,
540
+ easeInOutCubic: t => t < 0.5 ? 4 * t * t * t : (t - 1) * (2 * t - 2) * (2 * t - 2) + 1,
541
+ bounce: t => {
542
+ const n1 = 7.5625;
543
+ const d1 = 2.75;
544
+ if (t < 1 / d1) return n1 * t * t;
545
+ if (t < 2 / d1) return n1 * (t -= 1.5 / d1) * t + 0.75;
546
+ if (t < 2.5 / d1) return n1 * (t -= 2.25 / d1) * t + 0.9375;
547
+ return n1 * (t -= 2.625 / d1) * t + 0.984375;
548
+ },
549
+ },
550
+ };
551
+
552
+ // Update tweens in scene
553
+ const _Scene_Base_update2 = Scene_Base.prototype.update;
554
+ Scene_Base.prototype.update = function() {
555
+ _Scene_Base_update2.call(this);
556
+ N2D.Tween.update();
557
+ };
558
+
559
+ //=========================================================================
560
+ // Array Utilities
561
+ //=========================================================================
562
+
563
+ N2D.Array = {
564
+ shuffle(array) {
565
+ const result = [...array];
566
+ for (let i = result.length - 1; i > 0; i--) {
567
+ const j = Math.floor(Math.random() * (i + 1));
568
+ [result[i], result[j]] = [result[j], result[i]];
569
+ }
570
+ return result;
571
+ },
572
+
573
+ pick(array) {
574
+ return array[Math.floor(Math.random() * array.length)];
575
+ },
576
+
577
+ remove(array, item) {
578
+ const index = array.indexOf(item);
579
+ if (index !== -1) {
580
+ array.splice(index, 1);
581
+ }
582
+ return array;
583
+ },
584
+ };
585
+
586
+ console.log('[N2D] Utility plugin loaded');
587
+
588
+ })();
604
589
  `;
605
- this.addTextFile(`js/plugins/${this.pluginPrefix}_Utility.js`, utility);
590
+ this.addTextFile(`js/plugins/${this.pluginPrefix}_Utility.js`, utility);
591
+ }
592
+ /* ── Scene Export ───────────────────────────────────────────── */
593
+ async exportScene(scene, project, options) {
594
+ const platformOpts = options.platformOptions ?? {};
595
+ const mapWidth = platformOpts.defaultMapWidth ?? 20;
596
+ const mapHeight = platformOpts.defaultMapHeight ?? 15;
597
+ const map = {
598
+ autoplayBgm: false,
599
+ autoplayBgs: false,
600
+ battleback1Name: "",
601
+ battleback2Name: "",
602
+ bgm: { name: "", pan: 0, pitch: 100, volume: 90 },
603
+ bgs: { name: "", pan: 0, pitch: 100, volume: 90 },
604
+ disableDashing: false,
605
+ displayName: scene.name,
606
+ encounterList: [],
607
+ encounterStep: 30,
608
+ height: mapHeight,
609
+ note: `<N2D_Scene:${scene.name}>`,
610
+ parallaxLoopX: false,
611
+ parallaxLoopY: false,
612
+ parallaxName: "",
613
+ parallaxShow: true,
614
+ parallaxSx: 0,
615
+ parallaxSy: 0,
616
+ scrollType: 0,
617
+ specifyBattleback: false,
618
+ tilesetId: 1,
619
+ width: mapWidth,
620
+ data: new Array(mapWidth * mapHeight * 6).fill(0),
621
+ events: [null]
622
+ // First element is always null
623
+ };
624
+ for (const entity of scene.entities) {
625
+ const event = this.entityToEvent(entity, map.events.length);
626
+ if (event) {
627
+ map.events.push(event);
628
+ }
606
629
  }
607
- /* ── Scene Export ───────────────────────────────────────────── */
608
- async exportScene(scene, project, options) {
609
- const platformOpts = options.platformOptions ?? {};
610
- const mapWidth = platformOpts.defaultMapWidth ?? 20;
611
- const mapHeight = platformOpts.defaultMapHeight ?? 15;
612
- // Create map data
613
- const map = {
614
- autoplayBgm: false,
615
- autoplayBgs: false,
616
- battleback1Name: '',
617
- battleback2Name: '',
618
- bgm: { name: '', pan: 0, pitch: 100, volume: 90 },
619
- bgs: { name: '', pan: 0, pitch: 100, volume: 90 },
620
- disableDashing: false,
621
- displayName: scene.name,
622
- encounterList: [],
623
- encounterStep: 30,
624
- height: mapHeight,
625
- note: `<N2D_Scene:${scene.name}>`,
626
- parallaxLoopX: false,
627
- parallaxLoopY: false,
628
- parallaxName: '',
629
- parallaxShow: true,
630
- parallaxSx: 0,
631
- parallaxSy: 0,
632
- scrollType: 0,
633
- specifyBattleback: false,
634
- tilesetId: 1,
635
- width: mapWidth,
636
- data: new Array(mapWidth * mapHeight * 6).fill(0),
637
- events: [null], // First element is always null
638
- };
639
- // Convert entities to events
640
- for (const entity of scene.entities) {
641
- const event = this.entityToEvent(entity, map.events.length);
642
- if (event) {
643
- map.events.push(event);
644
- }
630
+ const sceneScript = `// Scene: ${scene.name}
631
+ // Generated from Nice2Dev
632
+
633
+ (() => {
634
+ const N2D = window.N2D;
635
+ if (!N2D) return;
636
+
637
+ N2D.SceneManager.registerScene('${scene.name}', {
638
+ name: '${scene.name}',
639
+ entities: [
640
+ ${scene.entities.map(
641
+ (e) => ` {
642
+ id: '${e.id}',
643
+ name: '${e.name ?? e.id}',
644
+ position: { x: ${e.position?.x ?? 0}, y: ${e.position?.y ?? 0} },
645
+ tags: [${(e.tags ?? []).map((t) => `'${t}'`).join(", ")}],
646
+ components: [${e.components.map((c) => `{ type: '${c.type}', properties: ${JSON.stringify(c.properties ?? {})} }`).join(", ")}],
647
+ }`
648
+ ).join(",\n")}
649
+ ],
650
+ });
651
+
652
+ console.log('[N2D] Scene registered: ${scene.name}');
653
+ })();
654
+ `;
655
+ this.addTextFile(
656
+ `js/plugins/${this.pluginPrefix}_Scene_${scene.name.replace(/[^a-zA-Z0-9]/g, "")}.js`,
657
+ sceneScript
658
+ );
659
+ const mapId = Math.abs(this.hashCode(scene.name)) % 999 + 1;
660
+ const mapIdStr = mapId.toString().padStart(3, "0");
661
+ this.addTextFile(`data/Map${mapIdStr}.json`, JSON.stringify(map, null, 2));
662
+ }
663
+ entityToEvent(entity, eventId) {
664
+ const pos = entity.position ?? { x: 0, y: 0 };
665
+ const tileX = Math.floor(pos.x / this.tileSize);
666
+ const tileY = Math.floor(pos.y / this.tileSize);
667
+ const event = {
668
+ id: eventId,
669
+ name: entity.name ?? entity.id,
670
+ note: `<N2D_Entity:${entity.id}>`,
671
+ pages: [
672
+ {
673
+ conditions: {
674
+ actorId: 1,
675
+ actorValid: false,
676
+ itemId: 1,
677
+ itemValid: false,
678
+ selfSwitchCh: "A",
679
+ selfSwitchValid: false,
680
+ switch1Id: 1,
681
+ switch1Valid: false,
682
+ switch2Id: 1,
683
+ switch2Valid: false,
684
+ variableId: 1,
685
+ variableValid: false,
686
+ variableValue: 0
687
+ },
688
+ directionFix: false,
689
+ image: {
690
+ characterIndex: 0,
691
+ characterName: "",
692
+ direction: 2,
693
+ pattern: 0,
694
+ tileId: 0
695
+ },
696
+ list: this.generateEventCommands(entity),
697
+ moveFrequency: 3,
698
+ moveRoute: { list: [{ code: 0 }], repeat: true, skippable: false, wait: false },
699
+ moveSpeed: 3,
700
+ moveType: 0,
701
+ priorityType: 1,
702
+ stepAnime: false,
703
+ through: false,
704
+ trigger: 0,
705
+ // Action button
706
+ walkAnime: true
645
707
  }
646
- // Generate scene registration script
647
- const sceneScript = `// Scene: ${scene.name}
648
- // Generated from Nice2Dev
649
-
650
- (() => {
651
- const N2D = window.N2D;
652
- if (!N2D) return;
653
-
654
- N2D.SceneManager.registerScene('${scene.name}', {
655
- name: '${scene.name}',
656
- entities: [
657
- ${scene.entities
658
- .map((e) => ` {
659
- id: '${e.id}',
660
- name: '${e.name ?? e.id}',
661
- position: { x: ${e.position?.x ?? 0}, y: ${e.position?.y ?? 0} },
662
- tags: [${(e.tags ?? []).map((t) => `'${t}'`).join(', ')}],
663
- components: [${e.components.map((c) => `{ type: '${c.type}', properties: ${JSON.stringify(c.properties ?? {})} }`).join(', ')}],
664
- }`)
665
- .join(',\n')}
666
- ],
667
- });
668
-
669
- console.log('[N2D] Scene registered: ${scene.name}');
670
- })();
708
+ ],
709
+ x: tileX,
710
+ y: tileY
711
+ };
712
+ return event;
713
+ }
714
+ generateEventCommands(entity) {
715
+ const commands = [];
716
+ commands.push({
717
+ code: EventCode.COMMENT,
718
+ indent: 0,
719
+ parameters: [`Nice2Dev Entity: ${entity.name ?? entity.id}`]
720
+ });
721
+ commands.push({
722
+ code: EventCode.SCRIPT,
723
+ indent: 0,
724
+ parameters: [`const entity = N2D.State.entities.get('${entity.id}');`]
725
+ });
726
+ commands.push({
727
+ code: EventCode.SCRIPT_DATA,
728
+ indent: 0,
729
+ parameters: [`if (entity) { /* Custom behavior */ }`]
730
+ });
731
+ commands.push({ code: EventCode.END, indent: 0, parameters: [] });
732
+ return commands;
733
+ }
734
+ /* ── Prefab Export ──────────────────────────────────────────── */
735
+ async exportPrefab(prefab, _options) {
736
+ const safeName = prefab.name.replace(/[^a-zA-Z0-9]/g, "");
737
+ const prefabScript = `// Prefab: ${prefab.name}
738
+ // Generated from Nice2Dev
739
+
740
+ (() => {
741
+ const N2D = window.N2D;
742
+ if (!N2D) return;
743
+
744
+ N2D.Prefabs = N2D.Prefabs || {};
745
+
746
+ N2D.Prefabs['${prefab.name}'] = {
747
+ name: '${prefab.entity.name ?? prefab.name}',
748
+ components: [
749
+ ${prefab.entity.components.map((c) => ` { type: '${c.type}', properties: ${JSON.stringify(c.properties ?? {})} },`).join("\n")}
750
+ ],
751
+ tags: [${(prefab.entity.tags ?? []).map((t) => `'${t}'`).join(", ")}],
752
+ };
753
+
754
+ console.log('[N2D] Prefab registered: ${prefab.name}');
755
+ })();
671
756
  `;
672
- this.addTextFile(`js/plugins/${this.pluginPrefix}_Scene_${scene.name.replace(/[^a-zA-Z0-9]/g, '')}.js`, sceneScript);
673
- // Map file would need map ID - using scene name hash
674
- const mapId = (Math.abs(this.hashCode(scene.name)) % 999) + 1;
675
- const mapIdStr = mapId.toString().padStart(3, '0');
676
- this.addTextFile(`data/Map${mapIdStr}.json`, JSON.stringify(map, null, 2));
677
- }
678
- entityToEvent(entity, eventId) {
679
- const pos = entity.position ?? { x: 0, y: 0 };
680
- const tileX = Math.floor(pos.x / this.tileSize);
681
- const tileY = Math.floor(pos.y / this.tileSize);
682
- const event = {
683
- id: eventId,
684
- name: entity.name ?? entity.id,
685
- note: `<N2D_Entity:${entity.id}>`,
686
- pages: [
687
- {
688
- conditions: {
689
- actorId: 1,
690
- actorValid: false,
691
- itemId: 1,
692
- itemValid: false,
693
- selfSwitchCh: 'A',
694
- selfSwitchValid: false,
695
- switch1Id: 1,
696
- switch1Valid: false,
697
- switch2Id: 1,
698
- switch2Valid: false,
699
- variableId: 1,
700
- variableValid: false,
701
- variableValue: 0,
702
- },
703
- directionFix: false,
704
- image: {
705
- characterIndex: 0,
706
- characterName: '',
707
- direction: 2,
708
- pattern: 0,
709
- tileId: 0,
710
- },
711
- list: this.generateEventCommands(entity),
712
- moveFrequency: 3,
713
- moveRoute: { list: [{ code: 0 }], repeat: true, skippable: false, wait: false },
714
- moveSpeed: 3,
715
- moveType: 0,
716
- priorityType: 1,
717
- stepAnime: false,
718
- through: false,
719
- trigger: 0, // Action button
720
- walkAnime: true,
721
- },
722
- ],
723
- x: tileX,
724
- y: tileY,
725
- };
726
- return event;
727
- }
728
- generateEventCommands(entity) {
729
- const commands = [];
730
- // Add a comment with entity info
731
- commands.push({
732
- code: EventCode.COMMENT,
733
- indent: 0,
734
- parameters: [`Nice2Dev Entity: ${entity.name ?? entity.id}`],
735
- });
736
- // Add script call for custom entity behavior
737
- commands.push({
757
+ this.addTextFile(`js/plugins/${this.pluginPrefix}_Prefab_${safeName}.js`, prefabScript);
758
+ }
759
+ /* ── Common Events ──────────────────────────────────────────── */
760
+ async generateCommonEvents(_project, _options) {
761
+ const commonEvents = [
762
+ null,
763
+ // Index 0 is always null
764
+ {
765
+ id: 1,
766
+ name: "N2D_GameInit",
767
+ switchId: 0,
768
+ trigger: 0,
769
+ list: [
770
+ { code: EventCode.COMMENT, indent: 0, parameters: ["Nice2Dev Game Initialization"] },
771
+ {
738
772
  code: EventCode.SCRIPT,
739
773
  indent: 0,
740
- parameters: [`const entity = N2D.State.entities.get('${entity.id}');`],
741
- });
742
- commands.push({
743
- code: EventCode.SCRIPT_DATA,
744
- indent: 0,
745
- parameters: [`if (entity) { /* Custom behavior */ }`],
746
- });
747
- // End
748
- commands.push({ code: EventCode.END, indent: 0, parameters: [] });
749
- return commands;
750
- }
751
- /* ── Prefab Export ──────────────────────────────────────────── */
752
- async exportPrefab(prefab, _options) {
753
- const safeName = prefab.name.replace(/[^a-zA-Z0-9]/g, '');
754
- // Generate prefab registration script
755
- const prefabScript = `// Prefab: ${prefab.name}
756
- // Generated from Nice2Dev
757
-
758
- (() => {
759
- const N2D = window.N2D;
760
- if (!N2D) return;
761
-
762
- N2D.Prefabs = N2D.Prefabs || {};
763
-
764
- N2D.Prefabs['${prefab.name}'] = {
765
- name: '${prefab.entity.name ?? prefab.name}',
766
- components: [
767
- ${prefab.entity.components.map((c) => ` { type: '${c.type}', properties: ${JSON.stringify(c.properties ?? {})} },`).join('\n')}
768
- ],
769
- tags: [${(prefab.entity.tags ?? []).map((t) => `'${t}'`).join(', ')}],
770
- };
771
-
772
- console.log('[N2D] Prefab registered: ${prefab.name}');
773
- })();
774
- `;
775
- this.addTextFile(`js/plugins/${this.pluginPrefix}_Prefab_${safeName}.js`, prefabScript);
774
+ parameters: ['console.log("[N2D] Game initialized");']
775
+ },
776
+ { code: EventCode.END, indent: 0, parameters: [] }
777
+ ]
778
+ },
779
+ {
780
+ id: 2,
781
+ name: "N2D_GameUpdate",
782
+ switchId: 0,
783
+ trigger: 0,
784
+ list: [
785
+ { code: EventCode.COMMENT, indent: 0, parameters: ["Nice2Dev Game Update Loop"] },
786
+ { code: EventCode.SCRIPT, indent: 0, parameters: ["// Called by parallel process"] },
787
+ { code: EventCode.END, indent: 0, parameters: [] }
788
+ ]
789
+ }
790
+ ];
791
+ this.addTextFile("data/CommonEvents.json", JSON.stringify(commonEvents, null, 2));
792
+ }
793
+ /* ── Data Files ─────────────────────────────────────────────── */
794
+ async generateDataFiles(project, _options) {
795
+ ({
796
+ gameTitle: project.name
797
+ });
798
+ this.addTextFile(
799
+ "data/System.json.stub.txt",
800
+ `// System.json should be configured in RPG Maker editor
801
+ // Game Title: ${project.name}`
802
+ );
803
+ const plugins = [
804
+ { name: `${this.pluginPrefix}_Utility`, status: true, parameters: {} },
805
+ {
806
+ name: `${this.pluginPrefix}_${project.name.replace(/[^a-zA-Z0-9]/g, "")}`,
807
+ status: true,
808
+ parameters: {}
809
+ }
810
+ ];
811
+ for (const scene of project.scenes) {
812
+ plugins.push({
813
+ name: `${this.pluginPrefix}_Scene_${scene.name.replace(/[^a-zA-Z0-9]/g, "")}`,
814
+ status: true,
815
+ parameters: {}
816
+ });
776
817
  }
777
- /* ── Common Events ──────────────────────────────────────────── */
778
- async generateCommonEvents(_project, _options) {
779
- const commonEvents = [
780
- null, // Index 0 is always null
781
- {
782
- id: 1,
783
- name: 'N2D_GameInit',
784
- switchId: 0,
785
- trigger: 0,
786
- list: [
787
- { code: EventCode.COMMENT, indent: 0, parameters: ['Nice2Dev Game Initialization'] },
788
- {
789
- code: EventCode.SCRIPT,
790
- indent: 0,
791
- parameters: ['console.log("[N2D] Game initialized");'],
792
- },
793
- { code: EventCode.END, indent: 0, parameters: [] },
794
- ],
795
- },
796
- {
797
- id: 2,
798
- name: 'N2D_GameUpdate',
799
- switchId: 0,
800
- trigger: 0,
801
- list: [
802
- { code: EventCode.COMMENT, indent: 0, parameters: ['Nice2Dev Game Update Loop'] },
803
- { code: EventCode.SCRIPT, indent: 0, parameters: ['// Called by parallel process'] },
804
- { code: EventCode.END, indent: 0, parameters: [] },
805
- ],
806
- },
807
- ];
808
- this.addTextFile('data/CommonEvents.json', JSON.stringify(commonEvents, null, 2));
818
+ for (const prefab of project.prefabs) {
819
+ plugins.push({
820
+ name: `${this.pluginPrefix}_Prefab_${prefab.name.replace(/[^a-zA-Z0-9]/g, "")}`,
821
+ status: true,
822
+ parameters: {}
823
+ });
809
824
  }
810
- /* ── Data Files ─────────────────────────────────────────────── */
811
- async generateDataFiles(project, _options) {
812
- // System.json stub
813
- ({
814
- gameTitle: project.name});
815
- this.addTextFile('data/System.json.stub.txt', `// System.json should be configured in RPG Maker editor\n// Game Title: ${project.name}`);
816
- // Plugins.json for plugin loading order
817
- const plugins = [
818
- { name: `${this.pluginPrefix}_Utility`, status: true, parameters: {} },
819
- {
820
- name: `${this.pluginPrefix}_${project.name.replace(/[^a-zA-Z0-9]/g, '')}`,
821
- status: true,
822
- parameters: {},
823
- },
824
- ];
825
- // Add scene plugins
826
- for (const scene of project.scenes) {
827
- plugins.push({
828
- name: `${this.pluginPrefix}_Scene_${scene.name.replace(/[^a-zA-Z0-9]/g, '')}`,
829
- status: true,
830
- parameters: {},
831
- });
832
- }
833
- // Add prefab plugins
834
- for (const prefab of project.prefabs) {
835
- plugins.push({
836
- name: `${this.pluginPrefix}_Prefab_${prefab.name.replace(/[^a-zA-Z0-9]/g, '')}`,
837
- status: true,
838
- parameters: {},
839
- });
840
- }
841
- this.addTextFile('js/plugins.js', `var $plugins = ${JSON.stringify(plugins, null, 2)};`);
842
- // README
843
- const readme = `# ${project.name} - RPG Maker ${this.version} Export
844
-
845
- Generated from Nice2Dev project v${project.version}
846
-
847
- ## Installation
848
-
849
- 1. Create a new RPG Maker ${this.version} project
850
- 2. Copy the contents of \`js/plugins/\` to your project's \`js/plugins/\` folder
851
- 3. Copy \`js/plugins.js\` (or merge with existing)
852
- 4. Copy map files from \`data/\` to your project's \`data/\` folder
853
- 5. Enable plugins in Plugin Manager
854
-
855
- ## Plugin Order
856
-
857
- Ensure plugins are loaded in this order:
858
- ${plugins.map((p, i) => `${i + 1}. ${p.name}`).join('\n')}
859
-
860
- ## Usage
861
-
862
- Use plugin commands to control Nice2Dev features:
863
-
864
- ### MZ Commands (Plugin Command)
865
- - **Load Scene**: Load a Nice2Dev scene by name
866
- - **Spawn Entity**: Spawn an entity from a prefab
867
- - **Set Variable**: Set a game variable
868
-
869
- ### MV Commands (Script Call)
870
- \`\`\`
871
- N2D_LoadScene <sceneName>
872
- N2D_SpawnEntity <prefabName> <x> <y>
873
- N2D_SetVariable <name> <value>
874
- \`\`\`
875
-
876
- ## Scenes
877
-
878
- ${project.scenes.map((s) => `- ${s.name} (${s.entities.length} entities)`).join('\n')}
879
-
880
- ## Prefabs
881
-
882
- ${project.prefabs.map((p) => `- ${p.name}`).join('\n') || 'None'}
825
+ this.addTextFile("js/plugins.js", `var $plugins = ${JSON.stringify(plugins, null, 2)};`);
826
+ const readme = `# ${project.name} - RPG Maker ${this.version} Export
827
+
828
+ Generated from Nice2Dev project v${project.version}
829
+
830
+ ## Installation
831
+
832
+ 1. Create a new RPG Maker ${this.version} project
833
+ 2. Copy the contents of \`js/plugins/\` to your project's \`js/plugins/\` folder
834
+ 3. Copy \`js/plugins.js\` (or merge with existing)
835
+ 4. Copy map files from \`data/\` to your project's \`data/\` folder
836
+ 5. Enable plugins in Plugin Manager
837
+
838
+ ## Plugin Order
839
+
840
+ Ensure plugins are loaded in this order:
841
+ ${plugins.map((p, i) => `${i + 1}. ${p.name}`).join("\n")}
842
+
843
+ ## Usage
844
+
845
+ Use plugin commands to control Nice2Dev features:
846
+
847
+ ### MZ Commands (Plugin Command)
848
+ - **Load Scene**: Load a Nice2Dev scene by name
849
+ - **Spawn Entity**: Spawn an entity from a prefab
850
+ - **Set Variable**: Set a game variable
851
+
852
+ ### MV Commands (Script Call)
853
+ \`\`\`
854
+ N2D_LoadScene <sceneName>
855
+ N2D_SpawnEntity <prefabName> <x> <y>
856
+ N2D_SetVariable <name> <value>
857
+ \`\`\`
858
+
859
+ ## Scenes
860
+
861
+ ${project.scenes.map((s) => `- ${s.name} (${s.entities.length} entities)`).join("\n")}
862
+
863
+ ## Prefabs
864
+
865
+ ${project.prefabs.map((p) => `- ${p.name}`).join("\n") || "None"}
883
866
  `;
884
- this.addTextFile('README.md', readme);
885
- }
886
- /* ── Helpers ────────────────────────────────────────────────── */
887
- hashCode(str) {
888
- let hash = 0;
889
- for (let i = 0; i < str.length; i++) {
890
- const char = str.charCodeAt(i);
891
- hash = (hash << 5) - hash + char;
892
- hash = hash & hash;
893
- }
894
- return hash;
867
+ this.addTextFile("README.md", readme);
868
+ }
869
+ /* ── Helpers ────────────────────────────────────────────────── */
870
+ hashCode(str) {
871
+ let hash = 0;
872
+ for (let i = 0; i < str.length; i++) {
873
+ const char = str.charCodeAt(i);
874
+ hash = (hash << 5) - hash + char;
875
+ hash = hash & hash;
895
876
  }
877
+ return hash;
878
+ }
896
879
  }
897
- /* ── Factory ──────────────────────────────────────────────────── */
898
880
  function createRPGMakerExporter() {
899
- return new RPGMakerExporter();
881
+ return new RPGMakerExporter();
900
882
  }
901
-
902
- export { RPGMakerExporter, createRPGMakerExporter };
883
+ export {
884
+ RPGMakerExporter,
885
+ createRPGMakerExporter
886
+ };