Create multiplayer experiences
There's nothing quite as thrilling as a multiplayer game. Learn how you can make the most our multiplayer games.
Types of games
Not all Gamezop games support multiplayer experiences. Here is a list of our games on which you can create real-time multiplayer experiences for your users.
There are 2 types of multiplayer games:
Generating game links for multiplayer games
When you open any game url
that you receive on our All Games API, the game opens a single-player experience by default.
To enable a multiplayer experience, you need to follow these steps:
Generate a roomDetails
object
roomDetails
objectThis carries all the details we need to create a match between your users. roomDetails
is a JSON object with the following values:
Base64 encode the object
Let's assume this is the final roomDetails
object you've generated and you now want to encode it:
If you're using Javascript, store this in a const
named roomDetails
, and then run:
You'll get the following value:
Create the multiplayer game url
url
If you are going to send user details or a wide variety of roomId
values, you may need to generate the final game link on the client instead of the server. If you aren't using those values, then you can manually generate a link and send all your users to the same link and they will keep getting matched with one other.
Generating the link is extremly simple. Once you have the encoded roomDetails
value, just append it to the URL you receive from the All Games API. The final URL will be of the following structure:
{url-from-All-Games-API} ?roomDetails= {encoded-object}
Get multiple users to open the multiplayer game together
Once you've set up the system to generate these links, you need to have multiple users from your platform open the links together. When a user opens one of these links, our matchmaking module tries to find other users from your Property ID with the same roomId
, and matches the users together in a multiplayer experience.
Receive data on match winners
In case you want a callback with details of the winners at the end of each match, you will have to provide 2 APIs for it. Detailed here.
Last updated