New account registration is temporarily disabled.
  • Add Review
  • Subscribe
  • Nominate
  • Submit Media
  • RSS

Core: AI

  • DFalcon
  • 06/11/2010 12:49 AM
  • 921 views
The last couple weeks have been pretty gamedev-free, what with starting a new job, moving, overtime, and other assorted stuff. I was kind of in the mood tonight, but my bug notes are inaccessible right now, so I thought instead I'd make an overdue post here.

The Oxtongue Heroes AI engine is built around a public constraint programming package. Without getting into it too much, this core is a program good at solving certain types of puzzles. I express the state of the battle map as a puzzle vaguely in the same vein, then can tell it to do things like "find a solution where the group does maximum damage".
Of course arranging it like that sort of puzzle is not exactly trivial, and I have to be careful that the question is both not-stupid and something that can be answered in reasonable time. (Below is an example, hidden for tl;dr.)
Consider, for example, finding a solution where the group does maximum damage, from above. Unfortunately, knocking a unit to zero HP usually does less than maximum damage - this is not a good way to kill units!

Telling it to maximize some sum involving bonuses for KOing units is a possibility, but complicating the expression to be maximized like that can be hard for it to handle (though I'm not sure off-hand that it couldn't manage that particular one). There's also a concern that the setup works a little better if no step decides to KO more than one unit; making a KO increases avenues of movement (sometimes quite a bit, because of zone of control), but I have to set that up as part of the 'puzzle rules', as the package can't efficiently understand it otherwise. As far as I've managed, anyway.

The best way to deal with this problem that I've used is to make sure it doesn't come up. Any set of goals that includes "maximize damage" has to figure out whether it's making any KOs or not before it gets to that step. Doable, but a complication; in that sense it's typical enough.

Like several aspects of the game, setting up the AI like this was an experiment. This does give the game the ability to take advantage of the turn format, moving several units in an order that makes sense instead of something weaker and less intuitive like a predetermined order. But you couldn't put it in a TRPG Maker - accounting for non-damage effects is often a real pain.

Moving on! The AI still usually does not calculate for every unit on its team simultaneously. Computer-controlled factions are divided up into groups: collections of units that share more or less the same set of goals. For a simple example, I could have one group defend a home base, and another move out to attack. Because these groups may by design have somewhat conflicting goals... they move in a predetermined order. You win some, you lose some - I wanted to leave some freedom in battle map design and that's how the balance has come out.

I had originally planned to make each group's priorities public, as part of the really-perfect-information philosophy of the game. But I've needed to make the lists of priorities longer than I anticipated, and I think it might be a little too intimidating and not helpful for a while. So now I'm not sure what exactly to show for this - maybe I can settle on a few standard labels that give some useful information about a group, though imperfect. If anyone's dedicated enough to want to see more, it's not hard to find in the map file...

Posts

Pages: 1
Craze
why would i heal when i could equip a morningstar
15170
I think this is pretty cool, and the the "group mentality" is an effective way of going about doing this. Not only does it save system resources, it makes the enemy works as a team - impressive to the player thinking "oh no that wave of dragon lich knights is charging at me while the lizardmen shamans are buffing them instead of those minion mobs this is baaaaaaaad."
Pages: 1