Alleviating lag problems by implementing GGPO

Oni_Shinobi

Green Slime
Hi there peoples!

So, I bought a 4-pack for me and 3 friends, and was recently playing with them. They all live in the USA, while I live in the Netherlands. This made for some nasty ping, (roundtrip delay of about 300ms) and I couldn't really effectively play any more due to about a third to a half of a second's delay on my end between button presses and action happening in-game.

Now, with the nature of this game, it is perfectly suited to implement the GGPO library to add in input prediction and state rollbacks, so as to alleviate a lot of the problems caused by network lag. It would make playing the game with pings above, say, 80 - 100 with some degree of skill viable.

I urge you to strongly consider adding it, as the sooner the decision is made to implement it, the less code will have to be rewritten.


Some basic info on GGPO:
https://en.wikipedia.org/wiki/GGPO

It was made by a guy called Tony Cannon to make playing fighting games over emulators online viable - and we all know how those require very responsive, twitchy controls. It really works like magic.

"Use of GGPO in commercial releases is accelerating, (Tony) Cannon says -- the code has been licensed for Capcom’s retro revamp Final Fight: Double Impact, Namco Bandai’s Japanese arcade fighter Dragon Ball Zenkai Battle Royale and upcoming indie 2D fighter Skullgirls, as well as several unannounced titles."


Here's a more detailed explanation of how GGPO works:

http://www.gamasutra.com/view/news/177508/The_lagfighting_techniques_behind_GGPOs_netcode.php

"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."



Here's a PDF of an issue of Game Developer Magazine where it's explained in even greater detail:

http://twvideo01.ubm-us.net/o1/vault/GD_Mag_Archives/GDM_September_2012.pdf

Go to page 9 - "Fight the lag!"

I won't quote it here, as it's very thorough and detailed in it's explanation, and very technical, to boot;- but I humbly request that you dev. guys read that article, and let it inspire you to contact Tony and try to get GGPO in Grindea!
 

Teddy

Developer
Staff member
Heya!

GGPO is awesome, but I don't think I'll throw away the netcode hoping for GGPO to solve everything, especially since I don't know how it performs in games that aren't fighting games. From my own experience with games using it, while impressive, it hasn't been able to eliminate 300+ ping (or even mask it that well), and that's in the genre of games it was made for! Unlike fighting games, our game isn't 100 % deterministic only based off inputs, due to the AI making decisions based on the server state. From what I've gathered about GGPO, that will reduce the efficiency quite drastically.

That being said, I do think the idea of fast forwarding to compensate for lag is interesting, and I'll probably work more with that when I revisit the netcode (which I do from time to time). Most of Phaseman's and GUN-D4M's projectiles gets fast forwarded equal to ping / 2 worth of distance to compensate for the delay of their creation, and I'm interested in trying that out for other things (such as monster and player attack animations).

I doubt I'll ever succeed in making 300 ping feel like 50, but who knows, maybe ~150 at some point :D
 
Top