Dungeon Architect for Unreal Engine 2.32 Help

Snap Forest PCG Demo

In this tutorial, we'll be creating this:

This tutorial build on these two existing tutorials:

Please go through those first, if you haven't done so already

Download and load up the Electric Dreams project

Create a new Open World level

image|534x454

Assign the landscape material

image|690x336

and drop in a Dungeon Actor and reset the location to ground level (e.g. 0,0,0)

image|607x440

Set the builder type to SnapMap

image|548x500

Module Creation

We'll create individual modules, like you see in the video above. Save this level then create a new empty level for our module

image|534x462
image|690x432

Select the ditch blueprint and select the Spline component, so you can visualizae and modify the spline shape

image|690x348

With the Spline component selected, enabled "Debug Draw" so you can view the spline shape even when the ditch actor is not selected. We'll need this for propertly aligning the connections

image|568x500

Snap Connection

Create an empty snap connection asset.

image|690x444

Drop this connection in a few places around the spline. Don't keep it too close to the spline as the art assets that the ditch blueprint creates around this spline are a bit further away. Place them like this:

image|690x376

Make sure the red connection arrows are facing outwards

Next, drop in a Snap Map Module Bounds actor

image|396x195

Add more points as needed and wrap it around the spline shape. Keep it a bit further away from the spline, as the ditch spline creates the assets outside the spline shape. Make sure the bounds are near the snap connection actor

image|690x381

You may switch to the top view to align everything

image|690x418

Save the module level

image|253x286

Module Database

Create a SnapMap module database and register this module.

image|690x440
image|567x499

Build module database cache

image|405x149

Flow Graph

Create a SnapMap flow graph. These are rules for stitching the levels. Right now we have only one module, registered under the name "Room" in the module database created above

image|690x445

Add a new node and name it Room. We name it Room because we've registerd our module in the ModuleDB with this name

image|690x334

Select the Start Rule and add two Room nodes on the RHS graph and connect them up

image|582x499

This will connect two rooms together. We start with a small graph to make sure the connection setup works. Then we'll move to a larger graphs

Setup Dungeon Actor

Open up the first map we created and select the Dungeon Actor

image|690x324

Change the Builder Class to Snap Map

image|500x500

Then assign the assets we created

image|690x479

Click Build Dungeon, it should stitch the two modules together

image|690x335
image|690x335

Troubleshoot

If it didn't build, make sure the connection points are not too far inside the module bounds

This is how a successful stitch looks like

image|616x500

Either update your connection point positions and rebuild your module database (important!) or increase the collision tollerance to a higher number, this is the amount of overlap the system would tolerate

image|341x294

Improved Flow Graph

Now that we have this working, open up the flow graph and add a more complex rule

image|513x500

Build the dungeon

image|690x322

Randomize, Click Build

image|687x500
image|690x424

Generate Persistent Level

After we generate the dungeon, we want to pass this spline information to the PCG system. So we don't need level streaming here and everything needs to be generated in the current persistent level

Select the dungeon actor and enable GenerateSinglePersistentDungeon

image|690x198

PCG Post Build Setup

After we spawn our rooms into the world (which are ditch splines) We want the PCG system to build everything. Lets create a post build event for it

image|232x500
image|406x432

Open it up and override the OnPostDungeonBuilt function

image|690x286

In this function, we're going to iterate through all the PCGDemo_DitchBP blueprints that were spawned as part of the room module and call the Clean Regen function on it.

Dungeon Architect has a DAGetAllActorsOfClass helper node for this

image|690x186

Assign this to the dungeon actor's Event Listener list

image|379x499

Rebuild the dungeon and it should build the ditch blueprints

image|690x416

Forest PCG Blueprint

Next, drop in a forest PCG bluerpint PCGDemo_ForestBP anywhere on the scene

image|690x364

We'll invoke the Forest PCG bluerpint on our dungeon post build event

image|690x330

Destroy the current dungeon and rebuild the dungeon

image|690x253

Ground PCG Graph

Drop in the Content/PCG/Graphs/Ground/PCGDemo_GroundBP blueprint anywhere on to the scene

image|562x500
image|690x341

Lets invoke this PCG as well, after our dungeon builds

image|690x441

PCG Post Destroy setup

We want to cleanup and rebuild the forest after the dungeon is destroyed

Override the OnPostDungeonDestroyed function

image|690x183

and perform cleanup like this:

image|690x320

Destroying the dungeon should remove the forest

image|690x306
image|690x306

Connection

The adjacent room connections look like this. The geometry from the other room is overlaping

image|690x270

Open up the module and increase the bounds. Also move the connection points outwards (this depends on your art asset placement)

image|545x500

Save and rebuild the module database cache. Then rebuild the dungeon

image|690x293

Opening up connections

Now we need to create a gap so the player can walk through to the other room

The forest and ditch PCG graphs designed by Epic have a logic where generation inside volumes is ignored if that PCGVolume has a PCG_EXCLUDE actor tag

To test this out, drop in a PCGVolume on to the scene

image|361x260

Scale it and place it approximately where the connection is

image|690x433

In the PCGVolume's detail panel, search for Tag and add PCG_EXCLUDE to the actor tag

image|385x500

Destroy and rebuild the dungeon

image|690x336

Open up your connection asset and use a PCG volume as a door

image|442x217
image|690x286

Set the scale to (20, 10, 10)

image|690x349

Set the PCG_EXCLUDE tag in the node template settings

image|494x500

Add more assign assets around the connection opening, like we've done in the video to cover up the gaps

image|690x283
Last modified: 14 September 2024