Title: Learning C++ by Creating Games with UE4
Author: William Sherif
Published: February 2015
Publishers summary: Learn C++ programming with a fun, real-world application that allows you to create your own games!
When I saw the title of this new book from technology publisher PACKT, I was intrigued. I know from experience that C++ has more complexities than many other languages and for a beginner these can be hard to overcome. In addition, although I have used C++ for many years and UE4 fairly intensively (although only for around 6 months) I had never done so much as amend a single line of C++ code in a UE4 project. It is far from straightforward. So what intrigued me is how you can possibly hope to teach a complete beginner C++ in a UE4 environment in just one book?
The author William Sherif gets started by introducing a theoretical overview of what makes a game pleasing to play. My immediate reaction was that I couldn’t see how there would be time for this with just 12 chapters and an already seemingly impossible task. Chapter 1 then quickly sets up a C++ development environment and builds a bare bones C++ (not UE4)project.
A very fast start
Then chapter 2 goes straight into basic variables just as I was expecting. Then within just a few more pages the discussion turns to programmer defined objects (structs) and before the end of the first chapter we are learning the way that C++ manages dynamic memory (pointers). I compared this with my favourite C++ beginners guide from 20 years ago. In Ivor Horton’s Beginning Visual C++ pointers were introduced on page 130 and structs on page 323. At least I suppose the book is making some fast progress but would it be too fast for a beginner.
The next few chapters were much calmer paced. Loops, functions, arrays and a few more programming staples as well. It became apparent at this point that the near ramming of extra topics into chapter 2 seemed to have worked. As chapters 3 through 7 progressed they clarified the complexities from the second chapter by using them repeatedly in example after example and to my great surprise and pleasure I was editing my first UE4 project in just chapter 4!
But not too fast
I am not saying that this means that the journey is easy, but that it is was a viable route after all. It got me to my first destination and with just 4 chapters gone. As I mentioned chapters 3 through 7 dip in to core C++ topics, they don’t cover them in detail but the dipping seemed very precisely executed as when chapter 8 comes you actually get to create a controllable, animated 3rd person perspective character who can walk up to a selection of non player characters and have a textual interaction. It seems that the precise parts of c++ knowledge that would be needed for this exercise were the exact parts that were given in the earlier chapters.
There is a brief but necessary pause in the fun with chapter 9 as C++ and UE4 templates are taught. Templates help us organize complex game worlds into organized and manageable collections. When this is done the real rewards of the book follow. Without using any previously unexplained C++ the reader gets to build a swarm of monsters, with swinging swords that actually chase the player and do damage. The player gets to defend himself by finding and collecting magic spells which he can cast by accessing a backpack inventory system.
Let the games begin
The ending few chapters cover so much ground. For example, we create particles (explosion like things) in the UE4 particle editor, implement them in C++ code, assign areas of effect in the UE4 editor and package the whole thing up in a Blueprint visual script. The last three chapters are constantly jumping around the different aspects of UE4 and demonstrating how they all fit together. It was very revealing even for someone who has used UE4 for many hours previously.
But should I buy it?
So if you are totally new to all forms of programming and Unreal Engine, then this book will probably present a steep learning curve, but not an insurmountable one and if you do manage to clamber up; the view from the top- in the form a a bare-bones third person RPG is truly one that any beginner can be proud of.
On the other hand if you have some other programming experience, especially in a C++ like language, perhaps Java or if you are already familiar with non-C++ UE4 especially if that experience includes a bit of Blueprints scripting then this really satisfying journey of a book will fill in so many of the gaps at the same time as giving a whirl wind tour of C++.
In summary it is definitely not a C++ reference, it is incomplete, definitely not the best, pure C++ beginners guide, you will need to cover some of the topics that were not mentioned. What it is is a journey from zero knowledge to an actual playable bare-bones 3d RPG and it’s a journey I would recommend you take.