matchmaking and automatic region selection

Hello, Using Godot 4.3 and Rivet Version 2.3.1, I attempted to address the following: A) Map and Skill-Based Matchmaking B) Automatic Region Selection Let me explain what I did. This might help you understand a developer's perspective when upgrading your website and documentation. Materials I Used: • EG1: Rivet Godot Version 1.x example • EG2: Rivet Godot Version 2.3.0 example • DOC: Rivet module documentation https://opengamebackend.org/modules/lobbies • MOD: Module page explaining how to get started https://github.com/OpenGameBackend/OpenGameBackend/tree/main/modules/lobbies A) Map and Skill-Based Matchmaking In EG2, I found code for await Rivet.lobbies.find_or_create, which takes a JSON parameter. I set tags and createConfig.tags to { "map": "sandstorm", "difficulty": "hard" }, but the server threw an error. I referred to DOC, but it didn’t clarify the purpose of JSON keys. Then, I checked MOD, where I found two useful pieces of information: - To enable tags, set taggable to true.
yaml matchmaker: game_modes: default: taggable: true
yaml matchmaker: game_modes: default: taggable: true
- RIVET.matchmaker.lobbies.find({ gameMode: 'default', tags: { map: "sandstorm", difficulty: "hard" } }); Next, I looked at EG1 and found that rivet.json defines matchmaker.game_modes.default. Based on this, I added the following to the rivet.json of EG2: "matchmaker": { "game_modes": { "default": { "taggable": true } } } After deploying the server (not sure if this was necessary), the client weren't able to connect to server due to server error. Observations from Documentation: 1) Config https://opengamebackend.org/modules/lobbies/config • Describes the structure of rivet.json, but it doesn’t include matchmaker or define game_modes. 2) Find API • find_or_create: https://opengamebackend.org/modules/lobbies/scripts/find_or_create • find: https://opengamebackend.org/modules/lobbies/scripts/find • Neither API’s JSON parameter includes gameMode.
6 Replies
Scott
ScottOP12mo ago
-----------------------------------Continued message due to text length limit: B) Automatic Region Selection In MOD, it’s explained that automatic region selection is possible. I was able to achieve this in EG1 by omitting the region parameter when calling find_or_create. However, in DOC, it states: “If no region is specified in find, OpenGB will use the GeoIP location provided by Cloudflare to find the nearest datacenter.” When I omitted the region in EG2, calling find_or_create, an error was thrown. I think MOD is outdated, and referencing DOC only, I don’t think I can figure out anything because DOC looks more like a set of definitions than actual documentation. Can you explain how to solve the questions related to Map and Skill-Based Matchmaking and Automatic Region Selection? Also, do you have any plans to update the documentation in the near future? I find it difficult to understand most of the JSON keys used by the API. Thanks, Scott
Nathan
Nathan12mo ago
Can you explain how to solve the questions related to Map and Skill-Based Matchmaking and Automatic Region Selection?
To clarify, EG1 is outdated and not relevant. Someone else just reported this error, I'm going to ship a fix later today. Will let you know when it's up.
“If no region is specified in find, OpenGB will use the GeoIP location provided by Cloudflare to find the nearest datacenter.”
i think this feature was cut for our mvp. the new version we're shipping has this enabled.
Also, do you have any plans to update the documentation in the near future? I find it difficult to understand most of the JSON keys used by the API.
working on it right now. ^ should be out in a few hours the fix should be live, you don't need to install anything new. let me know if you have any more issues. also please let me know if i answered all of the questions above, not sure i got them all.
Scott
ScottOP12mo ago
I've tested matchmaking, ran two tests 1) Using the example code from plugin version 2.3.0, the only changes I made were adding the following keys to the dictionary parameter of Rivet.lobbies.find_or_create: tags: { "difficulty": "hard", "map": "sandstorm" } "createConfig": { "tags": { "difficulty": "hard", "map": "sandstorm" } } Result: Both players were able to connect, but only one player displayed on the screen.
No description
Scott
ScottOP12mo ago
1) Logs: [Rivet] Connecting to lobby: { "id": "206a2823-9d63-48ce-ac87-9c0bd616fe3e", "version": "2025.01.03-1", "tags": { "difficulty": "hard", "map": "sandstorm" }, "region": { "slug": "atl", "name": "Atlanta", "latitude": 33.749, "longitude": -84.388 }, "createdAt": 1735910242331, "readyAt": 1735910250812, "players": 2, "maxPlayers": 32, "maxPlayersDirect": 32, "backend": { "server": { "serverId": "8fd51a8e-2a93-4e3f-ac2e-4552bea65a89", "ports": { "game": { "protocol": "udp", "internalPort": 7777, "publicHostname": "7ffdc7f3-e3ce-4b63-a34b-15a365917c98-game.actor.6510ffa2-a144-4110-928c-f14b562326b4.rivet.run", "publicPort": 26589, "routing": { "game_guard": { } } } } } } } { "token": "player_SNsfvvMGxqI9Qi0Wxgf2JsgOqBAk4HqlLEYJoNbJ", "id": "c78dd07b-8fa2-467b-afc4-0289f3ac4311" } [Rivet] Connecting to ENet server: 7ffdc7f3-e3ce-4b63-a34b-15a365917c98-game.actor.6510ffa2-a144-4110-928c-f14b562326b4.rivet.run:26589 [Rivet] request=lobbies.find_or_create result=ok elapsed=17239ms [Rivet] Connecting to lobby: { "id": "206a2823-9d63-48ce-ac87-9c0bd616fe3e", "version": "2025.01.03-1", "tags": { "difficulty": "hard", "map": "sandstorm" }, "region": { "slug": "atl", "name": "Atlanta", "latitude": 33.749, "longitude": -84.388 }, "createdAt": 1735910242331, "readyAt": 1735910250812, "players": 2, "maxPlayers": 32, "maxPlayersDirect": 32, "backend": { "server": { "serverId": "8fd51a8e-2a93-4e3f-ac2e-4552bea65a89", "ports": { "game": { "protocol": "udp", "internalPort": 7777, "publicHostname": "7ffdc7f3-e3ce-4b63-a34b-15a365917c98-game.actor.6510ffa2-a144-4110-928c-f14b562326b4.rivet.run", "publicPort": 26589, "routing": { "game_guard": { } } } } } } } { "token": "player_C9qCOrCkrXFpr94T31hXzR6bEdSshHzXbalkbVDh", "id": "00f91547-e154-4680-b60b-793c03eb2110" } [Rivet] Connecting to ENet server: 7ffdc7f3-e3ce-4b63-a34b-15a365917c98-game.actor.6510ffa2-a144-4110-928c-f14b562326b4.rivet.run:26589 [Rivet] Authenticating with server [Rivet] Authenticating with server [Rivet] Connected to server [Rivet] Peer connected: 1 [Rivet] Peer connected: 769870363 [Rivet] Connected to server [Rivet] Peer connected: 1 [Rivet] Peer connected: 1898569117
Scott
ScottOP12mo ago
2) I rolled back the code and removed the tags, modifying it as follows: tags: { } "createConfig": { "tags": { } } Result: Both players were able to connect, and both players appeared on the screen. However, the log printed "tags": { "difficulty": "hard", "map": "sandstorm" }, which was never passed to the function.
No description
Scott
ScottOP12mo ago
2) Logs: [Rivet] Connecting to lobby: { "id": "206a2823-9d63-48ce-ac87-9c0bd616fe3e", "version": "2025.01.03-1", "tags": { "difficulty": "hard", "map": "sandstorm" }, "region": { "slug": "atl", "name": "Atlanta", "latitude": 33.749, "longitude": -84.388 }, "createdAt": 1735910242331, "readyAt": 1735910250812, "players": 1, "maxPlayers": 32, "maxPlayersDirect": 32, "backend": { "server": { "serverId": "8fd51a8e-2a93-4e3f-ac2e-4552bea65a89", "ports": { "game": { "protocol": "udp", "internalPort": 7777, "publicHostname": "7ffdc7f3-e3ce-4b63-a34b-15a365917c98-game.actor.6510ffa2-a144-4110-928c-f14b562326b4.rivet.run", "publicPort": 26589, "routing": { "game_guard": { } } } } } } } { "token": "player_LhPprRnfjcMIh8GM7MUkUjQbla3QiJt52kRQFHae", "id": "d0df34c5-641c-483d-85d2-9e572cecbe49" } [Rivet] Connecting to ENet server: 7ffdc7f3-e3ce-4b63-a34b-15a365917c98-game.actor.6510ffa2-a144-4110-928c-f14b562326b4.rivet.run:26589 [Rivet] Authenticating with server [Rivet] Connected to server [Rivet] Peer connected: 1 [Rivet] request=lobbies.find_or_create result=ok elapsed=1478ms [Rivet] Connecting to lobby: { "id": "206a2823-9d63-48ce-ac87-9c0bd616fe3e", "version": "2025.01.03-1", "tags": { "difficulty": "hard", "map": "sandstorm" }, "region": { "slug": "atl", "name": "Atlanta", "latitude": 33.749, "longitude": -84.388 }, "createdAt": 1735910242331, "readyAt": 1735910250812, "players": 2, "maxPlayers": 32, "maxPlayersDirect": 32, "backend": { "server": { "serverId": "8fd51a8e-2a93-4e3f-ac2e-4552bea65a89", "ports": { "game": { "protocol": "udp", "internalPort": 7777, "publicHostname": "7ffdc7f3-e3ce-4b63-a34b-15a365917c98-game.actor.6510ffa2-a144-4110-928c-f14b562326b4.rivet.run", "publicPort": 26589, "routing": { "game_guard": { } } } } } } } { "token": "player_QriSm7GyWiT0EH0W9SufXHbO65TEYvabbolHq1xi", "id": "f761dac4-0aeb-4498-a2eb-6c2c1f46dc06" } [Rivet] Connecting to ENet server: 7ffdc7f3-e3ce-4b63-a34b-15a365917c98-game.actor.6510ffa2-a144-4110-928c-f14b562326b4.rivet.run:26589 [Rivet] Authenticating with server [Rivet] Connected to server [Rivet] Peer connected: 1 [Rivet] Peer connected: 2006912755 [Rivet] Peer connected: 202396784 Another issue I encountered is that both runs printed the following error: E 0:00:19:0926 process_confirm_path: Invalid packet received. Size too small. <C++ Error> Condition "p_packet_len != 6" is true. <C++ Source> modules/multiplayer/scene_cache_interface.cpp:144 @ process_confirm_path() If the example in Rivet plugin 2.3.0 is supposed to work, could you provide me with step-by-step instructions?

Did you find this page helpful?