Monday, March 23, 2015

Book Review: Learning C++ by Creating Games with UE4


    The past week I’ve pretty much jumped into UE4 programming feet first with my boots on, and I gotta say it’s been pretty fun. As I mentioned on twitter, good on Epic for providing a great UX for developers, so often people tend to think UX only applies to non-code content creators and end users, but as a someone who spends most of his time writing code, having a smooth flow from IDE to Build is awesome, especially given the fact that with something like UE4, it’s not just as simple as hitting the build button and clicking “Start Debugging” (although, with UE4 it actually is, which is a monumental feat). Props to Celia Hodent and the rest of the Epic UX crew, next time you guys are in the bay area, drinks on me.

    I have to say it hasn’t been lack of wanting that’s kept me out of UE4 up ‘till now, I was excited as anyone to get started last year, it’s been more due to a lack of available resources coupled with lack of available learning time. Seems the universe is doing that thing where it gently nudges me in a direction again though, and as I’ve had some projects come up at work recently that are less research and more production (and also require a high degree of shiny), combined with the aforementioned availability of resources, it seems like the perfect time to dive in. Sadly, I can’t give any specifics on what I’m working on just yet, but let’s just say...Good Hunting.


...and UE4 is definitely good at shiny. (Atlantis by Allegorithmic)

    To set some context for my review - In my search for learning resources, there were some specific “filter settings” I applied:
  1. Having prior C++ knowledge, I didn’t want something that focused too much on the basics of C++. Ideally, I’d like a “UE4 Programming for C++ Programmers” type of thing.
  2. I didn’t want something that focused too much on Blueprints other than how to implement custom Blueprints. I’ve seen quite a few tutorials that promise to teach UE4 programming but only touch on C++ just enough to get you into Blueprints, then all the actual heavy lifting is done in Blueprints, even thought it could be done in C++. I need to be “close to the metal,” as the kids say.
  3. I also didn’t want something that only focused on implementing gameplay features. I know that’s a tall order since it’s a game engine (and hey, I was a tech artist for 10 years, I know tools development and the like isn’t sexy), but ideally I’d also like to learn how to implement lower order functionality, say Blueprints for utility functions or how to wrap external libraries for use in UE4.
    Of course, since I’ve only been able to find this one book on UE4 C++ Programming, this criteria may be moot, although I just got wind of another text coming out end of next month, and though I’m not totally sanguine on paying college textbook prices anymore, I'll definitely be giving it the once over as well. Getting back on topic though, how does Learning C++ by Creating Games with UE4 stack up to my scrutiny?

    Given my first criterion, I can’t comment on the first seven chapters, but even if I could, I probably wouldn’t. One of my personal beliefs (validated through experience, mind you), is that using a tool like UE4 to teach a programming language isn’t the best approach, there are just too many other topics to contend with. Definitely not a knock on UE4, I mean, if I were going to teach someone C#, I wouldn’t use something like Unity either (for reasons I may detail in another blog post).


...pretty, but all that shiny can be distractive and not quite conducive to learning to code

    So how about actually teaching UE4 programming? Well, I have to say it does a pretty good job of that, but until the next revision comes out, I definitely recommend having google and the Official Unreal Engine docs on hand. Already much of the code in the book relies on deprecated functions and paradigms, which can cause a bit of confusion on initial read and also results in build errors. No knock on the book or UE4, it should certainly be expected that the APIs are going to change, and I would advise any other author and publisher to consider any UE4 text a living document and make sure to stay on top of errata and keep the code updated. That aside, the programming projects start from a good place and progress very well. Additionally, the author provides short learning projects for the reader to implement on their own which build on the currently presented topic. Personally, I spent about 4 hours going through some of those learning projects and exploring other features, so you can definitely use these as jumping off points for other exploration. And yes, there is some Blueprint work, but only so much as necessary to get the code accessible from the editor and to teach basic workflow, so you’ll definitely be self-sufficient after working through this text.

    Sadly, the book does focus purely on implementing gameplay features, but as I stated earlier, I can’t knock the author or publisher too much for that. I have to imagine that the majority of readers who come to this text will be more interested in creating gameplay features as opposed to plug-ins or other tools, but as the APIs tend to follow common patterns and conventions, branching out into other sorts of UE4 programming tasks shouldn’t be too hard from this foundation (hopefully once the plug-in framework crystallizes a bit!).


...and there's plenty of plugin source available, so you're in good...err, hands.

    Hopefully you can gather that my overall impression of this text is positive, but there are a few things I found a bit off, though none of them are showstoppers, at least not for an experienced C++ developer. The in-line code snippets tend to gloss over a few points, things like declaring things public vs private, including headers where necessary, and other little things that, again, for an experienced C++ developer won’t provide any roadblocks, but if you're just learning C++ and have some of the first time jitters (which is to be expected!), these oversights may cause some frustrations. I think there was also a bit of a missed opportunity with Chapter 9: Templates and Commonly Used Containers. This chapter touches on array types and gives a comparison to STL types, which is valuable, but reads a bit out of place. In my opinion, this discussion would’ve been better in the first section on basic C++, which would have allowed for this chapter to provide some more UE4 specific projects and code samples showing how to work with the T* container types. Just a small thought, again, not a total showstopper.

    I guess what I’ll say is that if you’re an experienced C++ developer and you want something light that you can just work through in a weekend or so and feel comfortable in UE4, this is a great choice. Between this and the official documentation, you’ll find yourself in a good position to strike out into your own projects, whatever they be. Based on the review criteria and my own perspective as outlined earlier, I don’t know if I would recommend this to someone who was wanting to learn C++ and UE4, but like I said, I wouldn’t recommend someone learn C++ through a large content creation framework anyway. My impression based on skimming through the first seven chapters is that it teaches you enough to be comfortable working in UE4, but I don’t know that it’s going to make you a competent C++ programmer, granted that's something that only really comes from practice, but having a good solid foundation is also key. To its credit, this book will definitely give you a good foundation in modern programming basics, but C++ is a vast topic that requires some specific discussions. I would recommend instead something along the lines of the tutorials found at Cprogramming.com, LearnCPP.com, and/or CPlusPlus.com. I don’t say these things out of elitism or snobbery, it's just that since UE4 now gives you access to the FULL engine source, I think it’s really worth learning C++ properly so you can take advantage of that fact. Who knows, you too may find yourself with an opportunity to push the engine outside of its original sandbox, why not be ready to rise to the occasion?

Overall, 7 out of 10