Skip to content

Node Editor IPC

Jordan Peck edited this page Feb 15, 2026 · 2 revisions

Overview

The FastNoise2 Node Editor includes an Inter-Process Communication (IPC) system that allows external applications (such as game engines) to communicate bidirectionally with the Node Editor in real-time. This enables powerful workflows where you can:

  • Preview noise in your engine: See node tree changes instantly reflected in your game/engine viewport
  • Live editing: Edit noise parameters in the Node Editor and see immediate results in your running application
  • Send encoded node trees to the node editor: Import a node tree via IPC

The IPC system uses shared memory for fast, low-latency communication between processes and provides a simple C API for easy integration.

Key Features

  • Cross-platform: Works on Windows, Linux, and macOS (not available on Emscripten/Web builds)
  • Low latency: See instant updates, the detached node graph view uses this same API
  • Simple C API: Easy to integrate into any engine or application
  • Bidirectional communication: Both send and receive node tree data

API Reference

Setup and Teardown

void* fnEditorIpcSetup(bool readPrevious);

Initialize IPC connection. Set readPrevious to true if you want the first poll to return any pre-existing selected node tree, or false to only receive new updates.

void fnEditorIpcRelease(void* ipc);

Clean up IPC resources when done.

Receiving Messages

int fnEditorIpcPollMessage(void* ipc, char* outBuffer, int bufferSize);

Poll for new messages. Returns:

  • 1: Selected node message received (User selected/modified a node tree in the editor)
  • 2: Import request received (Consumed by the node graph for importing encoded node trees)
  • 0: No new message
  • -1: Buffer too small

Sending Messages

bool fnEditorIpcSendSelectedNode(void* ipc, const char* encodedNodeTree);

Called by the node graph when the selected node is changed. Can be use to preview node trees in the node editor 3D mesh and texture windows

bool fnEditorIpcSendImportRequest(void* ipc, const char* encodedNodeTree);

Request the node editor node graph window to import a specific encoded node tree.

Process Management

bool fnEditorIpcStartNodeEditor(const char* encodedNodeTree, bool detached, bool childProcess);

Launch a Node Editor instance:

  • encodedNodeTree: Initial tree to load (or NULL)
  • detached: If true, launches graph-only mode without 3D mesh and texture windows
  • childProcess: If true, editor closes when your application exits
void fnEditorIpcSetNodeEditorPath(const char* path);

Manually set the full file path to the NodeEditor executable (optional - overrides automatic discovery).

Integration Guide

Basic Integration Example

Here's how you would integrate the Node Editor IPC into your game engine:

#include "FastNoise/NodeEditorIpc_C.h"

class NoiseEditorIntegration {
private:
    void* ipcContext;
    char receiveBuffer[64 * 1024];
    
public:
    // Initialize during engine startup
    bool Initialize() {
        // Connect to shared memory
        ipcContext = fnEditorIpcSetup(true); // true = get existing node tree if editor is already open
        
        if (!ipcContext) {
            LogWarning("Node Editor IPC not available");
            return false;
        }
        
        return true;
    }
    
    // Call this every frame or at regular intervals
    void Update() {
        if (!ipcContext) return;
        
        // Poll for messages from the editor
        int msgType = fnEditorIpcPollMessage(ipcContext, receiveBuffer, sizeof(receiveBuffer));
        
        if (msgType == FASTNOISE_EDITORIPC_MSG_SELECTED_NODE) {
            // User selected/modified a node tree in the editor
            OnNodeTreeReceived(receiveBuffer);
        }
        else if (msgType == FASTNOISE_EDITORIPC_MSG_BUFFER_TOO_SMALL) {
            LogError("Received node tree too large for buffer");
        }
    }
    
    void OnNodeTreeReceived(const char* encodedNodeTree) {
        // Deserialize the node tree
        auto currentGenerator = FastNoise::NewFromEncodedNodeTree(encodedNodeTree);
        
        if (currentGenerator) {
            // Update your terrain/preview with the new noise
            RegenerateTerrainWithNoise(currentGenerator);
            LogInfo("Applied new noise configuration from editor");
        }
    }
    
    // Send current noise to editor (e.g., when user clicks "Edit in Node Editor")
    void SendToEditor(FastNoiseSmartNode generator) {
        if (!ipcContext) return;
        
        // Serialize to encoded string
        std::string encoded = generator->SerialiseNodeTree();
        
        // Send to editor
        if (!fnEditorIpcSendImportRequest(ipcContext, encoded.c_str())) {
            LogError("Failed to send node tree to editor");
        }
    }
    
    // Launch the editor from your engine
    void LaunchEditor(const char* encodedNodeTree = nullptr, bool childProcess = true) 
    {        
        // Launch in detached mode (graph only, no 3D preview)
        // Set childProcess=true so editor closes when your app closes
        if (!fnEditorIpcStartNodeEditor(encodedNodeTree, true, childProcess)) {
            LogError("Failed to launch Node Editor");
        }
    }
    
    // Cleanup during engine shutdown
    void Shutdown() {
        if (ipcContext) {
            fnEditorIpcRelease(ipcContext);
            ipcContext = nullptr;
        }
    }
};

Workflow Examples

Live Terrain Preview

  1. User opens the Node Editor from your engine's menu
  2. Engine sends current terrain noise configuration to editor
  3. User modifies noise parameters in the editor
  4. Engine receives updates via IPC and regenerates terrain in real-time
  5. User sees immediate feedback in the game viewport

Build System Integration

To use the IPC in your project:

  1. Link against NodeEditorIpc library: You will need to link against the NodeEditorIpc library seperately from FastNoise as they are seperate DLLs Follow the same steps as the FastNoise library form here

  2. Include the header:

#include "FastNoise/NodeEditorIpc_C.h"
  1. Deploy the NodeEditor executable: Make sure NodeEditor (or NodeEditor.exe) is distributed with your application. The IPC will automatically search for it in:
    • The same directory as your executable
    • ../bin/ relative to your executable
    • You can override this with fnEditorIpcSetNodeEditorPath()

How It Works

The IPC system uses a named shared memory region (/FastNoise2NodeEditor) that both your application and the Node Editor can access. Communication is synchronized using an atomic counter byte and includes:

  1. Counter byte: Increments with each message to detect new data
  2. Message type byte: Indicates what kind of message was sent
  3. Payload: Base64-encoded node tree string (up to ~64KB)

Platform Notes

  • Windows: Uses CreateFileMapping / MapViewOfFile
  • Linux/macOS: Uses POSIX shared memory (shm_open / mmap)
  • Emscripten: IPC is disabled (not available in browser environment)
  • Child process behavior: On Linux/macOS, child processes automatically exit when parent dies. On Windows, uses Job Objects for this functionality.

Static Library Builds

The IPC library can be built as either a shared (.dll/.so) or static library. Path discovery works for both configurations.

Multiple Instances

Currently, only one shared memory region exists. Multiple applications connecting simultaneously will all receive the same messages (broadcast behavior).


This IPC system provides a powerful bridge between the FastNoise2 Node Editor and your application, enabling intuitive artist-friendly workflows for procedural noise generation!

Clone this wiki locally