Unreal Engine 4 Tutorial for Beginners: Getting Started

In this Unreal Engine tutorial, you will be guided through installing the engine, navigating the interface and creating your first game object.

5/5 4 Ratings · Leave a Rating
 
Please note, this is a STATIC archive of website www.raywenderlich.com from 08 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.

Unreal Engine 4 is a collection of game development tools capable of producing everything from 2D mobile games to AAA console titles. It is the engine behind titles such as ARK: Survival Evolved, Tekken 7 and Kingdom Hearts III.

Developing in Unreal Engine 4 is very simple for beginners. Using the Blueprints Visual Scripting system, you can create entire games without writing a single line of code! Combined with an easy-to-use interface, you can quickly get a prototype up and running.

This Unreal Engine 4 tutorial is focused on helping beginners get started. Here are the key points that this tutorial will cover:

  • Installing the engine
  • Importing assets
  • Creating materials
  • Using Blueprints to create objects with basic functionality

To learn these, you will create a spinning turntable that displays a banana.

Installing Unreal Engine 4

Unreal Engine 4 uses the Epic Games Launcher for installation. Head over to the Unreal Engine website and click the Get Unreal button at the top-right corner.

getunreal

You will need to create an account before you can download the launcher. After you have created an account, download the launcher for your operating system.

download

Once you have downloaded and installed the launcher, open it. The following window will appear:

00

Enter the email and password you used to download the launcher and click Sign In. Once signed in, this window will appear:

01

At the top-left corner, click Install Engine. The launcher will take you to a screen where you can select which components to install.

02

Note: Epic Games is constantly updating Unreal Engine, so your engine version may be slightly different than this. For example, since I wrote the first draft of this tutorial, the version has already updated to 4.14.3! As long as you have at least version 4.14, you should be set for this tutorial.

The default selections are Starter Content, Templates and Feature Packs and Engine Source. It is a good idea to leave these checked. Here’s why they are useful:

  • Starter Content: This is a collection of assets that you can use for free in your projects. It includes content such as models and materials. You can use these as placeholder assets or in your final game.
  • Templates and Feature Packs: Templates set up basic functionality relating to your chosen genre. For example, picking the Side Scroller template will create a project with a character, basic movement and a fixed plane camera.
  • Engine Source: Epic provides source code access, which means anyone can make changes to the engine. For example, if you want to add custom features to the editor, you can do it by changing the source code.

Scrolling down the list, there are different platforms available. If you don’t plan on developing for a specific platform, feel free to disable it.

03

Once you have selected your components, click Install. When the installation completes, the engine will appear in your library. Now it’s time to create the project.

04

Creating a Project

Click one of the Launch buttons to open the Project Browser. Once it opens, click the New Project tab.

05

Click the Blueprint tab. Here, you can use one of the templates. However, since you are starting from scratch, select the Blank template.

Further below, you will find additional settings.

06

Here’s what each option does:

  • Target Hardware: Selecting Mobile/Tablet will disable some post processing effects. It will also enable using the mouse as a touch input. Set this to Desktop/Console.
  • Graphical Target: Selecting Scalable 3D or 2D will disable some post processing effects. Set this to Maximum Quality.
  • Starter Content: You can enable this option to include Starter Content. For the sake of simplicity, set this to No Starter Content.

Finally, there is a section to specify the location of your project folder and the name of your project.

08

You can change the location of your project folder by clicking the three dots at the end of the Folder field.

The project name does not represent the game’s title so don’t worry if you want to change the title later on. Select the text in the Name field and type in BananaTurntable.

Finally, click Create Project.

Navigating the Interface

Once you have created the project, the editor will open. The editor is split into multiple panels:

09

  1. Content Browser: This panel displays all your project files. Use this to create folders and organize your files. You can search for your files by using the search bar or by using filters.
  2. Modes: This panel lets you select between tools such as the Landscape Tool and the Foliage Tool. The Place Tool is the default tool. It allows you to place many different types of objects into your level such as lights and cameras.
  3. World Outliner: Displays all the objects in the current level. You can organize the list by putting related items into folders. Also has the ability to search and filter by type.
  4. Details: Any object you select will have its properties displayed here. Use this panel to edit the settings of the object. Changes made will only affect that instance of the object. For example, if you have two spheres and change the size of one, you will only affect the selected object.
  5. Toolbar: Contains a variety of different functions. The one you will use the most is Play.
  6. Viewport: This is the view of your level. You can look around by holding right-click and moving your mouse. To move, hold right-click and use the WASD keys.

