agar.io-clone
agar.io-clone copied to clipboard
Use binary data instead of string/object data
To speed up the connection. Send/receive data in binary format is a better idea than string/object.
how would you implement that? could you point us to one example?
A starting point https://github.com/binaryjs/binaryjs
honestly, I have no idea how to do it. haha. that's why I put it here but not assigned to myself yet. thanks @chrisevans1001 for the hint. I will take a look at this one.
Socket.io in current version can send binary data just like json
http://socket.io/blog/introducing-socket-io-1-0/#binary-support
great!!!! :+1:
There is a feedback on HackerNews, he compared the amount of data transfer by the original AgarIO game and our clone. Here is the details: https://news.ycombinator.com/item?id=9633252
Original Agar:
- Compressed binary data
- Max packets size: 187 bytes
Our clone:
- JSON objects/String
- Packets size: 4253 bytes
There is a very long way ahead to optimize the server. First is the binary data, then, may be we will find a way to reduce packets size (only send changed values, etc)
Perhaps we could have the user compress to a BLOB format and then once it is in a BLOB the server could handle it as BLOB will move easier
If the user does the BLOB then we are utilizing some of the user resources not taxing the program
Super interesting !!! thank you
Found an interested article about Binary in JS http://danthedev.com/2015/07/25/binary-in-javascript/
Somebody has done a serious research on Agar.io data structure https://github.com/Eureka22/Agar.io-Protocol/blob/master/Protocol.md
@huytd That Protocol.md is pretty interesting!