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. KG204
K

KG204

@KG204

Chat Follow Unfollow
2
Reputation
5
Posts
2.0k
Profile views
0
Followers
0
Following
Joined 29 Jan 2019, 05:33 Last Online 2 May 2019, 02:20

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

Posts made by KG204

With the 0.10 schema release, has changing the state in the server changed?

I'm looking to update to the latest version of Colyseus, both in terms of the version and the new schema method of handling state.

The documentation has instructions on how to listen to state change for clients, and how to define the schema for state, but there isn't any documentation on modifying state in the server. Is this because the method is the same as in 0.9?

Example code:

this.state.PlayerList[client.id].AnswerPicked = true;

Schema

class TriviaState extends Schema {

constructor () {

    super();

    this.CurrentQuestion = new QuestionState();
    this.PlayerList = new ArraySchema();
}

}
type(QuestionState)(TriviaState.prototype, "CurrentQuestion");
type([PlayerState])(TriviaState.prototype, "PlayerList");

posted in Questions & Help • 19 Apr 2019, 04:50
RE: How to send message to client by client ID

@deadwind88 I think I can help with this.

You need to create an onMessage handler on your client side. Refer to this https://docs.colyseus.io/client-room/#onmessage
so lets say your server code is working fine, in the client, you'd need to extract that message.
ex: onMessage(…) {
if (message.action === "request_dule") {…}
}

posted in Questions & Help • 5 Feb 2019, 08:52
RE: Getting URL is not defined when connecting to Room

Thank you! Apologies if I thought it was colyseus related.

Its probably that but I wont be able to test for a while (computer crashed and fails to start, less than a year old, still under warranty)

And that's why unit tests should always be used. Could have caught the error. I come from a compiled background so still getting used to debugging JS

posted in Questions & Help • 29 Jan 2019, 17:22
RE: Getting URL is not defined when connecting to Room

Client Repo:
https://github.com/KG204/ff_client
Colyseus connection code is in src/application.js

Server Repo:
https://github.com/KG204/ff

Screenshot of browser:
https://imgur.com/a/9yw9haC

posted in Questions & Help • 29 Jan 2019, 05:49
Getting URL is not defined when connecting to Room

Been banging my head against this, trying to connect to a room.

When I try connecting to a Room, I get a console log in the web browser that url is not defined. However I know the server is seeing it, as onInit() in the server is called for that room.

Client Repo:
https://github.com/KG204/ff_client
Colyseus connection code is in src/application.js

Server Repo:
https://github.com/KG204/ff

Screenshot of browser:
https://imgur.com/a/9yw9haC

posted in Questions & Help • 29 Jan 2019, 05:36

© 2023 Endel Dreyer