4 ms·
I noticed that currently json is used to encode messages between clients and the server and also a lot of information that is not actually needed in every updat
by pagnol 9y ago
I noticed that currently json is used to encode messages between clients and the server and also a lot of information that is not actually needed in every update is included, such as the color of each player's car, their name or the number of lifes left.
How much could be gained by transferring only the information that is actually needed and using a different serialization format, perhaps protobuffers or the like?
- synthmeat 9y agoI got 2 to 4 orders of magnitude improvements across the board last weekend just by rolling my own binary protocol over ws, with world deltas. Didn't even bother to space-partition it to clients. Using JSON as serialization format for real-time multiplayer game is being very silly, unless it's just a prototype.
- jackmott 9y agoyes json is crazy. protocol buffers are ok. but custom bit packed format is still helpful for twitch games
- auspex 9y agoUsing JSON for a realtime game is extremely bad. Each request must not only be parsed (json-> object -> json) but each serialization requires a byte by byte encoding pass. Meaning that you're going to use a lot of CPU. Binary is a much better choice.
- jlebrech 9y agocould have used msgpack http://msgpack.org/ http://msgpack.org/
- nullpilot 9y agoMessagepack still contains field names as strings, which can easily double or triple your data, and explodes parsing time. A game is a pretty good use case for predefined schemas like Protocol Buffers, which is used by CS:GO and Pokemon Go for example. Other games like slither.io use binary over websockets without any of these libs.