Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
The Game Loop  ›  Lesson

The Game Client and the Frame

Client Side Development 12 minThe game client reads input, simulates the world and draws it on the player's device, producing each frame within a time budget of 1000 ms divided by the target frame rate.

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.

Does Harbour Hopper fit at 60 fps?Step 1 of 4
  1. 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.

quick drill

In an online Harbour Hopper race, which job belongs to the game client?

What is the frame budget at 50 fps, in milliseconds?
1000÷50= ?1000 \div 50 = \,?
quick drill

A Harbour Hopper frame costs 14.5 ms of work. What happens if you target 120 fps?

If one frame's work takes 8 ms, what is the highest frame rate the client can reach?
1000÷8= ?1000 \div 8 = \,?
quick drill

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.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainIs 60 fps on average enough?

A teammate says: "Harbour Hopper averages 60 fps, so performance is fine." Using the frame budget, explain what this claim can hide and what you would measure instead.