Skip to main content
Version: 3.6

Custom Create Dungeon Function

Introduction

The provided Dungeon Generator class in the plugin has a basic default generation algorithm.
Its behavior is to create a first room and then add new rooms to existing doors.

See the Create Dungeon function in the diagram below:

dungeon changed
OR generate called
Idle
all levels
unloaded
Unload Levels
all levels loaded
and initialized
Load Levels
is server AND
generate called
else
Pre Generation
Post Generation
Generation Init
no
Choose First Room
Choose Next Room
no
On Room Added
no
yes
Is Dungeon
Valid?
yes
no
All Tries
Exhausted?
Initialize Dungeon
Generation Failed
Must be overriden
Can be overriden
Internal only
Dungeon Generator's
State Machine
Continue To
Add Room?
yes
yes
no
Create Dungeon
Function
Start
End
LEGEND
Room Limit
Reached?
yes
yes
no
All Tries
Exhausted?
On Failed to Add Room
yes
Can Place
Room?
This function is
overridable !!!
Create Dungeon
Generation Success

If you are not satisfied with this default behavior, you can write your own Create Dungeon function while keeping the core features of the generator.

The Dungeon Generator Base class

To write your own custom Create Dungeon, you'll need to create a new class deriving from Dungeon Generator Base.
This class has the core features of a dungeon generator: the state machine to load/unload the level instances (shown in the diagram above), the network replication, the room culling system, etc.

You have to create a new blueprint class deriving from Dungeon Generator Base.

Then, the Create Dungeon function become overridable.

There are several functions to use inside the Create Dungeon.
See the screenshot below for a list of them, and how to use them.

caution

This is a non-working example!
Just to show you the most important functions and their use.