Tales of the Rampant Coyote

Adventures in Indie Gaming!

Frayed Knights: More Artificial Stupidity

Posted by Rampant Coyote on July 23, 2010

A real quick development note on  Frayed Knights (because I’m about to hit the road again for a few hours):

I’m working on some fairly simple artificial intelligence stuff right now – heuristic / weighting stuff for enemies choosing targets, etc. So they won’t try to, say, heal somebody who is already healed, or anything like that anymore. There’s still a bit of randomness involved in this current iteration, tentatively left in there to do something to keep the AI somewhat stupid.

Face it, if the enemies were really smart, the players would be dead in ANY dungeon delve. All you need is for the enemies to coordinate their defense, focus on the healers first (who effectively make up the “logistics” arm of the party, if you were to use a military analog), then burn down the other spellcasters (the “artillery” in a military analog) and finish off the rest of the party at their leisure.  There are some variants (maybe neutralizing the artillery-casters first, if the healers aren’t potent enough to keep up), but ultimately if I were playing the AI with a real desire to win and really, really hurt the party, I’d focus fire on killing or at least neutralizing party members one by one.

Knights of the Chalice – still one of my favorite indie RPGs – had some pretty evil, potent AI.  It could get frustrating, but it was fun too.  They weren’t exactly 100% optimized, but anybody who has played it knows that the game was all about protecting your wizard(s). One advantage to the AI in a class-based game is that character roles are very nicely defined, making strategy easier to implement.

In a more skill-based game, or a hybrid like Frayed Knights, it’s a little trickier to define.  And even so… does it really make sense to make the AI very smart and ruthless? One of the main tricks of a DM in a dice-and-paper game is to have the enemies back off a little on “finishing off” a heavily wounded PC to give the players time to avoid a TPK (Total Party Kill). Nearly wiping out the entire party is fun for all involved. Actually doing so – not so much.

So I find myself trying to put these little heuristics and rules of thumb into Frayed Knights, as well. So, for example, the more wounded a target is, the more likely they are to be zapped by a direct-damage spell, up until a certain point where the weighting algorithm flattens out.  Little things like that. Effectively, I am making the AI pull their punches just a little bit to give the player a chance.

But don’t worry about this cheapening victory. But most of the heuristics thrown into the mix are designed to make the AI pretty nasty with its tactics. Damage-over-time spells will be focused on more healthy characters, to maximize their damaging potential. Melee buffs and debuffs get focused on front-line fighters (friendly and enemy sides, respectively). Heals (and revivals) go to them that need it. A battle against a “mixed party” of spellcasters and melee enemies should be should provide an interesting challenge.

At least, so I hope. In spite of my making them a little less ruthless than they could be…

Filed Under: Frayed Knights - Comments: 12 Comments to Read

  • Stephen Wolstenholme said,

    For artificial intelligence get into neural networks. NN methods can improve game play a lot, especially if you allow the networks to continue learning during play.


  • Bad Sector said,

    It is always interesting to see magazine reviewers saying how clever (or not) a game’s AI is while nobody mentioning that if the AI was actually too smart (and it can be smart enough), players would have a hard time competing against them.

    Case in point: Half-Life. In HL1 the AI is actually much harder. Yes, Valve likes to boast how advanced the AI system in HL2 is, but in practice its much easier to kill HL2’s Combine than HL1’s soldiers. While some like HL1’s soldiers more for the difficulty involved, most people seem to prefer the easier combine.

  • Kimari said,

    Mmmhhh, have you thought about … assigning different strategies to each type of enemy?
    A simple example would be something like: Slimes always attack the enemy with the most HP while archers do the opposite. If the player has a way of knowing which monsters are going to appear in his way, then he’d be able to prepare for the tactics that he’ll have to face.

    … now, I don’t expect you to like this idea, much less implement it, but I just had to mention it for some reason.

  • Rampant Coyote said,

    @Kimari – Already going there, dude. Not sure if I’ll keep it or not, but that’s currently also “in progress.”

  • Kimari said,

    *high five*

  • JMP said,

    … Doesn’t it make a lot more sense to have enemy behaviors? It doesn’t make sense for a brainless slime to target a character intelligently, just like it doesn’t make sense for an intelligent mage to repeatedly cast spells on the party that they’re immune to. I’d recommend different AI arch-types for the different broad classes of enemy behavior.

    It’d also increase the level of strategy to find through playing the game that there are ‘dumb’ enemies, and more ruthless ones that won’t hesitate to gang up on the person acting as healer if the opportunity arises. “Oh shi- it’s a trio of arch-mages!!!”

  • ClassicsRemade said,

    In earlier versions of UW if all characters were asleep / charmed or otherwise incapacitated the mobs would strike one, thus lifting the incapacitating condition, then would gang up on him / her, leaving the others for later. Then start again with another.

    In the end though those fights turned out to be virtually impossible to win. I agree that there is a point where more realism stops adding fun to the experience and starts making it just too frustrating.

    Just sitting there watching your party shrink by one every round without being able to do anything about it would be such an experience. We have to make sure it doesn’t happen too often… Or at all!

  • Xenovore said,

    Quote: “…Face it, if the enemies were really smart, the players would be dead in ANY dungeon delve…”

    This is only true if the design does not provide the player with solutions to counter the AI’s strategies…

    Quote: “…focus on the healers first…then burn down the other spellcasters…”

    …if the design provides viable solutions to protect the healers and casters (e.g. “tank” classes can intercept attacks, shield/dispel/reflection spells are available and might be cast pre-emptively, heal-over-time spells can mitigate damage, etc.) then it’s okay to make the AI smart.

    Issues arise when the design does not provide a balance between what the player can do and what the AI can do, e.g. if the AI is always going to cast fireball on the healer, and there’s no way for the player to defend against that, then the design is flawed and needs to be adjusted, either to remove the AI’s fireball attack, or provide a defense against it.

  • Rampant Coyote said,

    Well, I could put it this way:

    A single encounter in a dungeon is generally a challenge.

    A “smart” colony of dungeon denizens wouldn’t fight the player in small groups of single encounters like that, but instead launch a spirited, combined defense. Alarms and stuff. Think… uh…. Moria right before the Balrog strikes…

    Imagine all the creatures in the Temple of Pokmor Xang coming at you at once when you are by the portcullis gates… 😉 Sheer numbers alone would drag the party down.

    While you’ll get a taste of that occasionally in FK (particularly if you make a beeline for the boss), the enemies still deliberately engage in small groups rather than combining forces for mutual defense.

  • Xenovore said,

    Thinking about this a little more…

    Facing up against a group, how does one realistically go about determining which is a healer or wizard? The lady dressed in robes? The guy waving his hands and mumbling? Of course, for AI you can just do a quick cheat and look up some variable like “Character[3].Profession” but that’s weak…

    You could check armor, “Oh that guy is wearing cloth, must be a caster” which would allow for a little bait-and-switch strategy, where the warrior throws on a robe, making enemies think he’s a caster. (Similar to a PVP strategy in WoW where a tank-specced paladin throws out a few heals at the beginning of the fight to fool the opposing players into thinking he’s the healer and going after him.)

    Of course, if a character actually casts a spell, that makes it obvious, but are the enemies necessarily going to notice…? There should be some sort of “awareness” or “perception” check there…

  • Xenovore said,

    @ Rampant: Yeah, very true… but once again — if the design allows for some sort of area-of-effect attacks and positional strategies like finding a choke point where only a few enemies can come at the party at a time, then even large groups can be viable without becoming unfair.

    It’s all in the design, man — balance, balance, balance. =)

  • Maklak said,

    Well, maybe not in F.K. (at least not if fights look anything like in the pilot), but in a game like TES enemise rallying agains the player, calling for reinforcements, etc, and forcing the player to run would be fun at times 🙂 I think they tried to do something like that in Darkfall MMO, but it ended up not as good as intended, and there are some user posts saying “Ok, so the goblin is running in circles around me, which is frustrating enough, I hit him a few times, and he runs over the hill, so I finnish his buddy, and by the time I’m done, he’s back with 2 more gobos, which is not a serius treat, more lewt form me!”. I also remember in EoB2 there was a corridor full of enough skeletons to overwhelm the party, but it could be sealed off by a door. The tactics here was to open the door for a short time, cast some spells, and shut the door again. Then rest and repeat a few times before going into direct combat. This was actually fun. Oh, and there is another tactics against overwhelming odds, that is for some reason considered a cheat in MMOs: Get to a place where monsters can’t get you, and PWN them with ranged area attacks for XP.