Sub topic 13
Measuring and tuning a live economy
This chapter assumes you know what sources, sinks, and currencies are. It also assumes you can read short Python and compare rates and percentages. It covers what to measure once real players are in your economy and how to change it without breaking it.
Why a live economy needs measurement
A simulation uses your assumptions about players. A live game gives you their behavior. Players find the fastest earning route, skip the sinks they dislike, and stockpile what they think will matter later. The numbers you chose before release are a hypothesis, and telemetry (data the game sends back about what players do) is how you test it.
You need two kinds of measurements:
- Flow metrics describe movement over a period, such as currency earned per day.
- Stock metrics describe a snapshot, such as the balance each player holds right now.
Inflation shows up first in the flow numbers, but players feel it in the stock numbers. Track both.
The core metrics
| Metric | How to compute it | What it tells you | Warning sign |
|---|---|---|---|
| Faucet volume by reason | Sum of earn events per reason label, per day | Which sources supply the economy | One source supplies most of the currency, which often means an exploit or a dominant farming route |
| Sink volume by reason | Sum of spend events per reason label, per day | Which sinks actually work | A sink with near-zero volume is not draining anything |
| Sink-to-source ratio | Total spent divided by total earned | Whether the total supply is growing or shrinking | Far below 1 for weeks means supply is growing |
| Median balance | Middle value of all active players' balances | What a typical player holds | Rising steadily with no matching rise in prices |
| Mean balance | Total supply divided by active players | Average holdings | A mean far above the median means a few players hold most of the currency |
| Top-10% share | Currency held by the richest tenth, divided by the total | Concentration of wealth | A rising share while the median stays flat |
| Time to afford | Hours of play for a typical player to afford a key item | Whether pacing matches your design target | Drifts well below or above the target you priced for |
Use the median instead of the mean for "the typical player". A handful of very rich accounts can pull the mean up while most players are short of currency.
A sink-to-source ratio below 1 is not automatically bad. Most games want it below 1 early, while players are building up a stock. The real question is whether the ratio moves toward 1 as players mature. A mature player base with a ratio stuck at 0.3 is accumulating currency with nothing to spend it on.
Computing metrics from ledger events
Metrics are only as good as the event data. The Ledger pattern from earlier in this tutorial helps because every change carries a reason label. Log each ledger call as an event with a day, a player, a kind, a reason, and an amount. The sketch below turns those events into a daily report.
import math
from collections import defaultdict
from statistics import mean, median
# (day, player, kind, reason, amount)
events = [
(1, "a", "earn", "quest_reward", 500),
(1, "b", "earn", "quest_reward", 300),
(1, "c", "earn", "quest_reward", 200),
(2, "a", "earn", "quest_reward", 600),
(2, "b", "earn", "quest_reward", 300),
(2, "c", "earn", "quest_reward", 200),
(2, "a", "spend", "weapon_repair", 150),
(2, "b", "spend", "shop_purchase", 100),
(2, "c", "spend", "weapon_repair", 50),
]
def daily_report(events, day):
earned = defaultdict(int)
spent = defaultdict(int)
balances = defaultdict(int)
for d, player, kind, reason, amount in events:
if d > day:
continue
if kind == "earn":
balances[player] += amount
if d == day:
earned[reason] += amount
else:
balances[player] -= amount
if d == day:
spent[reason] += amount
total_in = sum(earned.values())
total_out = sum(spent.values())
values = sorted(balances.values(), reverse=True)
top_count = max(1, math.ceil(len(values) * 0.10))
return {
"earned_by_reason": dict(earned),
"spent_by_reason": dict(spent),
"sink_to_source": round(total_out / total_in, 2) if total_in else None,
"mean_balance": mean(values),
"median_balance": median(values),
"top10_share": round(sum(values[:top_count]) / sum(values), 2),
}
print(daily_report(events, 2))For day 2 this reports 1,100 earned and 300 spent, so the sink-to-source ratio is 0.27. The mean balance is 600 and the median is 500. The richest player holds 950 of the 1,800 total, a top share of 0.53. With three players the numbers are tiny, but the structure is the same one a production pipeline uses on millions of events.
Two details in the code matter in practice. Balances are rebuilt from the full history, not just from today's events. Flow metrics are filtered to the day being reported. Mixing those up is a common source of wrong dashboards.
Reading the signals
A single number rarely points to one cause, so read the metrics together.
- Median balance rising, ratio low, time to afford falling. Currency is piling up faster than prices and sinks absorb it. This is inflation. The fix may be more sinks or lower rewards.
- Median balance falling, ratio near or above 1, time to afford rising. Players are being drained faster than they earn. This is deflation, and players will say the game feels grindy.
- Median flat, top-10% share rising. Your best players are finding a route that ordinary players are not. Check the faucet volume by reason for that group before touching global numbers.
- One sink has high volume and players are churning (leaving the game). The sink may be a pain point and not just a drain. Compare churn between players who hit it and players who did not.
Always split the metrics by segment. New players, mid-game players, and veterans earn at different rates, so a global average hides problems. A healthy global ratio can coexist with veterans swimming in currency and new players starving.
The tuning loop
Tuning is a repeated cycle, not a one-time fix.
Define the targets before launch, for example "a typical player affords the first major upgrade in 3 to 4 hours" or "sink-to-source ratio between 0.8 and 1.1 for players past level 30". Without targets, "out of range" has no meaning and every change becomes an opinion.
Tuning safely
Follow these rules when you change a live economy:
- Change one lever at a time. If you raise prices, add a sink, and cut a reward in one patch, you cannot tell which change moved the metrics.
- Test on a slice. Use an A/B test, where a randomly chosen group of players gets the change and the rest keep the old values. Compare the groups on the same metrics.
- Prefer adjusting faucets over prices. Players notice a price rise immediately and read it as a loss. A reward reduction on content they have not done yet is far less visible. Reducing rewards on content players already completed still feels like a punishment, so limit changes to new activity where you can.
- Compensate for retroactive changes. If a change devalues what players already hold, consider granting an equivalent in a different form, or grandfather existing items at their old values.
- Give changes time. Economies respond slowly. A new sink may take a week of play before its volume stabilizes, and judging it after a day can lead you to revert a working change.
- Keep the ledger of your own changes. Record each tuning change with its date and the metrics before and after. Months later this record explains why a curve bends where it does.
Common errors
- Measuring only the total. Without reason labels you cannot tell a healthy source from an exploit.
- Counting inactive accounts. Abandoned accounts with large balances inflate the mean and distort the supply. Restrict stock metrics to players active in a recent window, such as the last 14 days.
- Reacting to a single day. Events, weekends, and sales make daily numbers noisy. Compare weekly rolling averages.
- Fixing a symptom with a global lever. If one group exploits one source, cutting all rewards punishes everyone. Fix the source.
- Skipping alerts. Set thresholds on faucet volume by reason. A sudden jump in one reason's hourly volume is the earliest sign of a duplication bug or exploit, and it arrives before any balance metric moves.
Exercise
A week after a content patch, your dashboard shows the sink-to-source ratio at 0.9 for all players combined, the median balance for players below level 20 has fallen by 30%, and the median balance for players above level 50 has risen by 40%. Name one flaw in judging the economy by the combined ratio, and describe one tuning step you would take.
Show answer
The combined ratio hides opposing trends. New players are being drained while veterans accumulate currency, so the near-balanced total is misleading. A reasonable step is to look at faucet and sink volume by reason for each segment, find what changed in the patch (for example a new high-value reward only veterans reach, or a new sink that low-level players cannot avoid), and adjust that one lever. Test the change on a slice of players and recheck the segment medians afterward.
Exercise
Why is the median balance a better measure of a typical player's wealth than the mean, and what does a large gap between the two suggest?
Show answer
A few players with very large balances raise the mean but barely move the median, so the median reflects what an ordinary player holds. A mean far above the median means wealth is concentrated in a small group, which suggests that group has access to a faucet or route the rest of the player base does not.