Prototyping Unreal Engine 5: Level Blockouts

Learn how to do level prototyping for Unreal Engine 5, using blockouts and Blueprints to define basic gameplay. By Ricardo Santos.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 3 of 4 of this article. Click here to view the first page.

Adding Movement to the Level

While the scene looks better now, it doesn’t have much going on. Next, it’s time to add some moving elements to your level.

Adding Level Blockout Elements

To make sure the player can explore the whole level, you’ll create a path for the character to climb to the walkway facing the castle courtyard. To do that, you’ll add a few floating platforms. Go into Modeling Mode again and create a box with Width and Depth of 150. Set its Height to 50, with the M_Prototype_Grid_Walkable Material applied to it. Place the cube anywhere, and click Accept to add the geometry to your level.

Details for creating the project platform

Now, make a path using the platforms to allow the player character to get to the walkway on top of the castle wall. To do so, get the recently created platform, place it on the side of the house and set its Z coordinate to 50.

With the platform still selected, press Control-D (for MacOS users too!) on your keyboard to duplicate the platform. Place it in front of the house, and set the Z coordinate to 550.

Duplicate the platform again, set its Z coordinate to 670 and place it between the second platform and the walkway. Once you’ve done all that, your scene should look like this:

The platforms to climb the walls and the house

Don’t worry about perfect coordinates and positions. The goal is to allow the player to roam the level floor up to the castle walkway.

In fact, it’s a good idea for you to stop reading for a while and play with the platform positions. Test how different positions and numbers of platforms could allow for different gameplay possibilities.

Adding Blockout Volumes to Blueprints

The game is coming along well so far — you have a 3D platformer level, but there isn’t much movement. You want to make it more interesting. To accomplish this, you’ll add Blueprint elements in your level, using some code to add movement to the platform you’ve created.

In the Content Browser, navigate to Content ▸ LevelPrototyping. Create a Blueprints folder. Right-click within that folder and select Blueprint Class in the context menu that appears.

Creating a Blueprint class

In the dialog box, click Actor and name the new Blueprint Class MovingPlatform. Double-click to open the class.

On the Components tab, on the left side of the window, select the element DefaultSceneRoot. Use the Add button to create a Static Mesh component. Name it Platform.

Add two Arrow Components, and name them Initial and Final. Add one Cube element, and name it Distance.

Blueprint class components

To add the platform static mesh, select the Platform component of the Blueprint Class. In the Details area, under the Static Mesh section, use the dropdown to select the platform you just created in Modeling Mode.

Selecting the box static mesh created in the Modeling Mode

Select the Arrow element named Final, and set its location Z coordinate to 400. Finally, select the Distance box and set its Transform coordinates as follows:

Distance box preparation

Scroll down the Details pane and look for the Collision section. Under this section, find Collision Presets and select NoCollision in the dropdown box. Scroll down a little bit more to the Rendering section. Under the Rendering section, check the Hidden in Game box.

All these settings will make the Distance element appear only in the editor and not interfere with the gameplay. This element marks the path the platform will travel when the game plays, which allows you to view the path the platform travels even before testing the level.

The final result should look like this:

The final result for the moving platform Blueprint class

However, if you place this component in the level, nothing will happen, as there’s no programming yet.

Adding Behavior to Blockout Elements

You have a platform that should move, but if you put it in the level now, it’ll sit still. To remedy this situation, you’ll add some code into the Event Graph tab of the Blueprint Editor.

The Event Graph tab

This platform will begin moving in a linear path when the level loads and will travel from the point marked by the Arrow Component Initial to the point marked by the Arrow Component Final. Find the Event BeginPlay node, click and drag the Exec arrow out to open the Node Selection context menu. In it, search for and select the Move Component To node.

Now, drag the Platform component from the Components tab into the Event Graph, and connect it to the Component pin of the Move Component To node.

Connecting the platform node

Drag the Final component into the Event Graph. Click, drag out of, and release the pin on this node. Search for and select the Get Relative Location node from the context box, and connect the Relative Location output pin to the Target Relative Location pin of the Move Component To node.

Getting the Relative Location of the Final arrow component

This will make the platform move from the position of the Initial Arrow Component to the position of the Final Arrow Component. Now, you need to perform the inverse path. To do this, drag out from the Completed arrow of Move Component To and add a second Move Component To node. Connect the Platform component like you did before, and use the Initial arrow instead of the Final arrow for the Target Relative Location. The result should look like this:

The code up to this point

To make sure the movement is continuous, drag out of the second Move Component To node’s Completed arrow to the Move pin of the first one.

The nodes connected to move the platform continuously

Finally, to allow more flexibility for the class, promote the pin Over Time of the first node to a variable by clicking, dragging out, releasing and selecting the Promote to Variable option. Accept the default name for this variable and connect it to the other Move Component To node.

Promote Over Time to variable

Compile the Blueprint. Click the Over Time variable and set the Default Value of Over Time to 3.0. Compile and save the class. Go back to the Editor window and drag your Moving Platform into the level and Play to see it working.

The moving platform working

Diversifying Behavior on Level Elements

The platform works — it flies up and down. You might want to add diversity to the gameplay and make a platform that moves sideways or diagonally. Or maybe even a platform that goes a little farther up, or not as high.

You might think it would be necessary to create another Blueprint Class that implements another kind of movement. However, you defined that the platform should move between the Initial Arrow Component and the Final Arrow Component. Hence, by modifying the position of the Final Arrow Component, the platform behavior changes as well.

To do so, select the moving platform element in the scene and select the Final Arrow Component in the Details tab. You’ll notice a gizmo appears in the Editor window that allows you to change its position in the scene.

Moving the final platform point

Now, change the place of the final point of the movement and click Play to see how the platform movement changes.