### Setup Requirements Example Source: https://github.com/protospatial/nodetocode/wiki/Implementation-Notes Example detailing setup requirements, including required modules, include statements, and Build.cs modifications. ```plaintext Required Module: "GameplayTasks" Required Include: #include "GameplayTask.h" Build.cs Addition: "GameplayTasks" ``` -------------------------------- ### Blueprint Interface Changes Example Source: https://github.com/protospatial/nodetocode/wiki/Implementation-Notes Example outlining changes to the Blueprint interface, including category, parameter modifications, event replacements, and replication setup. ```plaintext Blueprint Category: "MyGame|Utilities" Parameter Changes: Now requires valid component reference Event Changes: Replaced with interface call Replication: Multicast setup required ``` -------------------------------- ### Optimization Suggestions Example Source: https://github.com/protospatial/nodetocode/wiki/Implementation-Notes Example of optimization suggestions, such as caching opportunities, batch processing, memory usage, and algorithm updates. ```plaintext Caching Opportunity: Component reference Batch Processing: Consider array operations Memory Usage: Pool temporary objects Algorithm Update: Use spatial partitioning ``` -------------------------------- ### Start LM Studio Server via CLI Source: https://github.com/protospatial/nodetocode/wiki/LM-Studio-Quick-Start Use the LM Studio command-line interface to start the server. Ensure the CLI is bootstrapped first. ```bash lms server start ``` -------------------------------- ### Usage Guideline Example Source: https://github.com/protospatial/nodetocode/wiki/Implementation-Notes Example of a usage guideline for translated AsyncTask. It advises calling from the game thread only and suggests using RunOnGameThread() for worker threads. ```cpp // Example usage note: "The translated AsyncTask should be called from game thread only. Consider using RunOnGameThread() for worker thread calls." ``` -------------------------------- ### Integration Note Example Source: https://github.com/protospatial/nodetocode/wiki/Implementation-Notes Example of an integration note detailing required module dependencies for translation. Add specified modules to your Build.cs file. ```cpp // Example integration note: "This translation requires the 'GameplayTasks' module. Add the following to your Build.cs: PublicDependencyModuleNames.AddRange(new string[] { "GameplayTasks" });" ``` -------------------------------- ### Blueprint Compatibility Example Source: https://github.com/protospatial/nodetocode/wiki/Implementation-Notes Example of a blueprint compatibility note. It highlights that the function is Blueprint-callable but requires latent action handling in C++. ```cpp // Example compatibility note: "This function remains Blueprint-callable but requires latent action handling in C++. See implementation details." ``` -------------------------------- ### Implementation Notes Example Source: https://github.com/protospatial/nodetocode/blob/main/Content/Prompting/CodeGen_Swift.md Demonstrates the 'implementationNotes' field, used for providing context, compilation requirements, or behavioral explanations for the generated Swift code. ```text Ensure all external dependencies are correctly imported. Handle potential nil values gracefully. Match the exact naming conventions specified in the project guidelines. ``` -------------------------------- ### Runtime Considerations Example Source: https://github.com/protospatial/nodetocode/wiki/Implementation-Notes Example of runtime considerations, specifying thread safety, memory management, network role, and performance impact. ```plaintext Thread Safety: Main thread only Memory Management: Uses weak pointers for safety Network Role: Server-side execution Performance Impact: O(n) complexity ``` -------------------------------- ### Onboarding Example with Links to Translated Files Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Provide links to saved translation files in onboarding documentation to help new team members understand core implementation patterns without needing to navigate complex Blueprints. ```text // In onboarding docs To understand our camera system without diving into complex Blueprint graphs, review these translated versions that show the core implementation patterns we use: - Blueprint System #1: [link to saved .cpp file] - Blueprint System #2: [link to saved .cpp file] - Blueprint System #3: [link to saved .cpp file] ``` -------------------------------- ### Performance Consideration Example Source: https://github.com/protospatial/nodetocode/wiki/Implementation-Notes Example of a performance consideration note recommending component reference caching for frequent access to avoid repeated lookups. ```cpp // Example performance note: "Consider caching the component reference rather than getting it every tick if frequent access is needed." ``` -------------------------------- ### Swift Function/Graph Implementation Example Source: https://github.com/protospatial/nodetocode/blob/main/Content/Prompting/CodeGen_Swift.md Shows the 'graphImplementation' field for Swift functions or graphs, containing the Swift code for the logic flow. ```swift func myFunction(input: Int) -> Int { // Swift logic implementation let result = input * 2 return result } ``` -------------------------------- ### Reference Actor Header for Code Generation Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code An example header file demonstrating proper Unreal Engine class and property declaration patterns for use as a reference during code generation. ```cpp // Example header to include as reference: UCLASS() class MYGAME_API AMyBaseActor : public AActor { GENERATED_BODY() public: // Document your patterns UFUNCTION(BlueprintCallable, Category = "MyGame|Utilities") void StandardUtilityFunction(); // Show proper property usage UPROPERTY(EditDefaultsOnly, Category = "MyGame|Configuration") float ConfigValue; }; ``` -------------------------------- ### Pseudocode Translation Example for Collaboration Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Share pseudocode files directly in chat applications for troubleshooting and discussion without needing to send screenshots of complex Blueprint graphs. ```text // In Discord/Slack/Email Hey Jane! I'm struggling with understanding why the grabbing logic isn't working in BP_TrackedHand. I think I narrowed it down to the DetectInteractableObjects function. Instead of sending screenshots of the Blueprint, I've attached the pseudocode version of function. Thoughts? [Attach the GraphName.md file from your Pseudocode translation] The issue seems to be around line 42 where the path calculation occurs. ``` -------------------------------- ### List Installed Ollama Models Source: https://github.com/protospatial/nodetocode/wiki/Translation-Fails-or-Hangs This command lists all models currently installed on your Ollama instance. Verify that the model specified in your plugin settings is present. ```bash ollama list ``` -------------------------------- ### Locate Unreal Engine Plugins Directory Source: https://github.com/protospatial/nodetocode/wiki/Plugin-Installation This path indicates where to find installed plugins within your Unreal Engine directory. ```bash /Engine/Plugins/Marketplace ``` -------------------------------- ### C++ Translation Example for Code Reviews Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Paste the contents of header and implementation files into code review tools to facilitate feedback on Blueprint logic without requiring editor access. ```text // In a PR comment or code review tool I've implemented the inventory system in Blueprint but looking for feedback on the structure. Here's the C++ equivalent for easier review: [Paste the contents of GraphName.h and GraphName.cpp] Specifically, I'm unsure about the efficiency of the item lookup method. ``` -------------------------------- ### Translate Blueprint Variable Access to C++ Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Shows how Blueprint 'Get' and 'Set' nodes translate to direct C++ property access and assignment, including safe access checks. ```cpp // Blueprint "Get" node becomes direct property access float Value = MyVariable; // Blueprint "Set" node becomes assignment MyVariable = NewValue; // Blueprint "Get" with validity check becomes: if (UObject* Object = MyObjectVariable) { // Safe usage here } ``` -------------------------------- ### Swift Struct/Enum Declaration Example Source: https://github.com/protospatial/nodetocode/blob/main/Content/Prompting/CodeGen_Swift.md Illustrates the 'graphDeclaration' field for Swift structs or enums, which contains the Swift syntax for their definition. ```swift struct MyStruct { var property: Int } enum MyEnum { case option1 case option2 } ``` -------------------------------- ### C# Class Method Generation (Unity MonoBehaviour) Source: https://github.com/protospatial/nodetocode/blob/main/Content/Prompting/CodeGen_CSharp.md Implement C# methods within a Unity MonoBehaviour script. Use [SerializeField] for inspector-exposed variables and map Unreal event names to Unity equivalents (BeginPlay → Start, Tick → Update). ```csharp using UnityEngine; public class MyComponent : MonoBehaviour { [SerializeField] private float speed = 5.0f; void Start() { // Equivalent to Unreal's BeginPlay Debug.Log("Component Started!"); } void Update() { // Equivalent to Unreal's Tick transform.Translate(Vector3.forward * speed * Time.deltaTime); } void Awake() { // Equivalent to Unreal's Construction Script Debug.Log("Component Initialized!"); } } ``` -------------------------------- ### Document UE C++ Patterns Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Create a personal reference library by comparing Blueprint screenshots with their generated C++ code implementations for common patterns like event binding and raycasting. ```plaintext # My UE C++ Pattern Reference ## Event Binding Implementation Blueprint: [Screenshot of Event Binding nodes] C++ Implementation: [Paste the relevant event binding code section from translation] ## Custom Trace/Raycast Pattern Blueprint: [Screenshot of trace/raycast nodes] C++ Implementation: [Paste the relevant trace/raycast code from translation] ``` -------------------------------- ### Identify Performance Bottlenecks with Profiling Data Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Document profiling results and recommended actions for performance optimization, including converting Blueprint functions to C++, implementing spatial partitioning, batching raycasts, and caching calculations. ```plaintext // In a development note or performance ticket Title: Critical Performance Investigation - AI Navigation System Bottleneck Priority: High Platform: Quest 3 Profiling Results: - Game Thread spike identified during heavy combat (15+ AI agents) - Unreal Insights shows BP_EnemyController→UpdateTacticalPosition consuming 3.8ms average - Occurring every tick (90fps target = 11.11ms budget) - Major hitching when multiple agents recalculate paths simultaneously I've translated the Blueprint to C++ using N2C: [Paste relevant C++ translation] Recommended Action: 1. Convert this entire function to C++ 2. Implement spatial partitioning to reduce cover point checks 3. Batch raycasts using AsyncLineTraceMultiByChannel 4. Cache squad matrix calculations and update less frequently 5. Move intensive calculations to async task graph ``` -------------------------------- ### C++ Enum Definition Example Source: https://github.com/protospatial/nodetocode/blob/main/Content/Prompting/CodeGen_CPP.md Example of an enum definition within the N2C JSON structure. The 'graphDeclaration' field holds the enum definition, while 'graphImplementation' is empty for enums. ```json { "graph_name": "SomeEnumName", "graph_type": "Enum", "graph_class": "", "code": { "graphDeclaration": "...enum definition goes here if enum is provided...", "graphImplementation": "", "implementationNotes": "..." } } ``` -------------------------------- ### Refine UFUNCTION Declaration Source: https://github.com/protospatial/nodetocode/wiki/Copy-&-Integrate Example of refining a generated UFUNCTION declaration by adding a Category for better organization in Unreal Engine Blueprints. ```cpp // Example of common adjustments needed: // Before (generated): UFUNCTION(BlueprintCallable) void ProcessData(const TArray& Data); // After (refined): UFUNCTION(BlueprintCallable, Category = "MyGame|DataProcessing") void ProcessData(const TArray& Data); ``` -------------------------------- ### Include Component Header in Source File Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Shows the necessary include for a component's full definition in the corresponding source (.cpp) file, after a forward declaration in the header. ```cpp // In header (.h) #include "GameFramework/Actor.h" class UMyComponent; // Forward declaration for pointers/references // In source (.cpp) #include "MyComponent.h" // Full include for implementation ``` -------------------------------- ### Ask LLM for C++ Optimization Help Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Provide your C++ translation of Blueprint logic and ask for specific performance optimizations to reduce game thread overhead. ```plaintext I have a Blueprint system in Unreal Engine that I've translated to C++. I'm seeing performance issues in this specific part: [Paste relevant section from the C++ translation inside a code block] How can I optimize this to reduce game thread overhead while maintaining the same functionality? ``` -------------------------------- ### Pull Required Ollama Model Source: https://github.com/protospatial/nodetocode/wiki/Translation-Fails-or-Hangs If a required model is missing, use this command to download and install it. Ensure the model name matches your plugin configuration. ```bash ollama pull codellama:code ``` -------------------------------- ### Python For Loop for ForLoop Node Source: https://github.com/protospatial/nodetocode/blob/main/Content/Prompting/CodeGen_Python.md Translates a Blueprint ForLoop node into a Python for loop. Adjust the range based on the node's start, end, and step configuration. ```Python for i in range(start, end + 1): # Code to execute for each iteration ``` -------------------------------- ### Fixing Unsafe Object Creation Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Demonstrates how to add null checks for newly created objects to prevent potential crashes. This is crucial when the creation function might fail. ```cpp // Generated code with potential issues UObject* NewObject = CreateObject(); // No null check NewObject->DoSomething(); // Potential crash ``` ```cpp if (UObject* NewObject = CreateObject()) { // Safe to use NewObject->DoSomething(); } ``` -------------------------------- ### Copy Plugin to Project Directory Source: https://github.com/protospatial/nodetocode/wiki/Plugin-Installation This shows the structure of the NodeToCode plugin folder when copying it to your project's Plugins directory. ```bash YourProject/Plugins/NodeToCode/ ├── NodeToCode.uplugin ├── Resources/ ├── Source/ ├── Docs/ └── Content/ ``` -------------------------------- ### Implement Latent Actions for Blueprint Latent Nodes Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Addresses the problem of directly translating latent Blueprint nodes (like Delay) by showing how to use Unreal Engine's Latent Action Manager for proper asynchronous execution. ```cpp // Generated code attempting direct latent operation void MyLatentOperation() { Delay(2.0f); // Won't work as expected } ``` ```cpp UFUNCTION(BlueprintCallable, meta = (Latent, LatentInfo = "LatentInfo")) void MyLatentOperation(FLatentActionInfo LatentInfo) { if (UWorld* World = GetWorld()) { FLatentActionManager& LatentManager = World->GetLatentActionManager(); FMyLatentAction* Action = new FMyLatentAction(LatentInfo); LatentManager.AddNewAction(LatentInfo.CallbackTarget, LatentInfo.UUID, Action); } } ``` -------------------------------- ### Markdown Documentation with C++ and Pseudocode Translations Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Integrate translated code snippets into internal wikis or documentation pages to explain implementation details and Blueprint flow. ```markdown ## Inventory System Technical Documentation ### Design Overview [Paste system diagram or high-level description] ### Implementation Details Our inventory system uses the following core algorithm (extracted from Blueprint): [Paste relevant sections from the C++ translation inside a code block] ### Blueprint Flow Explanation For a complete overview of the Blueprint logic flow in text form: [Paste pseudocode translation here inside a code block] ``` -------------------------------- ### Track Blueprint Evolution with Git Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Include Node to Code translations in version control using Git to track the evolution of Blueprint systems over time. ```bash # Include translations in version control to track Blueprint evolution over time git add ProjectRoot/Saved/NodeToCode/Translations/MyImportantSystem_*/*.{h,cpp,md} git commit -m "Add Blueprint translations for reference" ``` -------------------------------- ### Translate Blueprint Event Handling to C++ Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Converts Blueprint BeginPlay and Tick events into their C++ virtual function overrides. ```cpp // Blueprint BeginPlay event becomes: virtual void BeginPlay() override { Super::BeginPlay(); // Translated logic here } // Blueprint Tick event becomes: virtual void Tick(float DeltaTime) override { Super::Tick(DeltaTime); // Translated logic here } ``` -------------------------------- ### Annotate and Optimize Incremental Migration Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Use comments like TODO and FIXME in your C++ code to mark areas for future optimization, error handling, or refactoring during incremental migration from Blueprint. ```cpp // Start with Node to Code translation [Paste GraphName.h and GraphName.cpp to your IDE] // Then annotate and optimize as needed: // TODO: Optimize this loop for better cache coherency // TODO: Add error handling for edge cases // FIXME: This allocation could be moved outside the tick function ``` -------------------------------- ### Translate Blueprint Flow Control to C++ Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Illustrates the translation of Blueprint branch, sequence, and for-each loop nodes into C++ if-else statements, sequential calls, and range-based for loops. ```cpp // Blueprint branch node becomes if-else if (Condition) { // True path } else { // False path } // Blueprint sequence node becomes sequential statements FirstFunction(); SecondFunction(); ThirdFunction(); // Blueprint for-each loop becomes range-based for for (AActor* Actor : TActorRange(GetWorld())) { // Loop body } ``` -------------------------------- ### Correct UE Type Usage Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Illustrates the difference between poor and better quality C++ code regarding Unreal Engine type usage, focusing on memory management, array initialization, and vector initialization. ```cpp // Poor quality example: FString* StringPtr = new FString("Unsafe"); // Manual memory management TArray Numbers; // Missing size hints FVector Location(0); // Incomplete initialization // Better quality example: FString SafeString = TEXT("Safe"); // Automatic memory management TArray Numbers; // Explicit integer type FVector Location(0.0f, 0.0f, 0.0f); // Full initialization ``` -------------------------------- ### Add Missing UE Metadata Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Shows how to add necessary Unreal Engine metadata like UFUNCTION and UPROPERTY to C++ declarations to make them accessible in the editor and Blueprints. ```cpp // Poor quality example: void ProcessData(); // Missing UFUNCTION FString PlayerName; // Missing UPROPERTY // Better quality example: UFUNCTION(BlueprintCallable, Category = "Data Processing") void ProcessData(); UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Player Info") FString PlayerName; ``` -------------------------------- ### Compare Blueprint Changes with Diff Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Use the diff command to compare different versions of C++ translations of Blueprint logic, helping to track changes over time. ```bash # To compare Blueprint changes over time: diff ProjectRoot/Saved/NodeToCode/Translations/MySystem_2025-03-01/CalculatePath.cpp \ ProjectRoot/Saved/NodeToCode/Translations/MySystem_2025-04-01/CalculatePath.cpp ``` -------------------------------- ### Documenting Modified C++ Functions Source: https://github.com/protospatial/nodetocode/wiki/Improving-Generated-Code Shows how to add documentation comments (Doxygen style) to C++ functions, explaining their purpose, parameters, and return values, especially when modified from original Blueprint translations. ```cpp /** * Modified from Blueprint translation to handle edge cases * @param Input - Description of input parameter * @return Description of return value */ UFUNCTION(BlueprintCallable, Category = "MyFunctions") float ModifiedFunction(float Input); ``` -------------------------------- ### Ask LLM to Expand C++ Code Source: https://github.com/protospatial/nodetocode/wiki/Utilizing-Saved-Translations Present your C++ translation of Blueprint logic and request guidance on modifying it to implement new features. ```plaintext Here's my current Blueprint logic translated to C++: [Paste GraphName.cpp content] I want to expand this to include [new feature description]. Can you suggest how I would modify this code to implement that functionality? ```