RP1-Gaming / ArcMages-Old

This is a public-facing repository for https://arcmages.io and is used for issue tracking and intended to be an aid for transparency on the status of development.
1 stars 0 forks source link

Reduce bandwidth and garbage generation of the netcode to prepare for production costs & mobile networks. #5

Closed ChristianTucker closed 2 years ago

ChristianTucker commented 3 years ago

During the development process for easier debugging we utilized JSON serialization for messaging which is extremely inefficient for both bandwidth, garbage collection, and CPU cycles being spent on serialization and de-serialization time. This needs to be adjusted to utilize the Pool<MemoryBuffer> implementation on the Server and a Pool<Uint8Array> on the client.

ChristianTucker commented 3 years ago

Created a recyclable ByteBuffer implementation that included use-case specific optimizations such as bitpacking. Started implementing manual serialization for each NetworkMessage and implementing bitmasks to limit bandwidth consumption.

ChristianTucker commented 3 years ago

Upgraded the used SocketServer from websocket-sharp to a much more performance oriented implementation WebSocketListener and finished serializing most messages. State replication is currently automated for all networked entities, more testing will be needed once we update the client to make use of UInt8Array and implement serialization/deserialization there.

ChristianTucker commented 2 years ago

Bandwidth optimizations have been completed using serialization through the Apache Avro framework.