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, ...

Get Building an RPG with Unreal 4.x now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.