pcg
Author PCG graph assets: nodes, edges, and procedural-generation node families.
What it’s for
This namespace authors Unreal's Procedural Content Generation graphs (UPCGGraph assets):
you create the graph, append nodes by their settings class, and wire pins together to form a
working procedural pipeline. Your assistant reads the current node and edge structure as text, then
writes changes back one node at a time.
Use it when you want to build or edit a PCG graph without clicking around the graph editor: adding
a points source, a slope or noise filter, a self-pruning pass, or a reference to another graph as a
subgraph. Nodes are addressed by their UPCGSettings subclass path (for example
/Script/PCG.PCGCreatePointsSettings), and every node you add needs an explicit
x/y position because there is no auto-layout on the per-node path.
For common node families there are typed convenience handlers, so you do not have to know each
settings class's field layout: slope-to-density, spatial or attribute noise, subgraph references,
and self-pruning each get a dedicated call with the right knobs. When you would rather work in bulk
or read a whole graph as text, the sibling pcg.pcgir surface offers a text-IR and
decompiler path instead of imperative per-node edits.
Examples
Create a graph and add a points source
Start a fresh PCG graph and drop in a node that generates points.
You: Make a new PCG graph called PCG_Scatter under /Game/PCG and add a Create Points node.
call("pcg.create_graph", {name:"PCG_Scatter", savePath:"/Game/PCG"})
→ {ok:true, path:"/Game/PCG/PCG_Scatter"}
call("pcg.add_node", {graphPath:"/Game/PCG/PCG_Scatter",
nodeClass:"/Script/PCG.PCGCreatePointsSettings", x:0, y:0})
→ {ok:true, node:"PCGCreatePointsSettings_0"}
Done. PCG_Scatter created with a Create Points node.
Wire two nodes together
Connect a node's output pin to the graph's output so the pipeline actually flows.
You: In PCG_Scatter, connect the Create Points node's Out pin into the graph output.
call("pcg.inspect", {graphPath:"/Game/PCG/PCG_Scatter"})
→ {nodes:[...], edges:[]}
call("pcg.connect_pins", {graphPath:"/Game/PCG/PCG_Scatter",
fromNode:"PCGCreatePointsSettings_0", fromPin:"Out",
toNode:"OutputNode", toPin:"In"})
→ {ok:true}
Done. Create Points Out wired to the graph output.
Add a spatial noise filter
Insert a noise node using the typed helper, with a Perlin type and a seed.
You: Add a Perlin spatial noise node to PCG_Scatter with seed 42.
call("pcg.add_noise_filter", {graphPath:"/Game/PCG/PCG_Scatter",
x:300, y:0, kind:"spatial", noiseType:"Perlin2D", seed:42})
→ {ok:true, node:"PCGSpatialNoiseSettings_0"}
Done. Perlin2D spatial noise node added with seed 42.