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!