2
\$\begingroup\$

I'm trying to implement a mechanic in a turn based game, and deciding when in the turn order a status effect's duration gets decremented.

Background:

  1. Game is turn based, where there are two opposing players. Each player controls a small fixed amount of characters.

  2. On each turn, the current player submits all their actions.

  3. Then after the actions' calculations, it would be the other player's turn.

Problem:

When does status's duration get decreased?

  • End of turn
  • Start of turn
  • Trigger effect on end of turn, but decrease duration on start of turn?
  • etc.

Below are some example scenarios, decreasing duration at end of turn.

  1. Say I want to apply a status effect to a target such as poison, barrier (absorbs damage), stun. All these status effects have a duration of 1 turn.

  2. Now, when does this status's duration get decreased when applied?

  3. Consider different scenarios:

    • 3a. If PlayerA.unitA, applies poison to PlayerA.unitB, then at the end of PlayerA's turn then the status effect will reduce PlayerA.unitA's hp, and the status will get removed

    • 3b. If PlayerA.unitA. applies barrier to PlayerA.unitB, then at the end of PlayerA's turn it wouldn't be expected to remove the status barrier, because it hasn't even gotten an opportunity to take effect. Because the opponent's turn hasn't even started yet.

  4. So, both status have a duration of 1. But poison is ok to be removed after PlayerA's turn. But same flow can't be applied to barrier.

  5. The solution should be also neatly applicable to other side. Where PlayerA's units, targets PlayerB's units.

\$\endgroup\$
6
  • \$\begingroup\$ This will depend on both of the effect and most important, how you want to handle it. If you have an effect that lasts only one turn (a damage effect), it should not decreased before it actually dealt the damage. Some games deal effect dmg at the start of your turn, some games deal it when you end the turn. \$\endgroup\$ Commented Nov 3, 2024 at 15:23
  • \$\begingroup\$ For cases like damage effect, the effect will be triggered first before its duration expires. What I can't figure out are d cases mentioned above, eg. poison vs barrier. For example, I want poison damage to take effect at d end of turn, then its duration expires also, and it's ok. However, for barrier, I shouldn't remove it right away. Is d only solution, "some effects gets removed at start of turn, while others gets removed at end of turn"? \$\endgroup\$ Commented Nov 3, 2024 at 16:12
  • \$\begingroup\$ For buffs (power up or shilds) you could also consider that they expire on the start of turn of the caster, not the target that has the buff. \$\endgroup\$ Commented Nov 3, 2024 at 19:20
  • \$\begingroup\$ Thanks. Good point. I will consider this. But currently, im looking for a consistent way to reduce the duration, once this is established then can tweak it later. So, for now, im looking at based on target's turn, end/start of target's turn. \$\endgroup\$ Commented Nov 4, 2024 at 0:52
  • 1
    \$\begingroup\$ I would probably remove the word duration at all and replace it by something like instances of effect. For poison it would be like: deals X damage at the start of your turn for the next Y turn. A shield could have instead of a duration: Prevents the next X damage inflicted on the target. And heal over time would be the same as poison, you can decide how you word it. Or there might be a benefit of different heals (some at start, some at the end of the turn) depending how complex your fighting system is \$\endgroup\$ Commented Nov 4, 2024 at 7:43

1 Answer 1

1
\$\begingroup\$

I would recommend to remove time-based status effects on the start of the turn of the player who applied them. Why? Because it gives that player the opportunity to uphold status effects indefinitely by reapplying them immediately when they time out (assuming they got the resources to do that, of course).

Other options lead to weird situations you probably want to avoid.

  • At the end of turn of the player who applied them or at the start of the player who owns the unit: The current player might find themselves in a situation where the UI shows them a ton of attack, movement and action denial effects on various enemy units. But those are all meaningless, because they are going to be over when the player who owns the unit gets their turn. The UI is misinforming the player. You generally don't want that.
  • At the end of turn of the player who owns the unit: In a 2 player combat, this is more or less equivalent to the start of the applying player (assuming no edge cases from order of operations that would require me to make too many unfound assumptions about your game mechanics). But consider a battle with 3 or more factions. Now whether your ally can benefit from the debuffs you apply depends on move order. When the ally has their turn before the enemy, then you can support them by debuffing enemy units for 1 turn. When the enemy has their turn first, you can't. Do you really want that kind of metagaming in multi-faction battles?

Now about trigger effects of DOT effects like poison. This is a question with no right answer. It depends on how you want the game to play:

  • Beginning vs. end of player who owns the affected unit: Do you want a poisoned unit that is destined to die from poison damage this turn to always be able to perform one last action? Do you want the owning player to have an opportunity to heal poison before it even did its first damage?
  • End of turn of applying player vs. somewhere on turn of owning player: Do you want any 3rd factions taking their turn in between to be able to interact with units that are going to die from poision damage anyway?
\$\endgroup\$
5
  • \$\begingroup\$ Thanks for great explanations. Im liking the idea of, "start of the turn of the player who applied them" more. I think I will go with this approach. All different flows seems can be handled. I guess my thinking was fixed on basing it on target's turn. and I was rejecting basing it on caster's turn. Actually, I am trying to design a multi faction battle, so thanks for explaining d different pros and cons well, and considering/sharing it even if it wasn't stated in OP. I just said 2 teams in OP to make d scale smaller and less confusing. \$\endgroup\$ Commented Nov 4, 2024 at 16:29
  • \$\begingroup\$ I think I got tunnel visioned due to ff scenarios. ScenarioA: Player1.allyA stuns Player2.enemyB. Player2's turn starts. At d end of Player2's turn, it would make sense that the stun should be removed, regardless if there are more than 2 players or not. ScenarioB: Player1.allA casts poison on Player2.enemyB. Player2.enemyB. Player2's turn starts. At d end of Player2's turn, poison should deal damage and be removed. But yeah, I think more consistent approach is to base it on start of caster's turn for most statuses. For DOT/heals, I should treat it differently depending on game design. \$\endgroup\$ Commented Nov 4, 2024 at 17:21
  • \$\begingroup\$ i just wanted to mention that, after reviewing, there are some status that is best removed at the end of caster’s next turn, not d start. For example, unitA casts a self buff of damage increase. Then we shouldnt remove this at d start of his next turn, coz he hasnt had a chance to benefit from it yet. \$\endgroup\$ Commented Nov 5, 2024 at 0:34
  • \$\begingroup\$ @user7888262 An attack self-buff that consumes the turn's action is a tricky edge-case in this system. It could be easily implemented without having to add a special mechanic by simply giving it a duration of two turns instead of one. The drawback would be that it communicates to the player that it has a duration of two turns when it in practice only has one. Perhaps the most intuitive way to implement such an effect would be to define its ending condition as after the next attack of the unit. \$\endgroup\$ Commented Nov 5, 2024 at 9:37
  • \$\begingroup\$ thanks for suggestion about A: increasing the duration count B: define ending condition after next attack. How about the idea in my previous comment? Because for B, what if affected user doesn't attack? Then the buff doesn't get removed also. So, I was thinking to remove it after the affected unit's next turn (instead of start of affected unit's next turn which is when most status gets removed). So, regardless if affected unit, attacks or not, then the buff will expire \$\endgroup\$ Commented Nov 5, 2024 at 11:05

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.