[Solved] Multiplayer peer updates

  • So I am trying to have 1 object & 1 objects instant variable sync for all peers who are currently in the room and update for all peers who then connect.

    Here is what I have going on right now.

    I can get it to work for individual peers but I can't seem to have the variable & the object update there current status for all currently connected peers & new joining peers. e.g the first peers adds 40 to the variable, a new peer connects and automatically has that variable updated to 40.

    Any help ?

  • Bump. I'm trying to figure out the same thing.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do the players have separate sacrifice bars?

  • If what you're trying to do is create and edit a player's individual "sacrifice" bar during gameplay, you need to add PeerID's to the objects belonging to each player, add those values when they connect, and then pick, by comparison of their PeerID equal to that of the peer sending the message, them when you need to check or modify a value associated with that player's instance of the object.

  • If what you're trying to do is create and edit a player's individual "sacrifice" bar during gameplay, you need to add PeerID's to the objects belonging to each player, add those values when they connect, and then pick, by comparison of their PeerID equal to that of the peer sending the message, them when you need to check or modify a value associated with that player's instance of the object.

    I am attempting to have 1 bar update for all users currently connected as well as when new players connect have that bar update. For example, if peer 1 adds 10 to the bar and peer 2 adds 5 equalizing 15 and a new peer joins I need the bar to update to 15 for the new peer.

    It's meant to be cooperative, so that all peers contribute to the bar itself and when a new player joins he needs to be updated to whatever the bar is currently at.

    [Solved]

    I just got it working, may not be the best performing or the prettiest to look at but it functions the way I need it to at least for now. I used your idea for the comparison and stuck it under the host side after the peer is created. I did not have to use the peerid thing :3

    So my issue way that I had the variable being updated from the individual peer and not the host which is what I needed, so now the Sacrifice variable is automatically updated for all peers currently in the room and all those who join in. Now I just need to figure out how to auto update the sacrifice image bar itself in the same way, it does update after a player adds to the sacrifice variable though.

    [Final update to this post.]

    Figured out how to update the image as well

  • Very good, I'm glad you figured it all out! Good luck on your game!

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