From FreeOrionWiki
Jump to: navigation, search

WARNING: This page is out of date. For a blow by blow of the how the latest ideas are progressing, check out the forum thread Simulating Citizens. For a more detailed description of how imperial actions will affect the allegiance of various species, see this page regarding imperial alignment.

Citizens should be able to respond to events primarily in a way that enhances gameplay and is simple and predictable, and secondarily in a somewhat realistic way.

The purpose of the system of allegiance and happiness is to

  • Allow technologies and racial picks which affect diplomacy equally for human players and AIs,
  • Allow a method to alter and take advantage of the political condition of other empires,
  • Make multi-species empires more interesting than just an empire with different sets of numerical bonuses on different planets.

To meet these goals, I have developed and organized this system of Objective, Collective Allegiance with local happiness and visibility restrictions.


Happiness represents the overall comfort of a planet’s citizens, both physically and ideologically. Some things that affect a planet’s max happiness include:

  • Techs and buildings or other objects owned by the empire/nearby,
  • Racial picks, including government and ethos,
  • Planet environment

Things which might affect current happiness include:

  • Local events such as planetary bombardment, starvation, blockade, sabotage, etc;
  • Non-local events with a local effect on the planet in question, such as random events or disasters;
  • Empathy

Natural growth of the happiness meter is related to allegiance in much the same way population growth is related to health.

Effects of Happiness

When Happiness drops below 20, rebel troops are generated according to some formula involving (20 - current happiness) and current population. The action the troops take is largely dependent on their allegiance to the current owners of the planet. If allegiance is greater than 20, the action taken will involve some sort of destruction of infrastructure and/or buildings, possibly reducing current values of economic and military meters. This is known as a riot.

If allegiance to the current owners of the planet is less than 20, there is a possibility, determined by some formula involving (20 - current allegiance), that the action taken by the rebel troops will be an attempt to capture the planet. This is known as a rebellion.

Aside from determining when and to what extent riots and rebellions occur, the happiness meter functions as an internal espionage meter. If happiness is high, it is more difficult for enemy agents to successfully perform espionage operations, and easier for the owner to successfully perform internal espionage operations.

Each species in an empire also has an “average happiness”, which is an average of all the current values of the happiness meters on planets of the same species in the same empire, weighted by population. This value is used to determine current allegiance growth. In this way, allegiance and happiness are distinct, but strongly related aspects of a planet.


Allegiance represents the combined respect and loyalty that each species in each empire has towards each empire.

This means that each species in an empire has an allegiance meter which gauges its allegiance towards each empire, including its owner empire. Even if Empire X does not have any of species A in its empire, Empire X will still have meters indicating what species A’s allegiance to each empire will/would be when/if Empire X acquires some of species A. Some things which might affect the max value of these meters include:

  • Localized objects such as buildings and ship parts,
  • Non-localized objects such as technologies and racial picks,
  • Political objects such as treaties and wars.

Things which might affect the current value of these meters include:

  • Localized events such as battles, bombardment and espionage;
  • Non-localized events such as completion of a research project or some other type of special project;
  • Political events such as signing a treaty or declaring war.

Allegiance growth of a particular species towards a particular empire is determined by the average happiness of all the planets of that species in that empire, weighted by population.

Since every planet of the same species in the same empire shares allegiance meters, allegiance is not affected differently on the planet where an event occurs and a different planet of the same species in an empire. It is in this sense that a species responds collectively to allegiance altering events.

Furthermore, provided Empire X and Empire Y have visibility of the same allegiance altering event or object, that event or object will have exactly the same effect on the allegiance of species A, regardless of the empire to which they belong. It is in this sense that a species responds objectively to allegiance altering events.

If an empire does not have visibility of an object or event, that object or event does not affect max or current values of the allegiance meter. It is in this sense that there are visibility restrictions on allegiance.

