Dungeon Architect for Unreal Engine 2.32 Help

Setup GridFlow Gameplay

We'll clone an GridFlow sample scene and setup gameplay on it from scratch

Open Launch pad and clone this scene somewhere

image|689x141
image|690x424

Open the scene, select the dungeon actor and destroy the dungeon

image|690x408

Hitting play won't do anything, as there's no gameplay in this scene. We'll set that up now. For this, we need a custom GameMode

Game Mode

Create a blueprint that derives from GameMode (not GameModeBase)

image|472x375
image|564x431
image|674x479

We want our dungeon to build in a non-blocking way, where it's built over multiple frames. During this time, you may show an animated loading screen. In this example, we'll keep the player in specitator mode and start the game (spawn our character) only after the dungeon has been fully built

Build the dungeon

Do thie following:

  • Create a bool variable to control when the game starts. Call this CanStartGame and set the default value to false

    image|369x109
  • Place this logic in BeginPlay. Here we randomize the seed and build the dungoen. Before that, we hook on to the OnDungeonBuildComplete event so we get notified when it is fully built. When that happens, we set the boolean flag to true, which would then start the game (logic for that later below)

    image|690x174

ReadToStartMatch - Control when the game starts

Override the function Read to Start Match

image|381x500

Return the Can Start Game bool variable value.

image|690x366

This would tell the engine to start the game only after our dungeon is fully built.

Detailed explanation of how this function works:

Read to Start Match gets called by the engine repeatedly every tick to check if we can start the game. If you don't want to start the game, keep returning false here until you are ready, which is what we're doing here This flag gets set to true after our dungeon gets fully built, at which point we're ready to start

Find Player Start

You need to tell the engine which player start to use Override the FindPlayerStart function in your game mode blueprint

image|690x441

Put this code in:

image|690x213

Delete default Player Start

Our theme file spawns a Player Start actor in the spawn room. We want our FindPlayerStart function to search and pick this one up. So, we need to make sure we don't have any other PlayerStart actors in the scene.

When we created a new scene, there was a default PlayerStart actor, We need to delete this so it doesn't pick that up and place our character in an invalid location

image|637x230
image|637x230

Assign the game mode

With the level opened, open the World Settings window. Navigate to Settings > World Settings

image|690x445

You'll find the Settings button on the top right corner of Unreal Editor

image|690x257

Hit play and you should see your default pawn (with fly mode) placed at the spawn room

image|690x331

Use a custom character

Lets use a Third Person character. Open up your game mode asset, navigate to Class Defaults

image|420x107

Set the Default Pawn Class to something else. I've set it to a third person character (if you don't have it, then add it from the Content Browser > Add > Add Content or Feature Pack > Third Person Character)

/Game/ThirdPerson/Blueprints/BP_ThirdPersonCharacter

image|690x301
image|689x399

If you're not able to move the character or look around, open up the character blueprint and check the Begin Play event. This is how it looks like:

image|690x161

To fix it, do this:

image|690x373

Async Build

If you want your dungeon to build over multiple frames and not stall for a bit while the meshes spawn in, set it to a non-zero value.

image|634x500

Here, I allow the system to use up a max of 64ms per frame to spawn in the meshes. It will spread out the mesh spawns over multiple frames.

HUD and Inventory

Setup Player Controller

Create a Player Controller so we can display the inventory HUD, that comes along with the sample.

image|595x304
image|583x467

Open up the Game Mode asset and assign the new player controller, so it picks it up

image|298x383
image|514x92
image|690x346

Spawn HUD

Open the new player controller

image|258x376

Spawn this widget in: /Script/UMGEditor.WidgetBlueprint'/DungeonArchitect/Showcase/Legacy/Samples/DA_GridFlow_Game/UI/UI_GridFowDemo_HUD.UI_GridFowDemo_HUD'

image|690x176
image|690x435

Setup Inventory

Open the third person character and add the inventory component

image|690x363

Your character should now be able to pick up keys

image|690x468
image|690x468

and open the right doors with those keys

image|690x468
image|690x468
Last modified: 15 November 2024