Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typed binary snapshot compression / delta compression #2

Merged
merged 32 commits into from
Nov 16, 2023
Merged

typed binary snapshot compression / delta compression #2

merged 32 commits into from
Nov 16, 2023

Conversation

Marak
Copy link
Contributor

@Marak Marak commented Nov 15, 2023

This PR introduces the use of protobuf.js for snapshot compression as well as enabling delta compression by default.

snapshot compression pipeline is entirely configurable, defaulting to most optimally compressed messages.

config.deltaEncoding = true;         // only sends changed states and property values
config.deltaCompression = true;      // only send differences between int values
config.protobuf = true;              // `protobuf` encoding
config.msgpack = false;              // `msgpack` encoding

Notes

  • Servers and client will still work with all options disabled
  • In local / offline mode data compression pipeline is entirely skipped.
  • protobuf is preferred over msgpack
  • msgpack means no schema requirements for your data
  • Unencoded websocket messages can always be sent as string ( client will assume non-encoded JSON string )
  • Cloudflare servers won't run run protojs code due to eval security issue fix pending
  • owner and id are both now uint32 instead of string

Adds ability to encode / decode arrays of entities
Adds ability to encode / decode entire messages
Increase size of bitmask to UInt16
Adds more tests
Increases default buffer size
Adds support for undefined enum types
Adds more action types
Use auto-id for snapshot id, not date time
Adds `name` property
`type` property is no longer sent on each request
Increases bbb default buffer size
Increases bbb bitmask buffer size
Adds support for Boolean type
Switch to UTF8String
Adds stubs for enabling WebGPU
Moves border creation to inside listening block
Updates edge server to use new int IDs
Removes `Buffer.from` for browser env
Adds method to clear all state on deltaCompression
Adds more tests for deltaCompression
Ensures deltaCompression passes through non-compressed properties
Adds guards and tests for deltaCompression init states
Adds more tests for optional fields / missing fields
Adds delta compression and float encoding to more values
Owner is now `UInt16` instead of string
Updates entity auto-id such that server is always id 0
Removes flattened structure
Updates logger syntax
Adds game message schema
Truncate BitBuffer before returning it
Improves performance of encode / decode
Updates message schema to use one level + state array
Refactors Client / Server for new message schema
Replaces supreme json compression with protobuf
Use `arraybuffer` as default web socket data type
Adds configurable `MIN_BLOCK_SIZE`
Disables auto-binding of event classes by default
Simplifies entity removal process with `destroyed` flag
Bullets are now destroyed if hit Block
Adds velocity to deltaCompression pipeline
Removes un-needed graphics calls
Refactors Float2Int for performance
Bullet plugin is not responsible for creating graphics
Adds deltaCompression to edge server
Adds protobuf and msgpack to edge server
Ensure msgpack still works in regular server
Using msgpack by default for edge server ( see code comment )
Adds `Game.tick` counter
Use `MIN_BLOCK_SIZE` in Block config
Ensure id lookup works in offline mode
Removes conditional branching logic for float encoding
@Marak Marak merged commit 2fcdca4 into master Nov 16, 2023
1 check passed
@Marak Marak deleted the bbb branch November 16, 2023 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant