ZakBerkelaar / MyGame

A WIP multiplayer Terraria like game with a few basic features
GNU General Public License v3.0
0 stars 0 forks source link

Need a consistent way to serialize data #11

Open ZakBerkelaar opened 2 years ago

ZakBerkelaar commented 2 years ago

A consistent way is needed to serialize data for use in items, entities, tileentities (one day), etc. It should be small to serialize across the network but still easy to read. This kind of prevents strings from being used as they are larger than I would like to send. Think Minecraft NBT.

Idea: Perhaps strings could still be used but they are just hashed and sent and then when reading the same strings will be hashed and also read. This would likely be fine for 95+% of use cases where the same values will be sent and received every time but it does limit runtime data reflection. Perhaps a flag could be used to send the entire string for the rare cases where it is necessarily to inspect. However this could significantly impact debugging capabilities especially on the receiving side although I also imagine that this could be alleviated with the aforementioned flag.