GitHub Documentation

[Solved] Multigame in one Server Error

  • Hi all
    I face an annoy problem when run 4 game projects in 1 server.
    Let call them A in port 2000, B in port 2500, C in port 3000, D in port 3500.
    Player will join A as a Lobby for friend list and announcements, profiles ...
    Then player choose Game B, client will connect to Game B when Game A still connect. Everything fine here.
    But when leave Game B and connect to Game C (already have big room for everyone), Game C send error "room id already full" but just one player connect to this room.
    I try Create game C, its still work. But join or joinOrCreate or joinById meet the same error.

    here is the onCreate config:

        this.setState(new State());
        this.maxClients = 1024;
        this.autoDispose = false;

    I cant debug because this error from Socket library and I surely can't understand any code in that.
    Please help me, any suggest can save my project here.

  • Update:

    3 room A, B, C here. A create first, then B and the last is C.
    but when I try to join C, socket client throw error room B is full ...

    if I reset all socket and join room B, everything fine

  • Solve:
    I copy index.ts from B to C, so they have the same Room Name like this:

    and when I declare Room Name difference, the error fly away.
    Oh my :(

  • administrator

    Hi @kai_nguyenhuu, the problem here is because MongooseDriver is being used using the same database for matchmaking.

    If you specify a different database, each game should have its own matchmaking queues:

    // for game 1
    new MongooseDriver("mongodb://")
    // for game 2
    new MongooseDriver("mongodb://")
    // ...

    Hope this helps! Let me know if that works for you. Cheers!

  • Thanks endel
    But I need ro use same db for every game :D


© 2021 Lucid Sight, Inc