Stumped: Instance Variables only sync for Host Player

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Thanks in advance for reading.

    I've been fighting this for a bit: I have a mechanic in my game where the main weapon has a "warm up" between click and actually firing, and a "cool down" after that. The Player object has instance variables for "warm" and "cool", these are in the Start of Layout with the other Instance Variable Sync commands (that work), but they never Sync. I've tried Linear (which makes the most sense) and None for Interpolation. I've tried both Very Low and Low bandwidth, as the values are always integer and lower than 100. The value is only set by the Host, but the Peer should be able to use the value for display purposes.

    The only thing I can think of is that it is updated too often so the Multiplayer system never Syncs it, since it is updated every tick, except that it does properly sync to Peers for the Host Player object. Other Synced Instance Variables all work: a 1 byte "active" bitmask set for player activities, a 1 byte "inputs" (as in the tutorials), HUID ("Host UID" for specifically identifying objects by the host's UID), TeamID, and lookx and looky for the mouse position. These all work, but "warm" and "cold" don't sync from Host to Peer except for the Host's Player object.

    I've even changed their names a couple of times, changed their position in the list of Sync Instance Variables on Start of Layout, and tried putting the Sync Instance Variable definition into the Host's Player Object Creation for newly connected Peers. No change. The Host's Player's gun warms up, fires, and cools down on the Peer display exactly as it should, any Peers on the Peer display don't (including the local one). The Peers ALL warm up, fire, and cool down as they should on the Host display. The display code is common, based entirely on the Player Object's Instance Variables.

    Sorry for the wall of text, but I'm stumped. Thanks for any help or ideas on how to move forward!

  • I have stripped down my project for an example, removed my project name, removed the "Server" choice system, removed many unrelated functions and features, and replaced images with functional placeholder equivalents.

    Here is the resulting Project:

    You can only see the problem if you compare the Host and Peer displays, or at least the Peer debug data showing the Instance Variables.

    Thanks again for any help!

  • Further stripped the project down to the barest parts needed to see the problem. Removed upgrades I had made to the tutorial patterns. Tried to slow down the updates to those Instance variables, thinking they might update too often, but that did not correct the issue. The host displays the warmup/cooldown correctly for all players. The Peers see the host warmup/cooldown correctly, but not themselves or other peers. In debug, the "warm" and "cool" Instance variables don't change on Peers except for the Host's Player object. Tried in the latest beta, same results.

    r215 c3p:

    I feel like I'm missing something simple somewhere, because everything else just works, and this ALMOST works, but I can't find a simple way to "force" an Instance variable update to a Peer.

  • It was something simple: When syncing Object Instance Variables, do NOT put a "client value tag" for any value that is not a client Input variable.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could you please provide this c3p again? I am super stumped on the same issue.

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