What's new

What is Net-Code and how can we help fix it?

MadeOfMetal

Kenshi Srubtastic,Cyrax, Special Forces Mains
I make this thread in hopes that all of us can bond together to help devise a plan to rid MKX of lag between Clients and Servers if at all possible!

lets start with the Basics...


Recommended system requirements:

  • OS: 64-bit: Win 7, Win 8
  • Processor: Intel Core i7-3770, 3.4 GHz | AMD FX-8350, 4.0 GHz
  • Memory: 8 GB RAM
  • Graphics: NVIDIA GeForce GTX 660 | AMD Radeon HD 7950
  • DirectX: Version 11
  • Network: Broadband Internet connection
  • Hard Drive: 40 GB available space
internet: Good PS4/XB1/PC connection speed?

Ping is more important than speed when it comes to online play.
Your upload speed will never allow you to host a lobby. Your download speed only determines the time you have to wait to download a new game, Update, movie etc etc.
Go to speed test.net on your PC and as long as your ping is less than 75ms, you'll be fine.

  • Make sure you have a wired connection. (lets just get that out of the way)
  • make sure you are not sharing your internet with others while playing online.




Netcode is a blanket term for anything that somehow relates to networking in online games; netcode is a term most commonly used by gamers when discussing synchronization issues between clients and servers. The actual elements of a game engine that can cause so-called "netcode issues" include, among other things, latency, lag compensation or the lack thereof, simulation errors, and network issues between the client and server that are completely out of the game's hands.

Potential causes of netcode issues:
  • Latency is an unavoidable fact of online games, caused by not only network latency, which is largely out of a game's control, but also latency inherent in the way game simulations are run. There are several lag compensation methods used to disguise, reduce, or cope with latency, however their feasibility varies by application.
  • Tickrate: A single update of a game simulation is known as a tick. The rate at which the simulation is run on a server is referred often to as the server's tickrate; this is essentially the server equivalent of a client's frame rate, absent any rendering system. Tickrate is limited by the length of time it takes to run the simulation, and is often intentionally limited further to reduce instability introduced by a fluctuating tickrate, and to reduce CPU and data transmission costs. A lower tickrate increases latency in the synchronization of the game simulation between the server and clients. Tickrate can vary from 60 ticks per seconds, to 30 ticks per seconds. A lower tickrate also naturally reduces the precision of the simulation, which itself might cause problems if taken too far, or if the client and server simulations are running at significantly different rates. Games may limit the number of times per second that updates are sent to a particular client, and/or are sent about particular objects in the game's world. Because of limitations in the amount of bandwidth available, and the CPU time that's taken by network communication, some games prioritize certain critical communication while limiting the frequency and priority of less important information. As with the tickrate, this effectively increases the synchronization latency. Game engines may also reduce the precision of some values sent over the network to help with bandwidth use; this lack of precision may in some instances be noticeable. Various simulation synchronization errors between machines can also fall under the "netcode issues" blanket. These may include bugs which cause the simulation to proceed differently on one machine than on another, or which cause some things to not be communicated when the user perceives that they ought to be. Traditionally, real-time strategy games have used lock-step peer-to-peer networking models where it is assumed the simulation will run exactly the same on all clients; if, however, one client falls out of step for any reason, the desynchronization may compound and be unrecoverable.
  • Transport layer protocol and communication code: A game's choice of transport layer protocol can also affect perceived networking issues. Should the game use TCP, networking will have a high overhead cost and increased latency. Should it use UDP, the game engine may need to implement its own networking code to handle error conditions and other things that are handled by TCP; this increases the engine's complexity and might itself lead to issues.
Solutions and lag compensation:
There are various methods for reducing or disguising delays, though many of these have their drawbacks and may not be applicable in all cases. If synchronization is not possible by the game itself, the clients themselves may be able to choose to play on servers in geographical proximity to themselves in order to reduce latencies, or the servers may simply opt to drop clients with high latencies in order to avoid having to deal with the resulting problems. However, these are hardly optimal solutions. Instead, games will often be designed with lag compensation in mind.



