PCG – Core concepts

By jjeromegerstch

What is PCG ?

The Procedural Content Generation Framework (PCG) is a toolset for creating your own procedural content inside Unreal Engine. PCG provides artists and designers the ability to build fast, iterative tools and content of any complexity ranging from asset utilities, such as buildings or biome generation, up to entire worlds.

The PCG framework is built for extensibility and interactivity, providing easy integration into existing world building pipelines, effectively blurring the lines between procedural and more traditional workflows.

Source: https://dev.epicgames.com/documentation/en-us/unreal-engine/procedural-content-generation–framework-in-unreal-engine

PCG allows users to create PCG graphs to process a flow of data and to get it’s result. It can in the process scatter assets, generate geometry, apply terrain deformation, and a lot of other uses cases.

How does it work ?

PCG Subsystem

This subsystem is a UTickableWorldSubsystem so it’s life is tied to the lifetime of a UWorld.

It is the one responsible for starting/tracking and managing the execution of PCG graphs.

It keeps track of dependencies, manage the PCG World Actor and keep track of the PCG components instances.

It also handle the landscape cache – Ticking the UPCGLandscapeCache

It contains the GraphExecutor

When a PCG component Generate() is called it’s the subsystem that Schedule the refresh

I’ll add a post about this one with more indepth informations.

PCG Graph executor

It handles the graph compilation, execution sheduling and canceling

It also handles the cache of the graphs

It handles the threading mutex at the graph task level

PCG World Actor

This is the keeper of the global execution context of graphs that are world level.

There is only one per UWorld

It contains some WorldPatition logic and landscape logic

PCG Component

This is the thing that users will manipulate the most with the graphs.

When any actor with a PCG component is instantiated in the world, it is registered by the PCG subsystem to be linked with the various systems needed to make it compile/run/query the landscape or the World it lives in.

The PCG component Reference the PCGGraphs

It handles the Managed ressources linked to a graph (spawned Static Meshes, Actors,…) in UPCGManagedActors

This is at the PCG Component level that Replication is checked

The seed for the owned PCGGraph is defined at component level. We will have a full post about PCG and seeds later.

PCG Graph

Contains the logic of excecution of the nodegraph

Contains the logic to create a graph

Handle the graph parameters Through FInstancedPropertyBag

PCG Graph Instance

Handle an override version of the PCG graph with specific parameters and name.

the content of the PCGcomponent is a graph Instance.

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *