Reducing perceived latency

Reducing perceived latency

Before Instagram was a billion dollar company, Mike Krieger posted a presentation called Secrets to Lightning Fast Mobile Design about how his team made the Instagram photo-sharing application feel so responsive, which is one of the key reasons their company has garnered so many users so quickly. This slide caught my attention because the same trick is a cornerstone of good online game design:

Instagram shows how uploading earlier in the photo-upload process increases UI responsiveness

Why Instagram is worth big bucks — uploading earlier in the photo-upload process increases UI responsiveness

To ensure a great online game-play experience, your job as a game designer is to minimize the perceived latency between initiating an action and having that action actually take effect in-game, even though there may be 300-400 hundred milliseconds of actual latency between the game client and game server. Actually, I might be dating myself a bit — early Real-Time Strategy (RTS) games had to expect such huge latency because most players were using modems. Internet latency is much lower now but user expectations are higher, so every trick we can use to hide that latency is still useful.

First, it’s important to recognize why latency is so high in RTS games. Games like Warcraft, Starcraft, and Age of Empires are built using a “lockstep model”. All of the computers running a game simulation perform player actions “at the same time”. Well, not at exactly the same time, but during the same game “turn”.

It works like this: when you tell your Ogre Mage to attack my Peasant, your computer sends a network message to my computer. And then your computer ignores the attack action for a while. What?!? Yeah, your computer can’t act on that action yet because, if it did, your computer and my computer would be “out of sync”. Your computer has to wait until it receives my message for that game turn, and then both of our messages can be processed at once. Here’s a diagram that shows what’s going on:

Timeline depicting delayed execution of actions from arriving packets

Delaying execution of actions allows time for packets to arrive from remote players

If you’re interested in implementation details, Mark Terrano wrote 1500 Archers on a 28.8: Network Programming in Age of Empires and Beyond. The Warcraft and Starcraft RTS games used the basic same network model a couple of years prior, but Mark gets big props for writing the first article. And here I am just starting to blog 15+ years later!

So anyway, what this means is that, even though your game engine knows your Ogre Mage is going to attack, it can’t do anything to modify the state of the game world or the simulation will be de-synchronized.

Which means that you’re not getting any feedback that you’re about to kick my ass. No fun!

So here’s the solution: provide instantaneous visual and auditory feedback, without making changes to the game simulation.

Remember all those funny voices in Warcraft: “Yes, milord”; “At once, sire”, “Daboo”, “Zug Zug”? While quite entertaining in and of themselves, their fundamental purpose is to immediately reassure players by confirming that their orders are being obeyed.

In addition to playing a sound effect ‘Craft games also played an animation effect on the map-screen which, while it had no effect on the game-play, showed the target of the action.

So there you go, another tool to add to your game-designer toolbox. Improving online game responsiveness is not just about writing better networking code to minimize Internet latency, it's about finding ways to minimize perceived latency by providing instantaneous feedback to user requests.