Frayed Knights: Brains!
Posted by Rampant Coyote on March 10, 2014
Here is a little-known fact about Frayed Knights 1: The Skull of S’makh-Daon: The more intelligent enemies are actually smarter with how they attack. Not by much – in fact, it’s so subtle it’s probably unnoticeable unless you were to really find comparable enemies and do a comparison.
If you don’t mind peeking behind the curtain – on every move, the AI takes into consideration a handful of (semi-randomly selected) potential actions, gives them a weight based on circumstances, and then chooses the most heavily weighted action (with an additional, small, random amount added to the weight). As the enemy’s Brains score goes up, they take more options into consideration – increasing the chance that the “best” option will get added to the pool of actions being considered.
At one point, I had the enemies pretty regularly choosing the “best” action all the time… and it was rough. I don’t think I subjected any of the testers to that kind of punishment. The AI would play a lot like the player does – ganging up on one party member at a time, and so forth – only with the added bonus that the AI need never hold anything in reserve for a future fight. There was no conserving endurance or items. While this helped me optimize how some actions are weighted, and it was certainly challenging, it was too brutal. The game is a lot more fun with some “artificial stupidity.”
Besides not even considering some actions at random, I changed the weights to make things more interesting. For example, attacking an unwounded character is given a heavier weight (and higher likelihood) than moderately injured one. This is because it makes for a more tense, dramatic fight, and because “spreading the damage around” gives the player a better chance of surviving the first round or so and responding to attrition.
I love working on AI (most of the time), but Frayed Knights 2: The Khan of Wrath presents some interesting challenges for me as a designer and programmer. The biggest change is that parties are now controlled by a group, rather than just individuals taking their turn. This means at some level, I need a “mastermind” that plans out the activations of the party members. How smart should this “mastermind” be? What should their approach be? Should the personality of the enemy “player” controlling the enemies change based on the composition of the enemy party?
In nature, packs of predators do use intelligent tactics. Not the kinds of things that would translate really well into Frayed Knights, but things like position, distraction, flanking, surprise… even “unintelligent” animals master these tactics as a matter of survival. So it’s not like I should necessarily dumb down the “master AI” because the group is predominantly low-intelligence monsters.
One of the ideas I’m also fiddling around with is making enemy intelligence something of a factor for difficulty level. Rather than simply making enemies more powerful, players looking for a greater challenge can deal with enemies that really know how to go after the pain.
I’m pretty confident I’ll have it tuned and working pretty nicely in the end. But as I’m in the middle of it right now, you get to hear some of the thoughts I’ve had and choices I’ve been making lately.
Oh, and just a reminder – please vote to Greenlight Frayed Knights: The Skull of S’makh-Daon on Steam.
Filed Under: Frayed Knights - Comments: 6 Comments to Read
Maklak said,
Hehe, I remember pus golems and brittebone skellies attack pretty much at random, with slight preference for the front row. Chloe or Benjamin suddenly getting hit did make for more dramatic fights while giving some more time to heal up.
I also remember hobgoblins and paper matche dragons being pretty brutal and effective. It might have something to do with their brains, but they were alos pretty tough and hit hard.
The worst fight in the whole game was (to me) 8 goblins at once when their chief escaped. Action economy works about as well in FK as it does in DnD.
Rampant Coyote said,
One goal early on that I kinda moved away from (to be more traditional) was that numbers of enemies count. Fighting 3 opponents at once is a lot harder than fighting one at a time three times.
In a nod to that, in Frayed Knights (and in the sequel), you get an experience point bonus for fighting larger groups. So fighting a group of eight will be worth significantly more XP than four groups of two. I’ve never heard of any other game doing that, so I guess that’s another FK original…
alanm said,
I think better AI at higher difficulty levels is a good idea because it matches what players want. A player on the “just tell me the story” setting probably doesn’t want to min/max his party and won’t plan battle tactics beyond using fire attacks on ice enemies. But a player playing through on the “power gamer” setting is in it for the challenge.
Modran said,
Ah, the old “An AI too intelligent is horrible, an AI too stupid is boring” conundrum.
I’ve been playing Puzzle Quest 2 lately, and the AI is good at matching (always identifying 4-in-a-rows I miss, and, I’m pretty sure, cascades of mana), but less than stellar on skill combos. Many times I found myself thinking “It should have done this after this”. The results would have been sometimes a real PITA, but the game would have been less of a cakewalk…
The fights in FK are already pretty brutal as they are, IMHO. I found myself going back to town to rest up many times before managing to reach the top of the tower. But it felt GOOD to reach that top 🙂
Adam said,
You mentioned that the AI is somewhat subtle unless you are looking for it specifically so perhaps this next bit doesn’t make sense. Or perhaps this is actually already in the game in which case I’ll likely be embarrassed for not knowing. What about spells or other items that alter the intelligence of either single combatants or this “master mind” you are speaking of? Perhaps a potion of infinite dumbness or some consumable item that isn’t super easy to get. Or a ring of super smartness that essentially does the same thing. (You’re smarter if everyone around you becomes dumber right?) I’m not sure it would work if the changes to the AI are too subtle but the idea seems interesting. Or perhaps an entire dungeon where the enemies are on the “super intelligent” side of the scale. The player can go in and try to handle the fights, but if they can somehow steal the “mystic orb of knowing”, the ‘global’ intelligence of the dungeon goes down. Just some ideas that came to mind when I read your post.
Cuthalion said,
Interesting. I haven’t tried making AI yet, but it’s good to read how other people have balanced it.