Why isn't there an option to sync bool in Multiplayer

0 favourites
  • 3 posts
From the Asset Store
Sync animations, animation frames, mirror state, sounds and anything else using these methods.
  • It's more of a question for Ashley tho.

    But why isn't there a possibility to sync a bool in sync instance variable event in the multiplayer plugin. It's not very conveniant when you used a bool as a trigger and want the peers to be able to input it in the host's instances.

    Considering it should not be so difficult to change may i ask for this add for the next release?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The answer is that all transmission by way of socket and serial is all done in bytes. You can't send 1bit of a byte and a bool is pretty much a bit with a parity value. So a byte is going to be sent no matter what it is.

    Since a bool is translated to 0 or 1+ then you already have a a usable if statement with a byte or number.

    if( number ) is 1+

    or

    if( !number ) is 0

    A byte also values of 256 possible results. Since the minimal data is a byte spending the extra effort to typecast a byte to a limited use of a bool seems redundant when the developer can check against it themself. If you really need it you can typecast the input of byte to a bool on the change of the byte value.

  • You can't send a single bit over the network - the smallest is a byte, which allows you to send 8 booleans at once. This is already documented in Multiplayer tutorial 4.

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