How do I send a client state from the host's variables to the client?

0 favourites
  • 4 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • Hi guys, I know this sounds strange, but my project requires it and I can't figure out how it works!

    In my game, the host is handling all character movement and the peers only get character stats. The multiplayer connection is working just fine and I'm able to send messages from the peer to the host.

    However, I'd like to be able to sync the host's "peer-avatar-object"'s variables with the peer's avatar variables.

    All multiplayer tutorials that I found always consider the peer as an "emitter" that synchs with the host.

    I want it to be able to sync object variables just as if it was the host receiving them from the peers.

    I could use messages from the host to the peer, but as I understood, it isn't as effective nor practical for constant flows of info.

    In other words:

    My host handles a "Health" variable for each avatar. I would like to have the peers know what their "Health" is as frequently as possible.

    Tutorials only show how to send peer info to the host and let it update automatically via synch.

    How can I accomplish this?

    Thanks!

    -ViLa

  • This is the current code for my peer side (which doesnt work):

    i.gyazo.com/c0ee6262b6f26ef03ff65cc93c1e1beb.png

    This is the host side:

    i.gyazo.com/fcfcd4d6bc24fbb8aec9363496b89b42.png

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • why not only send health information when it changes

    Hey thank you for your reply!

    Well, it is supposed to be a set of stats that change all the time... and I read Ashley say somewhere that for that kind of thing its more reasonable to sync object variables - which I can't figure out how it works.

  • Wow thank you so much for your reply!

    Such a trove of information. I will look into it and see if I manage to figure it out.

    I'll look into it!

    Thank you so much YoyoEleanor - you've been helping me out a lot lately! :)

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