Skip to content

Room Architecture

BenPyton edited this page Nov 2, 2021 · 9 revisions

Room Architecture

WARNING: This page is for plugin version 2.0.0 and higher. If you use an older version, please read the page (Legacy)-Room-Architecture instead.

Understanding the architecture

Rooms are composed by 2 objects : the level and the data.

The level is an Unreal level where you create your room.
The data is an asset of type RoomData that define the room properties.
You can inherit from RoomData to add properties specific to your dungeon.

How to create a room

First, create a new Unreal level that will contains the actors and meshes of your rooms.

Then create a new blueprint that inherit from RoomData.
For that, expand the "all classes" and type "RoomData" in the search bar and select it.

You can add your own data inside this blueprint class. You can also make multiple RoomData blueprint classes, but I will don't tell you how Unreal works here ;)

After that, you need to create an instance of your new RoomData class (using right click -> Miscellaneous -> Data Asset).

Then, open the RoomData instance you've juste created and set the level field with your newly created level.

Then open your level, and go to the level blueprint (Blueprints -> Open Level Blueprint).

If it's not already done, reparent the blueprint to RoomLevel.

(In general you want to create a lot of room, so you can go to Project Settings -> Engine -> General Settings and set the "Level Script Actor Class" to RoomLevel thus you don't have to reparent each level)

Then, in the data field of this blueprint, set your room data you've just created.

There you have successfully created your room.

Room Parameters

If you have followed the previous steps to create a room, then you should have something like this:

This is a unit room with a door oriented to the north.
All actors and meshes should not cross the red boundary.
Doors are represented by a blue box.
The magenta sphere is the room origin (this cannot be changed).

You can set the size of your room (the red box) in its RoomData instance.

This size is expressed in room unit, can't be a float value and should not be negative nor zero.
For example, if your room unit is 10m*10m*4m and your real room size is 5m*23m*10m, then your room data size should be 1*3*3.

You can add as many door as you want in your room, and the entrance will be chosen randomly at generation (if checked).
But keep in mind that a door has to be on the border of the room boundary, not inside, and the arrow have to point to the outside of the room boundary.

Door positions are expressed in room unit and correspond to the "cell" of the room.

You can change room unit and door size in Project Settings -> Plugins -> Procedural Dungeon.

Clone this wiki locally