How do I sync peer objects in turn based games?

0 favourites
  • 4 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
  • I'm making a mobile version of a board game for a client. Looking at the multiplayer tutorials they seem to use a simulate 8Direction movement and mutliplayer variables LagCompisatingX LagCompisatingY that I think is how it syncs between host and client, which doesn't apply for a turn based game.

    The client player can see the host's moves, but not visa-versa.

    I tried making it so on creation of the peg objects it syncs it and associates it with the owner, like the tutorials do.

    Here's screenshots of relevant code (Since it's not my game, I didn't feel comfortable sharing the entire project)

    On object creation it asosciates it (like the tutorials do)

    The networking related code. I have a series of signals to the host on events, which then broadcasts it back to each client. I'm a bit lost on how I'm supposed to signal a client's move to the host (update the posistion of the pegs) though.

    Thanks!

  • Sync object

    Automatically sync an object. The host sends information about synced objects to peers. This is one-way transmission; peers sync with what is happening on the host.

    If you are using sync with an authoritative host, peers will only send their inputs to the host. Have your peers tell the host what they are doing or want to do by sending a message. The host will move all synced objects based on these messages/inputs, and thus update the object for itself and all the peers.

    Local input prediction, lag compensation, and interpolation will be not applicable to your game, since it is turn based.

    Alternatively, if you don't need an authoritative host, simply have each peer and host relay their actions to each other via messages, and update the game state on each peer/host individually. Make sure messages are set to reliable ordered, and make sure host and peers utilize the same set of events to update the game state to keep everyone synced. Do not use the built in sync object feature in this case.

  • So I have to spawn the objects manually via messages? Okay, I guess I was hoping there was a way of doing it automaticly, like it was doing from the host. Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Two ways

    A: Use the sync action - Create the object on the host, and the object will be created and updated for all peers. Peers do not create or otherwise manipulate these objects. Peers should instead tell the host what they want to do, and the host will do it for them (either via messages or send input state action).

    B: Don't use the sync action - Use messages to tell the host (and have the host relay to all other peers) what has been done. Each peer creates/makes changes the objects on their own locally, based on direct input and received messages.

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