Importing Assets

What’s the point in having a turntable with nothing to display? Download this model of a banana. Inside are two files: Banana_Model.fbx and Banana_Texture.jpg. Alternatively, you could use your own model but why would you when you have this badass banana?

Before Unreal can use any files, you need to import them. Navigate to the Content Browser and click Import.

10

Using the file browser, locate the folder where Banana_Model.fbx and Banana_Texture.jpg are. Drag-select both of the files and click Open.

11

Unreal will give you some import options for the .fbx file. Make sure Import Materials is unchecked as you will be creating your own material. You can leave the other settings alone.

12

Click Import. The two files will now appear in your Content Browser.

13

When you import a file, it is not actually saved into your project until you explicitly do so. You can save files by right-clicking the file and selecting Save. You can also save all files at once by selecting File\Save All. Make sure you save often!

Note that in Unreal, models are called meshes. So now that you have a mesh for your banana, it’s time to place it into the level.

Adding Meshes Into the Level

The level is looking pretty empty at the moment so let’s spice it up.

To add a mesh into the level, left-click and drag the Banana_Model from the Content Browser into the Viewport. Releasing left-click will place the mesh.

14

Objects in a level can be moved, rotated and scaled. The keyboard shortcuts for these are W, E and R. You can then use the manipulator like so:

15

About Materials

If you look closely at the banana, you will see that it’s not yellow at all! In fact, it almost looks gray.

ragecomic

To give the banana some color and detail, you need to create a material.

What is a Material?

A material determines how the surface of something looks. At a basic level, a material defines four things:

  • Base Color: The color or texture of a surface. Used to add detail and color variations.
  • Metallic: How “metal-like” a surface is. Generally, a pure metal will have the maximum Metallic value whereas fabric will have a value of zero.
  • Specular: Controls the shininess of non-metallic surfaces. For example, ceramic would have a high Specular value but clay would not.
  • Roughness: A surface with maximum roughness will not have any shininess. Used for surfaces such as rock and wood.

Below is an example of three different materials. They have the same color but different attributes. Each material has a high value for their respective attribute. The other attributes are set to zero.

16

Creating a Material

To create a material, go to your Content Browser and click the green Add New button. A menu will appear with a list of assets you can create. Click Material.

17

Name the material Banana_Material and then double-click the file to open it in the material editor.

18

The Material Editor

The material editor is composed of five main panels:

19

  1. Graph: This panel will contain all your nodes and the Result node. Pan by holding right-click and moving your mouse. Zoom by scrolling your mouse wheel.
  2. Details: Any node that you select will have its properties displayed here. If a node isn’t selected, the panel will show the material’s properties instead.
  3. Viewport: Contains a preview mesh that will display your material. Rotate the camera by holding left-click and moving your mouse. Zoom by scrolling your mouse wheel.
  4. Palette: A list of all the nodes available to your material.

What is a Node?

Before you start making your material, you need to know about the objects used to make it: nodes.

Nodes make up the majority of a material. Many types of nodes are available and offer different functionality.

Nodes can have inputs and outputs, represented by a circle with an arrow. Inputs will be on the left side and outputs will be on the right side.

Here is an example using a Multiply and Constant3Vector node to add yellow to a texture:

20

Materials have a special node called the Result node, which has already been created for you in this case as Banana_Material. This is where all your nodes will eventually end. Whatever you plug into this node will determine how the final material looks.

25

Adding Textures

To add color and detail to a model, you need a texture. A texture is just a 2D image. Typically, they are projected onto 3D models to give it color and detail.

To texture the banana, you will use Banana_Texture.jpg. The TextureSample node will allow you to use a texture within your material.

