Gamasutra: The Art & Business of Making Gamesspacer
arrowPress Releases
April 20, 2014
PR Newswire
View All





If you enjoy reading this site, you might also want to check out these UBM TechWeb sites:


The lag-fighting techniques behind GGPO’s netcode
The lag-fighting techniques behind GGPO’s netcode
September 12, 2012 | By Patrick Miller

September 12, 2012 | By Patrick Miller
Comments
    7 comments
More: Console/PC, Social/Online, Indie, Programming




Programmer Tony Cannon explains how his GGPO netcode can make timing-based skill games more responsive in online play, in the September 2012 issue of Game Developer magazine.

Every single millisecond matters in an online multiplayer action game. Take Street Fighter, for example; any fighting game enthusiast knows that one opponent is sitting behind the other screen, and the other is the lag that makes playing highly timing-sensitive games no fun. In the September 2012 issue of Game Developer magazine, programmer and fighting game community leader Tony Cannon takes a deep dive into how the techniques behind his predictive netcode, called GGPO (short for "Good Game, Peace Out"), can make both classic and modern games look and feel more responsive -- even if you're playing with someone in another continent.

Identifying the chokepoint

The traditional way to add online support to a multiplayer game can lead to "squishy" and "laggy" experiences, says Cannon, and for certain game genres that can ruin the multiplayer experience entirely -- especially if you're trying to add online multiplayer to a port of an older game that didn't have it before. Cannon explains:

