GitHub Documentation Patreon donate button

Question about joinOrCreate matchmaking algorithm



  • Hello, I'm completely new to Colyseus.
    I want to confirm that my understanding about matchmaking is correct, and if something is wrong, I want someone to correct me.

    On the serverside, a room and a handler is associated by a unique room name (game -> GameRoomHandler). In other words, multiple "game" rooms can exist.
    However, in order to avoid matchmaking ambiguity (I mean not being able to decide which room to join by join or joinOrCreate), "game" rooms with exactly same options cannot exist.
    When Colyseus server filters a room to join, it does the following... Is this correct?

    • reads the room name first
    • shallow or deep- compares room options
    • finds a single room that the options exactly match

    As the next question, if the above is true, why can I add room options to joinById? The room to join should already be unique since we specify room ID. I'm really confused about this. Shouldn't "room options" be just "room options"?

    For example, assume we want to allow each player to set their nickname. What do you think is the best practice for this library? Room messaging? Room options? OnAuth?



  • I found the algorithm explained at
    https://docs.colyseus.io/server/api/
    . The filter may return multiple rooms, and when that happens, the server sorts the rooms using sortBy settings and selects which one to join.


 

© 2020 Endel Dreyer