Monday 19 October 2015

Game Design #55: Solitaire Wargaming - Designing NPC "AI" - Part 1

First of all, I'd like to clarify what I'm talking about. This is not co-operative wargaming, which is becoming trendy through hybrid boardgames like Descent and Imperial Assault.  Whilst these games are co-op - with up to four players ganging up on a dungeonaster in charge of the "bad guys" - there's no "solo" element per se - the opposing force is controlled by a player, necessitating at least two players. 

What do you mean by "Solitaire Wargaming?"
But what I am interested in is solo gaming - where you can play solitaire against yourself, with the opposing army "NPC force" controlled by a mechanism (be it dice, cards or similar) - let's call it "AI." In short, in solitaire gaming you don't need an opponent, nor do you have to "play both sides" - the game takes care of the decisions of one army for you.

On the other hand there are games like Space Hulk - well, the NPCs spawn randomly and make a beeline for the nearest player.  Whilst the way the blips work add randomness, there isn't any real "AI" here, either.

So whilst solitaire wargames can be played co-operatively, not all co-operative games are solitaire. 



...and I mean "proper" solitaire wargaming...
It further annoys me that many indie games advertise "solo play" but include only the barest of mechanics.  A chart where you roll a d6 for each unit, and a 1-2 = attack, 3-4 = hold position, and 5-6 = fall back is not "AI" or a good solo play mechanism. It's just randomness. 

What inspired this train of thought?
I was playing the free FPS-RPG PC Game Warframe  (whose cyborg-Jedi-space-ninjas vs power armour marines, robots/mechs and infested alien critters is as glorious mashup of "cool stuff" in sci fi as Malifaux is to steampunk - I'll do an article on the game itself sometime) .  The game is co-operative, with up to 4 human players with flashy, super-cool weapons and kit decimating hordes of NPC (i.e. computer-controlled AI) foes.

The game has immense customisation for modifying gear and weapons, and I was wondering how this could be simplified to be added to a skirmish wargame campaign.  Then I wondered how easy it would be to straight-out convert Warframe to being a skirmish wargame, using my own homebrew rules. But central to the concept of Warframe is co-operative play.  Making one player the dungeon-master (Descent-style) would be the easy way....  ...but Warframe AI is pretty dumb, yet the game is still fun.   How easy would it be to model the (dumb, simple) AI from a PC game, into a wargame?

Ok, bearing in mind I know next to nothing about PC AI, here are my observations and rough classifications.  I'm going to use my own terminology here.

"Trigger"
This is an event that triggers a change of state or behaviourE.g. spotting you, being fired upon, hearing a suspicious noise, being hit by gunfire.

"Game State"
This is the current "status" of the NPC. In Warframe, there are about three basic states:

Default = Condition green. Oblivious, either standing around or following a preset patrol route.

Alert/Searching = Condition yellow. Triggered by a noise (gunfire). Resets to default after x amount of time without further triggers.

Combat = Condition red.  Triggered by enemies in vision arc or being hit by gunfire or melee.  Resets to yellow after x amount of time with no enemies in LoS of self or any allies.

"Behaviours"
Depending on the game state or trigger, the NPC can perform different behaviours or actions. 
This may vary depending on the type of unit or trigger. 

Default behaviours = stand still or walk in pre-set pattern

Alert/Search behaviours = pivot to face, then move towards source of noise for x amount of time

Combat behaviours = depends on type of unit.
 A melee-centric unit will make a bee-line for the closest foe and get stuck in.  A missile-centric unit will move to the nearest cover and shoot.
 If engaged in close combat, a melee unit will strike back, whilst a missile-centric unit will hit back once then attempt to break away to establish range to shoot at.   Furthermore, missile units may move up or fall back - I presume to attempt to maintain an optimum distance; though I'm not sure exactly what triggers this* (While playing, I'm mostly backflipping off walls while dual-wielding katanas and occasionally throwing lighting bolts from my fingers, so give me a break, OK)

This sketch of the Warframe "AI" loop might help - this was the notes I made myself while playing
 (click to enlarge).
Anyhooo....
I was thinking this would be rather easy to build into a reaction system, such as that used by Infinity (or better still, my d10 Infinity+SoBH homebrew mashup).
I.e. melee enemies "react" by charging towards you. Missile enemies "react" by moving to cover and shooting.  
 In fact, Infinity already does this with "Impetuous" type  troops - they automatically move towards their foes and you have to spend orders from your order pool to restrain them. 

Whats that elephant doing in the corner?  .....Hello there, Two Hour Wargames

This is the one inevitably mentioned when people ask for co-operative or solo play wargames.
Whilst regular readers would be aware I am not particularly fond of 2HW games in general (terrible rules layout/editing, ill-advised devotion to d6s, odd mechanics, and tendency for their fanboys to act like hipster indie music fans - you know, the ones who extol the rubbish local bands no one has ever heard of?)...     .....one of the reasons is a lack of decision points. Whilst I'm a fan of realistic friction and not allowing players total control and precision: I think 2HW errs in taking too many decisions away from the player and automating them.

But for our "AI" - automated decisions are exactly what we are looking for.  

Note: For the sake of this section, I am referring to the older 2HW versions which I have complete rulebooks for, rather than the "newer" CR 2015 system.  

2HW uses an "AI" method which is roll 2d6 against a "REP" level (skill/training) whenever a certain event triggers it.  This test occurs as soon as units first gain line-of-sight to each other, and if they do stuff like shoot at each other.

1. If both dice succeed, the mini can perform the optimal action.
2.If one dice succeeds, the mini can perform a sub-optimal action.
3. If both dice fail, a 'bad thing' or negative action happens.

