Sub topic 2
Structuring the Workbook: Parameters, Calculations, Outputs
A balance workbook is a program written in cells. Like any program, it becomes hard to change when inputs, logic and results are mixed together. This chapter sets up a three-layer layout that you will reuse in every later chapter.
Prerequisites
This chapter assumes you can:
- Write formulas with cell references in Excel or Google Sheets.
- Fill formulas down a column and know what changes when you do.
- Use basic functions such as
ROUND,SUM,AVERAGEandIF.
You do not need to know any game design theory beyond the goals from the previous chapter. You will need to turn those goals into numbers a sheet can check, so keep your target list nearby.
Why structure matters
Balancing is iterative. You change a number, look at the result, and change it again, often dozens of times. A poorly structured sheet makes this loop slow and error-prone in three ways:
- Hidden constants. A formula such as
=A5 * 120 ^ 1.8contains two tuning values that nobody can see without opening the cell. When you want to change the exponent, you must find every copy of it. - Inconsistent edits. If the same constant is typed into 40 cells, changing 39 of them produces results that look plausible and are wrong.
- Unreadable results. If the numbers you care about (time to kill, income per hour) sit in the middle of intermediate columns, you cannot tell at a glance whether the design meets its targets.
The fix is to separate the workbook into three layers.
| Layer | Contains | You edit it when | Typical sheet names |
|---|---|---|---|
| Parameters | Tunable inputs: base values, exponents, multipliers, targets | You want to try a different design | `Params` |
| Calculations | Formulas and tables that turn parameters into numbers | You change the model itself | `Levels`, `Targets`, `Damage` |
| Outputs | Summaries, checks and charts that you read | Rarely; they only display results | `Summary` |
Data flows in one direction only.
The rule that makes this work is simple: a calculation cell never contains a number that you might want to tune, and an output cell never feeds a calculation. The only arrow that returns to the start is you, the designer, changing a parameter.
The Params sheet
The Params sheet is a two- or three-column table. Each row is one tunable value.
| Row | A | B | C |
|---|---|---|---|
| 1 | Name | Value | Notes |
| 2 | Base XP | 100 | XP needed for level 1 |
| 3 | XP exponent | 1.6 | Higher means a steeper curve |
| 4 | Base price | 50 | Price of a level-1 item |
| 5 | Price growth | 1.15 | 15% more per level |
| 6 | Max level | 30 | Rows built in `Levels` |
| 7 | Target TTK (s) | 8 | Goal for a level-matched fight |
A few conventions keep the sheet usable:
- One value per row, with a label and a note. The note records the unit and the reason, such as "seconds" or "percent as 0.15".
- Store percentages consistently. Decide once whether 15% is
0.15or15, and write that rule in the notes. Mixing the two is a common source of errors that are off by a factor of 100. - Mark input cells visually. A common convention is a light-yellow fill, or blue text, for cells you are meant to edit. Everything else is a formula and should not be typed over.
- Keep targets here too. Target values, such as the time to kill you want, are parameters because you decide them. Placing them in
Paramslets the output layer compare results to targets.
Named ranges
You can refer to Params!$B$2 directly, as the later chapters do. You can also give the cell a name, such as BaseXP, using the Name Box or the named ranges menu. Then the formula reads =ROUND(BaseXP * A5 ^ XPExp, 0).
The trade-off:
- Names make formulas readable and survive row insertion without effort.
- Direct references are easier to trace with the "trace precedents" tool, and they work the same in every spreadsheet program without setup.
Pick one style per workbook. This tutorial uses direct references with absolute addressing so that every formula can be pasted and followed without setup.
Absolute and relative references
Fill-down is the main tool of a balance workbook, and it depends on getting references right. A dollar sign locks part of a reference.
| Reference | On fill-down | On fill-right | Use for |
|---|---|---|---|
| `A5` | Row changes | Column changes | The level in this row |
| `$A5` | Row changes | Column stays | A row label used across many columns |
| `A$5` | Row stays | Column changes | A column header used down many rows |
| `$A$5` | Fixed | Fixed | A parameter on `Params` |
Every reference to a parameter should be fully absolute ($B$2). If you forget the dollar signs, the first row works and the second row silently points at an empty cell, so the curve collapses to zero partway down.
The Calculations layer
Calculation sheets hold the model. Each sheet answers one question, and each column does one step.
Here is a Levels sheet that builds the XP curve from the Params table above. Row 4 holds the headers, and row 5 is level 1.
| Row | A | B | C |
|---|---|---|---|
| 4 | Level | XP to next level | Item price |
| 5 | 1 | formula | formula |
| 6 | 2 | formula | formula |
The formulas in row 5 are:
=ROUND(Params!$B$2 * A5 ^ Params!$B$3, 0)=ROUND(Params!$B$4 * Params!$B$5 ^ (A5 - 1), 0)The first goes in B5 and the second in C5. Fill both down to row 34 for 30 levels. Each formula uses the level in column A, which changes per row, and reads its tuning values from Params, which never move.
Guidelines for this layer:
- One step per column. Avoid a single cell that computes damage, applies armor, and converts to time to kill. Split it, so you can see where a surprising number first appears.
- Headers with units. "TTK (s)" is better than "TTK".
- Consistent formulas down a column. Every cell in a column should have the same formula in relative terms. If one row needs a special case, put the special case in its own column or row, not hidden inside a copied formula.
- Generate levels, do not type them. Make A6
=A5 + 1so that the table length depends on one rule. - Keep raw data separate from formulas. If you import a unit list, put it on its own sheet, such as
Targets, and let calculations read from it.
The Outputs layer
The Summary sheet is what you look at while tuning. It should answer "does the design meet its goals?" without scrolling through calculations.
A useful summary contains:
- Key results. A few numbers, such as time to kill at level 10, or hours to reach the level cap.
- Targets next to results. Show the target, the result, and the difference.
- Pass or fail flags. A simple check turns a comparison into a signal.
- Charts. A line chart of the XP curve shows a kink faster than a column of numbers.
A row of a check table might look like this:
| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | Metric | Target | Result | Error | Status |
| 2 | Level-matched TTK (s) | `=Params!B7` | `=Damage!H10` | `=(C2-B2)/B2` | `=IF(ABS(D2)<=0.1,"OK","CHECK")` |
The tolerance (here 0.1, or 10%) is also a design choice, so it should live in Params rather than in the status formula. Replace 0.1 with a reference such as Params!$B$8.
The table above uses the same relative-change idea as the sensitivity formula =(C2 - B2) / B2, which you will meet again in the sensitivity chapter.
Check cells beyond targets
Add a few cells that test the workbook itself:
- A check that the curve is increasing:
=IF(MIN(B6:B34 - B5:B33) > 0, "OK", "CHECK"). In Excel versions without dynamic arrays, enter this as an array formula or use a helper column. - A check that no cell in the table is an error:
=IF(SUMPRODUCT(--ISERROR(B5:C34)) = 0, "OK", "CHECK"). - A count of blank parameters:
=COUNTBLANK(Params!B2:B8), which should be zero.
Worked example: changing one number
Suppose the XP curve feels too steep. In a well-structured workbook you do this:
- Open
Paramsand change the exponent in B3 from 1.6 to 1.4. - Read
Summary. The hours-to-cap result updates, and its status flag turns from "CHECK" to "OK". - Look at the chart. The curve is flatter, with no other change.
That is one edit in one cell. In the unstructured version, you would search every formula for 1.6. Any copy you miss gives a curve that is internally inconsistent.
Common errors
| Error | Symptom | Fix |
|---|---|---|
| Constant typed inside a formula | Changing `Params` has no effect on some rows | Move the constant to `Params` and reference it |
| Missing `$` on a parameter | Values are right in row 1 and zero or wrong below | Use `$B$2` style references |
| Output feeds a calculation | Circular reference warnings, or results that change when you format a chart | Keep data flow one way |
| Percent stored two ways | Results off by 100 times | Standardize and note the rule in `Params` |
| Hard-coded copy of a result | The summary stays the same after you change a parameter | Replace pasted values with formulas |
| Hidden rows or columns | A formula refers to data nobody sees | Unhide, or document why they are hidden |
Protecting the structure
Once the layout works, protect it from accidents:
- Lock calculation and output cells, and leave only the input cells in
Paramseditable. Both Excel and Google Sheets support protected ranges. - Use data validation on parameters. For example, restrict "Max level" to whole numbers from 1 to 100, and "Price growth" to values greater than 0.
- Keep a short
READMEarea or sheet that lists the sheets, their purpose, and the unit conventions. - Save a dated copy before major changes, or use version history, so you can compare against an earlier design.
Summary
- Split the workbook into Params, Calculations and Outputs, with data flowing one way.
- Never type a tunable number inside a formula. Reference it with an absolute address.
- Make each calculation column do one step and keep formulas consistent down the column.
- Put targets and tolerances in
Params, and compare them with results onSummary. - Add checks for the workbook itself, and protect input cells with validation.
Exercise
A colleague's sheet has the formula =ROUND(100 A5 ^ 1.6, 0) filled down 30 rows, and a second sheet with =ROUND(100 A5 ^ 1.6, 0) * 2 for a boss XP curve. List the problems with this layout and describe how you would restructure it using the three layers.
Show answer
Problems: the base value 100 and exponent 1.6 are hidden constants, repeated in two places, so changing the curve means finding and editing every copy, and a missed copy makes the boss curve disagree with the normal curve. The multiplier 2 is also a hidden tuning value. Restructure: put Base XP (100), XP exponent (1.6) and Boss multiplier (2) in rows of Params with labels and notes. Change the first formula to =ROUND(Params!$B$2 A5 ^ Params!$B$3, 0). Make the boss column a separate step that reads the normal XP cell and multiplies it by Params!$B$4, for example =B5 Params!$B$4. Then one edit in Params updates both curves, and Summary can read from either.
Exercise
You fill =Params!B2 * A5 ^ Params!B3 down from row 5 to row 34. Row 5 gives the expected value, but row 6 gives 0. What went wrong, and what is the corrected formula?
Show answer
The parameter references are relative, so on fill-down they move to Params!B3 and Params!B4 in row 6, and further down to empty cells. The corrected formula locks both parameters: =Params!$B$2 * A5 ^ Params!$B$3. Only A5 stays relative because it must follow the level in each row.
Exercise
Why should the tolerance used in a pass or fail check, such as 10%, be stored in Params and not typed into the status formula?
Show answer
The tolerance is a design decision that you may want to tighten or relax while tuning. If it is typed into the formula, it is a hidden constant, and every status cell must be edited to change it. Stored in Params, one edit changes every check, and the value is visible and documented next to the other targets.