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. lambrohan
L

lambrohan

@lambrohan

Chat Follow Unfollow
0
Reputation
5
Posts
712
Profile views
0
Followers
0
Following
Joined 8 Jun 2022, 05:42 Last Online 9 Jun 2022, 09:27

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

Posts made by lambrohan

RE: Reducing Binary Message Size (amazing)

@coco Yep just did that refractor & got size to 6 bytes per player.

posted in Questions & Help • 9 Jun 2022, 08:17
RE: Reducing Binary Message Size (amazing)

As the players increase this size will keep on increasing. So as players increase and this snake sections increase the size will also increase. Will it be able to manage 500 concurrent players with such approach?

posted in Questions & Help • 8 Jun 2022, 16:31
RE: Reducing Binary Message Size (amazing)

Dude, you're a saviour! I'll start implementing this right away.

posted in Questions & Help • 8 Jun 2022, 12:15
RE: Reducing Binary Message Size (amazing)

@coco Thanks! Let me know if you need anything.

posted in Questions & Help • 8 Jun 2022, 09:09
Reducing Binary Message Size (amazing)

Hi, I'm building a game like Snake.io or Slither.io using colyseus & phaser.

The binary message size per message is increasing around 1Kb only with one player.
https://imgur.com/najWpxN.png

Here are the schema classes. Please help me regarding ways to improve this.

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

  @type({ map: Food })
  foodItems: MapSchema<Food> = new MapSchema<Food>();
}
export class PlayerState extends Schema {
  @type('string')
  publicAddress: string;

  @type('string')
  sessionId: string;

  @type('int16')
  x: number;

  @type('int16')
  y: number;

  @type('int16')
  score: number;

  @type('int16')
  angle: number = 0;

  @type('int8')
  snakeLength: number = 0;

  @type([SnakeSection])
  sections: ArraySchema<SnakeSection>;
export class SnakeSection extends Schema {
  constructor(x: number, y: number) {
    super();
    this.x = x;
    this.y = y;
  }

  @type('int16')
  x: number;

  @type('int16')
  y: number;

  setTo(x: number, y: number) {
    this.x = x;
    this.y = y;
  }
}

posted in Questions & Help • 8 Jun 2022, 06:02

© 2023 Endel Dreyer