Categories
Tutorial

Setting Up a First-Person Character in Unreal Engine 4: Part I: Getting Ready

Introduction

A first-person shooter (like Robot Dynamite) needs a first-person character.  In contrast to a full third-person humanoid character, all the player can see is the gun and possibly part of hands and arms of the character.  However, if it is a multiplayer game, or even a single player game in which one can look in a mirror or a closed-circuit video, the full third-person humanoid character is visible.

It is tempting to use the third-person character and place a first-person camera in a location corresponding to the character’s eyes and use that for the first-person view.  You can try that if you like, but it generally does not work very well.  This is one of the many situations in games and movies where absolute realism does not translate well to the viewer’s or player’s experience. In fact, conceptually, the first-person character is not an in-game object.  Instead, it is really a UI or HUD, with the arms and weapon part of the interface to show where the character is shooting (and what the character is shooting with).  For realism, this is one of the few user interfaces rendered as 3D.

Therefore, the best practice is to have two character meshes: a first-person character mesh consisting of nothing but arms holding a weapon, and a full third-person humanoid character mesh.  Visibility settings ensure that only the arms are visible to the player, while only the humanoid is visible to everybody else.  Of course, there are complications: one wants both first- and third-person guns to look like they are firing in the same direction and at the same target, while at the same time, you have to ensure the player does not see that the arms are really disconnected from the body, and the player should easily see what kind of gun he is carrying.

Prerequisites

  1. You need Unreal Engine 4 to complete this tutorial.  We use, and recommend using, version 4.19.2 for this tutorial.  It will “probably” work with other versions, though you might have to make some minor adjustments.   If you don’t have Unreal Engine 4, you need to go to https://www.unrealengine.com and download the latest version.  If you need more help, https://docs.unrealengine.com/en-US/GettingStarted/Installation shows, in detail, how to install the engine.
  2. You should be comfortable with basic operation of the editor.  If not, Epic Games provides two tutorials to bring you up to speed: https://docs.unrealengine.com/en-US/Engine/Basics/Projects/Browser for creating a new project (which we shall do shortly), and https://docs.unrealengine.com/en-US/Engine/QuickStart for basic editing.

Let’s Do It from Scratch (almost)

Why? Because one learns the most this way.  Nevertheless, we will not create a character entirely from scratch–that is too hard.  But we will set up the game project from scratch instead of using one of the provided templates.

So let’s get started.   Open up the Unreal Engine 4 editor and create a new blank blueprint project following the directions below:

  1. Open up the Epic Games Launcher.
  2. On the top menu, select Unreal Engine.
  3. On the left sidebar menu, select Library.
  4. Then, just below the menu, click the yellow Launch button, and wait a minute for the Unreal Project Browser to open.
  5. Select the New Project tab at the top.
  6. Select the Blueprint tab below that.
  7. Within that tab, select the Blank project template.
  8. Below that, make sure the settings are: Desktop / Console, Maximum Quality, and No Starter Content.
  9. At the bottom, find a suitable folder to put your project in, and give it a new name, “FirstPersonCharacter”.
  10. Finally, at the bottom right corner, click the Create Project button.  Wait a few minutes for the project to be generated and to open up.

Import the UE4 Mannequin Character

At this point, you should see a basic level in the main viewport window of the UE4 editor.  The level consists only of a square floor platform and a few assets like the directional light, a sphere reflection capture, a sky light, a player start position actor, an atmospheric fog actor, and in the background, a sky sphere that shows a basic daytime sky.  We now bring in a third-person character to start out with.

  1. Go back to the Epic Games Launcher.  We need to download the Animation Starter Pack.  If you already have that, skip to step 8.
  2. In the Top Menu, select Unreal Engine.
  3. Next, in the Left Sidebar menu, select Marketplace.
  4. In the search bar at the top right of the window, type Animation Starter Pack in the white box.
  5. Find the Animation Starter Pack, by Epic Games, with a picture of a mannequin shooting an invisible pistol.  Click Add to Cart (it is free) to get it.
  6. Click the yellow Shopping Cart icon on the top right next to the search bar.
  7. Then, click the yellow Check Out button and follow the instructions to download it.
  8. Now select Unreal Engine in the Top Menu, and then select Library from the left-sidebar menu.
  9. Scroll down to the Vault and find the Animation Starter Pack.
  10. Click the yellow Add to Project button.
  11. In the popup, find the FirstPersonCharacter project and select it.
  12. Click the Add to Project button at the bottom of the popup.  Wait a minute for the pack to be added.
  13. Confirm it was added by returning to the FirstPersonCharacter project in the Unreal Engine 4 Editor and noting that the AnimStarterPack folder is in the Content Browser, in the Content folder.

Import the First-Person Mannequin Arms and a Gun

In addition to the mannequin, we need the first-person arms, so we import that now.

  1. In the main window of the Unreal Engine 4 editor, find the Content Browser panel which is, by default, at the bottom-left of the window.
  2. Click the green Add New button.
  3. Select the first menu item: Add Feature or Content Pack…
  4. In the Add Content to Project menu, select the Blueprint Feature tab.
  5. Select the First Person feature below the tab.
  6. Click the green Add to Project button.
  7. Close the popup.
  8. Confirm the feature was added: in the Content Browser, in the top level Content folder, you should have three new folders: FirstPerson, FirstPersonBP, and Geometry.
  9. Save the default blank level: click the floppy disk icon in the top menubar that says “Save Current”.   Type Overview where asked to enter a name.
  10. Click the Save button to the right of the level name.
  11. Quit the Unreal Engine 4 editor by selecting File from the top menu, and then Exit.Screenshot of First Person Character project, initial setup

Next Steps

We now have the building blocks needed to create our first person character.  We shall begin doing that in part II.