O'Reilly logo

Building an RPG with Unreal 4.x by Alan R. Stagner, Steve Santello

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Turn-based combat

So, as mentioned in Chapter 1, Getting Started with RPG Design in Unreal, combat is turn-based. All characters first choose an action to perform; then, the actions are executed in order.

Combat will be split into two main phases: Decision, in which all characters decide on their course of action; and Action, in which all characters execute their chosen course of action.

Let's create a class with an empty parent to handle combat for us, which we'll call CombatEngine, and path it to a new directory located in Source/RPG/Combat, where we can organize all of our combat-related classes. Formulate the header file to look like this:

#pragma once #include "RPG.h" #include "GameCharacter.h" enum class CombatPhase : uint8 { CPHASE_Decision, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required