CS 276 // GAME SYSTEMS IN GODOT

Fair Game.

Balancing and Tuning with Playtest Evidence

Lucas P. Cordova, Ph.D.

Willamette University  |  Tuesday, November 17, 2026

SCORE 000276HI 999999

Outline

CS 276
LEVEL 01

Save Point

The quest log

SCORE 000276HI 999999

Quest log

WhenWhatWhere
Today, in classA first balance pass on your gamedocs/balance.md in the team repo
Thu Nov 19, 9:40 AMStakeholder Review 3: stakeholders play what is pushedPush before class. Printed review sheets
Thu Nov 19, 9:59 PMBeta gate and content lock (500 points)All content in; draft itch.io page; tag beta
Tue Nov 24Shipping: exports, release checklists, showcase prepClass meets. No class Thu Nov 26 (Fall Break)
Tue Dec 1Final playtest and bug bash; Sprint 3 reportdocs/sprint-3.md
Thu Dec 3Showcase: guests play your gameThe classroom arcade, Ford 202
CHECKPOINT

The beta requirement that today serves: difficulty numbers tuned against at least one playtest, with the tuning living in data (75 of the 500 points).

CS 276
LEVEL 02

What Balance Means

A player, a moment, and a number

SCORE 000276HI 999999

Too hard for whom?

The challenge isThe player feelsWhat they do next
Far above their skillAnxiety: nothing I try worksQuit, and tell a friend the game is broken
Far below their skillBoredom: nothing here needs meQuit, and forget the game
A step above their skill, and rising as they improveFlow: focused, in control, losing track of timeOne more run
  • Csikszentmihalyi named the state; game designers borrowed the picture of a channel between anxiety and boredom [1][2].
  • Skill is different for every player and it changes while they play. Balance is a moving target with a person attached.
CHECKPOINT

A number in your game is right or wrong only for a particular player at a particular moment.

CS 276

A target you can miss

DEFINITION

A balance target is one sentence that names a player, a moment, and a number. A playtest can prove it wrong.

Vague wish Target
Maze 1 should be approachable A first-time player escapes maze 1 within three tries
The gauntlet should be a challenge Fewer than half of first-time players clear both mazes in their first five runs
Runs should feel quick The median run lasts between 20 and 40 seconds
The boss should be tough but fair A player who has cleared level 2 beats the boss by attempt five
CS 276

You are the worst tester

  • You have played your game for forty hours. Nobody at the showcase has played it for forty seconds.
  • You know where the enemy turns, which jump is safe, and what the fig does. A new player knows none of it.
  • Every time the game felt easy to you, you made it harder. Teams tune toward their own skill without noticing.
  • Week 8 gave you the cure: hands off, watch a new player, write down what happens.
  • Today adds one thing to that protocol: the game writes the numbers down for you.
WATCH OUT

A game tuned only by its makers is tuned for two people. Balance it with players who have never seen it.

CS 276
LEVEL 03

The Knobs

Every number, the ratios between them, and how far to turn one

SCORE 000276HI 999999

Every number is a knob

KnobValueLives inTurning it up makes the game
speed (Blitz)300player.tscn, an exportEasier: Blitz outruns more
chase_speed240rivals/chaser.tresHarder: less room for mistakes
sight_range320rivals/chaser.tresHarder: chases start sooner
give_up_range420rivals/chaser.tresHarder: chases last longer
frightened_time3.0rivals/chaser.tresEasier: the fig buys more time
catch_distance36main.tscn, an export on game.gdHarder: near misses become catches
PATTERN

This table is a tuning sheet: every knob, its value today, the file it lives in, and what it does. Week 6 moved these numbers into exports and Resources so that today no one edits a script to tune.

CS 276

Ratios beat raw numbers

Rivalchase_speedDivided by Blitz's 300What the chase feels like
Wildcard1800.60A stroll. Blitz leaves whenever Blitz likes
Ambusher2000.67Pressure in tight halls, none in the open
Flanker2200.73A wrong turn costs you
Chaser2400.80Every dead end is a catch
  • Players feel relationships between numbers. Raise Blitz to 600 and the chaser to 480 and the chase feels the same.
  • Find the two or three ratios your game runs on (enemy speed to player speed, damage to health, spawn rate to clear rate) and tune those.
  • At a ratio of 1.0 the open-field escape is gone. A ratio has cliffs. Takes some experimentation.
CS 276

Double it or cut it in half

  • Sid Meier's rule, as Soren Johnson tells it: when a number is wrong, double it or cut it in half [3].
  • A ten percent change hides inside the noise of one playtest. A doubling shows up in a single run.
  • If double is too much, you now know the answer is between the two values. Split the difference and test again.
  • Turn one knob per test. Two knobs at once and the log cannot tell you which one did it.
  • Write down the value before, the value after, and what the next playtest showed.
PATTERN

