Dungeon Architect for Unity 1.20 Help

Connections

A Connection is a stitching point that the Snap framework uses to join rooms together. A connection contains a reference to a Door asset and a Wall asset.

If two rooms are stitched together through this stitching point, a door will be displayed in that position, otherwise the empty space will be walled off by the specified Wall asset

Create a Connection Asset

Create a new Snap Connection asset in a folder

Create > Dungeon Architect > Snap Grid Flow Builder > Snap Connection

Ut 08 20

This will create a snap connection prefab asset that you can open and customize

Ut 08 21

Customize Connection Asset

Select the newly created snap connection asset and click Open Prefab from the inspector tab

Ut 08 22

After you've opened the snap connection prefab, you'll see that it is setup like this:

Ut 08 23

You will place your wall assets under the Wall game object and the door assets under the Door game object

Dungeon Architect will take care of automatically showing the appropriate game object (wall or door) and hide the other one

Setup Wall Asset

In this example, we'll use a simple cube as a wall. Create a new cube mesh from the create menu

Ut 08 24

Parent this cube under the Wall game object.

Ut 08 25
Ut 08 26

We need the wall to be 4 units wide and 5 units tall (to cleanly cover up the gap we created in our modules previously)

Select the cube mesh and set the scale to (4, 5, 1)

Ut 08 27

The wall should be moved appropriately so that:

  • The red line is at the bottom-center of the wall

  • The wall should be behind the red line's origin point

Move the wall up and a bit back by setting the location to (0, 2.5, -0.5)

Ut 08 28
Ut 08 29

Setup Door Asset

There's a simple Door prefab that comes bundled with the samples. We'll use that here, however, feel free to use your own door prefabs

Navigate to Assets\CodeRespawn\DungeonArchitect_Samples\DemoBuilder_GridFlow\Art\Prefab and drop in the DoorLarge prefab under the Door game object

Ut 08 30
Ut 08 31

Go ahead and hide the Wall game object. Dungeon Architect will take care of making it visible where needed

Ut 08 32
Ut 08 33

The rules for aligning the door with the red line are a bit different

You should move the door asset so that:

  • The red line is at the bottom-center of the door

  • The origin point of the red line should be at the center of the door

Ut 08 35

Our door prefab is already of the correct size (5 units tall and 4 units wide) and the pivot is in the right position. So reset the transform of the DoorLarge game object

Ut 08 34

You'd want your door asset to be twice as thick as the walls. This is because when two adjacent modules are stitched together, we have two walls from each modules and a door that is twice as thick as the walls will cleanly fill up the gap

Setup One-way Door Asset

Some doors will be promoted to one-way doors. This is done so that the player doesn't bypass a locked door and enter through another nearby door. You'll need to provide a door prefab that opens only from one way

Right now, the snap connection is setup to support a Door and a Wall. We are going to add support for a one-way door.

  1. Create a new game object and name it OneWayDoor. This should stay alongside the Door and the Wall prefabs

    Ut 08 36
    Ut 08 37
  2. Select the DoorOneWay game object and reset the transform

    Ut 08 38
    Ut 08 39
  3. Let the SnapConnection know that this game object represents a one-way door. Select the root SnapConnection game object and inspect the properties

    Ut 08 40
    Ut 08 41

    We'll assign our newly created DoorOneWay game object here

    Ut 08 42

We can now place our one-way door assets under this. Navigate to Assets\CodeRespawn\DungeonArchitect_Samples\DemoBuilder_GridFlow\Art\Prefab and drop in DoorLargeOneWay prefab as shown below

Ut 08 43

The alignment rule of a one-way door is similar to a door. The direction in which we are allowed to go through the door should follow the red line outwards

Ut 08 45a

Reset the transform of the asset and rotate it along Y by 180 degrees since it is facing the wrong way

Ut 08 44a
Ut 08 44b
Ut 08 45b

Hide the Door and DoorOneWay game objects

Ut 08 46
Ut 08 47

Our snap connection is now complete and we are ready to place them in our snap modules

Exit out of the snap connection prefab and return to the scene by clicking the Scene button on the viewport

Ut 08 48

Place Connections on Modules

It's now time to use this snap connection on our modules

Open up the Room_1x1A module prefab we created earlier

Ut 08 50
Ut 08 51

Open the Grid and Snap window so we can align our snap connections correctly. Navigate to Edit > Grid and Snap Settings

Ut 08 54
Ut 08 55

Move over to one of the doors in the module prefab

Ut 08 56

Drag and drop the snap connection and align the snap connection origin point in the blue door position. Make sure the red line points outward

Ut 08 57

The position and rotation might be off by a slight margin. Select the snap connection actor and click All Axes button on the Grid and Snap window and it should cleanly snap at the door position

Ut 08 58

Repeat this for all the 4 door openings

Ut 08 59
Last modified: 24 January 2024