There are also a number of binary equivalent JSON formats

Mostly geometry.
, I finished up talking about latency issues for networked video games .
Today I want to move onto the other major network resource, which is.
Compared to latency, bandwidth is much easier to discuss.
This has been observed many times, .

Perhaps most colorfully by Stuart Cheshire: S

Cheshire.

(1996) ““ Some ISPs implement via either traffic billing or download quotas

In this situation, lowering bandwidth reduces the material costs of running the game.
The second issue is al so important , at least up to a point.
If updates from the game do not fit within a single , then they will have to be split apart and reassembled.
This increases , , and.
Again, reducing the size of a state update below the MTU will have no further effect on performance .
Some games use a variable update frequency to throttle back when they are under high load. For example, does this to maintain stability when many players are clustered within the same zone.
They call this technique “time dilation” and explain how it works in a short dev blog: CCP Veritas.
(2011) ““ The most visible target for state bandwidth optimization is message , or . While it is tempting to try first applying optimization effort to this problem, serialization improvements give at most a constant factor reduction in bandwidth. At the risk of sounding overly judgmental, I assert that serialization is a.
Worrying too much about it up front is probably not a wise use of time.

One approach is to adopt some existing serialization protocol. In JavaScript

the easiest way to serialize objects is to use.
There are also a number of binary equivalent JSON formats, like or which can be used interchangeably and save a few bytes here and there .
The main drawback to JSON is that serialized objects can’t contain any circular reference s, and that once they are serialized they will lose all of their function properties and prototypes.
As a result, it is easier to use JSON for sending small hierarchically structured messages than process gigantic amorphous interconnected networks of objects. For these latter situations,  may be more suitable. XML has the advantage that it is extremely flexible, but the disadvantage that it is much more complex.

Google’s are an example of a serialization format which uses structured schemas

In the XML world there has been some research into

though they are not widely used.
For JSON, there don’t appear to be many options yet, however, .

There has been some work on creating a for JSON documents

In , this is can be implemented with the built in The second and somewhat trickier issue is that zlib will split large packets into multiple chunks, and so the receiver will need to implement some extra logic to combine these packets.
Typically this can be done by prefixing each packet with an integer that gives the length of the rest of the message, and then buffering until the transfer is complete.
One draw back to streaming compression is that it does not work with asynchronous messaging or “datagram” protocols like UDP.

Because UDP packets can be dropped or shuffled

each message must be compressed independently.  Another closely related idea to compression is the concept of patch based updates.
Patching, or diff/merge algorithms use the between the previously observed states of the game and the transmitted states to reduce the amount of data that is sent.
This is more-or-less how manages commits, which are stored as a sparse set of updates. In video games, patch based replication is sometimes called ““.

The technique was popularized by John Carmack,

Finally, the most effective way to reduce the size of updates is to replicate fewer objects.
That is, given any player we only replicate some subset of the state which is relevant to what the player is currently seeing. Under the right conditions, this asymptotically reduces bandwidth, possibly below.
Some games naturally enforce area of interest management by the nature of their rules.
For example in a strategy game with ““, players should not be allowed to see hidden objects.
Therefore, these objects do not need to be replicated thus saving bandwidth.
More generally, some properties of objects like the state of a remote player’s inventory or the AI variables associated to computer controlled opponent do not need to be replicated as well.
This fine grained partitioning of the state into network relevant and hidden variables reduces the size of state updates and prevents cheating by snooping on the state of the game.
J.
S.
Boulanger, J.
Kienzle, C.
Verbugge.
(2006) “” Netgames 2006 E.
Cheslack-Postava.
(2013) “” PhD Dissertation, Stanford University.
This entry was posted in , and tagged ,.
Bookmark the permalink.

5 Responses to Replication in network games: Bandwidth (Part 4)

Arrr March 9, .

2014 at 8:37 am Nice post

Will you talk about encrypting packets and in general security in networked games.
Reply mikolalysenko March 9, 2014 at 5:31 pm I probably won’t write anything about encryption since it is kind of a low level problem, and there are plenty of off-the-shelf solutions that work just fine.
For example, you can just pipe your data through TLS/SSL and automatically get a secure connection.
Reply.
Krzysztof Narkowicz (@KriS_cg) March 10, 2014 at 10:00 am Hi, Nice series.
Thanks for sharing.
IMHO you shouldn’t downplay the importance of proper serialization.

Single UDP packet can contain only around of 1200b of data

For example sometimes you can store position as uint32_t (index in a table of predefined positions) instead of 3 floats.
Similarly rotation can be stored as uint_16 instead of 3 floats.
This way we can get a factor of 2 improvement for object updates.
This means storing 200 object updates instead of 100 in one packet and it really makes a difference.

Additionally strong compression algorithms can be used with UDP

The tricks is to use predefined dictionary.
Actually all dictionary based compression techniques would benefit from this aproach.
http://cbloomrants.blogspot.com/2013/11/11-14-13-oodle-packet-compression-for.html Reply.
Valentin March 15, 2014 at 10:55 pm Thanks for the articles.
Was an interesting read.
Reply.
Riley Stang (@RileyStang) March 4, 2020 at 4:51 am Thank you for writing this.
I’m trying to get prepared to be interviewed at a company that is developing an MMORPG.
Any tips for better understanding all the mathematics.
That’s the only part that was really fuzzy for me.
The highest math course I took was College Algebra like five years ago.
By the way, the link to the Time Dilation Video Demo for EVE Online is broken.
Thanks again.
Reply.
Leave a Reply Cancel reply.
Enter your comment here.
Email Name Website You are commenting using your WordPress.com account.
(  /   ) You are commenting using your Google account.
(  /   ) You are commenting using your Twitter account.
(  /   ) You are commenting using your Facebook account.
(  /   ).
Follow.
bloggers like this:.