Creating a landscape

One of the first things that we will need to do to work with build terrain is to create a landscape through Unreal Engine's Landscape mode, so let's get started!

Getting ready

Before we start working within the Unreal Editor, we will need to have a project to work with:

  1. First, open up the Unreal Editor by clicking on the Launch button from Unreal Engine Launcher.
  2. Start a new project from the Project Browser tab by selecting the New Project tab. Select First person and make sure that With Starter Content is selected. Give the project a Name (Cookbook_Chapter4). Once you are done, click on Create Project.

How to do it…

Now that we have our project set up, let's get started with building a landscape:

  1. With the editor up, we will first want to create a new level for us to work in. To do this, go to the top-left of the screen and select File | New Level… or press Ctrl + N.
  2. From here, you'll have the New Level window pop up. Click on the Default template, and you will have an empty level to work with.
  3. Since we are going to create everything from a terrain, we don't need to have the default floor. So, select the SM_Template_Map_Floor mesh and delete it by going to Edit | Delete or pressing the Delete key.
  4. After this, we will need to access the Modes tab on the top-left of the screen and click on the icon that looks like a mountain to change the game to the Landscape mode.
    How to do it…

You'll know that we're in the Landscape mode when you can see a green grid showing up inside the level.

Tip

You can also access the Landscape mode by pressing Shift + 3 on your keyboard.

Under the mode image, you'll notice that the properties have changed to show three modes, with two grayed out and the first one, Manage, selected. When selected, the Manage mode allows us to create new landscapes and modify the properties that we have already created. We will learn about the other modes later in this chapter.

Right now, we'll only see the New Landscape section. Now, we don't actually have a landscape created yet, but let's first set up some properties to make this seem more realistic:

  1. Go into the Content Browser tab and the StarterContentMaterial folder. Once here, drag and drop the M_Ground_Grass material into the Material property under the New Landscape section. This will make our landscape use this material on all of the terrain, by default. Alternatively, you can also select the material in the Content Browser tab and then within New Landscape, click the arrow to the right of the Material variable and apply the material to the landscape.

    Note

    It's possible to have multiple materials in your landscape to help create cool effects. For details on this, refer to https://docs.unrealengine.com/latest/INT/Engine/Landscape/Editing/PaintMode/index.html.

    How to do it…

    There are a number of properties (that we can change at this point), which will alter the landscape such as Location, Rotation, and Scale. There are also some new properties that will affect the size and quality of the landscape. The default values are balanced for quality and build time, so we're going to use them for the most part.

  2. Continuing in the New Landscape section of the Modes tab, change the Z property of Location to -10 to place it below our character's starting point (the Player Start object that looks similar to a hole in one with a gamepad controller to its next).
  3. Finally, at the bottom-right of the New Landscape section, click on the Create button to place the landscape into the world with our specifications.
    How to do it…

    Creating a landscape

  4. When it's first created, you may notice these dark lines in grids everywhere. This is because we haven't built lighting yet, so let's go ahead and do this by selecting the Build section's drop-down menu from the top toolbar above the level and selecting Build Lighting Only or by pressing Ctrl + Shift + ; on your keyboard. Wait for a few seconds, and the lighting should complete, however, there is a popup, which will display a warning:
    How to do it…

    This is alerting us to the fact that we should add Lightmass Importance Volume around the important parts of the level. Being a warning, it is something that we could technically avoid. As game developers, it's important for us to remove warnings wherever possible. To fix this, follow these steps:

  5. Switch back to the Place tab, go under Volumes, and scroll down to the Lightmass Importance Volume option. Drag and drop it into the center of the world. Once the option is created under the Details tab, change the X, Y, and Z properties to 50000. To check that everything is contained, restore the viewports and maneuver as needed to get the yellow lines to fit in your level.
    How to do it…

    In my example, I made the volume as big as needed to fit the terrain, but you may make it smaller to fit with just what your level contains.

  6. Build the lighting in the same manner as before, and everything should be set up correctly!

Note

For more information on creating landscapes and what all of the properties mean, check out the Unreal documentation at https://docs.unrealengine.com/latest/INT/Engine/Landscape/Creation/index.html.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.10.107