In part 1 of this tutorial, we talked about the basic overview of Unreal Engine and getting a first person shooter game started, in part 2 we will go in depth with “graphs” along with blueprints, level design and much more. If you have not read part 1, do so now so you will have the base game setup and ready to go for part 2. Let’s get started.
Level design can make or break a game in my opinion, especially when talking about first person shooters. The best way to go about making levels is to make low-poly tests and play through them a few times to make sure that they are everything you want them to be. Then gradually add detailed high-poly objects, features and effects until it is the completed level. It saves a lot of time to just get the basics done than to make full featured levels to just end up dumping them. This sounds redundant, but it will be better in the long run when you can easily tweak things without completely redoing parts of the finished level.
When you first set up the game, you are presented with a white square as the floor made from a cube mesh. Just like the picture, make the level with basic assets like the cube and design the layout by adding more cubes to the scene to get the floor layout and then add the basic walls and structures to get everything where you want it. Next up is how to make different scenes and add levels to your game. These levels can be accessed by scripted events in game or by clicking them in the content viewer while editing.
Any good story driven first person shooter is more than likely going to have multiple levels, so it is essential to learn how to do just that. Notice that you have your opening scene that you started out with, this will be level one. To create level two, click “Add New” in the content browser then click “Level” and follow the prompts whether you want a black design or a basic template to work off of. Just like the first level, make level two. Once done, we need to add a scripted event to be able to get to the newly created level.
You should now be able to jump to the second level through a trigger box.
This is a bit complicated, but Unreal Engine makes it as easy as possible while still having infinite customizability. The first thing to do is create a “Box Trigger”, this is exactly what it sounds like, in this example, the player will collide with the box to go to the next level. Add the box trigger by going to the left side and clicking Basic-Box Trigger. You can put this wherever you want in your first level so the player can move on to the second. Next up, click on the blueprints tab in the top middle and click the level blueprint. Once open, right click and click Add Event-Collision-Add onActorBeginOverlap. This will then add a node to the graph (more on this later). There will be an arrow pointing to the right in the node on the right side. Click and drag out a line then type in “Open Level” and click the option. There will then be a few attributes to mess with, the first one is the name of the map that needs to be opened when the box is triggered. Note the name of your second level and put that name in where it says “None”.
That’s it! You should now be able to jump to the second level through a trigger box. This is not the only way to do this of course, if you add enemies you can set attributes for the score and have the player move to different levels depending on the number for example, the possibilities are limitless. Next up, we will go into detail about graphs and how they are used.
Graphs are a unique feature to Unreal Engine, but they are very robust and allows for many different elements in a game to be made relatively easily. This is done by a visual flow chart of sorts instead of having to write straight code (which is still available however). The most basic examples include making a material and giving it some base color and metallic properties to the more complicated examples including playable game characters and HUDs on the screen. This kind of works like the drag and drop code solution that Stencyl uses but on a whole new level. There are more options than you can count in the graphs screen. To find out more, Unreal has a full overview of everything here.
Blueprints also use graphs to make things much easier than other methods. Blueprints allow for complex scripting including vector manipulation like dot product and cross product as well as character creation and animation. In the picture above, I made a new material by clicking “Add New” just above the content browser and made a new material, once made I dragged three 3 “Contant3Vector” nodes from “Constants” then connected them in a way so I could set the base color (#8AD630), add a metallic look and some roughness to the material. The possibilities are endless and Unreal does a great job of filling in the blanks.
Collisions are something that a lot of people will take for granted, but the reality is nothing can collide until you make collision boxes for them. Nothing in the scene actually collides with anything, what is actually happening is there is an invisible shape overlay on that object that gets collided with. This can work in a few ways in Unreal Engine. Double click on any static mesh in the content viewer to pull up a new window with that static mesh open. Once there, click “Collisions” in the top toolbar and click “Auto Convex Collision” for the easiest relatively accurate way to make collision boxes. As you can see in the image above, in the bottom right you have the ability to choose how accurate you want the box the be relative to the original mesh shape and how many hull verts, or “corners” or sorts, you want in the collision box. Most meshes will not take too long to complete even on the most precise setting so this is the best way if you need a pretty decent collision box without anything special.
Just don’t try to be super precise on something like a tree, Unreal Engine ended up crashing when attempted! If you need something that is not precise for something like background imagery or big buildings, doing something like a “box” shaped collision box or a more simple 3D shape listed in the menu might be the way to go. This could also depend on your hardware you are using to make the game, as complex collision boxes seem to stress my computer a lot more than basic ones, so that is definitely something to keep in mind when you have a bunch of objects that need collisions and you are on a time schedule. It is worth noting that once the collisions are applied to the static mesh, this does not just affect one instance of the mesh, but every instance. This way be a little confusing as you can jump into the static mesh viewer from a specific instance of said mesh.
Test the game for the correct platform
By default on Windows, Unreal Engine displays DirectX 11 (or 12 on Windows 10) with Shader Model 5. This is worth noting because while the above image looks great, it looks like this on Android:
Unreal Engine will tell you when you build your project what went wrong and what to do about fixing it. Usually just rebuilding the lighting and project fixed most of the issues seen in this picture (it even says lighting needs to be rebuilt in red). Although the material missing gun required a new UV map from Autodesk Mudbox and painting in Photoshop to fix.
To switch to Android quality settings click on Settings -> Preview Rendering Level -> Mobile / HTML5 – Android Preview. This will show you exactly how the game will look on Android, complete with all its imperfections.
Under the “Build” tab, you can also choose to show error in lighting that will then bake the lighting errors as color in the light map data so you can see what is going wrong. These graphical differences can be as easy as rebuilding the scene to completely changing materials because Android doesn’t like a certain feature.
It is also worth noting that you will need a lot of patience if you do not have a high end computer made for this type of development. Now that we are in part 2 and you have made a level with a bunch of objects in the scene, you will start to stress your computer quite a bit. I was able to build my scene with production level lighting with everything at the highest setting in about 15 seconds, but if your scene is any bigger than mine, or if you are using a notebook or a lower end computer, it could take all day.
Unreal Engine also loves to use as much resources as your computer can provide. While building the lighting in Unreal Engine my CPU usage went to 100% on all 8 threads at 4.4 ghz on my i7 6700k and UE used around 17 GB of RAM during the process as well. This does not even in include what my GPU is going through. Keeping all of this in mind, unless you have the hardware, or patience, it is probably a good idea to just stay in one rendering view, and not switch between them too frequently. There isn’t really a need to do so unless you are making your game cross platform.
Making a FPS for Android isn’t too difficult, getting everything setup is a breeze and with the use of graphs, hard tasks become easy and with a little work on a great level or two, you have a complete game ready to go, sans some enemies. But while getting the basics set up for a first person shooter is easy, Unreal Engine can go a lot deeper. The best way to learn is to do, mess around in Unreal Engine and explore all of the features it has to offer. Unreal offers great sample projects that cover most of what you will encounter while developing with helpful tips and tricks to help you make whatever you want.
Let us know in the comments if you’ve successfully made a FPS using this guide and show us on social media, we’d love to see what has been made. Now get out there and create!