Navigate to the Palette panel and search for TextureSample. Add the node by holding left-click and dragging it into the graph.

21

To select a texture, make sure you have the TextureSample node selected. Navigate to your Details panel and click the drop-down located to the right of Texture.

22

The menu that comes up will list all the textures in your project. Select Banana_Texture.

23

To see the texture on the preview mesh, you need to plug it into the Result node. Hold left-click on the white output pin of the TextureSample node. Drag it to the Base Color input pin of the Result node.

24

Go back to the Viewport to see the texture on the preview mesh. Rotate it around (by holding the left mouse button and dragging) to see the other details.

26

Click Apply in the Toolbar to update your material, and close the Materials editor – you are done here.

Using Materials

To use your material with the banana, you need to assign it. Go back to the Content Browser and double-click on Banana_Model to open it. The following editor will appear:

27

Go to the Details panel and locate the Materials section. Click the drop-down located to the right of Element 0 and select Banana_Material.

28

Close the mesh editor, go back to the main editor and look at the Viewport. You will see that your banana now has a texture. Congratulations, you now have everything it takes to be a level designer!

29

Note: If the lighting is too dark, you can change it by going to the World Outliner and clicking on Light Source. In the Details panel, locate the Intensity setting and set it to a higher value.

About Blueprints

Even though the banana is looking amazing, it would look even better spinning on a turntable. Creating one is easy using Blueprints.

In its simplest sense, a Blueprint represents a ‘thing’. Blueprints allow you to create custom behaviors for your objects. Your object can be something physical (like the turntable) or something abstract such as a health system.

Want to make a moving car? Make a Blueprint. What about a flying pig? Use Blueprints. How about a kitten that explodes on impact? Blueprints.

Just like materials, Blueprints use a node-based system. This means all you need to do is create nodes and link them; no coding needed!

ragecomic2

Note: If you prefer to write code, you can use C++ instead.

While Blueprints are easy to use, they are not as fast as C++ code. So, if you need to use something computationally heavy like a complex algorithm, you should consider using C++.

Even if you prefer using C++, there are times where it is a good idea to use Blueprints. Here are some of the benefits of Blueprints:

  • Generally, it is quicker to develop using Blueprints than C++.
  • Easy organization. You can separate your nodes into different areas such as functions and graphs.
  • If you are working with non-programmers, modifying the Blueprint is easy due to its visual and intuitive nature.

A good approach is to create your objects using Blueprints. When you need extra performance, convert them to C++.

Creating a Blueprint

Go to the Content Browser and click Add New. From the list, select Blueprint Class.

30

A window will appear prompting you to select a parent class. Your Blueprint will inherit all the variables, functions and components from your chosen parent class. Take a moment to read what each class does.

31

Note: Since you can place and spawn the Pawn and Character classes, they are also Actors.

Because the turntable is just going to stay in one spot, the Actor class is the most appropriate. Select Actor and name the new file Banana_Blueprint.

32

Finally, double-click on Banana_Blueprint to open it. Click Open Full Blueprint Editor if a window like this appears:

33

The Blueprint Editor

First, make sure that you have the Event Graph tab selected in the Blueprint editor.

The Blueprint editor has four main panels:

34

  1. Components: Contains a list of the current components.
  2. My Blueprint: This section is primarily used to manage your graphs, functions and variables.
  3. Details: This will display the properties of the currently selected item.
  4. Graph: This is where the magic happens. All your nodes and logic go in here. Pan by holding right-click and moving your mouse. Zoom by scrolling your mouse wheel.
  5. Viewport: Any components that have a visual element will appear here. You can move and look around using the same controls as the Viewport in the main editor.

Creating the Turntable

To create the turntable, you need two things: a base and a display. You can create both of these by using components.

What is a Component?

If a Blueprint is a car then components are the building blocks that make up the car. The doors, wheels and engine are all examples of components.

However, components are not limited to being physical objects.

For example, to make a car move, you could add a movement component. You could even make a car fly by adding a flying component.

Adding Components

Before you can see any components, you need to switch to the Viewport view. Click the Viewport tab to switch to it. This is what it looks like:

35