Many problems can be solved simply by allowing the clients to keep track of their own state and send absolute states to the server or directly to other clients. For example, the client can state exactly at what position it is or who they shot. This solution works and will all but eliminate most problems related to lag. Unfortunately, it also relies on the assumption that the client is honest. There is nothing that prevents a player from modifying the data they send, directly at the client or indirectly via a proxy, in order to ensure they will always hit their targets. In online games, the risk of cheating may make this solution unfeasible, and clients will be limited to sending relative states (i.e. which vector it moved or shot in).
Client-side:
As clients are normally not allowed to define the main game state, but rather receive it from the server, the main task of the client-side compensation is to render the virtual world as accurately as possible. As updates come with a delay and may even be dropped, it is sometimes necessary for the client to predict the flow of the game. Since the state is updated in discrete steps, the client must be able to estimate a movement based on available samples. Two basic methods can be used to accomplish this; extrapolation and interpolation.

Extrapolation is an attempt to estimate a future game state. As soon as a packet from the server is received, the position of an object is updated to the new position. Awaiting the next update, the next position is extrapolated based on the current position and the movement at the time of the update. Essentially, the client will assume that a moving object will continue in the same direction. When a new packet is received, the position may be corrected slightly.

Interpolation works by essentially buffering a game state and rendering the game state to the player with a slight, constant delay. When a packet from the server arrives, instead of updating the position of an object immediately, the client will start to interpolate the position, starting from the last known position. Over an interpolation interval, the object will be rendered moving smoothly between the two positions. Ideally this interval should exactly match the delay between packets, but due to loss and variable delay, this is rarely the case.

Both methods have advantages and drawbacks.

  • Interpolation ensures that objects will move between valid positions only and will produce good results with constant delay and no loss. Should dropped or out-of-order packets overflow the interpolation buffer the client will have to either freeze the object in position until a new packet arrives, or fall back on extrapolation instead. The downside of interpolation is that it causes the world to be rendered with additional latency, increasing the need for some form of lag compensation to be implemented.
  • The problem with extrapolating positions is fairly obvious: it is impossible to accurately predict the future. It will render movement correctly only if the movement is constant, but this will not always be the case. Players may change both speed and direction at random. This may result in a small amount of "warping" as new updates arrive and the estimated positions are corrected, and also cause problems for hit detection as players may be rendered in positions they are not actually in.
Often, in order to allow smooth gameplay, the client is allowed to do soft changes to the game state. While the server may ultimately keep track of ammunition, health, position etc., the client may be allowed to predict the new server-side game state based on the player's actions, such as allowing a player to start moving before the server has responded to the command. These changes will generally be accepted under normal conditions and make delay mostly transparent. Problems will arise only in the case of high delays or losses, when the clients predictions are very noticeably undone by the server. Sometimes, in the case of minor differences, the server may even allow "incorrect" changes to the state based on updates from the client.

Server-side:
Unlike clients, the server knows the exact current game state, and as such prediction is unnecessary. The main purpose of server-side lag compensation is instead to provide accurate effects of client actions. This is important because by the time a player's command has arrived time will have moved on, and the world will no longer be in the state that the player saw when issuing their command. A very explicit example of this is hit detection for weapons fired in first-person shooters, where margins are small and can potentially cause significant problems if not properly handled.


Design:

It is possible to reduce the perception of lag through game design. Techniques include playing client-side animations as if the action took place immediately, reducing/removing built-in timers on the host machine, and using camera transitions to hide warping.


Ideas: posted by others:

roosTakk said:
Rising thunder uses ggpo and is 2.5 d fighter just like mkx.
ESG Jagged
  • Final Fight: Double Impact (2010)
  • Dragon Ball: Zenkai Battle Royale (2011)
  • Street Fighter III: 3rd Strike Online Edition (2011)
  • Skullgirls (2012)
  • Marvel vs. Capcom Origins (2012)
  • Darkstalkers Resurrection (2013)
  • Dungeons & Dragons: Chronicles of Mystara (2013)
  • Divekick (2013)
  • Lethal League (2014)
  • Yatagarasu (Legend of Raven) (TBA)
  • Yatagarasu: Attack on Cataclysm (2015)
  • Rising Thunder (2015)
  • Killer Instinct (2013 video game)
all these use GGPO,




Design
Using a netcode technique called "rollback," GGPO puts lag ahead of a player's move which partially hides latency and creates a lagless illusion. The effects examine which players performed the right actions and correct any possible inaccuracies. The program itself can allow players to adjust latency in case of high ping situations; either creating a possibly jerky yet accurate representation or a smoother game with input delay.

GGPO client
The downloadable GGPO client itself has a matchmaking system for every game provided. Players can request challenges while others are able to spectate and chat. Once a challenge initiates, the match runs a ROM from emulator FinalBurn Alpha.
and i feel this could be the open beta solution what does everyone else think?

this could be similar to BF4's fix or League of Legends PBE

