How to think about time based aspects of Gameplay Ability System in terms of turn based instead

So I’m trying to incorporate GAS into a prototype turn based style game, think X-COM. I’m currently trying to figure out how to do what is traditionally thought of as duration based actions like HOT, DOT, Cool-downs, and Buffs but in terms of turn based. The Gameplay Abilities System’s Effect has Instant, Infinite, and Has Duration Duration Policies, but what is needed for a Turn based game is something like Has Turns. For Example, Adding a Damage Over Time should inflict damage at the beginning of each turn for x turns, not every x seconds.

So there are a few different ways to think about this:

  1. Gameplay Ability System wasn’t meant for turn based games and should be avoided. If so, then I’m going to use it anyways because literally everything else has benefit and it’s going to suck not being able to use duration/turn based effects.

  2. Is there a way to extend GAS to have and honor a Has Turns duration policy? Has anyone done this?

  3. Are there other ways to do turn based stuff within existing GAS infrastructure? For example, does it make sense to:
    a. Have duration based effects be Instant or Indefinite but somehow refreshed every turn for so many turns by some other GAS mechanic?
    b. Or could I use a Has Duration policy but with some Custom Calculation Class logic to accommodate it?
    c. Or maybe go with a very frequent (100ms maybe) Has Duration but with logic wrapped in a DoOnce that gets reset every turn?

  4. Or is this a forking situation? Or rather, turning off the plugin and porting the GAS code directly into project + replacing duration logic with turn logic.

You can have a gameplay ability that grants the target a passive ability that is activated when the turn passes

I’m attempting the exact same thing as you mention. I’m new to Unreal Engine, so take what I say with a grain of salt, but I’ve had some success in my game with the following strategy:

  1. All ‘Turn Based’ Gameplay Effects have a Duration of ‘Infinite’.

  2. All ‘Turn Based’ Gameplay Effects rely on a ‘SetByCaller’ tag so that turn based gameplay events can have a variable turn duration.

  3. Each character tracks their own active ‘Turn Based’ effects in a Map of Effect → NumTurns left.

  4. At the beginning of each turn decrement the number of turns left, executing the effect again if it applies on every turn, and then removing the effect manually if there are no more turns left.

This code is still in progress on my end, so I can’t provide much in turns of snippets… but here are some pieces.

Piece of my ‘HandleStartTurn’ function:

Applying An Effect:

Final thought – My method is definitely not working with GAS as it was meant to be used. It is probably more ‘correct’ to extend GAS FGameplayEffectSpec to support a HasTurns mode directly… but that would take a lot of effort. I’d love to know what you end up going with.

Hey @ScoochShotGames , i’m looking at the same thing and i’m just wondering how do you Execute the Effect at each turn ? . Are you playing with the Period ? Do you take into account the network replication?

regards

JP