GitHub Documentation Patreon donate button

[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;
        this.setSeatReservationTime(60); 
    

    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:
    0_1604942458102_83dea62d-f514-4420-8932-5d1359bcd490-image.png

    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 ...
    0_1604942650987_e9534f27-1d6b-4e36-8b46-1b22e99b5e38-image.png
    0_1604942675563_77b4e0f7-dd99-4648-9175-a3fefb9fe3e2-image.png

    if I reset all socket and join room B, everything fine
    0_1604943014676_ac62d830-4ef5-4a49-bb2d-e5799c340ce6-image.png



  • Solve:
    I copy index.ts from B to C, so they have the same Room Name like this:
    0_1604968937047_0897ab6a-a504-4590-915b-602e343ee433-image.png

    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://127.0.0.1:27017/game1")
    
    // for game 2
    new MongooseDriver("mongodb://127.0.0.1:27017/game2")
    
    // ...
    

    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


 

© 2020 Endel Dreyer