Group Details Private

administrators

 

Member List

RE: Issue with phaser tutorial

Hi @kayyos, please make sure to run the same version on the server and client, they both should be either 0.14 or 0.15.

Currently 0.15 is on preview, so you can fix this by installing 0.15@preview on the client-side:

npm install colyseus.js@preview --save

Hope this helps, cheers!

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

hey @Rangerz132, welcome!

onAdd is only called for "collections" of items, you could attach the onChange callback directly on it:

this.room.state.mole.onChange = (changes) => {};

Alternatively, I'd suggest using .listen() instead:

this.room.state.mole.listen("x", (value) => {})
this.room.state.mole.listen("y", (value) => {})
posted in Questions & Help
RE: Order trigger event when schema changed (solved)

hey, we've answered this on Discord (link): the order callbacks are triggered matches the order fields are defined on the schema

posted in Questions & Help
RE: Filter data

Hi @chaimae, can you describe your real-world scenario on why you need filters?

The filters are experimental and currently consume way too much CPU, I wouldn't recommend for production scenario with many clients.

See docs: https://docs.colyseus.io/colyseus/state/schema/#filtering-data-per-client

posted in Questions & Help
RE: Unexpected EncodeSchemaError and hard to find where tis the problem(solved)

HI @Alan-Jin, by the error message it seems like you're trying to add an Array item into the Array of players instead of a Player instance. The error is going to be thrown only at the next patch, that's why wrapping try/catch during assignments/pushes it doesn't catch it.

I suggest inspecting what's being added to the array.

if (item instanceof Player) {
  console.log("good!")
} else {
  console.log("will throw an error during encoding!")
}

Hope this helps, cheers!

posted in Questions & Help
RE: Bad gateway

Hey @chaimae, I'm in contact with the Arena team to check what's going on with your deployment 🤞 will get back to you soon, sorry for the inconvenience

posted in Questions & Help
RE: Bad gateway

Hey @chaimae, what's the server URL you're connecting to? We only found a indie plan with your username/email. Cheers!

posted in Questions & Help
RE: State not updating in nested object

Hi @arturspon,

Do you possibly re-use Schema instances? Depending on how the schema instance is being moved around (or re-used) within the state, the client-side callback may not trigger the way you expected, unfortunately. If you can provide a minimal reproduction example with your scenario it could help us understand the specific issue you're having.

You could potentially use spot.clone() to make sure a new object is created when sharing the instance is necessary

Hope this helps, cheers!

posted in Questions & Help
RE: Colyseus Server Freezes On Error(solved)

Hi Mitch,

I've never seen this issue being reported, could you share more details about the environment you're running in?

E.g. are you using Windows? which Node.js version? How do you spawn the process? If you can provide a way we can reproduce would also be nice. Thanks

posted in Questions & Help
RE: Smooth Interpolated Movement

Hi @MackeyK24, in the past I've made a simple demonstration of using linear interpolation using PixiJS here: https://github.com/endel/colyseus-pixijs-boilerplate/blob/53b490375f2ce065a880ffc1c87ca9fdee40dbf6/src/client/Application.ts#L119-L123

On this approach, the client-side is interpolating every entity's position towards the latest data available from the server at every frame. No action is being taken at the exact time the update came from the server but at every frame.

Hope this helps, let me know if that works for you

posted in Questions & Help