Relationship Meters
A relationship meter tracks how much one character likes the player, from minus 100 to 100. Kind deeds raise it and unkind ones lower it. Gains are capped per day, a mood is entered at one line and left at another so it does not flicker, and neglect fades the meter slowly toward neutral.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Relationship Meters" to my game.
What it should do: A meter for how much a character likes the player turns many small deeds into one feeling the whole game can react to: a warmer shop, a closed door, a friend who shows up when it counts.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> neutral
neutral: Neutral
friendly: Friendly
unfriendly: Unfriendly
neutral --> neutral: stays in the middle
neutral --> friendly: rises to friendly
neutral --> unfriendly: falls to unfriendly
friendly --> friendly: stays friendly
friendly --> neutral: falls back to neutral
friendly --> unfriendly: falls all the way
unfriendly --> unfriendly: stays unfriendly
unfriendly --> neutral: recovers to neutral
unfriendly --> friendly: jumps all the way up
```
Use these starting values:
- enterAt: 30 units
- tierGap: 10 units
- dailyGainLimit: 15 units
- decayPerDay: 2 units
Watch out for these common mistakes:
- One gift buys a friend: Tell your AI: limit how much the meter can gain in one day, and do not limit losses.
- The mood flickers at the line: Tell your AI: enter a level at one line and leave it at a line a little closer to zero.
- The fade overshoots zero: Tell your AI: move the value toward zero and stop at zero, never past it.
- A refused gift is treated as no contact: Tell your AI: any real attempt counts as contact for the day, even when the amount is cut to nothing.
- The player is away for a week: Tell your AI: when days pass, say how many, pause the fade for the one day of contact only, and fade the rest.
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
A meter for how much a character likes the player turns many small deeds into one feeling the whole game can react to: a warmer shop, a closed door, a friend who shows up when it counts.
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 → Neutral: stays in the middle
- Neutral → Friendly: rises to friendly
- Neutral → Unfriendly: falls to unfriendly
- Friendly → Friendly: stays friendly
- Friendly → Neutral: falls back to neutral
- Friendly → Unfriendly: falls all the way
- Unfriendly → Unfriendly: stays unfriendly
- Unfriendly → Neutral: recovers to neutral
- Unfriendly → Friendly: jumps all the way up
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| enterAt | 30 units | How far from zero the meter must be to reach the friendly or unfriendly level. A higher line makes friendship harder to earn. |
| tierGap | 10 units | How far inside that line the meter may fall before the level is lost. Without a gap, a value hovering at the line flips the character's mood on every small deed. |
| dailyGainLimit | 15 units | The most the meter can gain in one day. It stops one gift from being handed over again and again. Losses are never limited. |
| decayPerDay | 2 units | How far an ignored relationship drifts back toward zero each day. Zero means the feeling lasts forever. |
What usually goes wrong
One gift buys a friend
The player finds a flower that every character loves and hands one to the same person a hundred times. The meter hits the top in a minute.
Fix: Tell your AI: limit how much the meter can gain in one day, and do not limit losses.
The mood flickers at the line
The meter sits at 30, the friendly line. One small favour makes the character friendly and the next small insult makes her neutral, and her greeting changes back and forth.
Fix: Tell your AI: enter a level at one line and leave it at a line a little closer to zero.
The fade overshoots zero
A value of 1 loses 2 points overnight and ends at -1, so a forgotten friend turns into a mild enemy.
Fix: Tell your AI: move the value toward zero and stop at zero, never past it.
A refused gift is treated as no contact
The player has used up today's allowance and offers another gift. Nothing changes, the game counts the day as ignored, and the relationship fades anyway.
Fix: Tell your AI: any real attempt counts as contact for the day, even when the amount is cut to nothing.
The player is away for a week
The game loops over seven days by hand and forgets that yesterday's visit should pause the fade only once, or it applies seven fades to a character the player saw this morning.
Fix: Tell your AI: when days pass, say how many, pause the fade for the one day of contact only, and fade the rest.
How to check it works
- A stranger at zero. the player does a deed worth 8: the meter shows 8, the game reports 8 as the change, and the character is still neutral.
- A daily limit of 15. the player does ten deeds worth 5 each on the same day: the meter stops at 15 and the later deeds change nothing.
- The limit was used up today. a day passes and the player does a deed worth 20: 15 more is gained, so the meter shows 30.
- The daily gain is used up and the meter is at 10. the player does a deed worth minus 40: the full 40 is taken, so the meter shows minus 30.
- A meter near the top or near the bottom, with a large daily limit. a deed pushes past the end: the meter stops at 100 or at minus 100 and nothing more is reported as changed.
- The friendly line is at 30. the meter reaches 30, or only 29: 30 is friendly, 29 is still neutral, and the same holds mirrored for unfriendly.
- A friendly character at 30 and a gap of 10. a deed lowers the meter to 24, then to 19: she stays friendly at 24 and becomes neutral at 19, and the same holds mirrored for unfriendly.
- Meters at 10 and at minus 10, a fade of 2 a day, and no contact. one day passes for the first and three for the second: they show 8 and minus 4.
- The player did something today. one day passes, or four days: one day brings no fade, and four days bring only three days of fade.
- Meters at 1, at minus 1 and at 0. days pass: each stops at 0, never goes below it or above it, and 0 stays 0.
- Today's allowance is used up. the player offers another gift and a day passes: the gift changes nothing, but the day counts as contact and the meter does not fade.
- A meter at 10. a deed with no number, an endless number or zero arrives, or a number of days that is zero or not whole: the meter stays at 10 and it does not count as contact.
- An unfriendly character at minus 40 and a large daily limit. a deed worth 80 arrives: she is friendly straight away, without a stop at neutral.
Works well with
- Dialogue System: Use the level and not the raw number, so lines do not change on every small deed. Read the character's level when the conversation starts, then offer the answers for that level.
- Faction Reputation: A person can like the player while her group does not, which makes for good stories. Let deeds change both, by different amounts. Keep the two apart: a meter for one person, a standing for a whole group.
- Daily Rewards: A daily visit can pause the fade, which rewards players who come back without making them grind. Use the same day counter for both, so there is one idea of a day.
Common questions
how do relationship meters work in games
Each character has a number for how much they like the player. Deeds move it up or down, and the game reads a few levels such as unfriendly, neutral and friendly instead of the raw number.
how do i stop players from farming gifts
Limit how much the meter can gain per day, and leave losses unlimited. A good starting point is a daily gain of about 15 on a scale of 100, so a friendship takes at least a few days.
what do i tell my ai to add a relationship meter
Paste this: Add a relationship meter from -100 to 100 per character. Cap gains at 15 per day but not losses, enter the friendly level at 30 and leave it at 20, drift ignored relationships toward zero by 2 a day without crossing zero, and let any contact pause the drift for that day.
should relationships fade over time
A slow fade keeps the world alive and rewards players who come back, but a fast one feels like a chore. Two points a day is a gentle start. Let the player turn it off if it frustrates them.
Where it comes from
We could not find a reliable origin for this one yet.
What was checked
- 16 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