Navigation

    Colyseus
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. emarkk
    emarkk

    emarkk

    @emarkk

    Chat Follow Unfollow
    0
    Reputation
    4
    Posts
    1420
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with emarkk
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    emarkk Follow

    Posts made by emarkk

    RE: Questions about rooms

    apparently it was due to the websocket disconnecting. it happens every time a "normal" request is sent (like performing an http get request or loading an ad). for now I am just forcing the websocket to reconnect, but maybe a simpler way exists.

    posted in Questions & Help •
    Questions about rooms

    Is it possible to join two or more rooms together? The situation is the following: all clients join room A (and should stay there the entire time, until the app is closed). Then, if a player wants to start a match, its client will enter also room B. The problem is that when I do - with colyseus-defold - room_b:leave(), this causes the client to leave room A as well. Is it the normal behaviour or is there something wrong?

    posted in Questions & Help •
    RE: @filter not working as expected

    Ok, I get it. The same goes for @nosync?

    posted in Questions & Help •
    @filter not working as expected

    My GameState has a map (MapSchema) of players (Player). Inside Player, I have a field which should be private (visible to the player and not the entire room). I am trying to use @filter, but without success.

    export class SecretSchema extends Schema {
        @type("number")
        xyz: number;
    
        @type("number")
        abc: number;
    }
    export class Player extends Schema {
        @filter(function(this: Player, client: any, value: GameMap, root: GameState) {
                console.log("filter");
                return true;
        })
        @type(SecretSchema)
        secretVar: SecretSchema;
    }
    export class GameState extends Schema {
        @type({ map: Player })
        players = new MapSchema<Player>();
    }
    

    First, I have typescript errors on @filter. It says that Player and Schema are incompatible. But apart from that, "filter" is not printed to the console and I get the whole state on all Players in the room.

    posted in Questions & Help •