Sub topic 5
Balancing Inflow and Outflow
Assume you understand a game’s core loop, can read short Python code, and can calculate percentages. This chapter uses those skills to analyze how currency accumulates or disappears over time.
The stock-flow model
A game economy tracks a stock, which is the amount currently held by players. Currency enters the stock through sources, also called faucets. Currency leaves through sinks, such as purchases, repairs, crafting fees, or taxes.
The basic balance is:
ending stock = starting stock + inflow - outflowThe total stock can increase even when individual players spend currency. For example, quests may add 10,000 coins across all players while shops remove only 7,000. The economy gains 3,000 coins overall.
| Economy state | Inflow compared with outflow | Likely result |
|---|---|---|
| Growing | Inflow is greater | More currency accumulates |
| Stable | Inflow is about equal | The total stock stays near its target |
| Shrinking | Inflow is less | Players lose purchasing power or currency becomes scarce |
Track these values over the same time period. Comparing daily income with monthly spending produces a misleading result.
A proportional sink
Some sinks remove a fixed amount, such as a 100-coin repair fee. Others remove a percentage of a player’s balance. A proportional sink grows as the stock grows, which can help prevent runaway accumulation.
Suppose each day adds 100 coins and removes 10% of the current balance:
def simulate(days, income_per_day, sink_rate, start=0.0):
"""Track one player's balance."""
balance = start
history = []
for _ in range(days):
balance += income_per_day
balance -= balance * sink_rate
history.append(round(balance, 2))
return history
print(simulate(60, 100, 0.10)[-1]) # close to 900The balance approaches an equilibrium rather than increasing forever. For a fixed daily source and a proportional sink, the approximate equilibrium is:
equilibrium = daily income × (1 - sink rate) ÷ sink rateWith 100 coins and a 10% rate, this is 900 coins. The result depends on the order of operations. Adding income before the sink produces a different short-term path than removing the sink first.
Measuring stability
Use economy-wide telemetry, not only the balance of an average player. Record:
- currency created per day, grouped by source;
- currency destroyed per day, grouped by sink;
- median and percentile balances;
- time until a player makes a first purchase;
- the share of players who cannot afford intended purchases;
- inactive or abandoned balances.
A positive net flow is not automatically a problem. Early progression may intentionally give new players more currency. The important question is whether the stock remains compatible with prices, progression, and player behavior.
Finding the cause of drift
If balances rise, first separate the possible causes:
- A source pays more often than intended.
- A sink is optional, too expensive, or easy to avoid.
- Players have reached the end of progression and no longer need to spend.
- A reward can be claimed repeatedly through an exploit.
- Prices are too low for the earning rates.
If balances fall, inspect failed purchases, repair costs, mandatory fees, and changes in play frequency. A sink that looks balanced in a spreadsheet may be too harsh when players miss a day or play an unusual mode.
Exercise
A game creates 12,000 coins per day and removes 9,000. What is the daily net flow, and what should the designer investigate first?
Show answer
The net flow is +3,000 coins per day. Investigate which sources create the excess and whether intended sinks are optional, too costly, or unavailable to the players receiving the coins.