Easy Matchmaking
Rocket Networking comes equipped with a very easy to use matchmaking system.
Credit for this idea goes to @nils0445 on discord!
What is a match? In terms of Rocket Networking, it is an RNet room right? Because players/clients in that RNet room will be able to "see" each other.
So matchmaking is just the problem of taking players/clients from some lobby (which is also a RNet room), pair them up or make a set of them and put them in this "match" RNet room. And every "match" must be a different RNet room.
Auto Matchmaking System
If a client wants to be in the matchmaking lobby waiting, all they have to do is ChangeRoom()
to the room name "auto_matchmake_<size>"
, where size is the number of players that should be in your match.
For example ChangeRoom("auto_matchmake_2")
Every 10 seconds, all the players in the room "auto_matchmake_2" will be paired up and put into some other rooms called "auto_match_<someuniqueidentifier>"
like "auto_match_Lb5vJ8"
and so on.
So if there are 7 players waiting in room "auto_matchmake_2"
, then 3 pairs will be created and put into 3 different rooms like "auto_match_7BjvM7"
, "auto_match_vmdk8"
, "auto_match_osm4m"
, and 1 player will not be matched(because there is no one to match this player with) and will stay in waiting.
You can do this for a match of any size.
Last updated