Factions and AI

Today was mostly about getting AI to care about factions. Early in the day, I added faction standings to each creature, so they could have independent feelings about the other factions. They'd have some base standings when spawned, but those standings could change later.

I also added some code to share standings info with other allies (i.e. others in same faction) when sharing a hex. They either do it when calculating the next battle move or next map move, depending on whether they're currently in battle or not. It basically checks with other allies and sort of averages their opinions, with the leader having a bigger impact.

Then, I setup some new code and data so that each battle move could affect faction standings for the target. E.g. using "kick" or "attack" lowers the target's opinion of your faction, while "talk" or "accept surrender" raises it. I chose some numbers out of thin air for now, and we'll have to see how the factions hold up in practice.

Finally, I started modifying the AI strategy code so that it handled friendly creatures. "Friends" are treated like allies, minus sharing of opinions and leadership stuff. "Enemies" are any non-faction creatures with a negative rating, and results in fight/flight behavior like we see in 0.982 and earlier. Anyone else (neutral rating) might be lumped in with enemies, but I'll see if it makes sense to make them a special case (maybe a 50/50 chance of treating as an enemy or friend?).

In the case of "friends," I'm going to create a new category of moves called "passive" which includes "talk," "ignore," "advance," and other non-threatening moves. If there aren't other threats around, the AI will choose from this list in battle.

On the map, "friends" are basically ignored, and the AI continues to focus on threats and/or loot. And in the case of loot, AI will now ignore any hex that has a scent belonging to a "friendly" faction (so they don't loot friendly AI). This might not be perfect, but it should help keep the AI's looting focused on either allies (i.e. sharing) or enemies (stealing).

Tomorrow, I'll need to start testing. I'll also need to add the "ignore" and "hail" moves, as only "talk" is in there now. I'm not sure yet how to prove that they system works or not, so it might just be a heuristic playtest to get the general feel. I expect some tweaking will be in order.

Anyway, busy day! And hopefully, tomorrow I'll get a chance to see some of it in action. Have a good night, all!


Malacodor's picture

Sounds very interesting, I hope the faction system won't become too intransparent for the player.

It annoys me that the same combat move icons are always in a different place each new round, and adding even more icons will make it even worse, since I have to seek longer. The icons should have fixed places, so that (if I want to repeat the previous action) I can leave the cursor in the same place and just click and hit space. Also, it would make finding the right icon easier, since after some time one would automatically memorize their positions.

Icons which exclude each other, like for example "hide behind cover" and "advance under cover" could share the same spot to save place, if necessary.

Ran around with a clown mask before it was cool

Melvarius's picture

Don't forget about when the other person doesn't see you! Would passive moves work when you don't see the other person?

~The Pirate

dcfedor's picture

Fixed icon positions would definitely be an improvement. It'd be pretty tricky to setup, though, especially the way items drop into the grids programatically.

In other discussions, some folks have asked if it would be possible to make each move simply a button instead of an item. If this were the case, we'd have a lot more room to work with, and could have dedicated space for each move (I think). Setting that up would require some rewriting, though.

I have both your point and the button idea on my list for future review, in any case!

@Melvarius, that's true! For now, if you can't see the target, you can't offer to talk to them or anything. Depending on how things turn out, this might be a moot point, as some folks had some good ideas about hiding the battle UI unless you know there's someone there.

Dan Fedor - Founder, Blue Bottle Games