Friday, May 5, 2017

Thoughts on a turn-based combat system

I've been prototyping a turn-based RPG battle system for a bit now. I wanted to get my thoughts on how these mechanics work together in a more organized form than I'd had in the past, though, so I'm writing this post to detail exactly what I'm doing and get some thoughts.

FWIW: at present I have a battle model but the UI is sort of a hot mess, so there's nothing you'd actually want to play, unfortunately. The back-end is solid, the front-end is, uh, the opposite of that.

So let's start with what I'm shooting for at a high-level here:

  • Medium-weight turn-based combat. By "medium-weight" here I mean something that creates an expansive enough tactical space to facilitate interesting, dynamic encounters driven primarily by player skill as opposed to a pure "who has the bigger numbers" approach, but which remains simple enough that combat encounters aren't necessarily that complex. In a nutshell, I want something that scales well enough to facilitate both complex encounters that demand sophisticated tactical approaches and simpler encounters that are more about quickly and efficiently tearing through whatever's in your way so you can move on. I have some vague notions about a JRPG sort of game structure here, so it's important to have mechanics that are designed to facilitate both more demanding, intensive combat setups and simpler, quicker ones.
  •  "A turn-based fighting game." Turn-based battle systems typically abstract out most of the nitty-gritty of a fight. Which is fair: they're "battle" systems, not "fighting" systems. There's a huge range here in terms of both "complexity" and "abstraction" - but the overarching theme is that most of the fine points of individual person-to-person (or person-to monster, or person-to-robot, or whatever) combat are abstracted out. You talk about what characters are doing in a very detached, birds'-eye sense. I want something that feels much more intimate. I want players to think about combat as a sequence of moments. I want to place real tactical weight on very small movements here - knocking an enemy back a foot matters. And the choices available to you need to be very dependent on the rhythms of the fight - players need to feel out what the enemy is doing, build a plan of attack, and then adjust that on the fly as the fight moves in unforeseen ways. You can never just do something - every action is contingent. Every choice you make opens up some avenues and closes others, for both yourself and your opponent. I want to reward a very aggressive playstyle based in an understanding and control of tempo.

Okay, so now let's talk about the influences that came to mind here.

The first one is - I shit you not - Pokémon. I love the Pokémon battle system to death. I think it's the single most offensively underutilized system in any "major" series of games. I have a half-finished post about just how much tactical space the systems create and how woefully the campaigns fail to capitalize on that, actually; maybe I should finish that at some point. But, anyway, here's the short version: Pokémon switching is a brilliant mechanic that does a lot of interesting things with restricting the options available to players at any one time and, in doing so, creates a lot of room for players to try and control what their opponent can do.

I imagine most of the readers of this post probably haven't played Pokémon multiplayer competitively, obviously, but that's where the mechanic really shines, and so that's the experience I want to draw on here. You have a team of six monsters, each of which has four moves, so a total of 24 possible actions you can take... but you only have one out at a time. And switching your active Pokémon in a case where you didn't just lose one-sixth of everything you can possibly do requires you to waste a turn. This is a huge setback, since the Pokémon battle system is fast-moving enough to make one free turn a game-winning thing if you're prepared to capitalize on it. One free turn lets your opponent knock off half or more of one of your monsters' health. One free turn lets your opponent double their active monster's attack and proceed to sweep through your remaining team. One free turn lets your opponent set up Stealth Rock, which creates a persistent field hazard that can knock off as much as half of your monsters' HP just for switching in, depending on their typings. One free turn lets your opponent undo any of these advantages that you might have seized.

But, well, you have to give your opponent those free turns. Your options from any one game state are just too limited to allow you to address everything your opponent's party can do. If you switch, you risk ceding an enormous amount of momentum to the opponent... but if you don't, you lack the flexibility to capitalize on the opponents mistakes or to begin preparing and enacting your own win condition. Players are presented with a choice between finding openings to burn turns on switches or just outright losing. So you wind up trying to control your opponent and force them into actions that give you safe opportunities to switch in - you want them to use attacks that you know the monster you need to bring in can come in safely on. You want to hit them with status effects that prevent them from moving or weaken their offense enough that you can create safe switches where none existed, previously. You want to predict when defensive threats are going to have to spend a turn healing so that you can use that to bring in your answer to what's in front of you.

