Download

Some Book Reference for Gameplay Programming in C++

Hey Guys! I’m new to programming in Unreal Engine with C++, but I’ve done programming in Javascript for apps and C# in Unity for making mobile games.
I’m familiar to object oriented programming in C++ programming, but now I’m getting started with C++ in Unreal after spending a good time with blueprints and getting familiar with how UE4 works.

I’m following along with the Youtube tutorials in UE4 channel and also going through API documentation.

I know this is not a UE4 related question, but I want to ask if you guys could suggest some good books on Gameplay Programming in C++.

Thanks. Cheers.

Not a book, but to get me started I followed through the free courses on CPPInstitute.com

C++ is one of the most documented languages in the world, shouldn’t be hard to find them :slight_smile: There are game-specific books on programming out there. GameInstitute.com also has some amazing C++ / Mathematics tutorials.

I’m trying to think how our old resident Rama would put it… he’d probably say something along the lines, “Use your unique imagination when you create your code.” or maybe something along those lines. Anyways the point is you’re never going to find any true cookie cutter solution to the thing you’re trying to create. So you should experiment with your own unique kinds of patterns and algorithm’s. I know that isn’t exactly and answer to your question but it might save you a few bucks. Most of the time gameplay books and… well, programming books in general, simply try to get you to think outside of the “box”. So if you’re already thinking outside the box they might not help you.

Thank for the Reply. What you are saying is correct, but I’m not asking for some pre built solutions or code snippets. I was just looking for something that would help me strengthen my game programming in C++, something like best practices kind’a thing.

Hope you got what I’m trying to say. But thanks anyways

Effective C++. It’s exactly that, a series of best practices that stem from the sometimes obscure particularities of the C++ language, along with explanations as to why the language works that way.

-Camille

Effective C++ is indeed a good book; the author Scott Meyers knows his stuff. I just want to state that generally you can’t know all of C++ just by reading one book, and the language has quite evolved since, the book linked above should cover C++03 I believe, and not C++11. And so new features added in C++11 which includes move semantics, lambdas, the new initialization forms and much more won’t be covered in that book, if you want to know C++ well then you should at least try to learn all that. Also knowing that lvalue and rvalues are not the only types of values in C++11 anymore, as this is useful when it comes to knowing how to use move constructors which can save a lot of performance, lambdas are useful but mostly a syntactical feature, though it’s very useful when using the STL functions. For instance


    std::thread Thread{ ](void) -> void{
        // do something
    } };

is much more nicer than having to call a function that executes in the newly created thread. If you meant gameplay programming as I think you meant it, then I’d suggest to learn C++ first, read as much books as you can http://www.amazon.co.uk/Effective-Modern-Specific-Ways-Improve/dp/1491903996 that one is probably nice but I’ve never tried it, if you’re decent at C++ but want to be even better then read the C++ programming language, and just know that you can’t ever know everything as there’s always something new to learn, you’ll find that C++ supports a lot of features including type traits, auto type deduction and alternatives to macros, and of course a lot more!

Lastly knowing the architecture you’re targeting is generally good; since you said that’s not UE4 specific, then after knowing C++ well, perhaps you’d want to learn how your compiler transforms your code to x86 assembly (assuming you’re targetting the x86 architecture), how parameters are passed on the stack or to registers depending upon the calling convention, why local variables are uninitialized and why it’s bad to modify a string stored in .rodata. If you only want to learn C++ for UE4 then you can safely skip that and only learn the library provided by the engine. :slight_smile:

One more thing I’d like to add, knowing and being able to implement some algorithms is generally a good idea as it should help to think algorithmically.

Also best of luck!

Recently I decided to dig into code as well, ended up getting these books:

The C++ Language 4th Edition - By Bjarne Stroustrup (the creator of the C++ language)

Has both a quick rundown on using C++ in the first 6 chapters for those who have had some programming experience, as well as another 40+ chapters going though all of the details. Great book so far, really glad I bought it.

C++ Primer - 5th Edition - By Stanley B. Lippman & others

This one is more of a reference book containing information on how to use C++ in certain situations. Have not had to use it too much so far, but looks good as well.

I wanted to have both an instructional book as well as a good reference, so far these two haven’t let me down. Especially the first one, it is easy to read & well laid out, and he goes through everything at a good pace. Highly recommend it!

For even more recommendations, check out this thread on StackOverflow, The Definitive C++ Book Guide & List, it should point you in the right direction.

Good luck! :slight_smile:

It’s also worth adding that ‘ShooterGame’ is probably the best resource for C++ in UE4 right now, really is an outstanding piece of work.

One I’ve found very helpful and is referenced by many industry professionals for c++ (not just specific to games) is C++ Primer 5th Edition as mentioned above and my personal favorite C++ Primer Plus - 6th Edition. The more recent one includes more current standards, but either one is a solid reference to most of the language. There are several books out there that are learning C++ specifically in the context of game development, but these books may not be the best way to start because they teach you using technologies that you won’t be using in UE4 (at least not any time soon, ie. working directly with the rendering pipeline, etc.).

Thank you everyone for your help as always and providing such detailed feedback with all the references. As suggested, I’m going through C++ Primer 5th Edition and so far it is very helpful.

You are correct, I’m going through this example to get along with C++ structure in UE4.

I started a wiki page to collect a list of book recommendations, since I was looking for something similar. I added the books referenced here as well. Please feel free to add any books in any category!

The C++11 version of Effective C++ should make the cut, no? http://www.amazon.com/Effective-Modern-Specific-Ways-Improve/dp/1491903996/ref=pd_bxgy_b_img_y

Not really. It concerns the C++11/14-specific changes, most of which are either not used by UE4, or are already integrated in a transparent fashoin (like rvalue reference operators on TArray, TSet, etc.). It’s an excellent book nonetheless, but not that relevant for UE4 specifically.