Is there a way to send state changes in bulk instead of one-by-one?

Options
I have a state with some 20+ properties that I change at the same function. They seem to be unable to send it all in the same frame and I needed to add an artificial delay for the clients to receive all 20+ property changes.

I've read this doc https://doc.photonengine.com/en-us/bolt/current/in-depth/reliability and it says if I do changes in quick succession, the packets will be lost. I think that is the root of the problem.

Is there a way to send all 20+ properties at the same time in one frame, rather than when the value is changed? If there is none, what other ways can I send the 20+ properties? The properties need to be received before further execution or it won't work properly.

Comments

  • stanchion
    Options
    You can adjust in the state how many properties and bytes to limit per packet. I can make more suggestions if you say what these properties are for and why its important for them all to be received at the same time.
  • AlfonsoMatador
    edited June 2017
    Options
    It's for player equipment. There are at least 4 equipment slots that needs to have a valid value (non-zero positive integer) and another 5 slots that can have an invalid value (zero, meaning nothing is equipped on that slot). The 9 equipment slots are all accompanied by 5 Color values (used for customization) totaling to 45 Color values.

    I need at least the equipment slots to be sent before continuing on (in the client). I've tried adding a Verified property and the client just waits for the value to be true but it seems that the order state changes are sent is not preserved (so sometimes the client gets the Verified=True packet even when the equipment slot packets are not received yet).

    EDIT: There will be 2-8 players in one game but this whole exchange will only happen once at the end of the setup phase (before the start of the actual game loop).
  • stanchion
    Options
    You may want to use events then, and pack everything you want into one. However most games I've played do not send everything at once, for example when you log in WoW you'll often notice your items gradually being loaded from the server. This is also the case with equipment you see on other characters. Sending tons of data using reliable events is a great way to make your networking stop working properly, as everything else is dropped. This is why you should always use unreliable events, states, etc so that this doesn't happen.
  • DirtyHippy
    Options
    For this scenario, assuming equipment changes do not occur once the game is running the easiest thing would be just to create a state property as a token and attach your equipment via this token. A state token is essentially a custom-packed atomic property. This means you would pack the token yourself and assign it to the state. On the other end, the user would simply subscribe to that state property changing and when it does, he knows he has the equipment so he can unpack it all and do the right thing.

    You can also just send a bunch of reliable events or pack your equipment into a single packet using the BinaryData member of the packet. Not super elegant, but would work fine if this just happens up front.

    If equipment does change once the game starts this would require a bit more thoughtful design. Typically the pattern is what stanchion mentions above.
  • @DirtyHippy Is this what you're talking about? (https://doc.photonengine.com/en-us/bolt/current/in-depth/protocol-tokens) The equipment does not change during the game so it looks like this is the solution. I'll try it out and see what happens.