I designed a system to allow players to generate “codes” in a Roblox Studio plugin to import custom content into my game. These “codes” are large JSON formatted strings containing Part data. [[Size,CFrame,Color,Etc]]
The problem with this, is a TextBox | Documentation - Roblox Creator Hub cannot contain more than 16,385 characters. (This isn’t mentioned anywhere on the Wiki. That’s why I added the client-bugs tag) There is also no way to access the clipboard to extract the string in question. There is no way to input more than 16,385 characters.
Normally this isn’t a problem, but in this rare case it becomes a very big issue. (codes are generally 300K+)
I’ve looked into compression algorithms to try to fit as much as I can but a compression ratio of that magnitude is outright impossible.
I have been unable to find any workaround to this issue. If there is anything I should be aware of, please let me know in the replies!
(codes are generally 300K+) I’ve looked into compression algorithms to try to fit as much as I can but a compression ratio of that magnitude is outright impossible.
i didn’t mention that 300K was just for “A Happy Home in Robloxia”
a very simple build
EDIT: I looked at zlib, it claims it can turn ~300K into 50K characters, roughly
That’s still over 4X more than a TextBox can support, for a very simple build
I resorted to a mix of this library, and pastebin’s Http API to save and load the data
WOW that’s hacky
but at least it works! thanks for the resource!
The provided library above contains both zlib, and deflate compression.
I found deflate yeilded the best results, with astronomical compression ratios of around 80%
it’s like a magic module, anyone looking to compress text, this is your best solution.
it does come with it’s drawbacks. you can’t copy/paste the text after it is compressed, as it uses the entire set of 256 ascii characters, including control characters that are not meant to be held in the clipboard, malforming the data. The string itself can be preserved through Http api (ex. Pastebin). Datastores can’t store these “malformed characters” though, as far as I know.
-- Sorry for necroposting but I would like to warn anyone reading this that allowing users to use Pastebin API will get your place restricted by Roblox. I found this out the hard way.