Note: The DefaultSceneRoot component will not show when playing. It will only show in the editor.

The turntable will use two components:

  • Cylinder: A simple white cylinder. This will be the base that the banana sits on.
  • Static Mesh: This component will display the banana mesh.

To add the base, navigate to the Components panel. Click Add Component and select Cylinder.

36

It’s a good idea to make the base a bit shorter. Activate the scale manipulator by pressing R and then scale it down (the exact size doesn’t matter, you can tweak it later if you want).

37

It’s time to add the mesh. Go back to the Components panel and left-click an empty area to deselect the Cylinder component. This will make sure the next added component is not attached to the Cylinder component.

Note: If you don’t do this, the next component will be attached to the Cylinder component. This means it will also inherit the scale of the Cylinder component. Since you scaled the cylinder down, the next component would also be scaled down.

Next, click Add Component and select Static Mesh from the list.

38

To display the banana, select the Static Mesh component and then click the Details tab. Click on the drop-down located to the right of Static Mesh and select Banana_Model.

39

Move the banana if it is not in the correct position. Activate the move manipulator by pressing W and then move it up.

40

About Blueprint Nodes

It’s time to make the turntable rotate. This is where Blueprint nodes come in..

Unlike their material node cousins, Blueprint nodes have special pins called Execution pins. A pin on the left is an input and a pin on the right is an output. All nodes will have at least one of these.

If a node has an input pin, it must have a connection before it can execute. If a node is not connected, any subsequent nodes will not execute.

Here is an example:

43

Node A and Node B will execute because their input pins have a connection. Node C and Node D will never execute because Node C’s input pin does not have a connection.

Rotating the Turntable

Before you start, have a look at the Components panel. You will see that Cylinder and Static Mesh are indented but DefaultSceneRoot is not. This is because they are attached to DefaultSceneRoot.

components

If you move, rotate or scale a root component, the attached components will too. Using this behavior, you can rotate Cylinder and Static Mesh together rather than individually.

Creating a Node

To start scripting, switch back to the Event Graph tab.

Making an object rotate is so simple that you only need to create one node. Right-click an empty space on the graph to bring up a menu of available nodes. Search for AddLocalRotation. Since you need to rotate the base and banana, you can just rotate the root component. Select AddLocalRotation (DefaultSceneRoot).

Note: If the node isn’t listed, uncheck Context Sensitive at the top-right of the menu.

41

Your graph will now have a new AddLocalRotation node. The Target input will automatically have a connection to the component you selected.

To set the rotation value, go to the Delta Rotation input and change the Z value to 1.0. This will cause the Blueprint to rotate around it’s Z-axis. Higher values will rotate the turntable faster.

42

To constantly rotate the turntable, you need to call AddLocalRotation every frame. To execute a node every frame, use the Event Tick node. It’s already in your graph. If it’s not, you can create one using the same method as before.

Drag the output pin of the Event Tick node to the input pin of the AddLocalRotation node.

44

Note: In this implementation, the rotation rate is dependent on the frame rate. This means the turntable will rotate at a slower rate on slower machines and vice versa. That’s fine for this tutorial because I wanted to keep things simple, but I’ll show you how to solve this in a future tutorial.

Finally, go to the Toolbar and click Compile to update your Blueprint, then close the Blueprint editor.

compile

Adding Blueprints Into the Level

Before adding the Blueprint, go back to the Viewport in the main editor and delete the banana model. To do this, select the model and then select Edit\Delete or press your Delete key.

Adding a Blueprint is the same process as adding a mesh. Hold left-click on the file and drag it into the Viewport.

Navigate to the Toolbar and hit Play to see all your hard work in action!

45

Note: If you didn’t delete the original banana model, you may get a warning stating the lighting needs to be rebuilt. If you delete the model, the error will no longer appear.

Where to Go From Here?

You can download the completed project here.

You’ve learned a lot throughout this tutorial but that’s just a tiny portion of Unreal. If you want to keep learning more, check out the next post in the series, where I cover more about Unreal Engine blueprints.

Average Rating

5/5

Add a rating for this content

4 ratings

Contributors

Comments