GUS - Godot Universal Serializer

An asset by Daylily
The page banner background of a mountain and forest
GUS - Godot Universal Serializer thumbnail image
GUS - Godot Universal Serializer thumbnail image
GUS - Godot Universal Serializer thumbnail image
GUS - Godot Universal Serializer hero image

Quick Information

0 ratings
GUS - Godot Universal Serializer icon image
Daylily
GUS - Godot Universal Serializer

A Godot's universal serializer for size optimizationFeature: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.Edit history:January 21, 2022: Daylily-Zeleen - [email protected] - v1. 03In order to setting default value by string facilitatly in some special specific occasions, I made some change as below:a、Modify and add identification code for Boolean.b、Modify identification code for Boolean Array and Dictionary.For example, the default values of GUS encoded binary fields which stored in the database can be set as '[]', '{}', 'T' or 't', 'F' or 'f', which mean that empty Array, empty Dictionary, True and False .January 19, 2022: Daylily-Zeleen - [email protected] - v1. 02a、Fix empty Array deserialize error.b、Fix empty Dictionary deserialize error.c、Optimize empty pool arrays serialized size.January 19, 2022: Daylily-Zeleen - [email protected] - v1. 01a. Add type detection assert to GUS.to_bytes() for debugging purposes.b. Add 'null' and 'bool' into GUS._test().c. Add "How to use".d. Add descriptions of common methods and test methods.e. Optimize the text for push_error() when deserialize(GUS.to_var()) faild.January 18, 2022: Daylily-Zeleen - [email protected] - v1. 0

Supported Engine Version
3.4
Version String
1.03
License Version
MIT
Support Level
community
Modified Date
2 years ago
Git URL
Issue URL

GUS - Godot Universal Serializer - Godot的通用序列化器 - V1.03

README Image text

中文文档 <- 点击这里。

A Godot's universal serializer for size optimization.
Support all data types except Object and RID in Godot 3.x.

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.

Edit history:

  • January 21, 2022: Daylily-Zeleen - [email protected] - v1. 03:

    In order to setting default value by string facilitatly in some special specific occasions, I made some change as below:

    1. Modify and add identification code for Boolean.
    2. Modify identification code for Boolean Array and Dictionary.

    For example, the default values of GUS encoded binary fields which stored in the database can be set as '[]', '{}', 'T' or 't', 'F' or 'f', which mean that empty Array, empty Dictionary, True and False .

  • January 19, 2022: Daylily-Zeleen - [email protected] - v1. 02:

    1. Fix empty Array deserialize error.
    2. Fix empty Dictionary deserialize error.
    3. Optimize empty pool arrays serialized size.
  • January 19, 2022: Daylily-Zeleen - [email protected] - v1. 01:

    1. Add type detection assert to GUS.to_bytes() for debugging purposes.
    2. Add 'null' and 'bool' into GUS._test().
    3. Add "How to use".
    4. Add descriptions of common methods and test methods.
    5. Optimize the text for push_error() when deserialize(GUS.to_var()) faild.
  • January 18, 2022: Daylily-Zeleen - [email protected] - v1. 0:

    Initial submit.

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.

Edit history:
January 21, 2022: Daylily-Zeleen - [email protected] - v1. 03
In order to setting default value by string facilitatly in some special specific occasions, I made some change as below:
a、Modify and add identification code for Boolean.
b、Modify identification code for Boolean Array and Dictionary.
For example, the default values of GUS encoded binary fields which stored in the database can be set as '[]', '{}', 'T' or 't', 'F' or 'f', which mean that empty Array, empty Dictionary, True and False .

January 19, 2022: Daylily-Zeleen - [email protected] - v1. 02
a、Fix empty Array deserialize error.
b、Fix empty Dictionary deserialize error.
c、Optimize empty pool arrays serialized size.

January 19, 2022: Daylily-Zeleen - [email protected] - v1. 01
a. Add type detection assert to GUS.to_bytes() for debugging purposes.
b. Add 'null' and 'bool' into GUS._test().
c. Add "How to use".
d. Add descriptions of common methods and test methods.
e. Optimize the text for push_error() when deserialize(GUS.to_var()) faild.

January 18, 2022: Daylily-Zeleen - [email protected] - v1. 0

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
GUS - Godot Universal Serializer icon image
Daylily
GUS - Godot Universal Serializer

A Godot's universal serializer for size optimizationFeature: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.Edit history:January 21, 2022: Daylily-Zeleen - [email protected] - v1. 03In order to setting default value by string facilitatly in some special specific occasions, I made some change as below:a、Modify and add identification code for Boolean.b、Modify identification code for Boolean Array and Dictionary.For example, the default values of GUS encoded binary fields which stored in the database can be set as '[]', '{}', 'T' or 't', 'F' or 'f', which mean that empty Array, empty Dictionary, True and False .January 19, 2022: Daylily-Zeleen - [email protected] - v1. 02a、Fix empty Array deserialize error.b、Fix empty Dictionary deserialize error.c、Optimize empty pool arrays serialized size.January 19, 2022: Daylily-Zeleen - [email protected] - v1. 01a. Add type detection assert to GUS.to_bytes() for debugging purposes.b. Add 'null' and 'bool' into GUS._test().c. Add "How to use".d. Add descriptions of common methods and test methods.e. Optimize the text for push_error() when deserialize(GUS.to_var()) faild.January 18, 2022: Daylily-Zeleen - [email protected] - v1. 0

Supported Engine Version
3.4
Version String
1.03
License Version
MIT
Support Level
community
Modified Date
2 years ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers