Making an FPS in Unreal Engine 4 DevLog 1
Starting An FPS in UE4
In my childhood I always thought that the Call Of Duty Nazi Zombies game mode should receive it’s own game, with it’s own story. I loved that series so much and knew that one day, I would develop my own Zombies game. What better time to do so than right now.
I haven’t developed an FPS before, the closest I have ever done was working on Cryptid Hunter last year. I also have never worked in Unreal before the last couple months, as I am primarily a Unity developer. So I know that this endeavor is going to be long and challenging, however, I believe I am up to the task an I believe that Unreal Engine is a great engine to push me to the end.
I will be keeping with this devlog somewhat regularly, and while I am going to use this more to show what I have discovered and how I am doing things, I will also be showing progress overall. I will also say that I am doing a mix of blueprints as well as C++ for this project. Currently my approach is to setup my actors and components in c++, and then I will specify most of the functionality in the blueprints, the main exceptions are the zombies, as there will be many zombies, I want to make sure that they execute as fast as possible and so I want those written in as much C++ as possible. It is difficult to keep them entirely in C++ however, as if they are communicating with any other blueprint in the project, if the functionality for that blueprint isn’t defined in C++, then C++ doesn’t know about it, and it will not compile, in these cases, I either define the functionality in C++ or I push the functionality from C++ to blueprints. I imagine as time goes forwards I will be moving more and more of the project over to C++ as it is faster and I find it more clean to work with, however, I don’t know the API well and compiling takes a while, so blueprints allow me to work much faster and see results faster.
Tips For Working in C++ and Blueprints
If you can help it, ALWAYS define your classes, structs, interfaces, enumerators, in C++ and not in blueprints. This is because, if you ever want to access a class, interface, enum or struct in c++ and it is not defined in c++, you will have to make one and then you must replace all instances of the blueprint version with your newly defined c++ version. It is just a huge pain!
You can define functionality in C++ and then have that functionality implemented in blueprints. This can be done with the UFUNCTION(BlueprintNativeEvent) property specifier, or with the UFUNCTION(BlueprintImplementableEvent).
Make your functionality in blueprints first. If you do this, and you hover over the functions, you can see what libraries the functions come from, as well as function names, which makes finding the functionality in c++ much easier!
Always be searching the unreal documentation, when searching, you can also specify that you want to look at the c++ api so that you won’t see anything related to blueprints. Like this.
When programming, I noticed that my intelesence and compile times were VERY slow. I fixed this by moving the unreal engine and my project to my SSD.
Creating The Player Character
One aspect of the game Destiny that I really wanted, was to be able to see my arms and legs in the first person view, while my whole body is visible in the third person view. I eventually figured out how to achieve this, and it is actually quite simple. Really, an ideal first person shooter, the camera will remain still even when aiming down sights, the gun will come up to the camera. So you should set the camera to be the base component and have your arms dependent on the camera. However, you only want this to be visible to your character, you want to have a separate mesh for the body that will be visible to other players. In ue4, this is very easy to achieve. On the mesh, in the viewport, there is an option called “Owner No See” and “Only Owner See” You can utilize these to make sure that the camera is never clipping into the body while also making sure others see the whole body model. To fix the issue where the camera shows the legs only from the owner perspective, you can add another “Owner Only” version of the third person mesh, and then use the “Hide Bone By Name” blueprint node, to hide everything above the waist.
Current Progress
Tutorials/Resources Used:
This FPS tutorial gave me the basics of how to design a game around a first person with no body viewpoint. I also took the hands and gun meshes and animations from this tutorial series.
This FPS tutorial gave me some different basics of creating an FPS, I took the player mesh and animations, and zombie meshes and animations from this tutorial series.
This Destiny GDC talk gave me some insight into how to design around an FPS experience and how to break up the character for server/client views.
This C++ Tutorial series gave me info on how to create Structs, Interfaces, Enumerators, Classes as well as other C++ functionality to get started on creating a game with C++.
Wrapping Up
Well that’s about all I want to write about today, I will keep up to date with the progress that I am making and some info about my workflow, tools, and methods I use to do what I am doing. Eventually, once I better understand everything that I am doing I will possibly make some tutorial videos on YouTube.