So this question is code or engine agnostic but, I’m looking for ideas on how a game can keep track of a pre-determined number of factions or alliances. For example, say I made a space game that has 2 major and 3 minor federations of planets. A planet may join or leave a federation, but the federation itself may have an alliance or be at war with another (actually, to keep it simpler, I think all these changes will solely be reliant on the player’s actions).
However, I would also like to keep track of such diplomatic endeavours on the ‘individual’ level as well. Say the player has joined one federation that is at war with another. If the player should encounter another ship of the opposing federation, that ship becomes hostile. On the other side, two ships have an alliance, they might help one another.
What is the best way to keep track of all this?
One way I was thinking was creating a manager that holds all the Federation classes (which hold the status it holds with all other federations — say less than 0 and the federations are at war; more than x-amount, there’s an alliance). Meanwhile, each player/ship holds similar data in its class, along with its current alliance to whatever federation. Is my thinking logical in this or are there better ways of managing such things? Many thanks.