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