Navigation

    Colyseus
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. amir-arad
    amir-arad

    amir-arad

    @amir-arad

    Chat Follow Unfollow
    0
    Reputation
    3
    Posts
    896
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with amir-arad
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    amir-arad Follow

    Posts made by amir-arad

    Generate json-patch events from colyseus state

    Generate json-patch events from colyseus state.
    Read the project description on npm

    usage example:

    import { wireEvents } from 'colyseus-events';
    const room: Room<GameState> = await client.joinOrCreate("game");
    const events = wireEvents(room.state, new EventEmitter());
    // `events` will emit json-patch events whenever the room state changes
    
    posted in Links & Resources •
    Gist for saving / loading game state

    usage example:

    const saveGameData = new SaveGame(); // make a custom schema for saved games data
    ... /* add all state objects from your game manager to saveGameData */
    const serialized = await schemaToString(saveGameData);
    ... /* save to file, read from file etc. */
    const loadedGameData: SaveGame = await stringToSchema(SaveGame, serialized );
    ... /* take game state object from loadedGameData into your game manager */
    

    see code in this gist

    posted in Links & Resources •
    basic chat example does not preserve order

    Hi
    I'm starting out with the basic example from
    https://github.com/gamestdio/colyseus-examples

    and it seems that the state sync does not preserve the order of the messages array

    what am i missing?

    posted in Questions & Help •