Hi, I hope I"m not asking for too much but I'm trying to make an arcade game that uses a diplomacy system you might have seen in other games and despite my best trying to reverse engineer other games and think of how to implement one, I'm just finding myself stumped.
How would one go about creating a system where you can do simple things like proposing alliances, non-aggression pacts, or more important, surrendering to someone?
And a aspect of my game I want is if you capture someones capital building, you will turn them to your color and they will have to fight as your vassal unless they rebel or you kill them off.
I'd start with a new preset with all the different states you want, like
In Non-Aggression Pact
And another one for proposals.
Then make a new record (call it Diplomatic Status) with two variables: Relationship, Proposal
Then have a 2-dimensional array of Diplomatic Status type, so that for each player they have a Diplomatic Status for each other player. Though you might want to structure it a bit differently if, for example, a diplomatic relationship is always mutual, to avoid redundant storage in that case.
Then make some helper functions to make it easier to check any of several states, e.g. In Alliance and Non-Aggression Pact would both disable auto-attack, so you could make a function named "Is Hostile" that takes two player parameters and returns true if the relationship is either one of those two.
With those pieces in place, you should be able to make all the triggers necessary to show/hide dialog items (buttons to propose/accept relationships) and such.