And your opponent is doing the exact same thing, so you wind up trying to read their actions, divine a strategy from the information they've revealed about what their team does, and capitalize on the vulnerability this mechanic forces them to expose at regular intervals. If you think they're going to switch, you react to that, and try to exploit it by punishing what you expect to come in. The effect of this mechanic is to create a really rough-and-tumble sort of gamefeel. Players are forced, regularly, to make themselves very vulnerable, and the game builds itself around protecting yourself during those moments of vulnerability and predicting when your opponent will be vulnerable in order to capitalize on it.

This tension is great. There are three points I'm taking away from here:

  • Players should only have access to a limited subset of their total abilities at any one time.
  • Changing which ability subset is currently usable requires you to expose yourself and risk seriously compromising your position.
  • These rules apply equally to the player party and the AI opponents they face, allowing you to play aggressively and exploit the enemy's vulnerability, just like it intends to do to you.
So with that in mind what I arrived at, as far as the core mechanics of this battle system: stances, stamina, stance breaks, and stance changes. 

  • Stances: Every unit in the battle has its actions split between a number of separate fighting stances. Each stance provides access to just that stance's action set. While a unit is in a given stance, its stats are affected by the stat modifiers associated with that stance - a stance that favors dodges and counterattacks might give you a substantial bonus on your evasion stat but compromise on defenses, for example. Additionally: there's no formal indication of what stance an enemy is in. Because I want to emphasize aggressive, reactive play, concealing the name and properties of the enemy's current stance forces you to figure out what the enemy can do from what it has done, which is a nice source of tension, a good incentive for players to keep contingencies and fallback plans, and a good way to make it feel even more rewarding when you take control of the battle. However, each stance does have its own idle animation. You're not told what stance your enemy is in, but if you've fought this foe before and you're observant, you can get a pretty good idea of what you're looking at!
  • Stamina: Each unit has a stamina bar, which - when full - contains 100 points of stamina. Each time you use an attack, it costs you stamina. This isn't a small cost, either - as a general rule most attacks should cost you between one quarter and one half of your total stamina. Depending on what you're doing and how the enemy responds, you may get as many as five actions in before you run out of stamina or as few as one. You can use an attack when you don't have enough stamina to pay its stamina cost... but it'll send you into negative stamina, which is Not Great.
  • Stance breaks: When your stamina is at or below zero, you break your stance. When a character's stance is broken, their defenses and evasion should be reduced substantially until they're next able to take a turn. Additionally, that character will have to wait longer before their next turn comes up. If you're in negative stamina, these penalties increase corresponding to how far into the red you are. Stance break penalties should never be more than doubled... but if you're playing inefficiently, this does mean that you're going to be twice as exposed twice as long. Which is bad. Finally: you can trade your action for the ability to voluntarily break your current stance at any time. Voluntary stance breaks still leave you vulnerable, but penalties are reduced. This doesn't scale, though, and that matters - you get the same penalties for breaking voluntarily at 1 stamina that you do for breaking at 99 stamina. This encourages players to try and edge their stamina usage, getting as much as possible out of their bar before they have to break their stance... but because attacks exist that do stamina damage, edging too much can be risky. Instead of burning through nearly your full bar and then getting the mildest form of the stance break penalties, the opponent might just hit you with a big chunk of stamina damage before you can break, instead leaving you at -33 stamina and very exposed as a result.
  • Stance changes: Whenever a unit with a broken stance has its turn come up, it gets to select a new stance. The only restriction on which stance: it can't be the same one that just broke. The actions available to each unit in the battle - and thus, its "job" - will inevitably shift and change as the battle moves. As a general rule, stances don't totally change a unit's focus in the sense of e.g. making a front-line attacker into a squishy healbot... but they can still change how a unit operates pretty drastically. For example: a unit can be a ranged attacker in one stance, and a front-line attacker that specializes in breaking opponents' stances and creating openings in another. Because your units won't do the same things after changing stances that they did before changing stances, you're encouraged to plan not just around what your party can do right now, but also what you want them to be doing a few turns from now. Moreover, since your opponents' abilities are just as shifting, you need to have contingencies and fallback plans for dealing with sudden changes in the terms of the battle that preclude the approach you originally intended to use.
