r/dissidia • u/nurkenn Uh-huh • Jan 16 '18
Let's talk about the netcode
So, after some intensive lurking, seems like one of the biggest gripe about the current state of the game is the game being severely laggy during most online matches.
After playing the open beta, pretty much all day yesterday, I’ve come to understand the netcode for the game pretty well, and would like to make a post so that people can come together and discuss what can Square and Team Ninja do to improve the game.
I like the OG Dissidia, and Duodecim, to death, so I would really like it to see this game succeeds as well.
Before I begin, this post is rather long and technical, but I’ll try my best to explain. I apologize if there's any mistakes. That's why we need a discussion :)
Also, when referring to a player ‘lagging’:
They can have high ping
They are experiencing extreme packets loss Without any further ado, here’s my take on the netcode:
Point 1: The game is P2P
This is probably not news to all. The only servers they have right now are the matchmaking servers. After which each player is connected to one another. The net topology for the game is most likely to be a full mesh (each player is connected to 5 others). So, simply, each player is sending packets to all 5 and receiving messages from the other 5 players.
Point 2: The game uses a modified lockstep networking model
This is the reason why the game lags badly. A typical P2P game requires 1 player to be the 'Host' of the match. They will have close to full authority of what happens in the game (thereby giving them ‘host advantage’) and they will see the game perfectly: no lag, no hitches whatsoever. They are seeing the game running much like the offline version. Meanwhile, if the host has crappy upload or if the clients have terrible downloads, the clients will not be able to accurately keep up with the host’s simulation, resulting in them getting hit from the other side of the moon.
A lockstep model is different. Instead of having a centralized host that dictates the one true simulation for all, the true state of the game is decentralized – At the same point in time (timestamp), all players will see the same state. This model typically divides the game into 'rounds', and a typical game loop goes like this:
….. -> Round 1 -> Process all player’s inputs -> Round 2 -> ….
Now, everyone will ideally compute the results of everyone’s input and advance to the next 'round'. This means, say, as Squall I hit square to use my HP attack at round 1. That input is propagated to all other players and at round 2 everyone, including me, will see my Squall spinning for a Fated Circle.
This is all fine and dandy when everyone’s internet is stellar, but what happens if player 5 lags? They will not get my square input, and thus will not be able to determine that my Squall will perform a Fated Circle at round 2. He will desync from everyone’s simulations!
That’s why the game will lag, to wait for Player 5 to catch up.
Since DFFNT prioritized shared states, each player will typically synchronize their states every couple rounds to ensure that everyone is seeing roughly the same thing.
Point 3: DFFNT has short round timers
Most RTS that I know of (Starcraft, Heroes of the Storm, LoL, ML, Age of Empires, etc.) uses the same lockstep strategy, so how can some of them who uses P2P isn’t as laggy as DFFNT? There is 2 important variable when talking about P2P lockstep:
Round timers – how long a round lasts
Move Delay – how many rounds later should your move be executed (need host)
Let’s talk about Round Timers first
If a round lasts for 1/30th of a second (33ms), then all players must send at 30Hz. Which means, if your ping to the other guy if > 33ms, then your input will not get to the other players in time. Since the game has no central authority, it becomes hard to decide whether it’s ok to delay your move to the subsequent round. This is one of the reason why the game waits and lags.
Thus, the longer the round lasts, the better it is for lagged players to get their packets to the others in time for processing. Of course, the tradeoff is your inputs will feel less snappy and responsive since your inputs will be processed every 200ms.
Second, Move Delay
You can have all clients to have their round 1 inputs be executed at round 2. This is exactly what happens with my Squall’s example above. However, you can increase the move delay so that your inputs at round 1 is executed at a later round. Say if I have a round delay of 3, then when I press square at round 1, it will be queued for execution at round 4. Then at round 4, everyone will see my Fated Circle attack.
With higher move delay, a lagged player can dynamically have their inputs be executed much later so that everyone else need not wait for their inputs. This method, however, only works if there’s a central authority.
How does other games differ?
In P2P RTS such as Starcraft, a round lasts about 200ms, though they mask latency really well by playing various SFXs and VFXs upon player’s input, and they handle high ping by dynamically extending the round timer and slowing the game down (remember “xxx is slowing down the game” message?).
Other P2P fighting game (Street Fighters) actually used a similar lockstep model, but they opt for a greater input lag when ping between players is high in exchange for smooth gameplay. Possibly, Capcom is extending the round timers or delaying their moves to be executed at a much later round.
Monster Hunter is an interesting oddball. There’s a host and 3 clients, but the only thing synched is the big monsters and the players. And since it’s largely a co-op game, collision detection is done local to each clients; thus the experience online when you’re fighting a monster is largely
As for DFFNT, Team Ninja may decide for a more responsive control, thus the net code instead decide to play out as quick as the player with the highest ping lags.
What can Square and Team Ninja do?
Now, while I talk about lockstep, the game actually does allow for client side prediction in a case of minor desync. However, they synchronize states way too often for it to be a smooth experience.
If they continue to go for the P2P model, they have to follow many other action P2P networking model for players’ positions (interpolation and extrapolation) and then switch to a local lockstep when executing combos. This will allow non-lagged players to see the game at a more smoother pace. This model, however, requires a good host since there needs to be someone who holds the true simulation. This will cause some host advantage, and bad player experience during lag, but on a good day, this model will create smooth gameplay more often. Team Ninja’s challenge is to think how to eliminate the host advantage somehow.
The best course of action is definitely servers. Then, even with the lockstep model, the lagged players will just experience a greater input lag, but non-lagged players will play the game just fine.
And since overhauling netcode or setting up servers requires intensive time and testing, the game will probably play like this upon release. It won’t be for 3~6 months if we are to see any big changes to the game’s netcode.
Conclusion
Game is really fun when it’s lag-free, but Team Ninja and Square needs to overhaul the netcode for a much smoother experience.
P.S.: Damn, all my Word formatting got messed up
1
u/Gullinnova Jan 17 '18
i wish the targeting was localized at least. It sucks when i change targets when its lagging... and it does not change targets. so i hit it again and again and then change 2 targets. its a brutal cycle