The Game Client and the Frame
In Harbour Hopper, the small game this course builds piece by piece, you fly a cargo drone over a busy harbour, lift crates off the quay and drop them onto boats sailing past. Nudge the stick and the drone leans almost instantly. In that instant the program on your device has read your thumb, moved the whole harbour forward and painted a fresh picture — and it must do it all again before the next instant.
The rule
Frame budget = 1000 ms ÷ frames per second.
The game client is the part of a game that runs on the player's own device: a phone, a console, a laptop, a browser tab. It has three jobs:
- Input: read the stick, keys, touches and mouse.
- Simulation: move the drone, sail the boats, drop the crates, keep the score.
- Output: draw the picture and play the sounds.
In an online game a server somewhere else keeps the shared, official record (whose crate landed first, the leaderboard), and each client shows its own player a local view of it. This course is about the client.
A screen never really shows motion. It shows a rapid series of still pictures called frames, and your eye blends them into movement. How many arrive each second is the frame rate, measured in fps. Choosing a target frame rate fixes how long each frame is allowed to take — its budget:
| Target | Budget per frame |
|---|---|
| 30 fps | 33.3 ms |
| 60 fps | 16.7 ms |
| 120 fps | 8.3 ms |
Everything the client does for one frame must fit inside that slice. When it doesn't, the new picture is late, the screen shows the old one a second time, and the player feels a stutter.
The shortcut
Keep one anchor in your head — 60 fps is about 16.7 ms — and scale from it: double the frame rate and the budget halves; halve the frame rate and it doubles. Then treat the budget like pocket money: list what each job costs and add it up.
Find the budget
1000 ms ÷ 60 ≈ 16.7 ms for every frame.
The trap is trusting an average. A build that "averages 60 fps" can still take 50 ms on one frame every few seconds, and the player sees every one of those as a hitch. Watch the slowest frames, not just the mean.
Drills
Answer fast — trust the rule.
In an online Harbour Hopper race, which job belongs to the game client?
A Harbour Hopper frame costs 14.5 ms of work. What happens if you target 120 fps?
A build averages 60 fps, but one frame every few seconds takes 50 ms. What does the player notice?
Remember
- Frame budget = 1000 ms ÷ frames per second; 60 fps gives about 16.7 ms.
- Double the frame rate, halve the budget — then list each job's cost and add them up.
- Averages hide hitches: one slow frame is visible even when the mean looks fine.
