Book Image

Building an RPG with Unreal 4.x

By : Steve Santello
Book Image

Building an RPG with Unreal 4.x

By: Steve Santello

Overview of this book

Now that Unreal Engine 4 has become one of the most cutting edge game engines in the world, developers are looking for the best ways of creating games of any genre in the engine. This book will lay out the foundation of creating a turn-based RPG in Unreal Engine 4.12. The book starts by walking you through creating a turn-based battle system that can hold commands for party members and enemies. You’ll get your hands dirty by creating NPCs such as shop owners, and important mechanics, that make up every RPG such as a currency system, inventory, dialogue, and character statistics. Although this book specifically focuses on the creation of a turn-based RPG, there are a variety of topics that can be utilized when creating many other types of genres. By the end of the book, you will be able to build upon core RPG framework elements to create your own game experience.
Table of Contents (17 chapters)
Building an RPG with Unreal 4.x
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a new C++ class


We're now going to create a new C++ class with the following steps:

  1. To do this, from the Unreal editor, click on File | New C++ Class. We'll be creating an Actor class, so select Actor as the base class. Actors are the objects that are placed in the scene (anything from meshes, to lights, to sounds, and more).

  2. Next, enter a name for your new class, such as MyNewActor. Hit Create Class. After it adds the files to the project, open MyNewActor.h in Visual Studio. When you create a new class using this interface, it will generate both a header file and a source file for your class.

  3. Let's just make our actor print a message to the output log when we start our game. To do this, we'll use the BeginPlay event. BeginPlay is called once the game has started (in a multiplayer game, this might be called after an initial countdown, but in our case, it will be called immediately).

  4. The MyNewActor.h file (which should already be open at this point) should contain the following code...