Book Image

Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition

By : John P. Doran, William Sherif, Stephen Whittle
Book Image

Unreal Engine 4.x Scripting with C++ Cookbook - Second Edition

By: John P. Doran, William Sherif, Stephen Whittle

Overview of this book

Unreal Engine 4 (UE4) is a popular and award-winning game engine that powers some of the most popular games. A truly powerful tool for game development, there has never been a better time to use it for both commercial and independent projects. With more than 100 recipes, this book shows how to unleash the power of C++ while developing games with Unreal Engine. This book takes you on a journey to jumpstart your C++ and UE4 development skills. You will start off by setting up UE4 for C++ development and learn how to work with Visual Studio, a popular code editor. You will learn how to create C++ classes and structs the Unreal way. This will be followed by exploring memory management, smart pointers, and debugging your code. You will then learn how to make your own Actors and Components through code and how to handle input and collision events. You will also get exposure to many elements of game development including creating user interfaces, artificial intelligence, and writing code with networked play in mind. You will also learn how to add on to the Unreal Editor itself. With a range of task-oriented recipes, this book provides actionable information about writing code for games with UE4 using C++. By the end of the book, you will be empowered to become a top-notch developer with UE4 using C++ as your scripting language!
Table of Contents (16 chapters)

What this book covers

Chapter 1, UE4 Development Tools, outlines basic recipes to get you started with UE4 game development and the basic tools used to create the code that makes your game.

Chapter 2, Creating Classes, focuses on how to create C++ classes and structs that integrate well with the UE4 Blueprints Editor. These classes will be graduated versions of regular C++ classes, called UCLASSES.

Chapter 3, Memory Management, Smart Pointers, and Debugging, takes the reader through using all three types of pointer, and mentions some common pitfalls regarding automatic garbage collection. This chapter also shows readers how to use Visual Studio or Xcode to interpret crashes or confirm that the functionality is implemented correctly.

Chapter 4, Actors and Components, deals with creating custom actors and components, what purpose each of these serves, and how they work together.

Chapter 5, Handling Events and Delegates, describes delegates, events, and event handlers, and guides you through creating your own implementations.

Chapter 6, Input and Collision, shows how to connect user input to C++ functions and how to handle collisions in C++ from UE4. It will also provide default handling of game events such as user input and collision, allowing designers to override when necessary using Blueprint.

Chapter 7, Communication Between Classes and Interfaces: Part I, shows you how to write your own UInterfaces, and demonstrates how to take advantage of them within C++ to minimize class coupling and help keep your code clean.

Chapter 8, Communication Between Classes and Interfaces: Part II, continues the content covered in Chapter 7, discussing in more detail how to get UInterfaces to work in collaboration with Blueprints.

Chapter 9, Integrating C++ and the Unreal Editor: Part I, shows you how to customize the editor by creating custom Blueprint and animation nodes from scratch.

Chapter 10, Integrating C++ and the Unreal Editor: Part II, shows you how to implement custom editor windows and custom detail panels to inspect types created by users.

Chapter 11, User Interfaces – UI and UMG, demonstrates that displaying feedback to the player is one of the most important elements within game design, and this will usually involve some sort of HUD, or at least menus, within your game.

Chapter 12, AI for Controlling NPCs, covers recipes to control your NPC characters with a bit of Artificial Intelligence (AI).

Chapter 13, Working with UE4 APIs, explains that the API is the way in which you, as the programmer, can instruct the engine (and thus the PC) what to do. Each module has an API for it. To use an API, there is a very important linkage step, where you must list all APIs that you will use in your build in the ProjectName.Build.cs file.

Chapter 14, Multiplayer Networking in UE4, discusses how to replicate properties and functions over the network, while also testing your game as a client and server simultaneously.