GUS - Godot Universal Serializer 1.04 Scripts 3.4 Community
Submitted by user Daylily; MIT; 2022-02-26
A Godot's universal serializer for size optimization
Feature:
1. Without losing type information. Need not type detection and
forced typce conversion in Cross end transfer,just like local parameter transfer.
2. Integer and float are variable length serialization.
3. The serialized data size is smaller than JSON text to utf8 and the native serialization method (var2bytes ()).GUS is especially suitable for the serialization of structured small dat transfer in multiplayer games.You can call GUS._test() to view the data size comparison after serialization in these three way.
How to use:
1. Modify the configuration definition constants at the beginning of the script as required.
2. Pass variable which without Object and Eid into GUS.to_bytes() and gets the serialized data for sending through any network peer.
3. After the remote network peer obtains the serialized data, passe it into GUS.to_var () to get the same variable as before serialization.
Additional: The obtained serialized data can be passed into GUS.get_ pretty_ json_text(), a beautified JSON text will be return, which is for printing and display when debugging.
Be careful:
1. The configuration definitions of cross end applications should keep the same.
2. Array and Dictionary should not contain Object or RID.
3. Because of implementing by GDScript, although the serialized data size is better, it will cost lot of time when serialization and deserialization large array(both Array and PoolArray), you should avoid to use GUS in time sensitive case.
TODO:
1. Write GUS 2.0 applicable for godot4 X .
2. Write as C++ addons to solve the problem of low efficiency of large array serialization.
View files Download Submit an issue Recent Edits