Horizon World Tutorial - Maze Runner - Part 1 - Creating the World

L

LNATION

Guest
In this five part tutorial series, we'll expand on the concepts from my previous guide, Horizon World Tutorial - Player Management, to create a maze runner game. We'll walk through setting up a new world, building a game controller, adding sound, generating a maze, and adding NPC runners. Before starting, make sure you've completed the Player Management tutorial and are ready to duplicate that world in your Horizon Worlds desktop editor.

So lets begin, first open the Horizon Worlds desktop editor and duplicate your Player Logic world renaming the new world Maze runner.

Duplicate

Rename

Now just test your world has duplicated correctly by entering preview mode and testing the default player controller logic.

Preview

With the basic player logic set up, the next step is to configure our new world. Start by creating the main play area. In the editor, add a cube to represent the floor this will help you visualise the final size of the play area. Although the maze walls will eventually define the space, this temporary floor gives your avatar something to stand on during setup. Set the cube’s position to hz.vec3(0, -0.1, 0) and its scale to hz.Vec3(80, 0.1, 80). You can also adjust the tint color and strength to your preference.

Cube

Cube Properties

When you preview the scene, you might notice that the floor appears extended but the grid is still visible, which doesn't look quite right. To fix this, add an Environment gizmo: go to the Gizmo tab and select Environment. Alternatively, you can use the AI tools to generate an environment for you. After adding the Environment gizmo, open its properties and disable the 'Show Grid' option. This will hide the grid and give your play area a cleaner look.

Grid Showing

Gizmo

Search Environment

Set Properties

Next lets add some invisible walls so that the players cannot run off the game area. Add four transparent cubes to each side of the play area, I use the following Attributes:

Wall North
- position: hz.Vec3(-38,5,0)
- rotation: hz.Vec3(0,0,0)
- scale: hz.Vec3(4,10,80)

Wall East
- position: hz.Vec3(0,5,38)
- rotation: hz.Vec3(0,0,0)
- scale: hz.Vec3(80,10,4)

Wall South
- position: hz.Vec3(38,5,0)
- rotation: hz.Vec3(0,0,0)
- scale: hz.Vec3(4,10,80)

Wall West
- position: hz.Vec3(0,5,-38)
- rotation: hz.Vec3(0,0,0)
- scale: hz.Vec3(80,10,4)

To make transparent just set the visible property of the cube to disabled.

South Wall

Your game area should now look something like this:

Preview Game Area

Next to tidy up our Hierarchy we will group the objects we have just created under an parent object, select the 5 objects and right click and click 'create parent object' option. Once created rename this object to GameArea.

Group Game Area

Game Area

Now that the game area is set up, let's create a lobby where players will spawn before the game begins or while a game is already in progress. To make the experience more engaging, position the lobby above and to the side of the play area so players have a clear view of the maze below as they wait.

First lets create the lobby floor, add a new cube to the world and set the position to hz.Vec3(50,15,0) and scale to hz.Vec3(16,1,16), optionally set the tint to a colour of your choice.

Lobby Floor

Then add some walls to the lobby area so that the players cannot fall. In my example I use the following attributes:

Wall North:
- position: hz.Vec3(42,18,0)
- rotation: hz.Vec3(0,0,0)
- scale: hz.Vec3(0.5,6,16.5)

Wall East
- position: hz.Vec3(50,18,8)
- rotation: hz.Vec3(0,0,0)
- scale: hz.Vec3(16.5,6,0.5)

Wall South
- position: hz.Vec3(58,18,0)
- rotation: hz.Vec3(0,0,0)
- scale: hz.Vec3(0.5,6,16.5)

Wall West
- position: hz.Vec3(50,18,-8)
- rotation: hz.Vec3(0,0,0)
- scale: hz.Vec3(16.5,6,0.5)

Lobby Walls

Our lobby area should now look like this:

Preview Lobby Area

Next we need to move our default spawn location to be inside of our lobby area, you can either drag or just update the position attribute to hz.Vec3(50,17,0) and rotation to hz.Vec3(0,270,0). Now when you preview your world you will spawn into the lobby.

Spawn Point

With the main game area and lobby set up, let's add a few more elements to prepare for building the game controller. In the lobby, place a button that players can press to start the game, a text gizmo we can use to inform the player of the game status and additionally, set up a default leaderboard to get ready for tracking player times. For the button we will use a public asset that I have made available, in the editor navigate to the Asset Library panel and under public assets search for Maze Runner you should find several assets all of which we will use in this tutorial series, for this part we only need the button assets there should be two static and moving add these into your world. Position the static asset hz.Vec3(43,15.5,0) and the moving asset hz.Vec3(43,16.4,0).

Public Assets

Thing

Button Preview

With that in place we need to add a trigger that can be used to activate the button, this should be set to Selectable in Screen mode so that it works transparently on all devices. Position your trigger covering the moving button, I use the following position hz.Vec3(43,16.4,0) and scale hz.Vec3(0.9,0.9,0.9).

Search Trigger

Button Trigger

Now above the button add a default text gizmo which we will later use to update from our controller to inform players in the lobby the status of our game. Open the gizmo panel and search for text, rename the object GameInfo and place it above the button at the position hz.Vec3(42,18,0) and rotation hz.Vec3(0,90,0).

Search text

Game Info

To complete our basic lobby we will next add a leaderboard which we will use to track the fastest times players complete our randomly generated mazes. Under Systems click Leaderboards, then add a new leaderboard and call it Fastest Times and ensure you change the sort order to ascending so we get the fastest and not slowest times.

Systems leaderboards

Create leaderboard

After add the leaderboard to your world via the gizmo panel and searching for World leaderboards, ensure you set the properties to link to the Fastest Times leaderboard you defined in the previous step and then position it to the side of the lobby and scale based on your own preference. In my example I use the hz.Vec3(50,16,8) as the position and hz.Vec3(6,6,1) as the scale.

leaderboard properties

leaderboard preview

Finally before we finish for this part of the tutorial lets tidy up our hierarchy, first create a parent object for the button. Select the ButtonStatic, ButtonMoving and ButtonTrigger assets, right click and Create parent object. Rename the object to StartButton.

startButton

Then select all the remaining objects including the StartButton and SpawnPoint, right click and Create parent object. Rename this object to Lobby.

Select Lobby

Lobby

With these steps complete, your world is now set up and ready for the next phase. In the following part of this tutorial series, we'll begin building the game controller to handle the core gameplay logic.

Final View

Continue reading...
 


Join 𝕋𝕄𝕋 on Telegram
Channel PREVIEW:
Back
Top