Wirebook

Wirebook › Bonus lesson

How does a game controller talk to a console?

Bonus lesson · about 8 minutes · hands-on · nothing you type leaves your browser

You press jump and the character on the TV jumps. It feels instant, but in between, your controller has been chattering to the console the whole time. Picture it as a pea-shooter firing tiny paper darts, hundreds every second, each one carrying a short note about the controller. So here's the big question: if the darts never stop coming, why doesn't the console get buried in paper?

Fire the darts

Hold ◀ ▶ or Jump (or use the arrow keys and space while this box has focus) and watch the darts fly. Each dart is a snapshot of the whole controller. The console has a mailbox with room for one dart, and once every frame it looks inside. Time is slowed right down so you can see it, and the trip is drawn longer than it really is (a real one takes 1 to 10 thousandths of a second).


How often the console looks (frame rate)
Speed

0darts fired
–darts land per frame
0old darts recycled
0lost on the way

In the mailbox now: No dart has landed yet.

What's written on a dart?

Not "jump!" and not "move left a bit". Each dart, which engineers call an input report, is a tiny snapshot of the whole controller at that instant: one on/off bit for every button, a number for where each stick is pointing (often 0 to 255, with 128 in the middle), how far each trigger is squeezed, and on some controllers what the motion sensors feel. A whole report is usually somewhere between about 10 and 64 bytes, smaller than this sentence. The one in the box above is packed into just 4 bytes: a dart number, the buttons, stick left-right and stick up-down.

How often the darts are fired is the polling rate. Lots of controllers and keyboards send 125 a second (one every 8 thousandths of a second), many console controllers 250, and "gaming" ones 1,000 or more. The name comes from cables: on a USB lead, the console or computer asks "anything new?" on a strict timetable and the controller answers with a fresh snapshot.

So why doesn't the console get buried in paper?

Because it never keeps a pile. A game works in frames: 60 times a second (or 30, or 120) it reads the controller, moves everything, and draws a new picture. At 1,000 darts a second and 60 frames a second, about 17 darts land between each look. The console only cares about the newest one, because it already says everything: which buttons are down right now and where the stick is right now. The other 16 are simply replaced, like rubbing out a whiteboard and writing the latest score. Try "Step one frame" above: the gold dot is the one that was read, the grey ones were recycled without ever being looked at.

If darts were instructions instead ("press A", "let go of A") that all had to be followed in order, one per frame, the console really would be buried: at 1,000 a second it would fall more than 900 darts behind every second, and after a minute your jump would happen more than a quarter of an hour late. Snapshots make that problem vanish. (Computers and consoles do keep a very short list of button changes, so a lightning-quick tap that starts and ends between two frames isn't missed, but never a growing pile.)

What if a dart goes missing?

Wireless controllers talk by radio, and radio is crowded: Wi-Fi, other controllers, headphones and microwaves all share the same airwaves. Now and then a dart gets lost. Tick "Drop some darts" above and watch the red crosses: the character barely notices. Because every dart carries the full state, the next one that lands fixes everything, a few thousandths of a second later. That's a big difference from a file download, where every missing piece has to be sent again (see how a download picks up where it left off). Only when lots of darts go missing in a row, say when someone walks between you and the console or you're too far away, does the game stutter.

Cable, dongle or Bluetooth?

A cable is the most reliable: no lost darts and about a thousandth of a second on the way. A wireless controller with its own little USB receiver (a dongle, using 2.4 GHz radio) can be almost as quick, because it has a private radio link made just for this. Bluetooth is the handy, works-with-everything kind, but it shares its radio with headphones and other gadgets and usually adds a few thousandths of a second more, with a bit more wobble. For nearly everyone, any of the three is fine. The surprise is how small this part is compared with the next one.

The lag ladder: from your thumb to the TV

The time between pressing a button and seeing the result on screen is called input lag. It's made of five pieces stacked up. Change the settings and see which pieces grow and shrink. The times are typical, rounded figures.

Polling rate
Connection
Game frame rate
Screen
    –typical press-to-picture
    –luckiest press
    –unluckiest press
    –frames late (at 60 fps)

    What would help most?

      The five pieces of lag

      1. Waiting for the next dart. Your press happens at a random moment, so on average it waits half a gap: 4 thousandths of a second at 125 a second, half a thousandth at 1,000. Going from 125 to 1,000 saves only about 3.5 thousandths of a second.
      2. The dart's trip. About 1 thousandth by cable, a little more by dongle, often 5 to 10 by Bluetooth.
      3. Waiting for the console to look. The game only reads the mailbox once a frame, so on average you wait half a frame: about 8 thousandths of a second at 60 fps, 17 at 30.
      4. The game makes the picture. Working out what happens and drawing it usually takes a frame or two, sometimes more. This is why higher frame rates feel snappier: every frame is shorter.
      5. The screen shows it. TVs love to "improve" the picture by smoothing motion and sharpening, which means holding on to frames for a while. That can add 50 to 100 thousandths of a second. Game mode switches those extras off, and is often the single biggest win.

      Add them up and a typical console game is somewhere between about 30 and 150 thousandths of a second from thumb to picture. Online games add the trip to the game's server on top (see the giant invisible playground), and that's a separate thing from this local lag.

      Your turn: hit the drum on the beat

      Four lights count you in. Press Hit! (or space on the button) exactly as the fourth, big light comes on. The game judges your hit by when it arrives, after its trip up the lag ladder. Six beats a round. Try the sleepy setup, then the speedy one, then tick "practised" and see what changes.

        Your best rounds: none yet

        Steady lag versus wobbly lag

        Here's a secret rhythm-game players know: the same delay every time is easy to get used to. Your brain (or a calibration screen) just learns to press a tiny bit early. What's hard is wobble, when the delay is short one moment and long the next. Part of the wobble comes from waiting for the next dart and the next frame, which depends on exactly when you pressed. A higher polling rate and a higher frame rate shrink both of those waits, which is why they make a game feel more consistent, even when the average barely changes. A lost dart adds a tiny bit of wobble too, but only one gap's worth.

        So, does the console ever get buried in paper? No: it only ever reads the newest dart, and the old ones are recycled the moment a newer one lands. The real enemies of a quick jump are a slow screen and a low frame rate, not the darts.

        Related lessons: is there a giant invisible playground? · how a TV remote talks with invisible light · peeking on a timer vs a doorbell · why the game lags when someone starts a download · how Bluetooth helps a photo fly to the next phone.

        Grown-up twin: Tooltern's input lag calculator works out your own lag ladder with more settings (V-Sync, refresh rate, your TV's figure), with plain-words guides on TV game mode, polling rate and wired vs Bluetooth controllers. Its help page on Tooltern's help page on what counts as a good ping, jitter and packet loss for gaming covers the online side of lag, and why the internet lags when someone downloads covers the busy-line side. Glossary: polling rate, input lag, frame rate.

        Words from this lesson

        Earn a bonus badge

        Get all 4 right to collect the Paper-dart controller bonus badge. Bonus badges are extra: they don't change your stamp count or rank. Wrong answers are fine: just try again.

        1. What does each dart (input report) from the controller carry?

        2. At 1,000 darts a second and 60 frames a second, what happens to the darts between two frames?

        3. A wireless controller loses one dart on the way. What happens?

        4. Which change usually cuts the most lag on a TV?

        Try another lesson

        1. 3Can a website get tired?7 min · interactive
        2. 12How does a game remember where you got to?6 min · interactive
        3. 1What happens when you open a web page?6 min · interactive