Multiplayer Precisions (int16...)

0 favourites
  • 3 posts
From the Asset Store
The official Scirra Multiplayer Signalling Server for helping peers find and connect to each other
  • Hello community, I'm working on a multiplayer and I'm doing well, I would like to get help with the precisions I don't understand the difference and because I have to decide one...

    I noticed that even putting "HIGH DOUBLE 8BYTE" would not be the best since the INT16 2 Byte is supporting more than 255 values...

    Why, then, what shelters the most is further down?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 1 byte can contain up to 255 digits

    2 bytes up to about 65 thousand

    4 bytes up to 4 million

    8 bytes up to 18 quadrillion

    Low precision syncing (2 bytes) is indeed usually more than enough for most cases, as far as numbers go. You'll probably know when you need higher precision when you need it.

    It is most obvious when dealing with bitwise toggles. 1 byte has 8 bits, which is more or less 8 on/off toggles, or true/false statements. This is usually used to represent inputs, or keypresses, to determine what keys are down at a given time. 2 bytes increases that to 16 bits, 4 to 32, and 8 to 64. Again, 16 is usually more than enough (we only have 10 fingers to input things with!), but you can send a lot of stateful information besides just inputs for each client in the same packet if you use a higher precision sync. Again, you'll know when you need it.

    Also consider that a single ascii character requires 1 whole byte. So to sync just a 4 character string (converted to a value), for example the peerid, it would require 4 bytes. But don't do that, because peerID's shouldn't change and you should never need to actually sync it.

    One more thing I thought of, but I don't know how big an effect it actually has, is that the more precise a value is, the less of an effect rounding error will have. Rounding errors that build up over time result in desync between clients, which is a major headache for any sort of multiplayer environment or net code.

  • Thanks Thanks, I understood then that for a pixel art game that the layout has a maximum of 640px I can always use until8 because 255 information is too much... I only collect clicks and positions... whose positions are int16 by default.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)