That's a lot right there, but that's not actually an entire battle system. As you may have noticed: I'm thinking I want this to be party-based. The foci I'm looking at, then:

  • Emphasize the positions of units relative to each other. Unit movement is a thing, but I'm looking at a very "crunchy" sort of system here that's much more about trading blows than it is about the high-level details of a fight. No terrain, no elevation, no walls. Combat takes place on a featureless circular plane, fairly small in size, where the only thing that matters is formation. However, in accordance with the emphasis on small person-to-person combat here: movement is costly. You can't just up and walk away when you're in the thick of it with someone and expect that to work out unless you have someone to cover you, right? Before moving, each unit can move up to its full move range, but you incur additional turn delay for each unit you move in a turn, and not a small amount. If you're way back from a melee, you don't really want to try and charge in all at once if you can help it unless you have an action as part of your stance that's specifically for doing that, because you'll be waiting a long time for your next turn to come up if you do.
  • Emphasize smart use of formations to cover your vulnerable units: The stance change mechanics mean that some portion of your party is usually going to be in a vulnerable state at any one time... and if that's not true, it probably means you're going to be trying to deal with multiple vulnerable units very soon. So it's important to be able to protect those units. Note that "protect" doesn't necessarily just mean "bunch some guys up around them." All it means is "prevent the opponent from capitalizing on that vulnerability." You can protect a unit by positioning them conservatively, sure... but you can also protect that unit, by, say, using another unit to break the stance of the enemy they were engaging before it can attack. A unit can even cover itself by carefully selecting which targets to engage and ensuring that its enemies are dead or otherwise incapacitated when it breaks stance. The underlying aim of this system is to reward aggression and opportunism, so it needs to be possible to prevent opponents from exploiting your broken units while playing aggressively.
  • Parties are small. Because you have to micromanage your units to the extent that you do, and because you need to keep track of a lot of information on individual enemies in order to adequately control, contain, and exploit them, it'd be frustrating for players to deal with larger numbers in a system like this. What's more, the stance change system allows each unit to assume multiple distinct combat roles at different times; part of the tension of this system is that you can't have a party that does everything you want it to at once, which necessitates small enough parties that there will be gaps in the categories of threat you can successfully address at any one time.
The final part of this picture is turn order. What I've arrived at is this: each unit applies a certain delay value to itself at the end of its turn. That value depends on the distance you move, the action you take, and whether or not you break your stance. There's a turn order area to one side of the screen - similar to the Trails games or Final Fantasy X - which automatically displays for you where whatever you're about to do will put you in the current turn order, allowing you to quickly get an idea of what will happen before you can act again if you go ahead with your current plan. Turn order is initially based on unit initiative, which is calculated using the following formula:

speedFactor = (unitSpeed / battleMeanSpeed)

The mean speed stat of all units in the current battle is recalculated at the beginning of each turn, and a given unit's speed factor is just its speed stat expressed as a proportion of that mean speed. Speed factor is used to determine initiative at the start of the battle, but it's also used within the battle to determine exactly how much delay a unit incurs when it uses a given action. If a unit has a speed factor of 2.0 - meaning it's twice as fast as the average speed of the units currently involved in the battle - then all of its actions will divide their delay values by 2 before applying delay. You can act twice as quickly as you "should" if the numbers work! Because there are buffs and debuffs that allow for speed control, and because speed control is powerful, this provides yet another means by which players can manipulate and be manipulated by their opponents. Taking control of the turn order is one more means of minimizing your opponents' window to exploit your vulnerabilities and maximizing your window to exploit your opponents' vulnerabilities.

I might post some more about this project down the line if there's interest and I have something worth talking about; as is, I just wanted to get my thoughts in order a little bit, which I have.