Forum Feedback FEATURE REQUEST : add message.Size

Problem with the website? Confused about something? Or maybe you just have something you'd like to suggest. This is the place to do it.

FEATURE REQUEST : add message.Size

Postby Deril » June 28th, 2017, 12:00 pm

Hello,

fixing and debuging bandwidth is very important for developers, as it affects bottom line with bandwidth costs so mutch.

message.Size property to calculate and return on request message size in bytes is very needed.
Deril
 
Posts: 8
Joined: January 12th, 2017, 1:44 pm

Re: FEATURE REQUEST : add message.Size

Postby Henrik » July 2nd, 2017, 2:13 am

Well, the binary multiplayer message format is pretty straightforward. Generally, all parameters take up one type byte, an few optional bytes for length, and then the payload. Fixed-size data types are the easiest, long and double take 8 bytes, float and int take 4 bytes, booleans 1 byte. Variable-length strings are UTF8-encoded and bytearrays are sent as-is. There's some tricks to pack data into fewer bytes when possible, for example booleans and small integer (< 64) go in the type byte.

But outside the message you also have the TCP overhead of ~40 bytes per packet, which means that there is a difference between sending 40 messages with an integer in each, and sending one message with 40 integers. And that wouldn't show up in a call to message.size, so you're probably better off using the above info, look at what your code is doing, and then optimizing based on that.
Henrik
.IO
 
Posts: 1880
Joined: January 4th, 2010, 1:53 pm

Re: FEATURE REQUEST : add message.Size

Postby Deril » July 2nd, 2017, 6:32 am

Sounds like straightfoward implementation!

Can we make it part of default interface?
Deril
 
Posts: 8
Joined: January 12th, 2017, 1:44 pm


Return to Feedback



cron