Building incredible multiplayer games since 2012.

hxInflate – New Open Source Haxe Serialization Library

Dan Ogles

hxInflate – New Open Source Haxe Serialization Library

 

This post contains our latest contribution to the Open Source community! Here are some other OSS tools we have released:

I’m pleased to announce our newest open-source library, hxInflate. This is a Haxe library for serializing and unserializing objects, for the purpose of storing them on disk or in a database.

Haxe comes with its own Serializer and Unserializer classes, which are adequate for many tasks. They were not powerful enough for our needs, however, so we’ve extended them to add the following features:

  1. Versioning – When you’re working on a live game or other SaaS, the data you’re storing will change over time as you add new features, but you still need to be able to read old data. This can be very tedious and error-prone, but hxInflate makes it a lot easier!
  2. Streams – Unserializer only operates on a string, which means that the entire serialized object must be in memory. This can be problematic for very large serialized object hierarchies, when you need to conserve peak memory usage. hxInflate operates on streams, so you can deflate directly from disk or the network if you wish.
  3. Customization – hxInflate allows you to control which properties get serialized on an object, and even specify multiple use-cases. This is handy when you want to serialize some properties to send to a client, and other properties to serialize to a database.
  4. Optimized data size – The Serializer data format stores class name and field names per object instance, which can bloat out the size of a serialized blob. hxInflate stores type information only once per type, which can significantly reduce the size of the serialized blob. Type information can even be stored separately and shared between multiple blobs.
  5. Fast runtime – We’ve performed some small optimizations to make serialization and unserialization faster, particularly in C# and Javascript.

You can check out the Readme file here, which gives (lots) more information on features and usage.

You can download the source code on Github, or simply install the library via Haxelib:

haxelib install hxInflate

Enjoy!

 

Dan Ogles
Chief Technical Officer

1 Comment
  1. Wow! Thanks so much 😀

Leave a Reply

On Twitter