The type of event or object which affects a species' allegiance, and the extent to which allegiance is affected is determined by the species' ethos. The target species is considered an unchanging, integral part of an event. That is to say that the Trith, for example, will consider the bombing of a Trith planet to be an entirely different event from the bombing of an alien planet. If there are 3 ethoi, X, Y and Z, and the Trith have ethos X, bombing a planet will be one of five different events: "A planet containing our species was bombed", "A planet of ethos X, but not of our species was bombed", "A planet of ethos Y was bombed", "A planet of ethos Z was bombed" or "A planet of an unknown species was bombed" (maybe impossible, depending on how much visibility you need to see bombardment and the inhabiting species of a planet).

The above is for localized events and objects only. For both localized and non-localized events, the change in allegiance towards the perpetrator is also modified by allegiance towards the target empire. If the action is good, and allegiance towards the target empire is above 50, allegiance towards the instigator goes up. If the action is bad and allegiance to the target empire is above 50, allegiance towards the instigator goes down. The opposite is true if allegiance for the target empire is below 50. If the event is local, the change in allegiance due to allegiance towards the target can be considered separately from the species' objective opinion of the event itself. For example, if the Orange, Blue or Black Trith have high allegiance to Black, and Blue bombed a Black planet of ethos Z, the net effect on the Orange, Blue or Black Trith's allegiance to Blue would be "You bombed a planet belonging to an empire to which we have high allegiance. Shame on you." + "You bombed a planet inhabited by a species with ethos Z. Good for you."

It is important for the sake of maintaining consistent bonuses and penalties to allegiance that the amount by which allegiance to the target empire exceeds or falls short of 50 is irrelevant to the allegiance bonus/penalty towards the perpetrators. For the purposes of actions against a particular empire, either a species likes them, or they don’t. This prevents having to constantly check exactly how much your species like or dislike an empire when you are engaged in ongoing warfare or diplomacy with another empire.

If a planet of species A is captured by Empire X from Empire Y, that planet will then immediately take on Empire X’s allegiance meters for species A, regardless of what allegiance they had before as members of Empire Y. The justification for this seemingly weird rule is that other rules, such as averaging allegiance, or giving captured planets individual allegiance meters, draw too much attention to the micro details of individual planets. FO supports galaxies with up to 500 stars. At potentially 10 planets per system, this makes a possible 5000 planets. FO also, to my knowledge, supports up to 13 players at the moment. This means that at any given time, a player could be at war with several empires contesting dozens of planets. Having to worry about how the war as a whole will affect allegiance (due to the political object “war” and the cumulative effect of individual war actions) is a good, significant thing to have to consider. Having to consider how allegiance will be affected due to the effect of each captured planet’s allegiance averaging with that of the rest of the empire is far too micro to be considered worth the additional realism that it would allow.

This averaging contrasts with allegiance changes due to repetitive, individual war actions in that such actions will always get the same reaction from the same citizens, provided that their opinion of the target empire does not change drastically. There is no turn-by-turn checking involved. Bombing a planet of species A in Empire X will be either liked or disliked by species B, and the amount which it is liked or disliked will not fluctuate. The results of averaging the allegiance from a specific planet with the rest of your empire however, could change from one turn to the next, and the player would have to check each individual conquest to see if it would be worth the difference in allegiance. This would not be a good situation to have in a massive empire-building game with up to 5000 planets. Furthermore, if you were engaged in diplomacy with an empire whose citizens liked you, giving you the political advantage, and that empire happened to be capturing a lot of planets from an empire whose citizens didn’t like you, it would seem like an arbitrary and unintuitive blow when you lose your political advantage because the empire over whom you had said advantage was at war with an empire over whom you had no such advantage. Thus, it is more reasonable and practical to put up with a small amount of planetary allegiance-shifting weirdness rather than having to deal with a lot of imperial allegiance-averaging weirdness.

Effects of Allegiance

In addition to controlling the growth of the happiness meter, the allegiance meter should also have other, more direct functions. During an invasion, all parties involved in ground combat will receive support from the citizens based on allegiance. In addition, if ships have specific races aboard, high allegiance from that race should prevent outcomes such as retreating or defecting to the other empire, and raise performance in battle.

The relevant thread in the forums is here: Simulating Citizens