Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 21:26
    endel synchronize #357
  • 21:26

    endel on dev

    :nail_care: closes #173 (compare)

  • 19:43
    DimosthenisK closed #368
  • 19:43
    DimosthenisK commented #368
  • 19:09
    DimosthenisK commented #368
  • 19:06
    endel commented #368
  • 19:03
    DimosthenisK commented #368
  • 18:58
    endel commented #368
  • 15:20
    DimosthenisK opened #368
  • Oct 18 01:01
    endel synchronize #357
  • Oct 18 01:01

    endel on dev

    update patreon badge url expose broadcastPatch() method … (compare)

  • Oct 15 19:14

    endel on 0.14

    update patreon badge update colyseus.js to v0.14 (compare)

  • Oct 15 18:09
    endel synchronize #36
  • Oct 15 18:09

    endel on dev

    update patreon badge (compare)

  • Oct 15 18:09
    endel synchronize #126
  • Oct 15 18:09

    endel on dev

    update patreon badge (compare)

  • Oct 15 18:08
    endel synchronize #76
  • Oct 15 18:08

    endel on dev

    update patreon badge (compare)

  • Oct 15 17:53
    endel synchronize #357
  • Oct 15 17:53

    endel on dev

    update patreon supporters (compare)

Kyle J. Kemp
@seiyria
@Loonride ideally if each server is hosted in the same region the ping should be of a negligible difference.
Lightning K0ala 🐨⚡
@LightningK0ala_twitter
@seiyria Thanks for that tip, I'll try it out later when I get the chance and report back.
Loonride
@Loonride
I got RedisPresence working using the single server cluster method. However, when I tried to do the same with the MemsharedPresence, the server worked, but I was never able to connect to the room (it just sits there, I don't get any onJoin, onLeave, or onError events for the room, and no leave or error events from the server). Any suggestions?
aloani20
@aloani20
hi . guys . has anyone face problem with colyseus typescript version connecting to through unity client.
I have javascript colyesus game server version which works . even i upgraded to latest versions of . colyseus server and . unity client. but when i wrote my server in typescript i couldn't connect . to the server .
aloani20
@aloani20
i troubleshoot the issue if from . browser go to http://localhost:2567/colyseus/#/ . it . work . but when it comes to joining the room it is rejected. i used some socket debugging tools which could not connect to . the . server.
aloani20
@aloani20
sorry . guys for the . rush i am in. I found the issue was using wrong ports.
problem solved.
Loonride
@Loonride
@endel do you know why my MemsharedPresence might not be working like I mentioned above?
Kyle J. Kemp
@seiyria
@Loonride if you have code to share that will help
OYΞD
@oyed

Getting some strange behaviour trying to make my onLeave asynchronous - I'm just using a standard Promise to test things server-side:

onLeave(client) {
    return new Promise((resolve, reject) => {
        setTimeout(() => resolve(), 2000);
    });
}

Which works and executes fine, however client-side, the onLeave event for the Room is fired immediately and doesn't wait (Whether that means the Room is sending the leave event or the Client is just immediately executing the handler, I don't know)

Client-side:

this.room.onLeave.addOnce(() => {
    console.log('x');
});
this.room.leave();

Probably a stupid mistake on my end - let me know what you think @endel @seiyria

OYΞD
@oyed
To add - when shutting down the server, it'll wait for the onLeave promise before closing, whereas if the Client leaves the room, the Server executed onLeave properly but the Client doesn't wait for that before closing the connection
Kyle J. Kemp
@seiyria
that I'm not sure about @oyed
OYΞD
@oyed
Damn, alright, thanks @seiyria - I'm not sure what the issue could be, I've checked a tree view of the executed code in that timeframe client-side, and it really it just calling room.leave() followed by an almost immediate closed connection
OYΞD
@oyed
https://github.com/gamestdio/colyseus.js/blob/master/src/Room.ts#L61
Just to confirm, it isn't this check causing onLeave to fire immediately - I've checked - it sends the packet to the server
OYΞD
@oyed

@oyed I see, sure, you can use async onLeave() on the server-side, and the client-side will receive the "onLeave" event only after it's fully completed

^ From @endel, just wanted to make sure I wasn't crazy and at some point this did work :P

Loonride
@Loonride
@seiyria this was the issue I was having gamestdio/colyseus#201
Lightning K0ala 🐨⚡
@LightningK0ala_twitter
@oyed I haven't checked onLeave but I had a similar problem with onDispose which I fixed in this PR: gamestdio/colyseus#198. Might be worth looking if the fix is somewhat related. I'll try replicating your issue later and let you know if I find anything.
Endel Dreyer
@endel

@oyed the server actually closes the websocket immediately when LEAVE_ROOM is received, and the async onLeave() is performed, well, asynchronously :sweat_smile:

