@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,963 +1,933 @@
1
- 'use strict';
2
-
3
- var PlatformExporter = require('./PlatformExporter.js');
4
-
5
- /* ────────────────────────────────────────────────────────────────
6
- Unreal Exporter — Unreal Engine Project Export
7
-
8
- Exports Nice2Dev projects to Unreal Engine format including:
9
- - C++ header and source files
10
- - Blueprint-compatible UFUNCTION/UPROPERTY macros
11
- - Level files (.umap concepts)
12
- - Data assets and data tables
13
- ──────────────────────────────────────────────────────────────── */
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const PlatformExporter = require("./PlatformExporter.js");
14
4
  const COMPONENT_MAPPINGS = {
15
- sprite: {
16
- unrealClass: 'UPaperSpriteComponent',
17
- header: 'PaperSpriteComponent.h',
18
- properties: new Map([
19
- ['texture', 'SourceSprite'],
20
- ['color', 'SpriteColor'],
21
- ]),
22
- },
23
- transform: {
24
- unrealClass: 'USceneComponent',
25
- header: 'Components/SceneComponent.h',
26
- properties: new Map([
27
- ['position', 'RelativeLocation'],
28
- ['rotation', 'RelativeRotation'],
29
- ['scale', 'RelativeScale3D'],
30
- ]),
31
- },
32
- rigidbody: {
33
- unrealClass: 'UPhysicsComponent',
34
- header: 'PhysicsEngine/BodyInstance.h',
35
- properties: new Map([
36
- ['mass', 'MassInKg'],
37
- ['linearDamping', 'LinearDamping'],
38
- ['angularDamping', 'AngularDamping'],
39
- ['useGravity', 'bEnableGravity'],
40
- ]),
41
- },
42
- boxCollider: {
43
- unrealClass: 'UBoxComponent',
44
- header: 'Components/BoxComponent.h',
45
- properties: new Map([
46
- ['size', 'BoxExtent'],
47
- ['isTrigger', 'bGenerateOverlapEvents'],
48
- ]),
49
- },
50
- sphereCollider: {
51
- unrealClass: 'USphereComponent',
52
- header: 'Components/SphereComponent.h',
53
- properties: new Map([
54
- ['radius', 'SphereRadius'],
55
- ['isTrigger', 'bGenerateOverlapEvents'],
56
- ]),
57
- },
58
- capsuleCollider: {
59
- unrealClass: 'UCapsuleComponent',
60
- header: 'Components/CapsuleComponent.h',
61
- properties: new Map([
62
- ['radius', 'CapsuleRadius'],
63
- ['height', 'CapsuleHalfHeight'],
64
- ]),
65
- },
66
- audioSource: {
67
- unrealClass: 'UAudioComponent',
68
- header: 'Components/AudioComponent.h',
69
- properties: new Map([
70
- ['clip', 'Sound'],
71
- ['volume', 'VolumeMultiplier'],
72
- ['pitch', 'PitchMultiplier'],
73
- ['loop', 'bIsLooping'],
74
- ]),
75
- },
76
- camera: {
77
- unrealClass: 'UCameraComponent',
78
- header: 'Camera/CameraComponent.h',
79
- properties: new Map([
80
- ['fov', 'FieldOfView'],
81
- ['nearClip', 'OrthoNearClipPlane'],
82
- ['farClip', 'OrthoFarClipPlane'],
83
- ]),
84
- },
85
- light: {
86
- unrealClass: 'UPointLightComponent',
87
- header: 'Components/PointLightComponent.h',
88
- properties: new Map([
89
- ['color', 'LightColor'],
90
- ['intensity', 'Intensity'],
91
- ['range', 'AttenuationRadius'],
92
- ]),
93
- },
94
- characterMovement: {
95
- unrealClass: 'UCharacterMovementComponent',
96
- header: 'GameFramework/CharacterMovementComponent.h',
97
- properties: new Map([
98
- ['maxSpeed', 'MaxWalkSpeed'],
99
- ['jumpHeight', 'JumpZVelocity'],
100
- ['gravity', 'GravityScale'],
101
- ]),
102
- },
103
- particleSystem: {
104
- unrealClass: 'UNiagaraComponent',
105
- header: 'NiagaraComponent.h',
106
- properties: new Map([
107
- ['asset', 'Asset'],
108
- ['autoActivate', 'bAutoActivate'],
109
- ]),
110
- },
5
+ sprite: {
6
+ unrealClass: "UPaperSpriteComponent",
7
+ header: "PaperSpriteComponent.h",
8
+ properties: /* @__PURE__ */ new Map([
9
+ ["texture", "SourceSprite"],
10
+ ["color", "SpriteColor"]
11
+ ])
12
+ },
13
+ transform: {
14
+ unrealClass: "USceneComponent",
15
+ header: "Components/SceneComponent.h",
16
+ properties: /* @__PURE__ */ new Map([
17
+ ["position", "RelativeLocation"],
18
+ ["rotation", "RelativeRotation"],
19
+ ["scale", "RelativeScale3D"]
20
+ ])
21
+ },
22
+ rigidbody: {
23
+ unrealClass: "UPhysicsComponent",
24
+ header: "PhysicsEngine/BodyInstance.h",
25
+ properties: /* @__PURE__ */ new Map([
26
+ ["mass", "MassInKg"],
27
+ ["linearDamping", "LinearDamping"],
28
+ ["angularDamping", "AngularDamping"],
29
+ ["useGravity", "bEnableGravity"]
30
+ ])
31
+ },
32
+ boxCollider: {
33
+ unrealClass: "UBoxComponent",
34
+ header: "Components/BoxComponent.h",
35
+ properties: /* @__PURE__ */ new Map([
36
+ ["size", "BoxExtent"],
37
+ ["isTrigger", "bGenerateOverlapEvents"]
38
+ ])
39
+ },
40
+ sphereCollider: {
41
+ unrealClass: "USphereComponent",
42
+ header: "Components/SphereComponent.h",
43
+ properties: /* @__PURE__ */ new Map([
44
+ ["radius", "SphereRadius"],
45
+ ["isTrigger", "bGenerateOverlapEvents"]
46
+ ])
47
+ },
48
+ capsuleCollider: {
49
+ unrealClass: "UCapsuleComponent",
50
+ header: "Components/CapsuleComponent.h",
51
+ properties: /* @__PURE__ */ new Map([
52
+ ["radius", "CapsuleRadius"],
53
+ ["height", "CapsuleHalfHeight"]
54
+ ])
55
+ },
56
+ audioSource: {
57
+ unrealClass: "UAudioComponent",
58
+ header: "Components/AudioComponent.h",
59
+ properties: /* @__PURE__ */ new Map([
60
+ ["clip", "Sound"],
61
+ ["volume", "VolumeMultiplier"],
62
+ ["pitch", "PitchMultiplier"],
63
+ ["loop", "bIsLooping"]
64
+ ])
65
+ },
66
+ camera: {
67
+ unrealClass: "UCameraComponent",
68
+ header: "Camera/CameraComponent.h",
69
+ properties: /* @__PURE__ */ new Map([
70
+ ["fov", "FieldOfView"],
71
+ ["nearClip", "OrthoNearClipPlane"],
72
+ ["farClip", "OrthoFarClipPlane"]
73
+ ])
74
+ },
75
+ light: {
76
+ unrealClass: "UPointLightComponent",
77
+ header: "Components/PointLightComponent.h",
78
+ properties: /* @__PURE__ */ new Map([
79
+ ["color", "LightColor"],
80
+ ["intensity", "Intensity"],
81
+ ["range", "AttenuationRadius"]
82
+ ])
83
+ },
84
+ characterMovement: {
85
+ unrealClass: "UCharacterMovementComponent",
86
+ header: "GameFramework/CharacterMovementComponent.h",
87
+ properties: /* @__PURE__ */ new Map([
88
+ ["maxSpeed", "MaxWalkSpeed"],
89
+ ["jumpHeight", "JumpZVelocity"],
90
+ ["gravity", "GravityScale"]
91
+ ])
92
+ },
93
+ particleSystem: {
94
+ unrealClass: "UNiagaraComponent",
95
+ header: "NiagaraComponent.h",
96
+ properties: /* @__PURE__ */ new Map([
97
+ ["asset", "Asset"],
98
+ ["autoActivate", "bAutoActivate"]
99
+ ])
100
+ }
111
101
  };
