Devlog 3 – Unreal Adventures in PCG

Unreal and PCG

One of the first I noticed about Unreal Engine when I was investigating what to use for my new game was how there was a real focus on Procedural Generation. Being someone who is fairly time poor when it comes to Game Dev, and also someone who likes minimise working, this really appealed to me as a way to short circuit filling in some of my world.

I started following a number of tutorials based on the capability described here –

https://dev.epicgames.com/documentation/en-us/unreal-engine/procedural-content-generation-overview

After a few false starts, and being fairly baffled at what the data sets where, I got to the following point.

A very basic graph, not doing much clever, but also beneficial as a very simple example.

Create a PCG volume, and then use the for a graph with 2 streams at the start – you get a whole bunch of points from the landscape data, a whole bunch of points from the spline data – the “Get” nodes get everything, and the “Sampler” nodes have parameters that define the subset using a pattern.

These 2 data sets go into a difference node – the Landscape points minus the spline points. This goes to the Transform points which scales/rotates randomly, and finally Spawn Actor spits out a Static mesh.

Ignoring the generally crappiness of the textures on display, it’s easy to see the potential of generation on a systematic basis.

PCG Foliage

I then had a bit of a false start. Trying to adapt this PCG approach to spawn a number of trees and bushes over the landscape. After bumping up against various definitions of Static Mesh/Texture, I stumbled upon a specific Unreal beta plugin for procedurally generating Foliage.

Again, after some trial and error, I got some basics working. This one was a fairly useful tutorial.

The foliage spawner was even simpler than PCG. Create a Procedural Foliage Component in your landscape, add a Procedural Foliage Spawner (which is really basic – data driven parameters) including whatever Foliage types you want, and create Static Mesh Foliage types to fill those slots.

I’ve got a really basic volume to try – here you see 2 types of trees – the variations in size/shape are driving purely by PCG. The trees will also not spawn on the drier grass area – again, really straightforward to put a landscape layer that prevents your items spawning there.

Next Steps – PCGEx Plugin

All in all, a fairly successful week. Admittedly my meshes are all rudimetary, but I’m taking it as a positive week as I felt things opened up a bit on what I could achieve on my own.

I think the next thing to pick up is a bit of fortunately timing from last week – while I was having a look at PCG, it so happened that Unreal streamed an event talking about a plugin called PCGEx. I hadn’t heard of it before, but it immediately landed with me.

Tough build by someone else – the Video is mainly a walkthrough by https://jeanpaulsoftware.com/

In particular, the “procedurally build an irregular city” (in this example, London) really landed with. While I’ve got basic splines and meshes/actors spawning, refining this to automatically build town layouts is an exciting prospect.

Talk is here – highly recommended.

Posted in

Leave a comment