Spielerando

A laggy connection makes one jump press happen twice, or not at all

Online, the button press travels to the server, may be sent again to be safe, and can arrive late or out of order. Handled carelessly the character double jumps on a single press, or a press that arrived just after leaving the ground is lost. Here is how to number the presses and what to do with each one.

Why this works

Over a bad connection the same message may arrive twice, late or in the wrong order, so arrival tells you nothing about what the player did. A running number on each press gives every press one identity, and a press is then used once, whenever it turns up.

When not to use it

Not needed in a game played on one screen or one device, where a press cannot arrive twice. It also does not help if presses are not meant to be unique, for example when holding a button should repeat the action.

In the full entry

  • What to build, step by step
  • Starting values and the reason for each
  • 4 common mistakes and the fix
  • 39 lines of example code with 4 checks that pass
  • How your AI shows you that it works

Say this to your AI

Use the Spielerando entry "A laggy connection makes one jump press happen twice, or not at all" (read_entry one-jump-from-a-resent-input-packet) in my game. Build it step by step, and show me how you checked that it works.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP