-->
Back in 2018, when trying to decide which project to develop I came up with the idea of re-implementing in Unreal Engine a game I worked on using an in house engine (which sadly is now in the virtual limbo). That game was based on an old classic game named Columns, which is a mix of Tetris and match 3 games. Then I began working on the project, which involved learning Paper2D, which is the engine's 2D tool/plugin. While working on that I decided to turn it into a tutorial so, 5 weeks later I finished the test project and began writing this text. Frankly I never thought this process would consume so much time! Still, I believe it was worth it! At that time the latest stable engine version was 4.19.2 while 4.20 was in preview. Fast forward and the latest version (as of this writing) is 4.21.2 with the 4.22 in preview and almost released!
So, while the entire text was written according to tests done in Unreal Engine v4.19 the revision process involved reimplementing the project using v4.21 so it should be absolutely no problem to follow this tutorial with this version of the engine, aside from one compiler warning about one function that is used and not "fixed" in the text/tutorial.
The main goal of this tutorial is to showcase a process of developing a 2D game with Unreal Engine and C++. Note that what will be shown here is only one method of doing things and I don't claim to be the best one. Each person has his/her own experiences and preferences regarding the overall workflow and I don't doubt some people will think what I present here is totally wrong. All I can say is that everything in this tutorial was tested and at least on the used devices everything works as expected. In short, while I don't guarantee to showcase "the best techniques", I can promise that at the end the project works and there will be a playable game.
Regarding the game itself, if you don't know the inspirational one (Columns), it's basically a piece formed by random objects placed in a vertical format. This piece falls over time and the player can move it horizontally to land in a different grid column (this is the Tetris like part of the game). The player can also change the order in which those objects form the piece. The objective is to place those objects in a way that they form sequences of equal types (this is the "match 3" part of the game).
As I have mentioned, this project requires Unreal Engine and C++, meaning that you should be comfortable with building C++ Unreal projects. I don't expect you to be a programming expert, only that you are capable of working with C++ combined with Unreal Engine, that's all. During the tutorial I will dump all the relevant C++ code in a format similar to this:
#include "somefile.h"
...
some_code
As you can see, I explicitly specify the source file name that receives the code. Part of the explanation is meant to tell where that code should be placed. If you have JavaScript enabled (please do so, as a lot of feature of this site will break if you don't), hovering the mouse over the code section will make a button labeled Select
appear. Clicking it will select the entire source code in that box.
While I hope my explanation is enough so you can understand the logic behind the code and be able to rebuild your own complete source code, even if directly copying and pasting the snippets, I also understand it may not be an easy task. So, to that end, I provide the entire project code uploaded to Github. In this repository the master branch corresponds entirely to what is presented in this tutorial while the plus branch contains some additional features. Both branches contains files targeting Unreal Engine 4.21. All of the "raw" assets that I have created are also part of the repository. By "raw" I mean the files prior to importing into Unreal Engine.
I'm a programmer. Meaning: don't expect any of the graphics or audio in this project to be "good". Or even acceptable if you are really picky.
Regarding the Unreal Editor itself, please don't expect me to explain everything about how to use it. You should be able to understand some of the basics of it and, most importantly, how to navigate through it and find the internal editors. Because I don't assume you, the reader, know everything about the editor I do get into some specific details throughout the tutorial. Still, if something is not clear enough you can contact me!
If you are unsure you will be able to understand the contents of this tutorial, at the end of this introductory part I list a few links that may be of some help.
In any case, I'm a (PC) gamer and I'm not really fond of playing on mobile devices. Because of that it's extremely difficulty for me to know what works and doesn't in a mobile game. Still, I do talk a little bit about mobile in the tutorial. In a way this should serve as a disclaimer that my presented mobile version may not have optimal experience.
At some point I did think about placing here a "complete" list of tools with alternatives and so on. This is a somewhat very complicated task to be done so, instead I will just tell the tools I have used besides Visual Studio (Community Edition) and Unreal Engine.
For the graphics I used both Inkscape and GIMP. The sound effects were recorded by myself and edited with Audacity. As for the music I have used LMMS. Specifically regarding LMMS, I have used the beta (1.2.0-RC7) version because the stable one (1.1.3) crashes when loading projects that use VST plugins.
As you can see, I have only used free tools to develop this project. I believe the chances are high that you already have a personal preference towards an specific tool for some tasks. Please, do so while following this tutorial! What I have "listed" here is mostly for reference, nothing else!
This tutorial is organized in 23 parts, not counting this introduction. The original idea was to keep all of them with similar length but that was not possible, specially when trying to keep them in a logical sequence. Because of that, some will be a lot bigger than others. Note that I did not think about making possible to skip some parts. If you do so and don't understand anything, please consider this fact before taking your sword and coming to behead me!
While describing those parts I have done my best to not mention many of the internal nomenclature, which will be explained throughout the tutorial. So, if some of those descriptions seem a little vague, that's the reason. To be honest, I believe this is better than adding some cryptic names that will be presented at a later moment.
Project Github Repository - Source code, including "raw" assets for the completed project is in here. Note that this is meant to be used as a reference.
Inkscape - Free, open source, vector graphics application.
GIMP - Free, open source, bitmap graphics application.
Audacity - Free, open source, Audio editor.
LMMS - Free, open source, track editor music creator.
Visual Studio Setup for UE - Documentation on how to setup Visual Studio to work with Unreal Engine.
Unreal Engine Architecture - Official reference over the Unreal Engine architecture.
Unreal Engine Framework - Official documentation on the Unreal Engine framework.
Official Youtube - The official Unreal Engine Youtube Channel
Official Introduction - This is an officially produced video series showcasing the very basics of the Unreal Engine Editor, containing 11 videos.
Official Blueprint Introduction - Officially produced video series with an introduction to Blueprints, containing 9 videos.