112
102
  function mapNiceValueToUnreal(type, value) {
113
- switch (type) {
114
- case 'vector2': {
115
- const v2 = value;
116
- return `FVector2D(${v2.x}f, ${v2.y}f)`;
117
- }
118
- case 'vector3': {
119
- const v3 = value;
120
- return `FVector(${v3.x}f, ${v3.y}f, ${v3.z ?? 0}f)`;
121
- }
122
- case 'color':
123
- if (typeof value === 'string') {
124
- // Parse hex color
125
- const hex = value.replace('#', '');
126
- const r = parseInt(hex.substr(0, 2), 16) / 255;
127
- const g = parseInt(hex.substr(2, 2), 16) / 255;
128
- const b = parseInt(hex.substr(4, 2), 16) / 255;
129
- return `FLinearColor(${r}f, ${g}f, ${b}f, 1.0f)`;
130
- }
131
- return 'FLinearColor::White';
132
- case 'string':
133
- return `TEXT("${value}")`;
134
- case 'bool':
135
- return value ? 'true' : 'false';
136
- case 'float':
137
- return `${value}f`;
138
- default:
139
- return String(value);
103
+ switch (type) {
104
+ case "vector2": {
105
+ const v2 = value;
106
+ return `FVector2D(${v2.x}f, ${v2.y}f)`;
140
107
  }
108
+ case "vector3": {
109
+ const v3 = value;
110
+ return `FVector(${v3.x}f, ${v3.y}f, ${v3.z ?? 0}f)`;
111
+ }
112
+ case "color":
113
+ if (typeof value === "string") {
114
+ const hex = value.replace("#", "");
115
+ const r = parseInt(hex.substr(0, 2), 16) / 255;
116
+ const g = parseInt(hex.substr(2, 2), 16) / 255;
117
+ const b = parseInt(hex.substr(4, 2), 16) / 255;
118
+ return `FLinearColor(${r}f, ${g}f, ${b}f, 1.0f)`;
119
+ }
120
+ return "FLinearColor::White";
121
+ case "string":
122
+ return `TEXT("${value}")`;
123
+ case "bool":
124
+ return value ? "true" : "false";
125
+ case "float":
126
+ return `${value}f`;
127
+ default:
128
+ return String(value);
129
+ }
141
130
  }
142
- /* ── Unreal Exporter Implementation ───────────────────────────── */
143
131
  class UnrealExporter extends PlatformExporter.PlatformExporter {
144
- constructor() {
145
- super(...arguments);
146
- this.platformId = 'unreal';
147
- this.platformInfo = {
148
- id: 'unreal',
149
- name: 'Unreal Engine',
150
- description: 'Epic Games Unreal Engine 5.x with C++ and Blueprint support',
151
- website: 'https://unrealengine.com',
152
- features: [
153
- '2d-rendering',
154
- '3d-rendering',
155
- 'physics-2d',
156
- 'physics-3d',
157
- 'audio',
158
- 'networking',
159
- 'ui-system',
160
- 'visual-scripting',
161
- 'particles',
162
- 'animation',
163
- 'vr-ar',
164
- ],
165
- supportedAssets: [
166
- 'sprite',
167
- 'tileset',
168
- 'audio',
169
- 'font',
170
- 'script',
171
- 'scene',
172
- 'prefab',
173
- 'material',
174
- 'shader',
175
- 'animation',
176
- 'particleSystem',
177
- 'texture',
178
- 'data',
179
- ],
180
- exportFormats: ['.h', '.cpp', '.uasset', '.umap', '.uplugin'],
181
- };
182
- this.moduleName = 'Nice2DevGame';
183
- this.engineVersion = '5.3';
184
- this.usedHeaders = new Set();
132
+ constructor() {
133
+ super(...arguments);
134
+ this.platformId = "unreal";
135
+ this.platformInfo = {
136
+ id: "unreal",
137
+ name: "Unreal Engine",
138
+ description: "Epic Games Unreal Engine 5.x with C++ and Blueprint support",
139
+ website: "https://unrealengine.com",
140
+ features: [
141
+ "2d-rendering",
142
+ "3d-rendering",
143
+ "physics-2d",
144
+ "physics-3d",
145
+ "audio",
146
+ "networking",
147
+ "ui-system",
148
+ "visual-scripting",
149
+ "particles",
150
+ "animation",
151
+ "vr-ar"
152
+ ],
153
+ supportedAssets: [
154
+ "sprite",
155
+ "tileset",
156
+ "audio",
157
+ "font",
158
+ "script",
159
+ "scene",
160
+ "prefab",
161
+ "material",
162
+ "shader",
163
+ "animation",
164
+ "particleSystem",
165
+ "texture",
166
+ "data"
167
+ ],
168
+ exportFormats: [".h", ".cpp", ".uasset", ".umap", ".uplugin"]
169
+ };
170
+ this.moduleName = "Nice2DevGame";
171
+ this.engineVersion = "5.3";
172
+ this.usedHeaders = /* @__PURE__ */ new Set();
173
+ }
174
+ async doExport(project, options) {
175
+ const platformOpts = options.platformOptions ?? {};
176
+ this.moduleName = platformOpts.moduleName ?? project.name.replace(/[^a-zA-Z0-9]/g, "") ?? "Nice2DevGame";
177
+ this.engineVersion = platformOpts.engineVersion ?? "5.3";
178
+ await this.generateProjectFiles(project, options);
179
+ await this.generateBuildFiles(project, options);
180
+ await this.generateSourceFiles(project, options);
181
+ await this.generateConfigFiles(project, options);
182
+ for (const scene of project.scenes) {
183
+ await this.exportScene(scene, project, options);
185
184
  }
186
- async doExport(project, options) {
187
- const platformOpts = options.platformOptions ?? {};
188
- this.moduleName =
189
- platformOpts.moduleName ?? project.name.replace(/[^a-zA-Z0-9]/g, '') ?? 'Nice2DevGame';
190
- this.engineVersion = platformOpts.engineVersion ?? '5.3';
191
- // Generate project structure
192
- await this.generateProjectFiles(project, options);
193
- await this.generateBuildFiles(project, options);
194
- await this.generateSourceFiles(project, options);
195
- await this.generateConfigFiles(project, options);
196
- // Export scenes as levels
197
- for (const scene of project.scenes) {
198
- await this.exportScene(scene, project, options);
199
- }
200
- // Export assets
201
- for (const asset of project.assets) {
202
- await this.exportAsset(asset, options);
203
- }
204
- // Generate Blueprint nodes if requested
205
- if (platformOpts.generateBlueprints !== false) {
206
- await this.generateBlueprintLibrary(project, options);
207
- }
185
+ for (const asset of project.assets) {
186
+ await this.exportAsset(asset, options);
208
187
  }
209
- /* ── Project Structure ──────────────────────────────────────── */
210
- async generateProjectFiles(project, options) {
211
- const projectName = options.projectName ?? project.name;
212
- // .uproject file
213
- const uproject = {
214
- FileVersion: 3,
215
- EngineAssociation: this.engineVersion,
216
- Category: '',
217
- Description: project.description ?? '',
218
- Modules: [
219
- {
220
- Name: this.moduleName,
221
- Type: 'Runtime',
222
- LoadingPhase: 'Default',
223
- AdditionalDependencies: ['Engine', 'CoreUObject'],
224
- },
225
- ],
226
- Plugins: [
227
- { Name: 'Paper2D', Enabled: true },
228
- { Name: 'EnhancedInput', Enabled: true },
229
- { Name: 'Niagara', Enabled: true },
230
- ],
231
- };
232
- this.addTextFile(`${projectName}.uproject`, JSON.stringify(uproject, null, 2));
188
+ if (platformOpts.generateBlueprints !== false) {
189
+ await this.generateBlueprintLibrary(project, options);
233
190
  }
234
- async generateBuildFiles(_project, _options) {
235
- // Module Build.cs
236
- const buildCs = `// Copyright Nice2Dev. All Rights Reserved.
237
-
238
- using UnrealBuildTool;
239
-
240
- public class ${this.moduleName} : ModuleRules
241
- {
242
- public ${this.moduleName}(ReadOnlyTargetRules Target) : base(Target)
243
- {
244
- PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
245
-
246
- PublicDependencyModuleNames.AddRange(new string[] {
247
- "Core",
248
- "CoreUObject",
249
- "Engine",
250
- "InputCore",
251
- "EnhancedInput",
252
- "Paper2D",
253
- "Niagara",
254
- "PhysicsCore"
255
- });
256
-
257
- PrivateDependencyModuleNames.AddRange(new string[] {
258
- "Slate",
259
- "SlateCore"
260
- });
261
- }
262
- }
263
- `;
264
- this.addTextFile(`Source/${this.moduleName}/${this.moduleName}.Build.cs`, buildCs);
265
- // Target files
266
- const gameTarget = `// Copyright Nice2Dev. All Rights Reserved.
267
-
268
- using UnrealBuildTool;
269
- using System.Collections.Generic;
270
-
271
- public class ${this.moduleName}Target : TargetRules
272
- {
273
- public ${this.moduleName}Target(TargetInfo Target) : base(Target)
274
- {
275
- Type = TargetType.Game;
276
- DefaultBuildSettings = BuildSettingsVersion.V4;
277
- IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_3;
278
- ExtraModuleNames.Add("${this.moduleName}");
279
- }
280
- }
191
+ }
192
+ /* ── Project Structure ──────────────────────────────────────── */
193
+ async generateProjectFiles(project, options) {
194
+ const projectName = options.projectName ?? project.name;
195
+ const uproject = {
196
+ FileVersion: 3,
197
+ EngineAssociation: this.engineVersion,
198
+ Category: "",
199
+ Description: project.description ?? "",
200
+ Modules: [
201
+ {
202
+ Name: this.moduleName,
203
+ Type: "Runtime",
204
+ LoadingPhase: "Default",
205
+ AdditionalDependencies: ["Engine", "CoreUObject"]
206
+ }
207
+ ],
208
+ Plugins: [
209
+ { Name: "Paper2D", Enabled: true },
210
+ { Name: "EnhancedInput", Enabled: true },
211
+ { Name: "Niagara", Enabled: true }
212
+ ]
213
+ };
214
+ this.addTextFile(`${projectName}.uproject`, JSON.stringify(uproject, null, 2));
215
+ }
216
+ async generateBuildFiles(_project, _options) {
217
+ const buildCs = `// Copyright Nice2Dev. All Rights Reserved.
218
+
219
+ using UnrealBuildTool;
220
+
221
+ public class ${this.moduleName} : ModuleRules
222
+ {
223
+ public ${this.moduleName}(ReadOnlyTargetRules Target) : base(Target)
224
+ {
225
+ PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
226
+
227
+ PublicDependencyModuleNames.AddRange(new string[] {
228
+ "Core",
229
+ "CoreUObject",
230
+ "Engine",
231
+ "InputCore",
232
+ "EnhancedInput",
233
+ "Paper2D",
234
+ "Niagara",
235
+ "PhysicsCore"
236
+ });
237
+
238
+ PrivateDependencyModuleNames.AddRange(new string[] {
239
+ "Slate",
240
+ "SlateCore"
241
+ });
242
+ }
243
+ }
281
244
  `;
282
- this.addTextFile(`Source/${this.moduleName}Target.Target.cs`, gameTarget);
283
- const editorTarget = gameTarget
284
- .replace('TargetType.Game', 'TargetType.Editor')
285
- .replace(`${this.moduleName}Target`, `${this.moduleName}EditorTarget`);
286
- this.addTextFile(`Source/${this.moduleName}EditorTarget.Target.cs`, editorTarget);
245
+ this.addTextFile(`Source/${this.moduleName}/${this.moduleName}.Build.cs`, buildCs);
246
+ const gameTarget = `// Copyright Nice2Dev. All Rights Reserved.
247
+
248
+ using UnrealBuildTool;
249
+ using System.Collections.Generic;
250
+
251
+ public class ${this.moduleName}Target : TargetRules
252
+ {
253
+ public ${this.moduleName}Target(TargetInfo Target) : base(Target)
254
+ {
255
+ Type = TargetType.Game;
256
+ DefaultBuildSettings = BuildSettingsVersion.V4;
257
+ IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_3;
258
+ ExtraModuleNames.Add("${this.moduleName}");
287
259
  }
288
- async generateSourceFiles(project, options) {
289
- // Module header
290
- const moduleHeader = `// Copyright Nice2Dev. All Rights Reserved.
291
-
292
- #pragma once
293
-
294
- #include "CoreMinimal.h"
295
- #include "Modules/ModuleManager.h"
296
-
297
- class F${this.moduleName}Module : public IModuleInterface
298
- {
299
- public:
300
- virtual void StartupModule() override;
301
- virtual void ShutdownModule() override;
302
- };
260
+ }
303
261
  `;
304
- this.addTextFile(`Source/${this.moduleName}/${this.moduleName}.h`, moduleHeader);
305
- // Module source
306
- const moduleSource = `// Copyright Nice2Dev. All Rights Reserved.
307
-
308
- #include "${this.moduleName}.h"
309
- #include "Modules/ModuleManager.h"
310
-
311
- #define LOCTEXT_NAMESPACE "F${this.moduleName}Module"
312
-
313
- void F${this.moduleName}Module::StartupModule()
314
- {
315
- // Module startup logic
316
- }
317
-
318
- void F${this.moduleName}Module::ShutdownModule()
319
- {
320
- // Module shutdown logic
321
- }
322
-
323
- #undef LOCTEXT_NAMESPACE
324
-
325
- IMPLEMENT_PRIMARY_GAME_MODULE(F${this.moduleName}Module, ${this.moduleName}, "${this.moduleName}");
262
+ this.addTextFile(`Source/${this.moduleName}Target.Target.cs`, gameTarget);
263
+ const editorTarget = gameTarget.replace("TargetType.Game", "TargetType.Editor").replace(`${this.moduleName}Target`, `${this.moduleName}EditorTarget`);
264
+ this.addTextFile(`Source/${this.moduleName}EditorTarget.Target.cs`, editorTarget);
265
+ }
266
+ async generateSourceFiles(project, options) {
267
+ const moduleHeader = `// Copyright Nice2Dev. All Rights Reserved.
268
+
269
+ #pragma once
270
+
271
+ #include "CoreMinimal.h"
272
+ #include "Modules/ModuleManager.h"
273
+
274
+ class F${this.moduleName}Module : public IModuleInterface
275
+ {
276
+ public:
277
+ virtual void StartupModule() override;
278
+ virtual void ShutdownModule() override;
279
+ };
326
280
  `;
327
- this.addTextFile(`Source/${this.moduleName}/${this.moduleName}.cpp`, moduleSource);
328
- // Generate game mode
329
- this.generateGameMode(project, options);
330
- // Generate entity classes from prefabs
331
- for (const prefab of project.prefabs) {
332
- this.generateActorClass(prefab.entity, prefab.name, options);
333
- }
334
- }
335
- generateGameMode(project, _options) {
336
- const className = `A${this.moduleName}GameMode`;
337
- // Header
338
- const header = `// Copyright Nice2Dev. All Rights Reserved.
339
-
340
- #pragma once
341
-
342
- #include "CoreMinimal.h"
343
- #include "GameFramework/GameModeBase.h"
344
- #include "${this.moduleName}GameMode.generated.h"
345
-
346
- /**
347
- * Main game mode for ${project.name}
348
- * Generated from Nice2Dev project
349
- */
350
- UCLASS()
351
- class ${this.moduleName.toUpperCase()}_API ${className} : public AGameModeBase
352
- {
353
- GENERATED_BODY()
354
-
355
- public:
356
- ${className}();
357
-
358
- virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
359
- virtual void StartPlay() override;
360
-
361
- protected:
362
- /** Game settings from Nice2Dev project */
363
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Settings")
364
- FVector2D GameResolution;
365
-
366
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Settings")
367
- FLinearColor BackgroundColor;
368
-
369
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Physics")
370
- FVector2D Gravity;
371
-
372
- UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Audio")
373
- float MasterVolume;
374
- };
281
+ this.addTextFile(`Source/${this.moduleName}/${this.moduleName}.h`, moduleHeader);
282
+ const moduleSource = `// Copyright Nice2Dev. All Rights Reserved.
283
+
284
+ #include "${this.moduleName}.h"
285
+ #include "Modules/ModuleManager.h"
286
+
287
+ #define LOCTEXT_NAMESPACE "F${this.moduleName}Module"
288
+
289
+ void F${this.moduleName}Module::StartupModule()
290
+ {
291
+ // Module startup logic
292
+ }
293
+
294
+ void F${this.moduleName}Module::ShutdownModule()
295
+ {
296
+ // Module shutdown logic
297
+ }
298
+
299
+ #undef LOCTEXT_NAMESPACE
300
+
301
+ IMPLEMENT_PRIMARY_GAME_MODULE(F${this.moduleName}Module, ${this.moduleName}, "${this.moduleName}");
375
302
  `;
376
- this.addTextFile(`Source/${this.moduleName}/${this.moduleName}GameMode.h`, header);
377
- // Source
378
- const res = project.settings.resolution;
379
- const bgColor = project.settings.backgroundColor || '#000000';
380
- const gravity = project.settings.physics?.gravity ?? { x: 0, y: -980 };
381
- const masterVol = project.settings.audio?.masterVolume ?? 1.0;
382
- const source = `// Copyright Nice2Dev. All Rights Reserved.
383
-
384
- #include "${this.moduleName}GameMode.h"
385
-
386
- ${className}::${className}()
387
- {
388
- // Initialize settings from Nice2Dev project
389
- GameResolution = FVector2D(${res.width}f, ${res.height}f);
390
- BackgroundColor = ${mapNiceValueToUnreal('color', bgColor)};
391
- Gravity = FVector2D(${gravity.x}f, ${gravity.y}f);
392
- MasterVolume = ${masterVol}f;
393
- }
394
-
395
- void ${className}::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
396
- {
397
- Super::InitGame(MapName, Options, ErrorMessage);
398
-
399
- // Apply physics settings
400
- if (UWorld* World = GetWorld())
401
- {
402
- // Physics world configuration would go here
403
- }
404
- }
405
-
406
- void ${className}::StartPlay()
407
- {
408
- Super::StartPlay();
409
-
410
- // Apply audio settings
411
- // Set master volume through audio device
412
- }
303
+ this.addTextFile(`Source/${this.moduleName}/${this.moduleName}.cpp`, moduleSource);
304
+ this.generateGameMode(project, options);
305
+ for (const prefab of project.prefabs) {
306
+ this.generateActorClass(prefab.entity, prefab.name, options);
307
+ }
308
+ }
309
+ generateGameMode(project, _options) {
310
+ const className = `A${this.moduleName}GameMode`;
311
+ const header = `// Copyright Nice2Dev. All Rights Reserved.
312
+
313
+ #pragma once
314
+
315
+ #include "CoreMinimal.h"
316
+ #include "GameFramework/GameModeBase.h"
317
+ #include "${this.moduleName}GameMode.generated.h"
318
+
319
+ /**
320
+ * Main game mode for ${project.name}
321
+ * Generated from Nice2Dev project
322
+ */
323
+ UCLASS()
324
+ class ${this.moduleName.toUpperCase()}_API ${className} : public AGameModeBase
325
+ {
326
+ GENERATED_BODY()
327
+
328
+ public:
329
+ ${className}();
330
+
331
+ virtual void InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage) override;
332
+ virtual void StartPlay() override;
333
+
334
+ protected:
335
+ /** Game settings from Nice2Dev project */
336
+ UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Settings")
337
+ FVector2D GameResolution;
338
+
339
+ UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Settings")
340
+ FLinearColor BackgroundColor;
341
+
342
+ UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Physics")
343
+ FVector2D Gravity;
344
+
345
+ UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Audio")
346
+ float MasterVolume;
347
+ };
413
348
  `;
414
- this.addTextFile(`Source/${this.moduleName}/${this.moduleName}GameMode.cpp`, source);
349
+ this.addTextFile(`Source/${this.moduleName}/${this.moduleName}GameMode.h`, header);
350
+ const res = project.settings.resolution;
351
+ const bgColor = project.settings.backgroundColor || "#000000";
352
+ const gravity = project.settings.physics?.gravity ?? { x: 0, y: -980 };
353
+ const masterVol = project.settings.audio?.masterVolume ?? 1;
354
+ const source = `// Copyright Nice2Dev. All Rights Reserved.
355
+
356
+ #include "${this.moduleName}GameMode.h"
357
+
358
+ ${className}::${className}()
359
+ {
360
+ // Initialize settings from Nice2Dev project
361
+ GameResolution = FVector2D(${res.width}f, ${res.height}f);
362
+ BackgroundColor = ${mapNiceValueToUnreal("color", bgColor)};
363
+ Gravity = FVector2D(${gravity.x}f, ${gravity.y}f);
364
+ MasterVolume = ${masterVol}f;
365
+ }
366
+
367
+ void ${className}::InitGame(const FString& MapName, const FString& Options, FString& ErrorMessage)
368
+ {
369
+ Super::InitGame(MapName, Options, ErrorMessage);
370
+
371
+ // Apply physics settings
372
+ if (UWorld* World = GetWorld())
373
+ {
374
+ // Physics world configuration would go here
415
375
  }
416
- generateActorClass(entity, className, _options) {
417
- const sanitizedName = className.replace(/[^a-zA-Z0-9]/g, '');
418
- const fullClassName = `A${sanitizedName}`;
419
- this.usedHeaders.clear();
420
- // Collect component info
421
- const componentDeclarations = [];
422
- const componentInitializations = [];
423
- const requiredHeaders = ['CoreMinimal.h', 'GameFramework/Actor.h'];
424
- // Root component
425
- componentDeclarations.push(`
426
- /** Root scene component */
427
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
376
+ }
377
+
378
+ void ${className}::StartPlay()
379
+ {
380
+ Super::StartPlay();
381
+
382
+ // Apply audio settings
383
+ // Set master volume through audio device
384
+ }
385
+ `;
386
+ this.addTextFile(`Source/${this.moduleName}/${this.moduleName}GameMode.cpp`, source);
387
+ }
388
+ generateActorClass(entity, className, _options) {
389
+ const sanitizedName = className.replace(/[^a-zA-Z0-9]/g, "");
390
+ const fullClassName = `A${sanitizedName}`;
391
+ this.usedHeaders.clear();
392
+ const componentDeclarations = [];
393
+ const componentInitializations = [];
394
+ const requiredHeaders = ["CoreMinimal.h", "GameFramework/Actor.h"];
395
+ componentDeclarations.push(`
396
+ /** Root scene component */
397
+ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
428
398
  USceneComponent* RootSceneComponent;`);
429
- componentInitializations.push(`
430
- RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootSceneComponent"));
399
+ componentInitializations.push(`
400
+ RootSceneComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootSceneComponent"));
431
401
  SetRootComponent(RootSceneComponent);`);
432
- // Process components
433
- for (const comp of entity.components) {
434
- const mapping = COMPONENT_MAPPINGS[comp.type];
435
- if (mapping) {
436
- requiredHeaders.push(mapping.header);
437
- const compVarName = `${comp.type.charAt(0).toUpperCase()}${comp.type.slice(1)}Component`;
438
- componentDeclarations.push(`
439
- /** ${comp.type} component */
440
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
402
+ for (const comp of entity.components) {
403
+ const mapping = COMPONENT_MAPPINGS[comp.type];
404
+ if (mapping) {
405
+ requiredHeaders.push(mapping.header);
406
+ const compVarName = `${comp.type.charAt(0).toUpperCase()}${comp.type.slice(1)}Component`;
407
+ componentDeclarations.push(`
408
+ /** ${comp.type} component */
409
+ UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Components")
441
410
  ${mapping.unrealClass}* ${compVarName};`);
442
- componentInitializations.push(`
443
- ${compVarName} = CreateDefaultSubobject<${mapping.unrealClass}>(TEXT("${compVarName}"));
411
+ componentInitializations.push(`
412
+ ${compVarName} = CreateDefaultSubobject<${mapping.unrealClass}>(TEXT("${compVarName}"));
444
413
  ${compVarName}->SetupAttachment(RootSceneComponent);`);
445
- // Set properties
446
- if (comp.properties) {
447
- for (const [key, value] of Object.entries(comp.properties)) {
448
- const unrealProp = mapping.properties.get(key);
449
- if (unrealProp) {
450
- const convertedValue = this.convertPropertyValue(key, value);
451
- componentInitializations.push(` ${compVarName}->${unrealProp} = ${convertedValue};`);
452
- }
453
- }
454
- }
414
+ if (comp.properties) {
415
+ for (const [key, value] of Object.entries(comp.properties)) {
416
+ const unrealProp = mapping.properties.get(key);
417
+ if (unrealProp) {
418
+ const convertedValue = this.convertPropertyValue(key, value);
419
+ componentInitializations.push(
420
+ ` ${compVarName}->${unrealProp} = ${convertedValue};`
421
+ );
455
422
  }
423
+ }
456
424
  }
457
- // Header file
458
- const headerIncludes = [...new Set(requiredHeaders)].map((h) => `#include "${h}"`).join('\n');
459
- const header = `// Copyright Nice2Dev. All Rights Reserved.
460
-
461
- #pragma once
462
-
463
- ${headerIncludes}
464
- #include "${sanitizedName}.generated.h"
465
-
466
- /**
467
- * ${entity.name ?? className}
468
- * Generated from Nice2Dev prefab
469
- */
470
- UCLASS(Blueprintable, BlueprintType)
471
- class ${this.moduleName.toUpperCase()}_API ${fullClassName} : public AActor
472
- {
473
- GENERATED_BODY()
474
-
475
- public:
476
- ${fullClassName}();
477
-
478
- protected:
479
- virtual void BeginPlay() override;
480
-
481
- public:
482
- virtual void Tick(float DeltaTime) override;
483
-
484
- ${componentDeclarations.join('\n')}
485
-
486
- // Custom properties from Nice2Dev
487
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Nice2Dev")
488
- FString EntityId;
489
-
490
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Nice2Dev")
491
- TArray<FString> Tags;
492
-
493
- protected:
494
- /** Called when entity is spawned (from Nice2Dev Start event) */
495
- UFUNCTION(BlueprintNativeEvent, Category = "Nice2Dev")
496
- void OnNiceStart();
497
-
498
- /** Called every frame (from Nice2Dev Update event) */
499
- UFUNCTION(BlueprintNativeEvent, Category = "Nice2Dev")
500
- void OnNiceUpdate(float DeltaTime);
501
- };
425
+ }
426
+ }
427
+ const headerIncludes = [...new Set(requiredHeaders)].map((h) => `#include "${h}"`).join("\n");
428
+ const header = `// Copyright Nice2Dev. All Rights Reserved.
429
+
430
+ #pragma once
431
+
432
+ ${headerIncludes}
433
+ #include "${sanitizedName}.generated.h"
434
+
435
+ /**
436
+ * ${entity.name ?? className}
437
+ * Generated from Nice2Dev prefab
438
+ */
439
+ UCLASS(Blueprintable, BlueprintType)
440
+ class ${this.moduleName.toUpperCase()}_API ${fullClassName} : public AActor
441
+ {
442
+ GENERATED_BODY()
443
+
444
+ public:
445
+ ${fullClassName}();
446
+
447
+ protected:
448
+ virtual void BeginPlay() override;
449
+
450
+ public:
451
+ virtual void Tick(float DeltaTime) override;
452
+
453
+ ${componentDeclarations.join("\n")}
454
+
455
+ // Custom properties from Nice2Dev
456
+ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Nice2Dev")
457
+ FString EntityId;
458
+
459
+ UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Nice2Dev")
460
+ TArray<FString> Tags;
461
+
462
+ protected:
463
+ /** Called when entity is spawned (from Nice2Dev Start event) */
464
+ UFUNCTION(BlueprintNativeEvent, Category = "Nice2Dev")
465
+ void OnNiceStart();
466
+
467
+ /** Called every frame (from Nice2Dev Update event) */
468
+ UFUNCTION(BlueprintNativeEvent, Category = "Nice2Dev")
469
+ void OnNiceUpdate(float DeltaTime);
470
+ };
502
471
  `;
503
- this.addTextFile(`Source/${this.moduleName}/Actors/${sanitizedName}.h`, header);
504
- // Source file
505
- const source = `// Copyright Nice2Dev. All Rights Reserved.
506
-
507
- #include "Actors/${sanitizedName}.h"
508
-
509
- ${fullClassName}::${fullClassName}()
510
- {
511
- PrimaryActorTick.bCanEverTick = true;
512
-
513
- EntityId = TEXT("${entity.id}");
514
- ${componentInitializations.join('\n')}
515
- }
516
-
517
- void ${fullClassName}::BeginPlay()
518
- {
519
- Super::BeginPlay();
520
-
521
- // Set initial transform
522
- SetActorLocation(FVector(${entity.position?.x ?? 0}f, ${entity.position?.y ?? 0}f, 0.0f));
523
- SetActorRotation(FRotator(0.0f, ${entity.rotation ?? 0}f, 0.0f));
524
- SetActorScale3D(FVector(${entity.scale?.x ?? 1}f, ${entity.scale?.y ?? 1}f, 1.0f));
525
-
526
- OnNiceStart();
527
- }
528
-
529
- void ${fullClassName}::Tick(float DeltaTime)
530
- {
531
- Super::Tick(DeltaTime);
532
- OnNiceUpdate(DeltaTime);
533
- }
534
-
535
- void ${fullClassName}::OnNiceStart_Implementation()
536
- {
537
- // Override in Blueprint for custom start logic
538
- }
539
-
540
- void ${fullClassName}::OnNiceUpdate_Implementation(float DeltaTime)
541
- {
542
- // Override in Blueprint for custom update logic
543
- }
472
+ this.addTextFile(`Source/${this.moduleName}/Actors/${sanitizedName}.h`, header);
473
+ const source = `// Copyright Nice2Dev. All Rights Reserved.
474
+
475
+ #include "Actors/${sanitizedName}.h"
476
+
477
+ ${fullClassName}::${fullClassName}()
478
+ {
479
+ PrimaryActorTick.bCanEverTick = true;
480
+
481
+ EntityId = TEXT("${entity.id}");
482
+ ${componentInitializations.join("\n")}
483
+ }
484
+
485
+ void ${fullClassName}::BeginPlay()
486
+ {
487
+ Super::BeginPlay();
488
+
489
+ // Set initial transform
490
+ SetActorLocation(FVector(${entity.position?.x ?? 0}f, ${entity.position?.y ?? 0}f, 0.0f));
491
+ SetActorRotation(FRotator(0.0f, ${entity.rotation ?? 0}f, 0.0f));
492
+ SetActorScale3D(FVector(${entity.scale?.x ?? 1}f, ${entity.scale?.y ?? 1}f, 1.0f));
493
+
494
+ OnNiceStart();
495
+ }
496
+
497
+ void ${fullClassName}::Tick(float DeltaTime)
498
+ {
499
+ Super::Tick(DeltaTime);
500
+ OnNiceUpdate(DeltaTime);
501
+ }
502
+
503
+ void ${fullClassName}::OnNiceStart_Implementation()
504
+ {
505
+ // Override in Blueprint for custom start logic
506
+ }
507
+
508
+ void ${fullClassName}::OnNiceUpdate_Implementation(float DeltaTime)
509
+ {
510
+ // Override in Blueprint for custom update logic
511
+ }
544
512
  `;
545
- this.addTextFile(`Source/${this.moduleName}/Actors/${sanitizedName}.cpp`, source);
513
+ this.addTextFile(`Source/${this.moduleName}/Actors/${sanitizedName}.cpp`, source);
514
+ }
515
+ convertPropertyValue(key, value) {
516
+ if (value === null || value === void 0) {
517
+ return "0";
546
518
  }
547
- convertPropertyValue(key, value) {
548
- if (value === null || value === undefined) {
549
- return '0';
550
- }
551
- if (typeof value === 'object') {
552
- if ('x' in value && 'y' in value) {
553
- const v = value;
554
- if ('z' in v) {
555
- return `FVector(${v.x}f, ${v.y}f, ${v.z}f)`;
556
- }
557
- return `FVector2D(${v.x}f, ${v.y}f)`;
558
- }
519
+ if (typeof value === "object") {
520
+ if ("x" in value && "y" in value) {
521
+ const v = value;
522
+ if ("z" in v) {
523
+ return `FVector(${v.x}f, ${v.y}f, ${v.z}f)`;
559
524
  }
560
- if (typeof value === 'string') {
561
- if (value.startsWith('#')) {
562
- return mapNiceValueToUnreal('color', value);
563
- }
564
- return `TEXT("${value}")`;
565
- }
566
- if (typeof value === 'boolean') {
567
- return value ? 'true' : 'false';
568
- }
569
- if (typeof value === 'number') {
570
- return Number.isInteger(value) ? String(value) : `${value}f`;
571
- }
572
- return String(value);
525
+ return `FVector2D(${v.x}f, ${v.y}f)`;
526
+ }
527
+ }
528
+ if (typeof value === "string") {
529
+ if (value.startsWith("#")) {
530
+ return mapNiceValueToUnreal("color", value);
531
+ }
532
+ return `TEXT("${value}")`;
573
533
  }
574
- async generateConfigFiles(project, _options) {
575
- // Default Engine.ini
576
- const engineIni = `[/Script/EngineSettings.GameMapsSettings]
577
- GameDefaultMap=/Game/Maps/MainMenu
578
- GlobalDefaultGameMode=/Script/${this.moduleName}.${this.moduleName}GameMode
579
-
580
- [/Script/Engine.RendererSettings]
581
- r.DefaultFeature.AntiAliasing=${project.settings.rendering?.antialias ? '2' : '0'}
582
- r.DefaultFeature.AutoExposure=False
583
-
584
- [/Script/Engine.PhysicsSettings]
585
- DefaultGravityZ=${project.settings.physics?.gravity?.y ?? -980}
534
+ if (typeof value === "boolean") {
535
+ return value ? "true" : "false";
536
+ }
537
+ if (typeof value === "number") {
538
+ return Number.isInteger(value) ? String(value) : `${value}f`;
539
+ }
540
+ return String(value);
541
+ }
542
+ async generateConfigFiles(project, _options) {
543
+ const engineIni = `[/Script/EngineSettings.GameMapsSettings]
544
+ GameDefaultMap=/Game/Maps/MainMenu
545
+ GlobalDefaultGameMode=/Script/${this.moduleName}.${this.moduleName}GameMode
546
+
547
+ [/Script/Engine.RendererSettings]
548
+ r.DefaultFeature.AntiAliasing=${project.settings.rendering?.antialias ? "2" : "0"}
549
+ r.DefaultFeature.AutoExposure=False
550
+
551
+ [/Script/Engine.PhysicsSettings]
552
+ DefaultGravityZ=${project.settings.physics?.gravity?.y ?? -980}
586
553
  `;
587
- this.addTextFile('Config/DefaultEngine.ini', engineIni);
588
- // Default Input.ini (Enhanced Input)
589
- const inputIni = `[/Script/Engine.InputSettings]
590
- +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
591
- +ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
592
- +AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
593
- +AxisMappings=(AxisName="MoveRight",Scale=-1.000000,Key=A)
594
- +AxisMappings=(AxisName="MoveUp",Scale=1.000000,Key=W)
595
- +AxisMappings=(AxisName="MoveUp",Scale=-1.000000,Key=S)
554
+ this.addTextFile("Config/DefaultEngine.ini", engineIni);
555
+ const inputIni = `[/Script/Engine.InputSettings]
556
+ +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar)
557
+ +ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
558
+ +AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
559
+ +AxisMappings=(AxisName="MoveRight",Scale=-1.000000,Key=A)
560
+ +AxisMappings=(AxisName="MoveUp",Scale=1.000000,Key=W)
561
+ +AxisMappings=(AxisName="MoveUp",Scale=-1.000000,Key=S)
596
562
  `;
597
- this.addTextFile('Config/DefaultInput.ini', inputIni);
598
- // Default Game.ini
599
- const gameIni = `[/Script/${this.moduleName}.${this.moduleName}GameMode]
600
- ; Nice2Dev project: ${project.name}
601
- ; Version: ${project.version}
563
+ this.addTextFile("Config/DefaultInput.ini", inputIni);
564
+ const gameIni = `[/Script/${this.moduleName}.${this.moduleName}GameMode]
565
+ ; Nice2Dev project: ${project.name}
566
+ ; Version: ${project.version}
602
567
  `;
603
- this.addTextFile('Config/DefaultGame.ini', gameIni);
604
- }
605
- /* ── Scene Export ───────────────────────────────────────────── */
606
- async exportScene(scene, project, _options) {
607
- // Generate level blueprint
608
- const levelHeader = this.generateLevelBlueprint(scene, project);
609
- this.addTextFile(`Content/Maps/${scene.name}_LevelScript.h`, levelHeader.header);
610
- this.addTextFile(`Content/Maps/${scene.name}_LevelScript.cpp`, levelHeader.source);
611
- // Generate spawn data
612
- const spawnData = this.generateSpawnData(scene);
613
- this.addTextFile(`Content/Data/${scene.name}_SpawnData.json`, JSON.stringify(spawnData, null, 2));
614
- }
615
- generateLevelBlueprint(scene, _project) {
616
- const className = `A${scene.name.replace(/[^a-zA-Z0-9]/g, '')}LevelScript`;
617
- const header = `// Copyright Nice2Dev. All Rights Reserved.
618
-
619
- #pragma once
620
-
621
- #include "CoreMinimal.h"
622
- #include "Engine/LevelScriptActor.h"
623
- #include "${scene.name}_LevelScript.generated.h"
624
-
625
- /**
626
- * Level script for ${scene.name}
627
- * Generated from Nice2Dev scene
628
- */
629
- UCLASS()
630
- class ${this.moduleName.toUpperCase()}_API ${className} : public ALevelScriptActor
631
- {
632
- GENERATED_BODY()
633
-
634
- public:
635
- ${className}();
636
-
637
- protected:
638
- virtual void BeginPlay() override;
639
-
640
- /** Spawn all entities defined in the Nice2Dev scene */
641
- UFUNCTION(BlueprintCallable, Category = "Nice2Dev")
642
- void SpawnSceneEntities();
643
-
644
- private:
645
- /** Entity spawn data loaded from JSON */
646
- void LoadSpawnData();
647
-
648
- TArray<AActor*> SpawnedEntities;
649
- };
568
+ this.addTextFile("Config/DefaultGame.ini", gameIni);
569
+ }
570
+ /* ── Scene Export ───────────────────────────────────────────── */
571
+ async exportScene(scene, project, _options) {
572
+ const levelHeader = this.generateLevelBlueprint(scene, project);
573
+ this.addTextFile(`Content/Maps/${scene.name}_LevelScript.h`, levelHeader.header);
574
+ this.addTextFile(`Content/Maps/${scene.name}_LevelScript.cpp`, levelHeader.source);
575
+ const spawnData = this.generateSpawnData(scene);
576
+ this.addTextFile(
577
+ `Content/Data/${scene.name}_SpawnData.json`,
578
+ JSON.stringify(spawnData, null, 2)
579
+ );
580
+ }
581
+ generateLevelBlueprint(scene, _project) {
582
+ const className = `A${scene.name.replace(/[^a-zA-Z0-9]/g, "")}LevelScript`;
583
+ const header = `// Copyright Nice2Dev. All Rights Reserved.
584
+
585
+ #pragma once
586
+
587
+ #include "CoreMinimal.h"
588
+ #include "Engine/LevelScriptActor.h"
589
+ #include "${scene.name}_LevelScript.generated.h"
590
+
591
+ /**
592
+ * Level script for ${scene.name}
593
+ * Generated from Nice2Dev scene
594
+ */
595
+ UCLASS()
596
+ class ${this.moduleName.toUpperCase()}_API ${className} : public ALevelScriptActor
597
+ {
598
+ GENERATED_BODY()
599
+
600
+ public:
601
+ ${className}();
602
+
603
+ protected:
604
+ virtual void BeginPlay() override;
605
+
606
+ /** Spawn all entities defined in the Nice2Dev scene */
607
+ UFUNCTION(BlueprintCallable, Category = "Nice2Dev")
608
+ void SpawnSceneEntities();
609
+
610
+ private:
611
+ /** Entity spawn data loaded from JSON */
612
+ void LoadSpawnData();
613
+
614
+ TArray<AActor*> SpawnedEntities;
615
+ };
650
616
  `;
651
- const source = `// Copyright Nice2Dev. All Rights Reserved.
652
-
653
- #include "${scene.name}_LevelScript.h"
654
- #include "Kismet/GameplayStatics.h"
655
- #include "Engine/World.h"
656
-
657
- ${className}::${className}()
658
- {
659
- }
660
-
661
- void ${className}::BeginPlay()
662
- {
663
- Super::BeginPlay();
664
- LoadSpawnData();
665
- SpawnSceneEntities();
666
- }
667
-
668
- void ${className}::LoadSpawnData()
669
- {
670
- // Load spawn data from Content/Data/${scene.name}_SpawnData.json
671
- // In production, use UDataTable or UDataAsset
672
- }
673
-
674
- void ${className}::SpawnSceneEntities()
675
- {
676
- UWorld* World = GetWorld();
677
- if (!World) return;
678
-
679
- ${scene.entities.map((e) => this.generateEntitySpawnCode(e)).join('\n')}
680
- }
617
+ const source = `// Copyright Nice2Dev. All Rights Reserved.
618
+
619
+ #include "${scene.name}_LevelScript.h"
620
+ #include "Kismet/GameplayStatics.h"
621
+ #include "Engine/World.h"
622
+
623
+ ${className}::${className}()
624
+ {
625
+ }
626
+
627
+ void ${className}::BeginPlay()
628
+ {
629
+ Super::BeginPlay();
630
+ LoadSpawnData();
631
+ SpawnSceneEntities();
632
+ }
633
+
634
+ void ${className}::LoadSpawnData()
635
+ {
636
+ // Load spawn data from Content/Data/${scene.name}_SpawnData.json
637
+ // In production, use UDataTable or UDataAsset
638
+ }
639
+
640
+ void ${className}::SpawnSceneEntities()
641
+ {
642
+ UWorld* World = GetWorld();
643
+ if (!World) return;
644
+
645
+ ${scene.entities.map((e) => this.generateEntitySpawnCode(e)).join("\n")}
646
+ }
681
647
  `;
682
- return { header, source };
683
- }
684
- generateEntitySpawnCode(entity) {
685
- const pos = entity.position ?? { x: 0, y: 0 };
686
- const rot = entity.rotation ?? 0;
687
- return ` // Spawn ${entity.name ?? entity.id}
688
- {
689
- FActorSpawnParameters SpawnParams;
690
- SpawnParams.Name = TEXT("${entity.id}");
691
- FVector Location(${pos.x}f, ${pos.y}f, 0.0f);
692
- FRotator Rotation(0.0f, ${rot}f, 0.0f);
693
- // AActor* Entity = World->SpawnActor<AYourActorClass>(Location, Rotation, SpawnParams);
694
- // SpawnedEntities.Add(Entity);
648
+ return { header, source };
649
+ }
650
+ generateEntitySpawnCode(entity) {
651
+ const pos = entity.position ?? { x: 0, y: 0 };
652
+ const rot = entity.rotation ?? 0;
653
+ return ` // Spawn ${entity.name ?? entity.id}
654
+ {
655
+ FActorSpawnParameters SpawnParams;
656
+ SpawnParams.Name = TEXT("${entity.id}");
657
+ FVector Location(${pos.x}f, ${pos.y}f, 0.0f);
658
+ FRotator Rotation(0.0f, ${rot}f, 0.0f);
659
+ // AActor* Entity = World->SpawnActor<AYourActorClass>(Location, Rotation, SpawnParams);
660
+ // SpawnedEntities.Add(Entity);
695
661
  }`;
662
+ }
663
+ generateSpawnData(scene) {
664
+ return {
665
+ sceneName: scene.name,
666
+ sceneId: scene.id,
667
+ entities: scene.entities.map((e) => ({
668
+ id: e.id,
669
+ name: e.name,
670
+ type: e.type,
671
+ position: e.position,
672
+ rotation: e.rotation,
673
+ scale: e.scale,
674
+ components: e.components,
675
+ prefabId: e.prefabId,
676
+ tags: e.tags
677
+ })),
678
+ tilemaps: scene.tilemaps ?? []
679
+ };
680
+ }
681
+ /* ── Asset Export ───────────────────────────────────────────── */
682
+ async exportAsset(asset, _options) {
683
+ switch (asset.type) {
684
+ case "sprite":
685
+ case "texture":
686
+ this.addWarning(
687
+ "ASSET_MANUAL",
688
+ `Texture asset "${asset.name}" requires manual import`,
689
+ "Import textures through Unreal Editor for proper compression settings"
690
+ );
691
+ break;
692
+ case "audio":
693
+ this.addWarning(
694
+ "ASSET_MANUAL",
695
+ `Audio asset "${asset.name}" requires manual import`,
696
+ "Import audio through Unreal Editor for proper format conversion"
697
+ );
698
+ break;
699
+ case "data":
700
+ this.generateDataAsset(asset);
701
+ break;
696
702
  }
697
- generateSpawnData(scene) {
698
- return {
699
- sceneName: scene.name,
700
- sceneId: scene.id,
701
- entities: scene.entities.map((e) => ({
702
- id: e.id,
703
- name: e.name,
704
- type: e.type,
705
- position: e.position,
706
- rotation: e.rotation,
707
- scale: e.scale,
708
- components: e.components,
709
- prefabId: e.prefabId,
710
- tags: e.tags,
711
- })),
712
- tilemaps: scene.tilemaps ?? [],
713
- };
703
+ }
704
+ generateDataAsset(asset) {
705
+ const sanitizedName = asset.name.replace(/[^a-zA-Z0-9]/g, "");
706
+ const dataContent = {
707
+ assetId: asset.id,
708
+ assetName: asset.name,
709
+ assetType: asset.type,
710
+ data: asset.data ?? {},
711
+ metadata: asset.metadata ?? {}
712
+ };
713
+ this.addTextFile(`Content/Data/${sanitizedName}.json`, JSON.stringify(dataContent, null, 2));
714
+ }
715
+ /* ── Blueprint Library ──────────────────────────────────────── */
716
+ async generateBlueprintLibrary(_project, _options) {
717
+ const header = `// Copyright Nice2Dev. All Rights Reserved.
718
+
719
+ #pragma once
720
+
721
+ #include "CoreMinimal.h"
722
+ #include "Kismet/BlueprintFunctionLibrary.h"
723
+ #include "Nice2DevBlueprintLibrary.generated.h"
724
+
725
+ /**
726
+ * Blueprint function library exposing Nice2Dev game engine features
727
+ */
728
+ UCLASS()
729
+ class ${this.moduleName.toUpperCase()}_API UNice2DevBlueprintLibrary : public UBlueprintFunctionLibrary
730
+ {
731
+ GENERATED_BODY()
732
+
733
+ public:
734
+ // === Transform Utilities ===
735
+
736
+ /** Move an actor towards a target position at specified speed */
737
+ UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Movement")
738
+ static void MoveTowards(AActor* Actor, FVector TargetPosition, float Speed, float DeltaTime);
739
+
740
+ /** Rotate an actor to face a target position */
741
+ UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Movement")
742
+ static void LookAt2D(AActor* Actor, FVector TargetPosition);
743
+
744
+ // === Math Utilities ===
745
+
746
+ /** Get a random point within a circle */
747
+ UFUNCTION(BlueprintPure, Category = "Nice2Dev|Math")
748
+ static FVector2D RandomPointInCircle(FVector2D Center, float Radius);
749
+
750
+ /** Lerp between colors */
751
+ UFUNCTION(BlueprintPure, Category = "Nice2Dev|Math")
752
+ static FLinearColor LerpColor(FLinearColor A, FLinearColor B, float Alpha);
753
+
754
+ /** Remap a value from one range to another */
755
+ UFUNCTION(BlueprintPure, Category = "Nice2Dev|Math")
756
+ static float Remap(float Value, float InMin, float InMax, float OutMin, float OutMax);
757
+
758
+ // === Game Utilities ===
759
+
760
+ /** Spawn an entity from a prefab ID */
761
+ UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Spawn", meta = (WorldContext = "WorldContextObject"))
762
+ static AActor* SpawnPrefab(UObject* WorldContextObject, const FString& PrefabId, FVector Location, FRotator Rotation);
763
+
764
+ /** Find all entities with a specific tag */
765
+ UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Query", meta = (WorldContext = "WorldContextObject"))
766
+ static TArray<AActor*> FindEntitiesWithTag(UObject* WorldContextObject, const FString& Tag);
767
+
768
+ /** Get the distance between two actors */
769
+ UFUNCTION(BlueprintPure, Category = "Nice2Dev|Query")
770
+ static float GetDistance2D(AActor* ActorA, AActor* ActorB);
771
+
772
+ // === State Management ===
773
+
774
+ /** Set a global game variable */
775
+ UFUNCTION(BlueprintCallable, Category = "Nice2Dev|State")
776
+ static void SetGameVariable(const FString& Key, const FString& Value);
777
+
778
+ /** Get a global game variable */
779
+ UFUNCTION(BlueprintPure, Category = "Nice2Dev|State")
780
+ static FString GetGameVariable(const FString& Key);
781
+
782
+ /** Check if a global variable exists */
783
+ UFUNCTION(BlueprintPure, Category = "Nice2Dev|State")
784
+ static bool HasGameVariable(const FString& Key);
785
+
786
+ // === Audio Utilities ===
787
+
788
+ /** Play a sound with volume and pitch variation */
789
+ UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Audio", meta = (WorldContext = "WorldContextObject"))
790
+ static void PlaySoundWithVariation(UObject* WorldContextObject, USoundBase* Sound, FVector Location,
791
+ float VolumeMin = 0.9f, float VolumeMax = 1.0f,
792
+ float PitchMin = 0.95f, float PitchMax = 1.05f);
793
+ };
794
+ `;
795
+ const source = `// Copyright Nice2Dev. All Rights Reserved.
796
+
797
+ #include "Nice2DevBlueprintLibrary.h"
798
+ #include "Kismet/GameplayStatics.h"
799
+ #include "Engine/World.h"
800
+ #include "GameFramework/Actor.h"
801
+
802
+ // Static game variables storage
803
+ static TMap<FString, FString> GameVariables;
804
+
805
+ void UNice2DevBlueprintLibrary::MoveTowards(AActor* Actor, FVector TargetPosition, float Speed, float DeltaTime)
806
+ {
807
+ if (!Actor) return;
808
+
809
+ FVector CurrentLocation = Actor->GetActorLocation();
810
+ FVector Direction = (TargetPosition - CurrentLocation).GetSafeNormal();
811
+ FVector NewLocation = CurrentLocation + Direction * Speed * DeltaTime;
812
+
813
+ // Don't overshoot
814
+ if (FVector::DistSquared(NewLocation, TargetPosition) < FMath::Square(Speed * DeltaTime))
815
+ {
816
+ NewLocation = TargetPosition;
714
817
  }
715
- /* ── Asset Export ───────────────────────────────────────────── */
716
- async exportAsset(asset, _options) {
717
- switch (asset.type) {
718
- case 'sprite':
719
- case 'texture':
720
- this.addWarning('ASSET_MANUAL', `Texture asset "${asset.name}" requires manual import`, 'Import textures through Unreal Editor for proper compression settings');
721
- break;
722
- case 'audio':
723
- this.addWarning('ASSET_MANUAL', `Audio asset "${asset.name}" requires manual import`, 'Import audio through Unreal Editor for proper format conversion');
724
- break;
725
- case 'data':
726
- // Export as DataTable or JSON
727
- this.generateDataAsset(asset);
728
- break;
818
+
819
+ Actor->SetActorLocation(NewLocation);
820
+ }
821
+
822
+ void UNice2DevBlueprintLibrary::LookAt2D(AActor* Actor, FVector TargetPosition)
823
+ {
824
+ if (!Actor) return;
825
+
826
+ FVector CurrentLocation = Actor->GetActorLocation();
827
+ FVector Direction = TargetPosition - CurrentLocation;
828
+ float Angle = FMath::RadiansToDegrees(FMath::Atan2(Direction.Y, Direction.X));
829
+
830
+ Actor->SetActorRotation(FRotator(0.0f, Angle, 0.0f));
831
+ }
832
+
833
+ FVector2D UNice2DevBlueprintLibrary::RandomPointInCircle(FVector2D Center, float Radius)
834
+ {
835
+ float Angle = FMath::FRand() * 2.0f * PI;
836
+ float Distance = FMath::Sqrt(FMath::FRand()) * Radius;
837
+ return Center + FVector2D(FMath::Cos(Angle), FMath::Sin(Angle)) * Distance;
838
+ }
839
+
840
+ FLinearColor UNice2DevBlueprintLibrary::LerpColor(FLinearColor A, FLinearColor B, float Alpha)
841
+ {
842
+ return FLinearColor::LerpUsingHSV(A, B, FMath::Clamp(Alpha, 0.0f, 1.0f));
843
+ }
844
+
845
+ float UNice2DevBlueprintLibrary::Remap(float Value, float InMin, float InMax, float OutMin, float OutMax)
846
+ {
847
+ return OutMin + (Value - InMin) * (OutMax - OutMin) / (InMax - InMin);
848
+ }
849
+
850
+ AActor* UNice2DevBlueprintLibrary::SpawnPrefab(UObject* WorldContextObject, const FString& PrefabId, FVector Location, FRotator Rotation)
851
+ {
852
+ UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
853
+ if (!World) return nullptr;
854
+
855
+ // In production, look up prefab class from a registry
856
+ // For now, return nullptr with a warning
857
+ UE_LOG(LogTemp, Warning, TEXT("SpawnPrefab: Prefab registry not implemented. ID: %s"), *PrefabId);
858
+ return nullptr;
859
+ }
860
+
861
+ TArray<AActor*> UNice2DevBlueprintLibrary::FindEntitiesWithTag(UObject* WorldContextObject, const FString& Tag)
862
+ {
863
+ TArray<AActor*> Result;
864
+ UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
865
+ if (!World) return Result;
866
+
867
+ TArray<AActor*> AllActors;
868
+ UGameplayStatics::GetAllActorsOfClass(World, AActor::StaticClass(), AllActors);
869
+
870
+ for (AActor* Actor : AllActors)
871
+ {
872
+ if (Actor->Tags.Contains(FName(*Tag)))
873
+ {
874
+ Result.Add(Actor);
729
875
  }
730
876
  }
731
- generateDataAsset(asset) {
732
- const sanitizedName = asset.name.replace(/[^a-zA-Z0-9]/g, '');
733
- // Create a simple JSON data asset that can be read by Unreal
734
- const dataContent = {
735
- assetId: asset.id,
736
- assetName: asset.name,
737
- assetType: asset.type,
738
- data: asset.data ?? {},
739
- metadata: asset.metadata ?? {},
740
- };
741
- this.addTextFile(`Content/Data/${sanitizedName}.json`, JSON.stringify(dataContent, null, 2));
877
+
878
+ return Result;
879
+ }
880
+
881
+ float UNice2DevBlueprintLibrary::GetDistance2D(AActor* ActorA, AActor* ActorB)
882
+ {
883
+ if (!ActorA || !ActorB) return 0.0f;
884
+
885
+ FVector LocationA = ActorA->GetActorLocation();
886
+ FVector LocationB = ActorB->GetActorLocation();
887
+
888
+ return FVector2D::Distance(FVector2D(LocationA), FVector2D(LocationB));
889
+ }
890
+
891
+ void UNice2DevBlueprintLibrary::SetGameVariable(const FString& Key, const FString& Value)
892
+ {
893
+ GameVariables.Add(Key, Value);
894
+ }
895
+
896
+ FString UNice2DevBlueprintLibrary::GetGameVariable(const FString& Key)
897
+ {
898
+ if (const FString* Value = GameVariables.Find(Key))
899
+ {
900
+ return *Value;
742
901
  }
743
- /* ── Blueprint Library ──────────────────────────────────────── */
744
- async generateBlueprintLibrary(_project, _options) {
745
- const header = `// Copyright Nice2Dev. All Rights Reserved.
746
-
747
- #pragma once
748
-
749
- #include "CoreMinimal.h"
750
- #include "Kismet/BlueprintFunctionLibrary.h"
751
- #include "Nice2DevBlueprintLibrary.generated.h"
752
-
753
- /**
754
- * Blueprint function library exposing Nice2Dev game engine features
755
- */
756
- UCLASS()
757
- class ${this.moduleName.toUpperCase()}_API UNice2DevBlueprintLibrary : public UBlueprintFunctionLibrary
758
- {
759
- GENERATED_BODY()
760
-
761
- public:
762
- // === Transform Utilities ===
763
-
764
- /** Move an actor towards a target position at specified speed */
765
- UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Movement")
766
- static void MoveTowards(AActor* Actor, FVector TargetPosition, float Speed, float DeltaTime);
767
-
768
- /** Rotate an actor to face a target position */
769
- UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Movement")
770
- static void LookAt2D(AActor* Actor, FVector TargetPosition);
771
-
772
- // === Math Utilities ===
773
-
774
- /** Get a random point within a circle */
775
- UFUNCTION(BlueprintPure, Category = "Nice2Dev|Math")
776
- static FVector2D RandomPointInCircle(FVector2D Center, float Radius);
777
-
778
- /** Lerp between colors */
779
- UFUNCTION(BlueprintPure, Category = "Nice2Dev|Math")
780
- static FLinearColor LerpColor(FLinearColor A, FLinearColor B, float Alpha);
781
-
782
- /** Remap a value from one range to another */
783
- UFUNCTION(BlueprintPure, Category = "Nice2Dev|Math")
784
- static float Remap(float Value, float InMin, float InMax, float OutMin, float OutMax);
785
-
786
- // === Game Utilities ===
787
-
788
- /** Spawn an entity from a prefab ID */
789
- UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Spawn", meta = (WorldContext = "WorldContextObject"))
790
- static AActor* SpawnPrefab(UObject* WorldContextObject, const FString& PrefabId, FVector Location, FRotator Rotation);
791
-
792
- /** Find all entities with a specific tag */
793
- UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Query", meta = (WorldContext = "WorldContextObject"))
794
- static TArray<AActor*> FindEntitiesWithTag(UObject* WorldContextObject, const FString& Tag);
795
-
796
- /** Get the distance between two actors */
797
- UFUNCTION(BlueprintPure, Category = "Nice2Dev|Query")
798
- static float GetDistance2D(AActor* ActorA, AActor* ActorB);
799
-
800
- // === State Management ===
801
-
802
- /** Set a global game variable */
803
- UFUNCTION(BlueprintCallable, Category = "Nice2Dev|State")
804
- static void SetGameVariable(const FString& Key, const FString& Value);
805
-
806
- /** Get a global game variable */
807
- UFUNCTION(BlueprintPure, Category = "Nice2Dev|State")
808
- static FString GetGameVariable(const FString& Key);
809
-
810
- /** Check if a global variable exists */
811
- UFUNCTION(BlueprintPure, Category = "Nice2Dev|State")
812
- static bool HasGameVariable(const FString& Key);
813
-
814
- // === Audio Utilities ===
815
-
816
- /** Play a sound with volume and pitch variation */
817
- UFUNCTION(BlueprintCallable, Category = "Nice2Dev|Audio", meta = (WorldContext = "WorldContextObject"))
818
- static void PlaySoundWithVariation(UObject* WorldContextObject, USoundBase* Sound, FVector Location,
819
- float VolumeMin = 0.9f, float VolumeMax = 1.0f,
820
- float PitchMin = 0.95f, float PitchMax = 1.05f);
821
- };
822
- `;
823
- const source = `// Copyright Nice2Dev. All Rights Reserved.
824
-
825
- #include "Nice2DevBlueprintLibrary.h"
826
- #include "Kismet/GameplayStatics.h"
827
- #include "Engine/World.h"
828
- #include "GameFramework/Actor.h"
829
-
830
- // Static game variables storage
831
- static TMap<FString, FString> GameVariables;
832
-
833
- void UNice2DevBlueprintLibrary::MoveTowards(AActor* Actor, FVector TargetPosition, float Speed, float DeltaTime)
834
- {
835
- if (!Actor) return;
836
-
837
- FVector CurrentLocation = Actor->GetActorLocation();
838
- FVector Direction = (TargetPosition - CurrentLocation).GetSafeNormal();
839
- FVector NewLocation = CurrentLocation + Direction * Speed * DeltaTime;
840
-
841
- // Don't overshoot
842
- if (FVector::DistSquared(NewLocation, TargetPosition) < FMath::Square(Speed * DeltaTime))
843
- {
844
- NewLocation = TargetPosition;
845
- }
846
-
847
- Actor->SetActorLocation(NewLocation);
848
- }
849
-
850
- void UNice2DevBlueprintLibrary::LookAt2D(AActor* Actor, FVector TargetPosition)
851
- {
852
- if (!Actor) return;
853
-
854
- FVector CurrentLocation = Actor->GetActorLocation();
855
- FVector Direction = TargetPosition - CurrentLocation;
856
- float Angle = FMath::RadiansToDegrees(FMath::Atan2(Direction.Y, Direction.X));
857
-
858
- Actor->SetActorRotation(FRotator(0.0f, Angle, 0.0f));
859
- }
860
-
861
- FVector2D UNice2DevBlueprintLibrary::RandomPointInCircle(FVector2D Center, float Radius)
862
- {
863
- float Angle = FMath::FRand() * 2.0f * PI;
864
- float Distance = FMath::Sqrt(FMath::FRand()) * Radius;
865
- return Center + FVector2D(FMath::Cos(Angle), FMath::Sin(Angle)) * Distance;
866
- }
867
-
868
- FLinearColor UNice2DevBlueprintLibrary::LerpColor(FLinearColor A, FLinearColor B, float Alpha)
869
- {
870
- return FLinearColor::LerpUsingHSV(A, B, FMath::Clamp(Alpha, 0.0f, 1.0f));
871
- }
872
-
873
- float UNice2DevBlueprintLibrary::Remap(float Value, float InMin, float InMax, float OutMin, float OutMax)
874
- {
875
- return OutMin + (Value - InMin) * (OutMax - OutMin) / (InMax - InMin);
876
- }
877
-
878
- AActor* UNice2DevBlueprintLibrary::SpawnPrefab(UObject* WorldContextObject, const FString& PrefabId, FVector Location, FRotator Rotation)
879
- {
880
- UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
881
- if (!World) return nullptr;
882
-
883
- // In production, look up prefab class from a registry
884
- // For now, return nullptr with a warning
885
- UE_LOG(LogTemp, Warning, TEXT("SpawnPrefab: Prefab registry not implemented. ID: %s"), *PrefabId);
886
- return nullptr;
887
- }
888
-
889
- TArray<AActor*> UNice2DevBlueprintLibrary::FindEntitiesWithTag(UObject* WorldContextObject, const FString& Tag)
890
- {
891
- TArray<AActor*> Result;
892
- UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
893
- if (!World) return Result;
894
-
895
- TArray<AActor*> AllActors;
896
- UGameplayStatics::GetAllActorsOfClass(World, AActor::StaticClass(), AllActors);
897
-
898
- for (AActor* Actor : AllActors)
899
- {
900
- if (Actor->Tags.Contains(FName(*Tag)))
901
- {
902
- Result.Add(Actor);
903
- }
904
- }
905
-
906
- return Result;
907
- }
908
-
909
- float UNice2DevBlueprintLibrary::GetDistance2D(AActor* ActorA, AActor* ActorB)
910
- {
911
- if (!ActorA || !ActorB) return 0.0f;
912
-
913
- FVector LocationA = ActorA->GetActorLocation();
914
- FVector LocationB = ActorB->GetActorLocation();
915
-
916
- return FVector2D::Distance(FVector2D(LocationA), FVector2D(LocationB));
917
- }
918
-
919
- void UNice2DevBlueprintLibrary::SetGameVariable(const FString& Key, const FString& Value)
920
- {
921
- GameVariables.Add(Key, Value);
922
- }
923
-
924
- FString UNice2DevBlueprintLibrary::GetGameVariable(const FString& Key)
925
- {
926
- if (const FString* Value = GameVariables.Find(Key))
927
- {
928
- return *Value;
929
- }
930
- return FString();
931
- }
932
-
933
- bool UNice2DevBlueprintLibrary::HasGameVariable(const FString& Key)
934
- {
935
- return GameVariables.Contains(Key);
936
- }
937
-
938
- void UNice2DevBlueprintLibrary::PlaySoundWithVariation(UObject* WorldContextObject, USoundBase* Sound, FVector Location,
939
- float VolumeMin, float VolumeMax,
940
- float PitchMin, float PitchMax)
941
- {
942
- if (!Sound) return;
943
-
944
- UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
945
- if (!World) return;
946
-
947
- float Volume = FMath::FRandRange(VolumeMin, VolumeMax);
948
- float Pitch = FMath::FRandRange(PitchMin, PitchMax);
949
-
950
- UGameplayStatics::PlaySoundAtLocation(World, Sound, Location, Volume, Pitch);
951
- }
902
+ return FString();
903
+ }
904
+
905
+ bool UNice2DevBlueprintLibrary::HasGameVariable(const FString& Key)
906
+ {
907
+ return GameVariables.Contains(Key);
908
+ }
909
+
910
+ void UNice2DevBlueprintLibrary::PlaySoundWithVariation(UObject* WorldContextObject, USoundBase* Sound, FVector Location,
911
+ float VolumeMin, float VolumeMax,
912
+ float PitchMin, float PitchMax)
913
+ {
914
+ if (!Sound) return;
915
+
916
+ UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
917
+ if (!World) return;
918
+
919
+ float Volume = FMath::FRandRange(VolumeMin, VolumeMax);
920
+ float Pitch = FMath::FRandRange(PitchMin, PitchMax);
921
+
922
+ UGameplayStatics::PlaySoundAtLocation(World, Sound, Location, Volume, Pitch);
923
+ }
952
924
  `;
953
- this.addTextFile(`Source/${this.moduleName}/Nice2DevBlueprintLibrary.h`, header);
954
- this.addTextFile(`Source/${this.moduleName}/Nice2DevBlueprintLibrary.cpp`, source);
955
- }
925
+ this.addTextFile(`Source/${this.moduleName}/Nice2DevBlueprintLibrary.h`, header);
926
+ this.addTextFile(`Source/${this.moduleName}/Nice2DevBlueprintLibrary.cpp`, source);
927
+ }
956
928
  }
957
- /* ── Factory ──────────────────────────────────────────────────── */
958
929
  function createUnrealExporter() {
959
- return new UnrealExporter();
930
+ return new UnrealExporter();
960
931
  }
961
-
962
932
  exports.UnrealExporter = UnrealExporter;
963
933
  exports.createUnrealExporter = createUnrealExporter;