i think this in time could fix before the tournament scene is over... maybe make mkx playable for years, im interested what others think about flipping this to NRS?



now with all this said, What can we all do or suggest to NRS/WB to get this Netcode issue solved?

i say we should try an open beta environment or something along those lines, could work but may not solve all problems, maybe in time, i would really like MKX or MK11 to benefit from this before it's to late.


post your solution/idea below!


@WidowPuppy

@Temjiin
@KHAOTIC True Grave
@kabelfritz
@Bombardier777
@sub_on_dubs
@The Slaj Jazz
@Wetdoba
@LaidbackOne
@Houndovhell
@Marbledecker
@Eldriken
@Afk Skinny
@beepboop
@Death
@I GOT HANDS

tag anyone i forgot!
 
Last edited:

I GOT HANDS

Official Infrared Scorp wid gapless Wi-Fi pressure
@mercureXI is committed as well

Just skimmed at the moment (bout to have a bath BITCHES) but this all looks like really good, accurate and informed stuff. I like the way this thread is going and hopefully some of the people who love to spout "the netcode" off as a buzzword without really understanding what it is (I see people arguing both for and against it who look like a pair of 5 year olds arguing about who does what in the office when playing dress ups - a lot of very vague and inaccurate perceptions being flung around mostly based loosely on personal interpretations that they have made out of statements made by people who DO know what they are talking about), will read this and learn at least one thing.



One thing I'll touch on in is under Design, in my opinion adding client side animations to make the input lag less obvious is possibly the only way that we could actually make this worse. At least with animations lagging along with the character we have a visual reference that can help us adjust our timing to suit the lag, this will be a lot harder trying to recognise individual hitboxes. Just my opinion on that one. The rest is really good however.
 
Last edited:

Marbledecker

BUTTONS
It would be difficult for even an expert to make recommendations without knowing an intimate bit about how things are set up for the game in the first place. You have to feed this kind of thing with information.
 

VaderFett

Cry-o me a river!
Even though I can't help with this because I know little to nothing about technology, I still learned something so as to be better informed on the issues causing problems than to not have something concrete to actually pin the blame on.
 
People need to understand, this game has 3D hitboxes.

Someone do a mockup JSON doc of the game state of a 2D hitboxes Fighter, then try the same with 3D hitboxes. You are going to easily end up with well over 5 times the size.
 

Skkra

PSN: Skkra
I'm with @d3v. While I thank you for your nice explanation, which I hope will educate some people, we have no idea what NRS's implementation looks like.

I have no idea why NRS has perpetually garbage netcode. Are they tied into some multi-game deal with a third party provider that we dont know about? Who knows.

What I DO know, particularly being a professional programmer myself for over a decade now, is that there is zero reason to reinvent the wheel in the modern era of programming. There are a million third party libraries out there nowadays, and teams should be choosing among them and building for them starting in the design phase of a project. I sure as hell dont know how to write spectacular rollback-based netcode - but I know Tony Cannon did, so I'll build my project with his libraries.

When you have netcode as tried and true as GGPO, I cant for the life of me understand why you wouldnt use it. Hopefully they will in the next title? Who knows.

Im fairly sure that nothing is going to change for MKX. This is what we have. The netcode is surely baked way too deep in the product to do an overhaul.
 

Skkra

PSN: Skkra
People need to understand, this game has 3D hitboxes.

Someone do a mockup JSON doc of the game state of a 2D hitboxes Fighter, then try the same with 3D hitboxes. You are going to easily end up with well over 5 times the size.
Hitbox styles aside, I refuse to believe that the current netcode is the best that NRS can possibly do. There's just no way. Play TTT2, a fully 3D game - the netcode is great.

This netcode is just so poor so that I cannot even begin to make excuses for it. Not when I've played almost every other fighter on the market and they all outclass it.
 

ArcticTabasco

I wish I knew Kung Fu.
The only things we, the players, can do is get a good enough Internet service plan, use a hardline connection and switch off the porn torrents when playing.

Otherwise it's an issue that doesn't only deal with the game's code for handling on-line communication, but starts at the very ground level of building a game. Is it 2D or 3D? How fast are the attack animations? What is the combo system like and what sort of inputs does it require? Every single aspect of a game contributes to what we percieve as on-line lag.

Harada speaks truth.
 

Scott The Scot

Where there is smoke, there is cancer.
I think the solution is for everyone to have a good connection and be wired. That's it. I've played in those conditions and the online is pretty good, I think most people are connecting to people with shitty internet.