Tuesday, January 27, 2015

Behavior Trees, and Stunt Concept

I've finished building a new AI frame for Legacy based on behavior trees. The main motivation was to make the AI much faster and more predictable, which also means more controllable for me. The old algorithm algorithm was a monte-carlo tree search, which worked after a fashion, but was frustratingly slow and difficult to tune (e.g. monsters would run away from heroes rather than engaging them.)

It is definitely much faster now! Before, each move would mean a 5 second pause, and each monster made 2 or 3 moves per turn. Now, choices are made without any noticeable lag (<200ms? I should measure it.. but it's so fast I don't care!) and the AI behavior sticks (mostly, perhaps there are some bugs) to what I expect.

The new strategy is a pretty simple tree, it looks like this:


I'm sure that doesn't make sense but basically it means, for each character, try to attack an enemy this turn by getting in range and using an ability. Once you can't use any more abilities this turn, prepare for next turn by moving towards or away from your enemies. (it's bad to be too close to your enemy because they can surround you, but you want to be close enough to attack them next turn if possible.) Once every team member has moved, end the turn.

More complicated abilities will probably have to modify this just a bit, but I think this should model most of the basic behavior we want from our AI. The great thing about the behavior tree model is how scalable it is. I can easily add more strategies as sub-trees, and then randomly select into them rather than the default, or even select into them based on other high-level criteria. I'm feeling good about the model and the performance.

Nothing particularly relevant here..

Onward to fun combat! I have some ideas for integrating character back stories into combat. The problem is that we want to have tons of interesting aspects that are applicable in certain contexts, without overwhelming the player with a vast ability menu. The idea I have in mind is a combination of the FATE spin/boost system and the stunt system from the Dragon Age table top RPG (I have not played but I watched this episode of TableTop. The idea is that when you attack, if you roll doubles (on 3d6) then you get to apply a bonus effect or two from the stunt table.

So the way I'm adapting that for Legacy is that instead of a crit chance and crit damage, you have a stunt chance that scales with the number of applicable aspects (and the situation), and when you stunt you apply a generic disadvantage on the target, along with some flavor text from the relevant aspect. (That's the part that is like FATE.) The temporary disadvantage is consumed in the next relevant interaction with that monster (when your ally attacks it, for example, or when it attacks on its turn) or at the end of your next turn.

The result, hopefully, will be to bring a character's background into the foreground in a way that is fun but not distracting or annoying. No huge menu full of situational abilities. Just a good chance that your background will have a positive (or negative!) effect during combat. With supporting flavor text.

So to that end I'm going to do some work on the character histories -- tying them to aspects, and revamping the combat roll. I may also revisit the longer-form histories that we used to have, since I think they are better suited to use as aspects.

Tuesday, January 13, 2015

Housekeeping

We're all moved in at the new place, and I'm back at work. Today I finished some housekeeping tasks for Legacy, too. The animation system is finally put back together, and I'm generally happy with the state of the code, so I'm ready to move forward.

It looks like one of the first things I need to do is revisit AI, because the current implementation is getting in the way of fun. I need it to be faster and more predictable, so that I can iterate on the core tactical mechanics. There's a lot of things to try out, like Beacons, and mini CCG/Dominion -style character advancement. Mission structures. Monsters and Puzzles.

You know, the fun stuff.

Friday, January 2, 2015

Beacons


Nate's been tossing around the idea of "beacons," and I'm sure he'll correct/edit this post if I get the summary wrong:

Beacons would be points on the map (maybe 2-3 on large maps?) where little shriney-looking ancient stone lanterns are. You "light" them with magic or potions or... I dunno, regular fire like a normal boring person. Once lit, they not only provide light to a large area (super convenient in dark dungeons) but probably also do something fun like give out healing energy or buff your fire spells or daze enemies. Hence the different colors.

He also brought up the idea that they can be used as "locks," where you have to light a certain color beacon that opens a corresponding door or breaks a corresponding curse or MacGuffins a corresponding MacGuffin.