Sprites Done, Moving On To Non-Hostiles
After a few more tweaks this morning, I got the creature sprites finished and updating correctly. There was a small issue of draw order with some slots, and I needed a way to update mid-battle, but all seems to be working now!
Next up: non-hostiles. Originally, I was going to start on dynamic creature names. E.g. bandits first appear as "stranger" (thanks, Malacodor!) until being identified. However, I had some questions about what constitutes "identified." Does the NPC say "I am a bandit?" Do we assume they're a bandit because they attacked? There's something at work here, and I'm not sure yet how to model it.
So instead, I decided to turn towards non-hostile interactions. One of the first building blocks here is to halt combat so creatures can exist in the same hex without being in battle. Doing this allows us to move freely from the hex, start encounters (e.g. have a conversation) without reverting to battle, and even re-enter battle if someone else enters the hex.
So far, this wasn't hard to do. I setup a test battlemove for "talk" which exits battle. I had to tweak a few things so battle didn't start right up again, but I can now enter and exit 1v1 battle at will.
If there are more than 2 people in battle, however, things get tricky. Does battle just keep going until everyone agrees to talk? Should this work like surrender, where one combatant suggests talking, and everyone is presented with the option to agree? Should everyone be forced to choose yes/no before continuing the battle? What about feigning peace and tricking the opponent into disarming?
So far, the idea of one person kicking-off talks with a request seems simplest. Then, everyone in the battle only has responses to the talk request their next turn, so we can see who wants to talk, and who doesn't. There's a possibility that this opens up cheating via spamming talk requests, so maybe I need to have a "cooldown" on such requests if they fail the first time.
The other tricky thing here is the AI's decision-making process. So far, attack/retreat/hold position are the three modes AI chooses between when in battle. They go through a pretty complex threat assessment to arrive at this choice, based on their condition and that of other combatants.
How does talking fit into this assessment? What makes AI decide talking is a good idea or bad? And more to the point, what makes it better than attacking or retreating? This will require some thinking.
I did get an interesting idea for faction relations while I was working. It seems like I can pretty easily setup a look-up table for each creature that says what their relationship is to each faction, and change those values based on events in the game. This way, creatures can develop a hatred for former allies if there are enough abuses, or form truces. I could also make certain encounters change these values. And it wouldn't be too hard for AI to share this info with other AI it encounters, so we have a sort of viral propagation of love/hate.
It's a lot to chew on, so haven't started coding yet. It'll be good to come back to these ideas tomorrow with a fresh perspective, and see if they're still worth trying.
Have a good one, all!