[Tutorial] How to create an online multiplayer game


Good job The Gem!
I saw a few latence delay to synchronize the 2 P2P game sessions.
Considering that this example is very light, can we expect more latence delay with fatter p2P games made with this GD extension?

Thanks for your response and again, well done.

It’s going to come in handy. Thanks

1 Like

I just saw your template you are amazing you are a legend and everyone involved in this extension.

1 Like

Well the P2P is not designed for large multiplayer games.

1 Like

Wow, I tested it and with my connection it works correctly


The next step is to play 2 match in the game time and manafe the ID automatically
Player a b c d
Player a create the id
Player b activate the program, the system detect that there is the player a waiting and start the match
Player c create the new id
Player d activate the program, the system detect that there is the player a waiting and start the new match

1 Like

Please make a tutorial for players more than two. :pray:

  1. My wifi is too slow to load it.
  2. Please make a page/article or something so explain what i must do on a page/article.
  3. I can’t use my laptop as my broker server because the ram/memory is not high enough
  1. If your wifi is to slow to load a youtube video, you are going to run into much larger issues using GDevelop than just this video.
  2. The peer to peer article already exists on the wiki, and an example is already available there.
  3. A broker server is required, so unfortunately you will not be able to make/produce peer to peer multiplayer without it.
1 Like
  1. I looked at the wiki and read it 2 times but still failed.
  2. I have trouble trying to install peer dependencies in cmd, if i had it installed i would not ask this question.
  3. I need more help then anyone has ever gotti’

What I’m saying is that you cannot make a multiplayer game using the built-in Peer to Peer options in GDevelop without a broker server. There isn’t another option. You either need to run it locally or look into paying for a hosted cloud instance of a broker server, but that will be expensive and you’ll need to do some research on PeerJS options.

Additionally, If you’re unable to watch the youtube video, and you aren’t able to follow the wiki, then you will not be able to proceed from a base technical level. Unfortunately, just around testing alone you will need wifi that can handle streams, and youtube is already one of the lightest video methods out there.

i watched the video and it was ok but i have the south africa’s worst wifi here. i’m using and i did not buy it

Thats unfortunate, but that does mean you likely won’t be able to make a peer to peer multiplayer game as you won’t meet the minimum requirements to host a broker server.

Hi, i’ve two question :

  1. in the tutorial player1 and player2 use different keys to move the own sprite. Is it possible to each player use the same keys (Up,Down,Left and Right arrow) ?
  2. can the broken server create the same ID session every time ? So, every player automatically are connected each other without copy/paste the p2p::getID ? i’d put the fix getID in Gdevelop.

thank you very much

These aren’t really relevant to the tutorial, however:

  1. Yes, you just need to ensure you are setting up your own event system that detects each player (via variables, likely) and then make the detected controls behave differently for each variable. There isn’t a tutorial for this so you’ll need to develop your own method on how.
  2. No, as far as I know the session ID is going to be unique every time with how PeerJS works.

First, thank you for this wonderful tutorial. Nevertheless I have a question: When I open the project in Gdevelop as a preview, everything still works, but as soon as I export the game, the connection doesn’t work anymore either. ( i used the heroku server) Can you help me?
Thank you very much

hello the Gem, i downloaded your Online multiplayer Demo on Itch.io i opened it in GDevelop and tried playing it. it wouldnt work because i didnt have the local broker server running. i tried getting it to work but it wont work.

what template??? is it on Itch.io? i rlly need one

Do you have peerjs installed on your computer?