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. kai_nguyenhuu
  3. Posts
  • Profile
  • More
    • Continue chat with kai_nguyenhuu
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

Posts made by kai_nguyenhuu

RE: [Solved] Multigame in one Server Error

Thanks endel
But I need ro use same db for every game :D

posted in Questions & Help • 10 Nov 2020, 09:20
RE: [Solved] Multigame in one Server Error

Solve:
I copy index.ts from B to C, so they have the same Room Name like this:
0_1604968937047_0897ab6a-a504-4590-915b-602e343ee433-image.png

and when I declare Room Name difference, the error fly away.
Oh my :(

posted in Questions & Help • 10 Nov 2020, 00:44
RE: [Solved] Multigame in one Server Error

Update:
0_1604942458102_83dea62d-f514-4420-8932-5d1359bcd490-image.png

3 room A, B, C here. A create first, then B and the last is C.
but when I try to join C, socket client throw error room B is full ...
0_1604942650987_e9534f27-1d6b-4e36-8b46-1b22e99b5e38-image.png
0_1604942675563_77b4e0f7-dd99-4648-9175-a3fefb9fe3e2-image.png

if I reset all socket and join room B, everything fine
0_1604943014676_ac62d830-4ef5-4a49-bb2d-e5799c340ce6-image.png

posted in Questions & Help • 9 Nov 2020, 17:26
[Solved] Multigame in one Server Error

Hi all
I face an annoy problem when run 4 game projects in 1 server.
Let call them A in port 2000, B in port 2500, C in port 3000, D in port 3500.
Player will join A as a Lobby for friend list and announcements, profiles ...
Then player choose Game B, client will connect to Game B when Game A still connect. Everything fine here.
But when leave Game B and connect to Game C (already have big room for everyone), Game C send error "room id already full" but just one player connect to this room.
I try Create game C, its still work. But join or joinOrCreate or joinById meet the same error.

here is the onCreate config:

    this.setState(new State());
    this.maxClients = 1024;
    this.autoDispose = false;
    this.setSeatReservationTime(60); 

I cant debug because this error from Socket library and I surely can't understand any code in that.
Please help me, any suggest can save my project here.

posted in Questions & Help • 9 Nov 2020, 09:39
RE: ArraySchema unshift error

thanks, I will try it later

posted in Questions & Help • 31 Oct 2020, 03:17
ArraySchema unshift error

0_1604110301465_ab5b2bce-edd4-4614-b615-9925471818cf-image.png
0_1604110333558_98f6e26a-3ea7-496a-abd7-bc6de6268ad6-image.png
Hi, error appear when I use unshift, please check it out :D

posted in Questions & Help • 31 Oct 2020, 02:14
Convert Array of Client to Object of Client

Hi,
I have an issue about find specific client for sending message. Now this.clients return an array of objects and think about 500 players seperate to 100 group need to private chat each other.
Fastest Solution for this ChatBox is save Client Object to each Player and use this to send.
But I think this is the course of Client leave room but the Web Socket not disconnect in https://github.com/colyseus/colyseus/issues/361
If I loop in the array of 500 client to find correct clients ID and send each message (1s/mess), this will be a nightmare for game performance.
It would be easier if Room can get specific client with id and send it with this.clients[id].send

posted in Questions & Help • 20 Oct 2020, 07:56
RE: UNITY WEBGL Always Fail with 0.14

Thank you, I will check it out

posted in Questions & Help • 24 Sept 2020, 07:08
RE: UNITY WEBGL Always Fail with 0.14

@endel Wait, you mean type string with value "123456" as a key of MapSchema is a number ??? Really @@
So what about "P123456" :-? is this string ?

posted in Questions & Help • 17 Sept 2020, 16:28
RE: UNITY WEBGL Always Fail with 0.14

@endel said in UNITY WEBGL Always Fail with 0.14:

Indeed Unity WebGL builds are a disaster I can't do anything about.

Thank you for your reply
I am using 0.14 alpha and build Development Version for displaying errors and I see this out of bound memory, you can try these settings.
here is the full log:

e6296834-adc2-4891-bead-9fec51d1e47d:16501 Uncaught RuntimeError: memory access out of bounds
    at __ZN16VirtFuncInvoker0IP6Type_tE6InvokeEjP12Il2CppObject (<anonymous>:wasm-function[14275]:0x49f68f)
    at _LightLambda_MakeRunDelegateCtor_m34176183E3A928A397721E889331C32DF9C556C1 (<anonymous>:wasm-function[29012]:0x6ff302)
    at dynCall_iii (<anonymous>:wasm-function[38913]:0x8a8460)
    at Object.dynCall_iii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:23532:38)
    at invoke_iii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:15478:31)
    at _LightLambda_GetRunDelegateCtor_m802F474EE5F98CB221B2E24609A743536CFF4517 (<anonymous>:wasm-function[29010]:0x6fe6f9)
    at _LightLambda_MakeDelegate_m5BF4647527466A602E0339000CBE3382BB98B4C0 (<anonymous>:wasm-function[29009]:0x6fe518)
    at _LightDelegateCreator_CreateDelegate_mAD897B269ED0186D1E2CEA54BFBD550375E072F6 (<anonymous>:wasm-function[29007]:0x6fe4aa)
    at _LightDelegateCreator_CreateDelegate_m1B6E2A2E3D20D75EB586A04B9F248208272329CC (<anonymous>:wasm-function[29006]:0x6fe459)
    at _Expression_1_Compile_m5F2BD4EE3DA1F051DDD2D1CF6B3467390FE06A39_gshared (<anonymous>:wasm-function[32776]:0x7a1b61)
    at _Expression_1_Compile_mFE50C0A6E0A4094C260C663865AE2998F8D3EC9C_gshared (<anonymous>:wasm-function[32775]:0x7a1b17)
    at _CallSite_1_CreateCustomNoMatchDelegate_m6BCC989CF45D9202768E2EBB6CA15472929099AB_gshared (<anonymous>:wasm-function[30404]:0x72d768)
    at _CallSite_1_MakeUpdateDelegate_mA3D780010BF746743A550D06DA68B526AFC2A149_gshared (<anonymous>:wasm-function[30401]:0x72c6b5)
    at _CallSite_1_GetUpdateDelegate_m79CA328C2441772AC6F7F926AABEE80EB325C34E_gshared (<anonymous>:wasm-function[30398]:0x72c4ef)
    at _CallSite_1_GetUpdateDelegate_m075943FBD03182D985E9B8AD853B54A93ABA7BB9_gshared (<anonymous>:wasm-function[30397]:0x72c4c1)
    at _CallSite_1__ctor_m016244378ECCDAD6C12C5EC311197593644F1AC9_gshared (<anonymous>:wasm-function[30393]:0x72c2f0)
    at _CallSite_1_Create_m8BA8F1719AEF3E1526C60C38C28E5F6F76B3D999_gshared (<anonymous>:wasm-function[30396]:0x72c460)
    at __Z59CallSite_1_Create_mCEA53BA1AA06CD5A94B6449183437E1FEF57C227P56CallSiteBinder_t76CF754DF48E3820B386E9C71F8DA13FCDD1C889PK10MethodInfo (<anonymous>:wasm-function[16971]:0x50b390)
    at _Schema_set_Item_m9192F2FB40E7BBE7186D57186BCE707E0FE74B61 (<anonymous>:wasm-function[16992]:0x50ba29)
    at _Schema_Decode_mED0B69A23A445801376C5C7F8753354B5A0C8621 (<anonymous>:wasm-function[16994]:0x50c5c5)
    at _SchemaSerializer_1_Handshake_m16C78A6FED561D75AF0BF3059425DD045953D6EE_gshared (<anonymous>:wasm-function[25201]:0x6682ec)
    at __ZN23InterfaceActionInvoker2IP12Il2CppObjectS1_E6InvokeEjP11Il2CppClassS1_S1_S1_ (<anonymous>:wasm-function[16556]:0x4f501a)
    at dynCall_viiiii (<anonymous>:wasm-function[39016]:0x8a8f11)
    at Object.dynCall_viiiii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:24047:41)
    at invoke_viiiii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:16508:27)
    at _U3CParseMessageU3Ed__37_MoveNext_m961408E7C092E417F72BF3DDE3409B849D3FED26_gshared (<anonymous>:wasm-function[25082]:0x661e49)
    at __ZN23InterfaceActionInvoker06InvokeEjP11Il2CppClassP12Il2CppObject (<anonymous>:wasm-function[14281]:0x49fa38)
    at dynCall_viii (<anonymous>:wasm-function[39012]:0x8a8eaf)
    at Object.dynCall_viii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:24027:39)
    at invoke_viii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:16468:25)
    at _AsyncVoidMethodBuilder_Start_TisRuntimeObject_m8590BDB280C38FD9D41163DF39805FFA6EA8F508_gshared (<anonymous>:wasm-function[20974]:0x597c73)
    at __Z139AsyncVoidMethodBuilder_Start_TisU3CParseMessageU3Ed__37_tD1CFFCBA0DEE11C960CC79E46042EA00C0374AB2_m49937871A6FFD69FA0DD71EEC151C468CF0E6E50P64AsyncVoidMethodBuilder_t44E3C9B52B019BB5BDCC0E1BB83188B536161CFFPP65U3CParseMessageU3Ed__37_tD1CFFCBA0DEE11C960CC79E46042EA00C0374AB2PK10MethodInfo (<anonymous>:wasm-function[25122]:0x665174)
    at _Room_1_ParseMessage_m652746ACA553F31780383C8DBC1D3D6CFB594C95_gshared (<anonymous>:wasm-function[25119]:0x665120)
    at _Room_1_U3CSetConnectionU3Eb__25_2_m32611B5D6169915CABD3BC495839932E92702EF8_gshared (<anonymous>:wasm-function[25127]:0x6652c1)
    at _OnChangeEventHandler_Invoke_m03FBDEEBF2D4821CC9EA1180A8CB8606CC0DE738 (<anonymous>:wasm-function[16958]:0x50a90b)
    at _WebSocket_DelegateOnMessageEvent_mF14DAEE5729B03D82FAB1C330E25C2AB445DB6CB (<anonymous>:wasm-function[22958]:0x5f6c90)
    at _WebSocketFactory_DelegateOnMessageEvent_m557BCF08A8C8CD3E0BE9FE4517E13B5E14162D83 (<anonymous>:wasm-function[22969]:0x5f710a)
    at dynCall_viiii (<anonymous>:wasm-function[39015]:0x8a8ef6)
    at Object.dynCall_viiii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:24042:40)
    at invoke_viiii (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:16498:26)
    at _ReversePInvokeWrapper_WebSocketFactory_DelegateOnMessageEvent_m557BCF08A8C8CD3E0BE9FE4517E13B5E14162D83 (<anonymous>:wasm-function[22968]:0x5f700c)
    at dynCall_viii (<anonymous>:wasm-function[39012]:0x8a8eaf)
    at blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:24027:39
    at Object.dynCall (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:366:35)
    at WebSocket.<anonymous> (blob:https://socket.website.com/e6296834-adc2-4891-bead-9fec51d1e47d:3685:13)

about the bufffer, I will try not to connect to the room and check the heap memory again :D

btw, every still good in 0.13 version, except the map schema ^_^ 0.14 every thing work ok on vuejs but fail in WEBGL now :(

posted in Questions & Help • 17 Sept 2020, 16:17
RE: UNITY WEBGL Always Fail with 0.14

0_1600357762621_40f3a028-d3f6-488e-a706-15e28f346c3b-image.png

71mb for ArrayBufferData in empty schema
Its really a big deal :(

posted in Questions & Help • 17 Sept 2020, 15:48
UNITY WEBGL Always Fail with 0.14

0_1600346515458_8cf4b02b-c84a-4051-921a-0c3bb5c55ae1-image.png

I create an whole new Project with Colyseus 0.14 use Schema, and Unity 3D use 0.14 plugin.
The clean build of WEBGL always return memory access out of bound :(
Is there any solutions for this ?

posted in Questions & Help • 17 Sept 2020, 12:43
RE: Wrong Key update in Map schema

@endel
After upgrade to alpha, now the room.state return null, then I cant call back the onChange event :(

0_1600266105634_bdfa16ad-c79f-4683-a2fd-58e4715fe5f0-image.png

posted in Questions & Help • 16 Sept 2020, 14:20
Wrong Key update in Map schema

Hi
I am using Colyseus for my multiplayer game. But there is a problem when I try to connect between 2 client in localhost:

  1. Client User Info look like:
import { Room, Client } from "colyseus";
import { Schema, type, MapSchema } from "@colyseus/schema";


export class UserInfo extends Schema 
{
  @type("string")
  ID:string;
  @type("string")
  Email:string;

  @type("number")
  Balance:number;
  @type("number")
  Gold:number;
}

export class UserInfo_State extends Schema 
{
  @type({ map: UserInfo })
  players = new MapSchema<UserInfo>();
}

export class MyRoom extends Room {

  onCreate (options: any) {
    this.setState(new UserInfo_State());

    this.onMessage("Change", (client, message) => {
      console.log(message);
      this.state.players[message].Balance += 100;
    });
  }

  onJoin (client: Client, options: any) {

    console.log(options.ID);
    this.state.players[options.ID] = new UserInfo;
    this.state.players[options.ID].ID = options.ID;
    this.state.players[options.ID].Balance = 100;
    console.log(this.state.players[options.ID]);

    client.send('LoginSuccess');
  }

  onLeave (client: Client, consented: boolean) {
  }

  onDispose() {
  }

}
  1. Game Client look like:
import { Room, Client } from "colyseus";

export class MyRoom extends Room {

  onCreate (options: any) {

    this.onMessage("buy_new_egg", (client, message) => {
      console.log(message.ID);
      Lobby.send("Change", message.ID);
      client.send("BuySuccess", ["EGG"]);
    });

  }

  onJoin (client: Client, options: any) {
    console.log(options.ID);
    client.send('LoginSuccess');
  }

  onLeave (client: Client, consented: boolean) {
  }

  onDispose() {
  }

}


/////////////////////////////
//// Join Lobby for data ////
/////////////////////////////
import * as Colyseus from "colyseus.js";
let client = new Colyseus.Client("ws://localhost:3333");
var Lobby:any;
client.joinOrCreate("lobby", {ID: "0"}).then((room:any) => 
{
  Lobby = room;
  room.state.players.onChange = (player:any, key:string) => {
    console.log("Onchange outside", key, player.Balance)
  };
})
  1. Step look like:
  • 1st player connect.
  • 2nd player connect.
  • 1st player send the signal change the balance to Game Client
  • Game Client send signal to Info Client for update data
  • Info Client Update data with map schema

Problem is:
0_1600263081848_3584c5d1-917a-4709-9930-363cc7695e9e-image.png
149847 is 1st player send signal and 700591 is 2nd player change data.

I dont know why, can someone explain and help me a solution?
Many thanks

posted in Questions & Help • 16 Sept 2020, 13:32

© 2023 Endel Dreyer