Target, playtest, read, turn one knob a long way, playtest again. That loop is the whole balance pass.

CS 276
LEVEL 04

Evidence

A run log, six runs, and what the log says

SCORE 000276HI 999999

Measure first

  • Last week: nobody fixed the frame rate before profiling.
  • Same rule today: nobody turns a knob before a log says which one.
  • A playtest you only watched gives you a story. A playtest the game recorded gives you a number to compare.
MAIN.TSCN, AT DEMO10-LAP1
Main (Node2D) game.gd ├─ Maze, Player, Rival ├─ BerryStorm ├─ RunLog (Node) run_log.gd ├─ Audio (Node) └─ UI (CanvasLayer)

One new node with one script. It has one job: write a line every time a run ends.

LIVE DEMO

The live demo starts on the tag demo10-lap1. Tag demo10-lap2 and branch demo10 are the catch-up points. project.godot is the same on all of them.

CS 276

The log

Open run_log.gd. The first half of record opens the file, or creates it with a header row:

const PATH := "user://runs.csv"

var times: Array[float] = []
var escapes: int = 0

func record(outcome: String, maze_number: int, rival_name: String, seconds: float, berries: int) -> void:
    var file: FileAccess
    if FileAccess.file_exists(PATH):
        file = FileAccess.open(PATH, FileAccess.READ_WRITE)
        file.seek_end()
    else:
        file = FileAccess.open(PATH, FileAccess.WRITE)
        file.store_line("when,outcome,maze,rival,seconds,berries")
  • user:// is a folder Godot keeps for each project, outside the repo. It survives closing the game [5].
  • The rest of the function stores one line (when, outcome, maze, rival, seconds, berries) and prints a running median to Output.
CS 276

Two calls in the game's door

In game.gd, the CAUGHT arm of _change_state gains one line (ESCAPED gains its twin):

State.CAUGHT:
    caught_sound.play()
    Scoreboard.report(time_alive)
    run_log.record("caught", maze_index + 1, _rival_name(), time_alive, berries)

At the bottom of game.gd, a helper names the rival by its stats file:

func _rival_name() -> String:
    return rival.stats.resource_path.get_file().get_basename()
  • Week 5 again: a run ends in exactly one place, the door every transition walks through. That is where the log call goes.
  • chaser.tres becomes the word chaser in the log, so every row says which numbers were in play.
CS 276

Read the log

LIVE DEMO

With the game stopped:

  1. Look at the Output panel at the bottom of the editor. Each run printed one line; the last one carries the median.
  2. In the menu bar, click Project, then Open User Data Folder. A file browser opens.
  3. Open runs.csv. Six rows, one per run, plus the header.
If the log shows It suggests First knob to turn
Every run ends in maze 1, in a few seconds The opening is above a new player's skill The rival a new player meets first
Every run escapes on the first try Nothing here needs the player chase_speed, up, a long way
Times spread wide, later runs longer Skill matters and players are learning None yet. Test more players

Use the median. One lucky run drags an average a long way and leaves the median where it was.

CS 276
LEVEL 05

Difficulty Is Data

A rival per maze, and a curve inside a maze

SCORE 000276HI 999999

One rival for every maze

  • rival.tscn carries chaser.tres in its Stats slot, so maze 1 and maze 2 run the same numbers.
  • The gauntlet has one difficulty from the first second to the last. Its difficulty curve is a flat line.
  • A game teaches, then tests. The first maze is where a new player learns what the rival does.
  • Making maze 1 gentler today means editing chaser.tres, which also softens maze 2.
MazeJobRival
1TeachAmbusher (0.67)
2TestChaser (0.80)

The plan: the maze decides which stats the rival runs. The rival stays one scene.

PATTERN

A level owns its difficulty as data. Adding a third maze means choosing a file, with no new code.

CS 276

Step 1: a slot on the maze

LIVE DEMO

With demo10-lap1 open in Godot, game stopped:

  1. In the FileSystem dock, double-click maze.gd. Under the line signal exited, add the export shown on the right. Save the script.
  2. In the FileSystem dock, open the mazes folder and double-click maze_1.tscn.
  3. In the Scene dock, click the root node, Maze.
  4. In the Inspector, find the new property Rival Stats. It says <empty>.
  5. In the FileSystem dock, open the rivals folder. Drag ambusher.tres onto the Rival Stats slot.
  6. Save the scene.
  7. Open maze_2.tscn, click Maze, and drag chaser.tres onto its Rival Stats slot. Save the scene.

In maze.gd, add one line:

signal exited

@export var rival_stats: RivalStats
WATCH OUT

Save the script before opening the scene. The slot appears in the Inspector only after the saved script declares it.

CS 276

Step 2: the game hands it over

In game.gd, inside _load_maze, add the two middle lines:

rival.patrol_points = maze.patrol_points()
if maze.rival_stats != null:
    rival.stats = maze.rival_stats
