agar.io-clone icon indicating copy to clipboard operation
agar.io-clone copied to clipboard

Use binary data instead of string/object data

Open huytd opened this issue 9 years ago • 12 comments

To speed up the connection. Send/receive data in binary format is a better idea than string/object.

huytd avatar May 23 '15 12:05 huytd

how would you implement that? could you point us to one example?

uncedric avatar May 23 '15 19:05 uncedric

A starting point https://github.com/binaryjs/binaryjs

chrisevans1001 avatar May 23 '15 21:05 chrisevans1001

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.

huytd avatar May 24 '15 02:05 huytd

Socket.io in current version can send binary data just like json

http://socket.io/blog/introducing-socket-io-1-0/#binary-support

krtr avatar May 25 '15 21:05 krtr

great!!!! :+1:

huytd avatar May 26 '15 04:05 huytd

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)

huytd avatar May 31 '15 14:05 huytd

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

Azeranth avatar Jun 04 '15 22:06 Azeranth

If the user does the BLOB then we are utilizing some of the user resources not taxing the program

Azeranth avatar Jun 04 '15 22:06 Azeranth

Super interesting !!! thank you

giongto35 avatar Jun 05 '15 13:06 giongto35

Found an interested article about Binary in JS http://danthedev.com/2015/07/25/binary-in-javascript/

huytd avatar Jul 29 '15 08:07 huytd

Somebody has done a serious research on Agar.io data structure https://github.com/Eureka22/Agar.io-Protocol/blob/master/Protocol.md

huytd avatar Jul 30 '15 18:07 huytd

@huytd That Protocol.md is pretty interesting!

igorantun avatar Jul 30 '15 19:07 igorantun