Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. amir-arad
amir-arad

amir-arad

@amir-arad

Chat Follow Unfollow
0
Reputation
3
Posts
1.5k
Profile views
0
Followers
0
Following
Joined 14 Mar 2018, 08:13 Last Online 22 Jul 2022, 19:01

  • 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 • 22 Jul 2022, 19:01
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 • 22 Jul 2022, 18:58
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 • 14 Mar 2018, 08:16

© 2023 Endel Dreyer