rival.calm()
LIVE DEMO

Then:

  1. Save game.gd.
  2. Run the project. Get caught in maze 1 on purpose. The Output line now says ambusher.
  3. Run again, reach the exit pad, and get caught in maze 2. The Output line says chaser.
  • The maze knows its difficulty. The game passes it along. The rival reads stats the way it has since week 6.
  • The log names the rival, so old rows and new rows can sit in one file and still be compared.
CS 276

A curve inside a maze

On the demo10 branch, rival_stats.gd gains two exports:

@export var pressure: Curve          # multiplies chase_speed; x runs 0 to 1 across pressure_time
@export var pressure_time: float = 30.0

In rival.gd, the CHASE arm multiplies by a new function:

        State.CHASE:
            velocity = to_player.normalized() * stats.chase_speed * _pressure()

func _pressure() -> float:
    if stats.pressure == null:
        return 1.0
    return stats.pressure.sample(clampf(time_in_maze / stats.pressure_time, 0.0, 1.0))
  • A Curve is a Resource you draw in the Inspector. sample reads its height at a position from 0 to 1 [5].
  • The chaser's curve rises from 0.85 to 1.15 across thirty seconds in a maze. Ratio 0.68 at the start, 0.92 at the end.
CS 276

Step 3: see the curve, bend the curve

LIVE DEMO

Switch to the finished branch, then look:

  1. Stop the game. In a terminal, in the rival-brains folder, run git checkout demo10. In Godot, accept the reload prompt.
  2. In the FileSystem dock, open rivals and double-click chaser.tres. Its properties open in the Inspector.
  3. Find Pressure. Click the small curve picture to expand it.
  4. The curve starts low on the left and ends high on the right. Left is the moment the maze loads; right is Pressure Time seconds later.
  5. Drag the right-hand point higher. Save the resource.
  6. Run the project, reach maze 2, and stay alive. The chase tightens the longer you take.
DEFINITION

A difficulty curve is how hard the game is, plotted against time or progress. In Godot it can be a literal curve that a designer drags.

  • Pac-Man does this: as the dots run out, the red ghost speeds up. Players named that mode Cruise Elroy [4].
  • The slow start gives a new player time to read the maze. The rise keeps an expert from camping.
CS 276

Hard is fine. Unfair is a bug

Players forgivePlayers quit over
Losing to a rule they can seeLosing to something off screen or unannounced
A hard section followed by a short retryA hard section followed by a long walk back
Difficulty that rises in steps they can feelA spike that arrives with no warning
An enemy that behaves the same way every timeAn outcome decided by a coin flip
  • When a tester says the game is too hard, ask what beat them. The answer is often a missing signal, with every number left alone.
CS 276
LEVEL 07

Studio

Two days to content lock

SCORE 000276HI 999999

Beta push

CO-OP MODE

The rest of class is yours. 

Beta asks forBefore you leave today
All content in: every level, enemy, menu, and asset that will shipName what is still missing. Each piece gets an owner or gets cut
The full flow: title, play, win and loss, and a way backPlay it start to finish once, with nobody touching the editor
A first balance pass, tuned against a playtest, in datadocs/balance.md committed
A draft itch.io page with a build uploaded, linked in the READMEOne owner, and the page created today
FEEDBACK.md answers Review 2; a content lock line in the READMEBoth written before Thursday morning
CS 276
LEVEL 08

Game Over Screen

What you know now

SCORE 000276HI 999999

Checkpoint reached

CHECKPOINT
  • Balance is the match between challenge and one player's skill. The channel between anxiety and boredom moves as they learn.
  • A target names a player, a moment, and a number, so a playtest can prove it wrong.
  • Every number is a knob. Keep a tuning sheet, and tune the ratios.
  • Double it or cut it in half, one knob per test.
  • The game logs its own playtests. Read the median, and read where runs end.
  • Difficulty lives in data: a Resource per level, a Curve inside a level.
QUEST LOG

Thu Nov 19: Stakeholder Review 3 in class (push before 9:40 AM), then the beta gate and content lock at 9:59 PM. Tue Nov 24: shipping and showcase prep.

CS 276

Sources

  • [1] Csikszentmihalyi, M. Flow: The Psychology of Optimal Experience. Harper and Row, 1990.
  • [2] Chen, J. Flow in Games (and Everything Else). Communications of the ACM 50(4), 2007.
  • [3] Johnson, S. Sid's Rules. Game Developer magazine, January 2009. designer-notes.com
  • [4] Pittman, J. The Pac-Man Dossier. pacman.holenet.info
  • [5] Godot docs: Resources; File paths in Godot projects (user://); Curve and FileAccess class references.
  • [6] Demo repo: github.com/LucasCordova/rival-brains, branch demo10, tags demo10-lap1 and demo10-lap2.
CS 276