Faction Reputation
Faction reputation tracks how much each group in the world likes the player, as a number that deeds move up and down. A tier such as friendly or hostile is read from it. A tier changes only a little past its border, a deed also moves the groups tied to it, and time slowly fades every standing.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Faction Reputation" to my game.
What it should do: Reputation makes the world remember. The player's choices change how doors, prices and words are given, so siding with one group has a price, and helping everyone is not free.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> neutral
hostile: Hostile
wary: Wary
neutral: Neutral
friendly: Friendly
allied: Allied
neutral --> friendly: favour reaches 25
friendly --> neutral: favour sinks below 20
friendly --> allied: favour reaches 70
allied --> friendly: favour sinks below 65
neutral --> wary: favour sinks below -15
wary --> neutral: favour reaches -10
wary --> hostile: favour sinks below -45
hostile --> wary: favour reaches -40
allied --> neutral: a long time passes
hostile --> neutral: a long time passes
```
Use these starting values:
- maxStep: 30 points
- spillover: 50 %
- margin: 5 points
- decayPerDay: 1 points/day
Watch out for these common mistakes:
- A player on the border flickers: Tell your AI: keep the tier between actions. Go up at the border, but go down only once the standing is a few points below it.
- Friends and enemies pass deeds on forever: Tell your AI: spread a deed to the tied groups exactly once, from the group it was for, and never again from a group that was only reached.
- The favoured group is already at the top: Tell your AI: a deed still counts for the tied groups when its own group is already at the limit.
- Waiting turns a grudge into a liking: Tell your AI: when time pulls a standing toward zero, stop at zero.
- One huge deed skips a whole tier: Tell your AI: cap what a single deed can move, at no more than the width of the narrowest tier.
- A tie is only written one way: Tell your AI: a tie between two groups works both ways, so one entry is enough.
- A tie stronger than one: Tell your AI: hold every tie between minus 1 and 1.
Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
What it does
Reputation makes the world remember. The player's choices change how doors, prices and words are given, so siding with one group has a price, and helping everyone is not free.
How it runs, as a diagram
Everything it can be in, and what moves it on. Your AI builds from exactly this.
How it runs, as a diagram
- Neutral → Friendly: favour reaches 25
- Friendly → Neutral: favour sinks below 20
- Friendly → Allied: favour reaches 70
- Allied → Friendly: favour sinks below 65
- Neutral → Wary: favour sinks below -15
- Wary → Neutral: favour reaches -10
- Wary → Hostile: favour sinks below -45
- Hostile → Wary: favour reaches -40
- Allied → Neutral: a long time passes
- Hostile → Neutral: a long time passes
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| maxStep | 30 points | The most one deed can move a standing. It is never more than 30, the width of the narrowest tier, so that no single deed can jump over a whole tier. |
| spillover | 50 % | How much of a deed reaches the groups tied to the one it was for. At 0 the groups ignore each other, and at 100 a friend of a friend gains as much as the one helped. Half keeps the pull felt but small. |
| margin | 5 points | How far below its border a standing may sink before the tier drops. It stops a player standing right on a border from flipping between two tiers. At 0 the tier flips at once. Stay under the width of the narrowest tier. |
| decayPerDay | 1 points/day | How fast every standing drifts back toward zero, in points per day. Zero means the world never forgets. At 1 a grudge or a friendship fades in a few months of play. |
What usually goes wrong
A player on the border flickers
A standing sits at 26 and the friendly tier begins at 25. One small deed down and the tier is neutral, one small deed up and it is friendly. Shop prices and greetings jump back and forth.
Fix: Tell your AI: keep the tier between actions. Go up at the border, but go down only once the standing is a few points below it.
Friends and enemies pass deeds on forever
Group A is friends with B and B is friends with A. A deed for A raises B, which raises A, which raises B, and the numbers run away or the game hangs.
Fix: Tell your AI: spread a deed to the tied groups exactly once, from the group it was for, and never again from a group that was only reached.
The favoured group is already at the top
The player is already at the top with the guild and does it a favour. The game sees no change for the guild and skips the whole deed, so the guild's rivals lose nothing.
Fix: Tell your AI: a deed still counts for the tied groups when its own group is already at the limit.
Waiting turns a grudge into a liking
Time pulls a standing of minus 0.4 toward zero by a full point and carries it past zero to plus 0.6. A group that hated the player now likes them for nothing.
Fix: Tell your AI: when time pulls a standing toward zero, stop at zero.
One huge deed skips a whole tier
A big reward gives plus 90. A hated player jumps from hostile straight past wary and neutral to friendly, and the whole slow climb is gone.
Fix: Tell your AI: cap what a single deed can move, at no more than the width of the narrowest tier.
A tie is only written one way
The list says the guild is against the smugglers, but a deed for the smugglers does not touch the guild. The rivalry works in one direction only.
Fix: Tell your AI: a tie between two groups works both ways, so one entry is enough.
A tie stronger than one
A typo makes a tie 9 instead of 0.9. A small favour for one group then moves another by nine times as much.
Fix: Tell your AI: hold every tie between minus 1 and 1.
How to check it works
- A new game, every group at 0. the player does the guild a deed worth 20: the guild stands at 20 and is still neutral.
- The guild stands at 24 and the friendly tier begins at 25. the player does the guild a deed worth 1, or a deed worth 0.5: the guild becomes friendly after 1, and stays neutral after 0.5.
- The guild is friendly at 30 and the margin is 5. the player loses 8 (to 22), then 2 more (to 20), then 3 more (to 19): the guild stays friendly at 22 and at 20 and becomes neutral at 19.
- The guild and the smugglers are enemies, the guild and the crown are friends at a strength of 0.5, and half of a deed spreads. the player does the guild a deed worth 30: the guild gains 30, the smugglers lose 15 and the crown gains 7.5.
- The crown is sworn against the smugglers. the crown gains 7.5 from a deed for the guild: the smugglers lose only the 15 that came from the guild's deed, and nothing more from the crown's gain.
- A cap of 30 per deed. a deed worth 500 or minus 500 is done: the standing moves by 30 up or 30 down.
- The guild stands at 0. the player does deeds worth 30 again and again, and then deeds worth minus 30 again and again: the guild stops at exactly 100 and allied, and then at exactly minus 100 and hostile.
- Standings of 20, minus 20 and 0.5 and a fade of 1 per day. 2 days pass, and for 0.5 one day passes: they read 18, minus 18 and exactly 0.
- The guild is friendly at exactly 25, and another game has it allied at 100. 6 days pass, and in the other game 500 days pass: the first guild is neutral at 19, and the second is neutral too.
- The fade is set to zero and the guild stands at 40. 1000 days pass: the guild is still at 40.
- A deed for a group that does not exist, or for an amount that is not a number, is infinite, or is zero. the game does it: nothing changes.
Works well with
- Shop (Buy and Sell): A friendly tier can cut prices and a hostile one can close the shop. Use the tier, not the raw number, so prices do not jump with every small deed. Read the tier when the shop opens, then apply the price change for that tier.
- Dialogue System: Changing a tier in the middle of a talk makes a character change tone halfway through a sentence. Read the tier once at the start. Pick the lines for the player's tier before the conversation starts.
Common questions
how do i make a reputation system with different factions
Give each group a number from minus 100 to 100 that deeds move. Turn the number into tiers such as hostile, neutral and friendly, and let the rest of the game read the tier. Tell your AI to keep the tier between actions, so it does not flicker.
how do i make helping one faction anger its rival
List a tie between the two groups, from minus 1 for enemies to 1 for friends. When the player helps one, move the other by the deed times the tie, and about half strength works well. Do it once, and never pass it on from the group that was only reached.
why does my reputation tier keep flipping back and forth
The player stands right on the border and each tiny deed crosses it. Go up at the border, but go down only after the standing sinks about five points below it.
what do i tell my ai to add faction reputation
Paste this: Add faction reputation from minus 100 to 100 per group with five tiers. One deed moves a standing by at most 30, and moves tied groups by half of that once, never in a chain. A tier goes up at its border and down only 5 points below it. Standings fade toward zero over time and stop at zero.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 22 tests pass on the reference code.
- The state diagram was checked against the code, at the default values and at every listed low and high value.
Your AI gets the code
Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it