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