W.U. 12: Victory/Defeat Conditions

I was tackling on implementing the checking of victory/defeat conditions to check if the player won already or not, and I realized, “Why not use behaviour trees for this?” Is this really going to help, or is it a case of “when you have a shiny new hammer, everything looks like a nail”?

What I have are these so far:

Types of Victory Conditions:

  1. All enemies defeated
  2. Kill certain units
  3. Survive for N turns
  4. Default: Only player left who is not defeated

Types of Defeat Conditions:

  1. All my units defeated
  2. Certain units of mine are dead
  3. N number of turns passed
  4. A (non-ally) player is victorious

(There’s a lot of redundancy there, like “all enemies defeated” would also trigger “all my units defeated” for the opposing player, but for cases where there are more than two players, defeat of one player won’t automatically mean victory because there would be at least two players left.)

Usually there’d be a list of victory conditions and another list for defeat conditions, for each player.

The question is, does triggering at least only one condition in the list constitute an automatic victory (for that player), or do you need all conditions in the list to trigger true to mean victory? Basically, are the conditions in the list strung together in an AND operation or an OR operation?

And the answer is, it depends on each mission the designer creates. So why not allow the designer the flexibility to specify how he wants it? And with my goal of allowing mods, this does need to be flexible.

So I was thinking, why not structure it as a behaviour tree? One behaviour tree for checking victory, and another for checking defeat. And each player will have one of those pairs (there shouldn’t be only one meant for all players since the AI can have different victory conditions than the human player, for example).

So there it is. Right now it’s just a simple message saying “YOU WON” or “YOU LOST”.

2 thoughts on “W.U. 12: Victory/Defeat Conditions

  1. You could use a trigger system similar to the map editors for RTS’s. Fulfill condition 1 to achieve effect 1. Its much more versatile IMO. You can create any condition from elapsed time, control of unit X, death of unit x, etc. with multiple effects, like unlocking a certain mission, to opening gates or outright victory.

    • So instead of just checking for win/defeat, you mean something that can enable any sort of change? Yeah, we can easily do that. Just depends on what exact type of effects we want.

      Unlocking new missions like you mentioned, opening gates, perhaps gaining new objectives (according to story) are few things that come to mind.

      I already have the system for checking of win/defeat done, and its easy to plug in extra effects.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s