back

Creating a 6-Digit P2P ID and Implementing Multiplayer in GDevelop using THNK


Overview

This document outlines the steps involved in creating a 6-digit p2p ID and setting up multiplayer functionality in GDevelop using the THNK extension.


Key Steps:

Project Setup:

Create three scenes: Main Menu, Game, and Join. scenes

Menu Scene:

Add two buttons: "Host" and "Join".
buttons
Events:
For Generating a P2P Code:
p2p code events
For the "Host" button:
Transition to the Game scene.
host
For the "Join" button:
Transition to the Join scene.
join

Join Scene:

an input box for the player to enter the p2p ID.
Add a button to join the game using the entered p2p ID.
join scene
There is only one event here! join events

Game Scene:

Add a text object to display the generated p2p ID (initially hidden).
object
Events:
Show the p2p ID on the text object.

join events

THNK Extension Integration:

Use THNK's functions to generate the p2p ID and handle multiplayer connections.
Refer to THNK's documentation for specific usage details.

Additional Resources:

GDevelop Multiplayer documentation:
https://gdevelop.io/blog/make-multiplayer-games-easily
THNK - Official Docs:
https://thnk.cloud/docs/

Note: THNK and THNK P2P Extensions are Necessary for This Working.