Balancing with numbers

Play this lesson

Too hard, or too boring?

Before you joined, Kai and Remy ran a test of Garden Defense. Wave 3 sent 40 beetles and nobody survived. In another test, the snails were so slow that players got bored and wandered off.

Both problems are just numbers. Tuning a game's numbers so it feels fun and fair is called balancing.

All the numbers in one place

Garden Defense keeps its numbers in one data file called balance.json, outside the code. A piece of it looks like this:

"beetle": { "speed": 40, "health": 3 }
"sunflower": { "cost": 50 }
"wave1": { "beetles": 5 }

To make beetles slower, we change one number and no code changes. Later, a tool called Remote Config (Stage 9) can even change these numbers on players' devices without a new app update.

Quick check

Which of these belongs in balance.json?

  1. How fast a beetle moves
  2. The code that draws the garden
  3. The player's password
Show the answer

How fast a beetle moves

balance.json holds the numbers that shape the challenge: speeds, health, costs and wave sizes. Code and private data live somewhere else.

The difficulty curve

The difficulty curve is how the challenge changes over time. A good one looks like a roller coaster climbing a hill, not a wall.

Numbers that grow

Writing every wave by hand gets slow, so designers use a formula, a rule that works the number out.

Multiplying suits prices, because players earn more as they go. Adding suits enemy counts, so waves never explode out of control.

Read the numbers

The first Hyper Shards shield upgrade costs 100 shards, and each next one costs 1.5 times the last. What does the third upgrade cost?

  1. 225 shards
  2. 150 shards
  3. 200 shards
  4. 300 shards
Show the answer

225 shards

100, then 100 x 1.5 = 150, then 150 x 1.5 = 225. Adding 50 each time would give 200, but multiplying grows a little faster at every step.

Fair or frustrating?

Losing is part of games. What matters is how it feels.

Fair: you lose, you know why, and you think "next time I'll do better". A Hyper Shards boss with an attack pattern you can learn is fair.

Frustrating: you lose and don't know why, or it feels like the game cheated. A boss that fires bullets nobody could dodge is frustrating.

Change one number at a time

Say you make beetles faster, plants cheaper and wave 3 bigger, all at once. Now the game feels worse. Which change caused it? There is no way to tell.

So balance like a scientist: change one number, play the game, write down what happened. Then the next number.

Save each change as a commit, a save point in the project's history, with a clear note like beetle speed 40 to 35. If it was a bad idea, you can go back.

Tune it

balance.json
{  "beetle": { "speed": 40, "health": 3 },  "sunflower": { "cost": 50 },  "startCoins": 100,  "wave1": { "beetles": 5 },  "wave2": { "beetles": 8 },  "wave3": { "beetles": 40 },  "wave4": { "beetles": 14 }}

Testers breeze through waves 1 and 2, then everyone loses on wave 3. Which single change makes wave 3 fair?

  1. Set wave3 beetles to 11
  2. Set wave3 beetles to 4
  3. Set beetle speed to 80
  4. Set startCoins to 0
Show the answer

Set wave3 beetles to 11

Waves go 5, 8, then 40: that is a wall, not a hill. With 11, the curve climbs smoothly (5, 8, 11, 14), following 2 + 3 x wave. Only 4 beetles would make wave 3 easier than wave 1, and the other two changes make every wave harder.

You're too good at your own game

Testing after every change is important. But there is a catch: the team has played these games hundreds of times. A wave that feels easy to us might be impossible for someone new.

To find out how the game really feels, we need fresh eyes.

Bolt says: Next lesson: playtesting, the best way to see a game the way a new player does.

Fact-checked 9 October 2026