The basic concepts in how this is done has been described in the Innovation Brief. The math behind the transference of reputation values is fairly straight forward, but the data stored in the individuals and factions may take an explanation.
To begin with, the factions simply store the reputation value and the motivational priorities for the faction. The class is simply nothing more than a list of variables.
Faction(float rp, float fa, float wa, float sci, float mo)
{
rep = rp;
family = fa;
war = wa;
science = sci;
money = mo;
}
The NPCs use a similar set up in this version of the project. However, they are placed within an ArrayList of a faction. Factions themselves can become subfactions by placing them within an ArrayList as well, nesting ArrayLists into multiple factions and subfactions. However, this project is focusing on the factions and one level of individuals.
The basics of reputation evaluation have been discussed in the brief, however the details are quite interesting. Though a faction’s reputation is based on the “average” of all the NPCs reputation values, it is further adjusted by comparing the current stored values of last communications. This last value is stored for each priority seperately (compare npc.familyrep and npc.lastfamilycom). This last communication is multiplied against its type within the faction and that value is applied to the factions reputation.