We need binary support for DataStores

As a Roblox developer, it is currently too hard to save data in an efficient way with binary based file specification. This happens since DataStores can only save plain-text JSON files (which also means binary values will get casted to \uXXXX)

The issue with JSON is that it has a lot of unneccessary whitespace, the JSON syntax characters; {, }, [, ], ", : and , can create a lot of whitespace that wont be present with a binary spec. (Binary has whitespace characters as well, sizeof identifiers etc. but the size impact of these are not as much as JSON’s whitespace characters

Another issue with JSON is that schemas and structs cannot be stored and will need to be declared repetitively for multiple datums of the same struct, where with a binary spec, we can create the shcema once then create a simple list of pairs for everything in that struct.

There are definitely tricks to reduce the amount of space taken up by repetitive JSON data, however they’re monotonous and that point you’d still be better off just using binary.

The only way to store binary data right now is to encode it as base64, which results, on average, a 34% size increase on the original data.

Lets take Luau bytecode, a binary format. (Standard debug setting, simple hello world script)

  • With the bytecode spec, this takes up 78 bytes
  • With a best interpretation as JSON, it will take up 322 bytes

If Roblox is able to address this issue, it would improve my development experience because I could then utilise binary based specification to reduce more space against the 4MiB byte cap.

22 Likes

Support, data usage is crucial for me to train my AI model in Roblox for testing purposes.

5 Likes

This is something I realized to, formatting the games data to JSON in my game creates tons of whitespace like you mentioned ", [], : etc. By implementing the ability to store binary data it would save so much storage. And increase the amount of buildings my players can make.

In one of my games, instead of saving my data as a table, I create a string. In the string, I’m able to use 92 characters (roblox datastores only accept 93 from the 256 utf-8 characters, and I use _ as a separator)
It would still be very useful to be able to either save to the full 256 characters or bytes directly