The most common method of bringing multiplayer games online is to run a separate simulation on each console and keep them synchronized by ensuring that each simulation gets exactly the same inputs. If the simulations are determined solely by the inputs, playing the same inputs on both consoles will result in the same output. This method has a lot of plus sides to it; computers are by nature deterministic and most arcade games use integer math exclusively, which is very well behaved from processor to processor, and the developer is also completely isolated from the details of the network implementation. Aside from making sure the game runs deterministically, the engineers and designers implementing the gameplay can be isolated from the details of the network engine. This means you can retroactively add online multiplayer support to games that have already been released. (If you can provide a machine emulator for the original hardware the game was written on, you don't even need to recompile it!) Finally, this method has no server-based components aside from a method required for basic matchmaking, which is usually provided by the console manufacturer.

Unfortunately, this method also comes with one major drawback: These games are usually designed to sample the controller input before every simulation state update. A simulation frame in the game cannot execute until all the inputs from remote players have been received. In practice, this manifests itself as an input delay equal to the time it takes to send a packet from one console to the next. In short, the games lag. The instant response the game was designed for is replaced by a sluggish and squishy control that can ruin the players' experience.

In many cases, the delay introduced by the networking layer can completely change the feel of the game. In Street Fighter, we call them "lag tactics": using the knowledge that by the time your opponent sees your move it will be too late to respond. To many, including myself, lag tactics greatly influence the competitive experience of the game online.

GGPO's solution

In order to minimize lag, Cannon designed GGPO to keep the local player's inputs responsive, predict the remote player's actions, and subtly roll the game back when it receives the remote player's inputs and finds where those inputs were not predicted, leading to more responsive gameplay. In the article, Cannon explains:

I wrote GGPO to try to do a better job of solving the lag problem, without sacrificing all the other great properties of this method. Instead of adding an input delay to the entire simulation, GGPO gives the local player immediate control over his avatar by hiding the latency of the connection in the start-up of each remote player's action. This does a much better job of faithfully reproducing the offline experience in the online game.

GGPO uses speculative execution to eliminate the perceived input delay for each local player. Instead of waiting for all inputs to reach a player's simulation before executing a frame, GGPO will guess what remote players will do based on their previous actions. This eliminates the lag experienced by the local player created by the traditional frame-delay method. The local player's avatar is just as responsive as when playing offline. Though the actions of the other players cannot be known until their inputs arrive, the prediction mechanism used by GGPO ensures that the game simulation is correct most of the time.

When GGPO receives the remote inputs from the network, it compares the predicted inputs to the actual ones. If it finds a discrepancy, it rewinds the simulation back to the first incorrect frame, repredicts the inputs for each player based on the updated input stream, and advances the simulation to the current frame using the new prediction.


Grab the September issue of Game Developer magazine to get the full scoop on GGPO. Also, check out this issue for tips on how to tackle development weaknesses and make your studio a more successful one, as well as a postmortem of experimental PlayStation 3 music game PixelJunk 4am. Game Developer is available for purchase or subscription at the GDMag web store, or you can download the Game Developer iOS app.


Related Jobs

Activision Publishing
Activision Publishing — Vancouver, British Columbia, Canada
[04.19.14]

Principal Graphics Programmer
Insomniac Games
Insomniac Games — Burbank, California, United States
[04.18.14]

Associate Engine Programmer
Insomniac Games
Insomniac Games — Burbank, California, United States
[04.18.14]

iOS Programmer
Insomniac Games
Insomniac Games — Burbank , California, United States
[04.18.14]

Senior Engine Programmer










Comments


Chris Lynn
profile image
The fighting game community has embraced GGPO, and for good reason, to the point that even Capcom noticed it, like in the latest version of Street Fighter 3. It is, from the competitive fighting viewpoint, the best solution available.

There are a few reasons why it is not so popular with the general audience. The first is that it requires some knowledge, as it requires the user to set some settings that some players do not know about. SF3 had this problem, and people were saying the online was "broken" because they did not understand the "rewind" effect.

The second reason is that it is not an universal solution. 3D fighting games, like Tekken, can't use it due to the way packs are transmitted (Tekken producer Harada confirmed it). And those games are responsible for a huge part of sales, including there Tekken, Soul Calibur, Mortal Kombat, etc. The other reason is that most fighting games are still made in Japan, where lag is usually a much smaller problem, so they don't design thinking of it too much (like was the case in King of Fighters).

I see GGPO growing in the next generation of fighting games, as players become more aware of it and how it works, and by some american companies, more used to lag then japanese developers, adopting it, like was the case with Skullgirls.

Roderick Hossack
profile image
"The second reason is that it is not an universal solution. 3D fighting games, like Tekken, can't use it due to the way packs are transmitted (Tekken producer Harada confirmed it)."

This is inaccurate. GGPO's technique can be used in any fully-deterministic online multiplayer game. The only limitation is that the game must have been developed in such a way that the game logic is both decoupled from the display logic and can be simulated several times faster than the display rate. Ideally, a game would be developed for GGPO from the ground up.

Sadly, you're right about the mentality of Japanese fighting game developers. There are a lot of easily-fixed problems with fighting games today (button config, mid-match pausing, player side selection, etc.) that generally go ignored for one reason or another.

Chris Lynn
profile image
Roderick, I admit that I didn't knew it could be fully used in a 3D game, I though that there were technical limitations after reading a interview by Harada. But I see your point, if they had it in mind from the start, they could have implemented it. Sorry for the confusion.

Mike Murray
profile image
As a SRK community member, I'm happy to see GGPO get more exposure, especially in the game development circle. GGPO is amazing when it works well. It's not a magic bullet, and I can name other games with great non-GGPO netcode, but more developers would benefit having this kind of netcode in their fighting games. I would like to see GGPO used in non-fighting games as well.

I agree with Roderick's point about certain features that should be common in fighting games by now, but the problem is that Japanese developers in general have a bad habit of not sticking with what works. Every current fighting game should have a tutorial mode on the level of VF4 Evo's. Not even Sega's own Final Showdown has anything as robust.

Cordero W
profile image
Being a Street Fighter fan myself having played on GGPO, and now having read the specifics behind their system, I think there's no better saying for this than: "Turn the beat back."

Michael O'Hair
profile image
Roms.
That is all.

David Boudreau
profile image
There is another similar effort to improve an area where fighting games have come up short, but in the aspect of a training mode as opposed to GGPO's netcode. That particular innovation came from the author of the Controlling Space paper.


none
 
Comment: