Navigation

    Colyseus
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. Rangerz132
    R

    Rangerz132

    @Rangerz132

    Chat Follow Unfollow
    0
    Reputation
    11
    Posts
    218
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

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

    Posts made by Rangerz132

    Index of item in an ArraySchema

    Hi! I'm currently facing some issues about the ArraySchema.

    To resume the situation, I have a Schema (team) which contain an ArraySchema (players). When a user click on a button he will join the team and he will be added to the ArraySchema mentionned above to become a player.

    When the user left the application, I added a function to splice the ArraySchema mentionned above at the exact index of that player. To make sure that the player is correctly removed from the ArraySchema, I added a console.log in the onRemove callback.

    Now, when a new user logging and click on the button to join the team, the player index should be the current amount of player. However, the index of the player is always increasing even if I remove multiple items from the ArraySchema. Am I missing something? Thanks :)

    Here's a little snippet to showcase the structure:

    0_1666725600869_Screenshot 2022-10-25 151945.png

    posted in Questions & Help •
    RE: Update simple schema (Solved)

    That's perfect! Thanks for the quick response!

    posted in Questions & Help •
    Update simple schema (Solved)

    Hi! I'm having issue updating a single schema. The only example I found was about MapSchema or ArraySchema. I'm trying to replicate the logic for a single schema created in the StateHandler and It does not seems to work. I'm not having any issue with the MapSchema Update and ArraySchema update... only with the single Schema. What am I doing wrong?

    0_1664905157236_Screenshot 2022-10-04 103724.png

    0_1664905165872_Screenshot 2022-10-04 103757.png

    0_1664905172956_Screenshot 2022-10-04 103844.png

    posted in Questions & Help •
    Removing an ArraySchema contained in a schema

    Hi! I have a Schema which has an ArraySchema variable and I would like to remove/delete an object contain in that ArraySchema when a player exit the room. Since this ArraySchema is part of another schema, I'm not able to do this.room.mySchema.myArraySchema.onRemove(). Is there a way to do so?

    Thanks

    posted in Questions & Help •
    RE: Update changes in a dynamically created schema (Solved)

    So I managed to find my solution. Maybe I was a bit confused but I simply had to do another onAdd() inside it. Hope it will help someone.

    this.room.state.teams.onAdd = (team, sessionId) => {
    team.onChange = (changes) => {
    changes.forEach((change) => {});
    };

    team.playerTeams.onAdd = (playerTeam, sessionId) => {
    playerTeam.onChange = (changes) => {};
    };
    };

    posted in Questions & Help •
    Update changes in a dynamically created schema (Solved)

    Hello! I'm currently working on a game and I'm facing an issue. The game is quite simple at the moment because I'm currently working on the architecture.

    Here's the logic : an user can click on a button to join a team (Green or Red). I already created a Team Schema which contain an ArraySchema of PlayerTeam.

    0_1664488742695_Screenshot 2022-09-29 144441.png

    0_1664488772292_Screenshot 2022-09-29 144540.png

    When the user click on the button. It will create a new PlayerTeam and will be push to the according Team.

    0_1664488814349_Screenshot 2022-09-29 144601.png

    0_1664489018640_Screenshot 2022-09-29 150320.png

    Since the PlayerTeam schema is dynamicly created and not created initially, I am not able to see if there have been any changes on it. In other words, I'm not able to that :

    0_1664488725987_Screenshot 2022-09-29 145834.png

    Is there a way to see if there have been any changes on the PlayerTeam schema ? Am I missing something?

    Thanks! :)

    posted in Questions & Help •
    New session overwrite current class data

    Hi! I<m currently developing a multiplayer game using Colyseus and I'm having a some issue synching data.

    My problem is that :

    I have a class PLAYER on the server which contain different data such as his position and his score which is generated on the onJoin() method from the class ROOM . I also have a class PLAYER on the client side which have the exact same properties. The client and the server are running in parallel (authoritative server) because I don't want my clients to wait. My objective is to be able to share the exact same score (which is contain in the PLAYER class) and to update it as well for all client. At the moment, if every client start at the same time, the score will be the exact same one for each session, which is what I want. However, when a new client join the room in progress, every player score and position will be reinitialized... I would like for my new client to have the exact same score and position as the previous one before he joins the room.

    How can I fix that? Thanks :)

    posted in Questions & Help •
    Multiplayer without seeing and interact with other ones (Solved)

    Hi! Is there a way to have multiple players in the same room without having any interaction between them as well as not being able to see the other players. One simple solution would be to simply add the maxClient=1 but I was wondering if there was some cleaner way to achieve that.

    Thanks!

    posted in Questions & Help •
    RE: Hosting Multiple separate game on the same server (solved)

    Thanks @COCO ! Also, while reading the documentation I noticed that there was a maximum amount of players that a server can have approximatively, however is there a maximum amount of rooms?

    posted in Questions & Help •