I believe it would make sense to wait for the promise to fulfil before closing the connection, right? If the application persists some user data during async onLeave(), and the user joins another room in the meantime, he would have outdated info on the other room

OYΞD
@oyed
@endel @LightningK0ala_twitter I believe at some point this was the behaviour (As you can see from the quote I found from @endel last November), I also remember it working in my previous project (I unfortunately can't go back and double-check), but yes I think it does make sense, especially for the given use-case:
  • User is in Room A
  • User called leave() on Room A
  • Room A persists user data and then tells User they have left
  • User receives the onLeave and can then join Room B
  • Room B fetches persisted data
OYΞD
@oyed
@endel - opened an issue for this, I'm guessing instead of room.leave() closing the connection client-side, it should send a protocol event which the server should listen for instead of client.once('close
Endel Dreyer
@endel
thanks @oyed! :heart: I'll fix this soon, I think this never actually worked as expected, I sent you the right instructions but the actual behaviour was not correct
OYΞD
@oyed
Thanks :)
Loonride
@Loonride
Hey could anyone suggest how I can improve my client interpolation code: https://gist.github.com/Loonride/2f76d04fbdd8c926c6b3f0993bb9e275 , it's something I'm struggling with. It works ok, but is a bit choppy at times. I would rather it be a bit more smooth at the cost of being slightly behind the most recent state info. Does anyone know of any libraries that can do this for me?
Endel Dreyer
@endel
thanks for sharing @Loonride, I personally don't have much experience on client interpolation, what I usually do is lerping the current value with the latest one from the server, it's not perfect but has a reasonable result:
function lerp(a: number, b: number, t: number) {
  return (b - a) * t + a;
}

// on every tick
entity.x = lerp(entity.x, entityPositionInTheServer.x, 0.2);
entity.y = lerp(entity.y, entityPositionInTheServer.y, 0.2);
OYΞD
@oyed
@endel Any reason why the colyseusid wouldn't get set client-side?
Tao Pan
@pantaovay
colyseus:errors trying to send event ("147,13,170,57,95,105,68,49,53,109,68,77,55,129,162,105,100,181,67,111,109,109,111,110,82,111,111,109,80,108,97,121,101,114,82,101,97,100,121") to non-existing remote client (null) +867ms
@endel
image.png
There is a client on Room that has no sessionId
Weird
Endel Dreyer
@endel
@pantaovay weird indeed! let me know if you figure out the scenario where this happened :scream:
Tao Pan
@pantaovay
After searching for a day, I didn't find out either....
That's terrible...
Heartbreak
Endel Dreyer
@endel
@pantaovay is it happening often? do you mind sharing your project with me so I can investigate?
Tao Pan
@pantaovay
Yes. It happens in multi-process mode with memshared
Endel Dreyer
@endel
@pantaovay created here for tracking gamestdio/colyseus#205
Tao Pan
@pantaovay
room disposed: i9gvO2Rdc0
(node:20223) UnhandledPromiseRejectionWarning: Error: remote room (i9gvO2Rdc0) timed out, requesting "_emitOnClient with args ["zEA70eTF5","close",1005]"
at Timeout.setTimeout (/data/code/node-game-server/node_modules/colyseus/lib/MatchMaker.js:160:32)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
(node:20223) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:20216) UnhandledPromiseRejectionWarning: Error: remote room (i9gvO2Rdc0) timed out, requesting "_emitOnClient with args ["hVFYSL4cL","close",1005]"
at Timeout.setTimeout (/data/code/node-game-server/node_modules/colyseus/lib/MatchMaker.js:160:32)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10)
(node:20216) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
OYΞD
@oyed
Quick question; how do you guys handle/plan to handle latency due to location? E.g. have Server A in Northern America, Server B in central Europe and let the user choose
Loonride
@Loonride
Are there cases where the server.onError event is fired on the client, but the connection with the room is not lost?
Loonride
@Loonride
@endel It seems if I have memshared presence and a room on every process returns false for requestJoin, then a new room wont be made on the same process as an existing room? Is this the case? If so, how do I let two rooms exist on the same process within memshared?
I'm getting this, and I believe it is because each process already has a room and all are returning false - server error: remote room (v8rFRuB5gQW) timed out, requesting "hasReachedMaxClients"
Endel Dreyer
@endel
@Loonride sounds bad, hard to say what's the reason for this. do you mind sharing your project privately with me, so I can inspect? if it's public on GitHub even better
jestarray
@jestarray
ello there
new to programming the multiplayer end of games but i have a niche question
arch.PNG
how do you guys architect your game & server ? i saw someone have the client(browser-side) and the server side both contain their own dependencies, having their own node_modules and webpack configs
Endel Dreyer
@endel
hey @jestarray, nothing stops you from having both client & server together, sometimes it's better to separate for deployment purposes, it really depends on your needs.
jestarray
@jestarray
thanks!