So there is actually three different responses possible, allowing for a wide range of actions/behaviours; and the likelihood of a favourable outcome is dependent on the unit's skill/training (aka REP).

Furthermore, a different trigger (came into sight of enemy -vs- was shot at  -vs- was charged) may elicit different responses.  These different responses are listed on a series of tables.

Furthermore, different troop types might use different response tables.
Different units will act differently. Not just be humans with different stat lines.

Do you want to know more? The newest Chain Reaction 2015 mechanics are free from 2HW or (less messing around->) DriveThruRPG/WargameVault.  It's a bit more streamlined, but still gives you a good feel for the interplay between triggers and the unit actions that result.

I found it interesting that....
Warframe had triggers (A) which lead to game states (B) i.e. default/searching/combat which then had their own actions/beaviours (C) such as shooting, taking cover, and charging to melee .

Whereas 5150 had triggers (A) that lead directly to actions/behaviours (C) such a shooting, taking cover, and charging to melee - bypassing the (B) step. 

I'm not sure exactly of the implications of this.  5150 cuts out a step, but Warframe organises it more neatly?

As you can see in this older 5150 edition, each trigger - e.g. "In Sight"  "Received Fire" "Being Charged" etc is linked directly to the possible responses/actions in the same box...  Each race would have their own page like this, listing their own unique responses to the triggers...

Infinity and "Semi-solitaire" Gaming
Whilst not "co-operative", as I already mentioned, the impetuous troops have an interesting mechanic. Again, what is cool is they actually act differently to other troops, instead of just having +1 shooting or -1 defence etc. They make a beeline for enemies (without doing sensible things like using cover) unless you spend one of your order pool.  So they have a default behaviour which you can spend resources to alter.

I think the last sentence has interesting implications for the role of a "dungeonmaster" style GM.  In fact, imagine a game that runs by itself solo, but you have the option to have a guy from another table walk over and change x amount of default AI decisons/behaviour.   But then you could do the same to him.  Aka "semi-solitaire" - not quite competitive, but a mutually-agreed chance to mess with other players. 

Well, that's a big enough wall of text.  I'll explore it further and look at some practical examples in Part 2.

Disclaimer:  I have played little to no solo boardgames nor card games nor do I plan to (not enough shiny toys!). If you have thoughts for these areas and the implications for solo wargames feel free to comment below, link to a blog, or start a thread in our google group. 

Why do you always uses videogame analogies/examples? Like it or not, videogames have vastly outgrown their wargame/boardgame cousins, and are far more familiar to a wider audience.

9 comments:

  1. It's not solo, but consider Necromunda. It had a couple of stealth missions where the defending player's sentries each moved a random distance - 1d6 inches minus the model's initiative, if memory serves. If the number came up negative the attacking player moved the model that distance in any direction. If positive, the attacking payer determined the direction the model moved. Which could lead to some interesting tug-of-wars with sentries moving back and forth as the attacker moved the figure away from infiltrators, and the defender moving figures towards attacking figures. Made for some tense stealth missions.

    I always thought that was an elegant way to keep decision points in the game, keep sentries moving, and keep the defender engaged, all while limiting the options that a defender had.

    This is relevant to your post, because it points out an additional avenue for fine tuning reactions. You could make part of the mechanic that sometimes the rule dictates the models' actions and sometimes the player dictates, but over time the programming overwhelms the player choice, so it becomes more of a "table top/in game" counter counting down the turns until the player loses any control over the figure.

    ReplyDelete
  2. You might know of this blog: http://www.solo-battles.blogspot.com/
    He has not posted in a long time, but he was looking at computer games' AI and how the programming might be applied to tabletop gaming.

    --Chris

    ReplyDelete
  3. Pony Wars has one of the original and best "AI"s I have come across, which combines a range of what you have discussed with a valued randomising factor too. You don't want an AI that is too predictable or it just becomes another SOP to trigger doctrinal reactions.

    Written in 1980 they are classically old school but a LOT of fun and have spawned many variants.

    ReplyDelete
  4. Boardgames such as Castle Ravenloft have a one vs system. Each "enemy type" has it's own AI. This can be a passive enemy. It can be one that at a certain distance keeps away from you but with a certain distance will attack the nearest figure. They can shoot you at long range or melee with the figure with the most deadly weapon, or the figure with the most hit-points.
    The free boardgame dungeon plungin' (via Boardgamegeek) has a better monsters AI than the commercial D&D boardgames.

    ReplyDelete
  5. I always thought the popularity of zombie and "bug hunt" scenarios is in part due to the fact that you can make the "AI" extremely simple and predictable and actually have it be in character :)

    ReplyDelete
    Replies
    1. Colonial style games have similar advantages for the native styled forces

      Delete
  6. One idea for making an AI might be giving the Artificial Opponent a number of choices, lined up against the player's last choice in a chart, giving its next action. So if a player Move, Shoot, or Eat Cheese as her action, and the Artificial opponent has the same, then it would rank those actions 1-3 depending on what the Real oppponent did last turn.

    ReplyDelete
    Replies
    1. I'll do a post with some practical applications soon (cards and decision trees tended to figure prominently) but Nick Caldwell over on the DV google group has the best one I've seen, combining cards and dice.

      Delete
  7. I really like your blog and I dive in every now and then to read up to learn more about the hobby. I've been considering Behavior Trees for solo-gaming and co-op play and I think this is a more flexible way to control AI forces.

    The link below gets more technical but the basic idea is there at the top.

    http://www.gamasutra.com/blogs/ChrisSimpson/20140717/221339/Behavior_trees_for_AI_How_they_work.php

    ReplyDelete