How do I synchronize randomly generated levels for online multiplayer?

0 favourites
  • 4 posts
From the Asset Store
Unlock Levels, Worlds & skin plus add coins by watching ads
  • I have a platformer-type game where I create a randomly generated level from prebuilt sections that are outside the layout. It is meant to be an online 2-player game.

    When I do remote preview, the peer doesn't have any level. It's just the player floating in midair, with no ground under him.

    I do not know how to send a seed from the host to the peer so they have the same randomly generated level.

    How do I make it so that the advanced random plugin generates the same level for both the host and the peer?

  • You can use Multiplayer's "Send Message" action to send the seed

    Also, instead of using remote preview, you can hold Alt/Option and click Preview Layout twice to open two preview windows

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for your response.

    I know I need to use the "Send Message" action, but I don't know when/where to send it. At what point do I need to send the message, at every generated piece of the level (prebuilt scenes) or at the beginning or the end?

    Do I send the message from the peer to the host, or do I broadcast the message from the host to the peer?

    What exactly do I send?

  • I know I need to use the "Send Message" action, but I don't know when/where to send it. At what point do I need to send the message, at every generated piece of the level (prebuilt scenes) or at the beginning or the end?

    This is up to you. You could hypothetically send the message at any point. In the beginning, or when each piece is created, or at the end

    Do I send the message from the peer to the host, or do I broadcast the message from the host to the peer?

    As far as syncing, this doesn't matter. One player just needs to create the level layout, and the other player(s) need to receive that level layout. It can be the host or the peer that creates the layout and sends the message, although generally it makes sense to give the Host more control over the game. So Host -> Peer(s) is fine

    What exactly do I send?

    Here's an example with 2 methods. One is sending the entire layout at once, and the other is sending the layout piece by piece.

    dropbox.com/s/9xck9lejimkq9rv/Multiplayer%20Layout%20Sync%20Example.c3p

    You could also send a seed if you have your layout construction set up that way. This would be as simple as sending the seed in a message

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