Skip to content

ENS v0.8 Major Update - Custom Serialization.

Compare
Choose a tag to compare
@AncientEntity AncientEntity released this 02 Sep 21:22
· 25 commits to master since this release
5b93b04

If you are using a older version I highly recommend you update.

Serialization
This is a fairly big and important update, it makes ENS much faster at sending messages. Instead of using the BinaryFormatter and some JSON Formatting I have gotten rid of as much of it as possible, creating custom serializers when possible. This has brought down message sizes incredibly. (Example: The binary formatter used 28 bytes of overhead to serialize an empty byte array)

Before this update a simple packet could be anywhere between 400 to 800 bytes. It isn't the worst but clearly when transmitting a ton of information it can become a problem. Now afterwards a message can be as low as 30 bytes. Even 30 bytes could be considered a high amount, however since I want this to be a general library it needs to know certain information.

Through the use of creating custom serializers I have reduced the overhead of the serialization almost down to zero. Not everything has one but everything ENS handles does, so RPCs, NetworkFields, etc all have custom serializers that bring the message size down. However if a developer still wants to use an Object that doesn't have a custom serializer they can, ENS will just convert it into JSON or use the BinaryFormatter depending on the situation. This adds overhead however in the future i'd like it so the developer can easily 'register' serializers for non supported Objects.

UnityPacketHandler (UPH)
I took a few minutes to improve the handler. Before hand every X packets the UPH would yield for an update. Now instead the amount of packets per yield changes depending on how many are in queue. Think of how a CPU's clock speed changes depending on the load on the CPU.