Multiplayer: connect multiple peers, however "rounds" are played in groups of 2

0 favourites
  • 3 posts
From the Asset Store
Full source code to the game guardian. Includes all art and music assets.
  • i understand hosting multiple peers and starting a game w/ everyone connected & playing together. however is there any tips out there about syncing peers into groups?

    for example if 8 peers joined a room for the game "pong" (w/ a dedicated server acting as host). but when the game starts each peer is paired up & have there own game, totaling 4 games of pong. Then pretend this is repeated 7 times so every peer gets a chance to play the other peers in the room.

    i have the language set up for assigning peers their next opponent though IDs over multiple rounds, however i am stumped on syncing only one peer to another w/o the others interfering.

    i hope this was clear, & thanks for the help. i will continue studying the examples & post a solution if i come across one

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First Problem: So you want to have 8 players playing 4 games at the same time. Those 4 games should be in separate Multiplayer rooms, so only 2 players are connected.

    Second Problem: You still want 8 players not two. So we need a lobby room. For them to come to first, and after their match.

    Third Problem: We need to remember who in the lobby we have played against, yet. Since we know everyone has a unique Alias when connecting to a room lets store that. To get around constucts storing stuff between rooms, I would suggest storing it to Local Storage.

    Fourth Problem: How do we get back to the lobby Room? Lets store the lobbies info in local storage as well.

    Fifth Problem: Grouping, We know what games people have played against each other. So we just have to loop through our players and find the ones that we haven't played with yet by checking each's local storage List of alias, Then set up and join a room with that player. (this part takes the most code work and will kind of suck, as you need to pass info back and forth across the network, which is always a pain.)

    I hope this example architecture helps..

  • omg that's perfect, i can't believe using two different rooms for lobby & gameplay didn't cross my mind. Thanks for your input; very helpful.

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