Mgameplay

deki-nodegraph

The node graph canvas: an editor window, undo, domains and node registration, with no opinion about what the nodes mean.

What it does

deki-nodegraph is the container and the canvas, not a graph language. It loads a compiled graph asset at runtime and hosts the editor window that authors one. Nothing in it knows what a node does. A consuming package declares its own node types and its own graph domain, and this package draws and runs them.

deki-fsm is the first consumer. A project can add node types of its own the same way, without rebuilding the editor.

Declaring a node type

A node type is a plain reflected struct. The codegen emits its deserializer, its editor metadata and the self-registration that puts it in the registry when the DLL loads.

#include "deki-nodegraph/DekiNode.h"

DEKI_NODE("MyGraph/Flow")           // category: "<DomainKey>/<MenuGroup>"
struct MyWaitNode
{
    DEKI_NODE_NAME("MyWait")
    DEKI_NODE_OUTPUTS("Done")
    DEKI_EXPORT float seconds = 1.0f;
};

Declaring a domain

A domain ties an .asset type to the node categories allowed inside it, and names the node a fresh graph is seeded with. The Node Graph window claims any asset whose type matches a registered domain and scopes its add-node menu to that domain.

REGISTER_NODE_GRAPH_DOMAIN(g_MyDomain,
                           "MyGraph",        // .asset "type" and loader key
                           "My Graph",       // human-readable
                           "MyGraph",        // category filter
                           "MyStart");       // seed node

Nesting

A node can contain an inner graph rather than being a leaf. Double-clicking it descends; a breadcrumb walks back out. An inner graph is a full graph, nested to any depth. Node ids are unique across the whole document, so an id names one node however deep it sits, and links are always local to a single graph. Crossing a boundary is the consumer’s job.

Runtime

Loading is all-or-nothing. Any structural error, unknown node type or failed deserialize destroys everything already created and returns nothing, so a half-built graph never reaches the game. Interpreting pins and links is left to the consumer: deki-fsm walks them as a state machine, another tool could walk the same data as a dialogue tree.

In the editor

The window is built from the editor DLL’s own UI and theme, makes no ImGui calls of its own, and pushes edits onto the editor’s shared command history, so node graph undo interleaves with every other edit. It survives hot reload.