Group Details Private

Global Moderators

Forum wide moderators

 
RE: 再谈 Redis Presence

您好, 请问没用proxy的时候一切正常吗?

posted in 中文
RE: Colyseus for a turn-based singleplayer game with server authority?

Hi, bralz.

  1. No, unless you modify the source yourself.
  2. Yes, Colyseus can be used for turn-based games. ex: https://github.com/colyseus/cocos-demo-tictactoe
  3. Yes, there's a buildin room "Lobby": https://docs.colyseus.io/colyseus/builtin-rooms/lobby/
  4. You need to implement it yourself.
  5. No such an out of box feature. You need to implement it yourself.
posted in Questions & Help
RE: handl error when client recconect(SOLVED)

@chaimae
Hi,
reference:

  1. https://docs.colyseus.io/colyseus/client/client/#reconnect-roomid-string-sessionid-string
    Usage - Colyseus & Arena Cloud Documentation
    Documentation for Colyseus Multiplayer Framework for Node.js
  2. https://docs.colyseus.io/colyseus/server/room/#allowreconnection-client-seconds
    Room - Colyseus & Arena Cloud Documentation
    Documentation for Colyseus Multiplayer Framework for Node.js
  3. https://github.com/colyseus/colyseus-unity3d/blob/master/Server/src/rooms/MyRoom.ts
    GitHub
    colyseus-unity-sdk/MyRoom.ts at master · colyseus/colyseus-unity-sdk

server:

async onLeave (client: Client, consented: boolean) {
  // flag client as inactive for other users
  this.state.players.get(client.sessionId).connected = false;

  try {
    if (consented) {
        throw new Error("consented leave");
    }

    // allow disconnected client to reconnect into this room until 20 seconds
    await this.allowReconnection(client, 20);

    // client returned! let's re-activate it.
    this.state.players.get(client.sessionId).connected = true;

  } catch (e) {

    // 20 seconds expired. let's remove the client.
    this.state.players.delete(client.sessionId);
  }
}

client:

    private void OnLeaveRoom(int code)
    {
        WebSocketCloseCode parsedCode = WebSocketHelpers.ParseCloseCodeEnum(code);
        LSLog.Log(string.Format("ROOM: ON LEAVE =- Reason: {0} ({1})", parsedCode, code));
        _pingThread.Abort();
        _pingThread = null;
        _room = null;

        if (parsedCode != WebSocketCloseCode.Normal && !string.IsNullOrEmpty(_lastRoomId))
        {
            JoinRoomId(_lastRoomId,null);
        }
    }
posted in Questions & Help
第一个游戏 -- 复刻 <Palamedes>

技术
Colyseus Arena Defold
0_1655203485153_bf62df2f-32a0-4ac7-a169-da6785a4903b-image.png
图片来源: 爱儿aiko
0_1655289224188_da33a159-a136-452a-94ca-cfbe768fb735-image.png
(编辑中...)

posted in 中文
好用的命令与工具 (持续更新)
  • 远程载入压力测试
    npx colyseus-loadtest --endpoint wss://your-server-domain --room my_room --numClients 100 loadtest/example.ts
posted in 中文
RE: read ECONNRESET

It looks like connection timeout caused by lots of clients at the same time. I'm asking the team what should we do if this happens.
If the number of clients is big enough, timeout errors will happen sooner or later. Try to increase the timeout value or catch errors by your code.
The server should serve how many clients at the same time is depend on your game design.
Ther sever can serve how many clients at the same time is depend on the soft and hardware.

posted in Questions & Help
RE: Reducing Binary Message Size (amazing)

I don't think you need to transfer positions of all sections of a snake -- they can be computed by both server and client side.

posted in Questions & Help
RE: Reducing Binary Message Size (amazing)

@lambrohan

OK, so I got a message about 7 Bytes per frame, that's pretty good I think.
0_1654689136053_4927b1e9-8356-4fad-b815-22540b611ed2-image.png

I'll share my test project for you and others who are insterested about it here:
https://github.com/CocosGames/bandwidth_test_colyseus_defold/tree/main/test

Cheers.

posted in Questions & Help