Workaround for syncing strings OR how to convert text to numbers?

0 favourites
  • 4 posts
From the Asset Store
This collection of music is the beautiful performance of rather small strings ensemble (8 first violins, 6 second violin
  • Hi there.

    Currently I have a lot of hassle. I have to rewrite all of the unit frames creation because of the limitation of syncing variables to numbers only.

    My workaround was to store the players multiplayer index (multiplayer.peerCount-1) in a local variable on the object that I want to sync. They are basically the players character frames where you see their name, hp, mana and so on. After the local variable with the index is created the host will then broadcast a message to the players containing a JSON with alle the information, as well as which player has which index (as I discovered that the players multiplayer index will not be the same between peers).

    The problem now is that When the peers receive this message the sync objects are not created yet. So again it will not work.

    Now I'm having a headache on how to sync all of this. I just want to create a player frame when someone connects.

    I think I might drop all of this and just look into techniques of converting text to a number (double should be enough), just sync it and re-convert it to text on the peers side.

    Any ideas? Thank you in advance!

  • You want to make it so peers request info. That way they never get info prematurely before they’re ready for it

    So, for example, if a peer joins, the other peers should wait until they “detect” that a new peer has been created, and then they should msg the host asking for that peer’s info

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Use the message system for strings.

    Also in general, consider if something really needs to be synced or not. Often if an instance variable never changes or changes very rarely, it is more suitable to use messages, even for number values. Syncing is best reserved for values that need to be updated pretty much constantly and for values that can take advantage of interpolation.

  • Thank you both for your replies!

    Yesterday while laying in the bed I realized that I need to do this the other way around to have the right order of things happening.

    basically what you said. But not when a peer detects another peer but when it detects the creation of a player frame. This way it is ensured that it will not fire too early as it is the case right now.

    oosyrag Yes I know I should be very considerate with syncing. I sync the player stats so that I do not need to worry about sending all these messages. I think with only up to 5 players it shouldn't be an issue bandwidth wise.

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