How do I wait for peers to ready before starting the game?

0 favourites
  • 3 posts
From the Asset Store
Add calm and a lounge vibe to your games with these 8 tracks
  • okay, so I'm making a multiplayer game and I'm working off from the Pong multiplayer example. That example waits for 3 seconds before starting the game, but what I want to do is to have both the host and peer to press "ready" button before starting the game.

    I keep getting problem here, I imagine I have to make the peer send a value to host indicating it's ready, and then I have to start the game after both the host and peer are ready. Somehow I fail to do that.

    I use

    is Host |
    is ReadyInRoom | (start game here)
    Multiplayer.PeerState(peerId, "ready") = 1 |
    

    the ReadyInRoom variable indicates if the host is ready, and the peerState indicates if the peer is ready.

  • You probably don't want to use the peerstate expression, unless your ready trigger is holding a key down. Peerstate is better used for inputs and not variables.

    I'd just have the peer send a message. When host receives the message, it also knows which peer sent it, and can set a variable for that peer to true or ready.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ah I thought I could use peerState. I will try to do your suggestion, I'll update if I found new problems.

    edit: I tried that, and it worked! Thank you.

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