Entity serialization interface

There are many ways to serialize data in both binary and textual form which can be used for storage and transmission.

There is an issue in gmod with every developer designing their own serialization mechanisms, which makes it super hard to make other addons interact with your addon in terms of data persistance.

Imagine yourself designing an inventory system like ItemStore, you’d want to pickup many items from various addons persisting their custom data (when you pickup a weapon you’d need to remember how much ammo there’s in a clip, for a money printer you’d need to remember its upgrades, for a text note you’d need to remember its author and text, etc.), but authors of all these various addons come up each with their own way of saving/restoring entity data.

This creates a huge problem, you’d need to write adapters for all addons that you want to support, even though they all do virtually the same thing, but different ways.

Facepunch could design a few interfaces (like ISerializable, IStorable, idk) or attributes that you’d need to implement or define for your entities or other objects to let everyone know how to deal with your data. This would eliminate the issue of ugly explicit adapters.

5 Likes