Hello this is my block saving system

hello all i accidentally posted this in development discussion so this post v2 im sorry moderators pls dont delete this thx
i made this very cool very epic block saving system for my game Zombies vs Humans from scratch that i made on roblox and it saves blocks very small so you can put the builds anywhere you want
the build i save in the video saved to 5kb!!! that is so small
ok check out my video i made to show you

4 Likes

did u use serialization for this?
this looks very cool

1 Like

Really cool stuff dude…
What sort of encoding system are you using?
you can def make this go way quicker i managed to get 64k blocks moved per frame with BulkMoveTo… tho i wasnt creating new instances…

1 Like

hello potatovampire7797

the system was made with me and my brain and what little i’ve learned in the past. it uses a lot of methods i thought of myself, so i don’t know the exact names of each step. i’m not very knowledgeable about encoding and binary or whatever the heck

but in a nutshell it’s compressed in this order (sorry if this is horrible to read):

  1. since all the blocks are 4x4x4, store all positions divided by 4
  2. apply greedy meshing to all block position and store as regions (this saved the most space overall)
  3. convert all positional values to a chunk, storing a chunk number and position
    eg. with a chunk size of 16x16x16, chunk number (0, 0, 1) and chunk position (10, 0, 0) would translate to (10, 0, 16)
  4. encode the chunk number and position axes into 1 byte characters. this is done by looking up the number in a table to get a character. (eg. “ABC123”, which could translate to (1, 2, 3), (4, 5, 6)) this makes each chunk a consistent 6 characters
  5. in the encoded string each block has it’s own group and identifier assigned to it, the groups are seperated by the “|” character and it’s identifier after. so you start off by writing that
  6. chunks aren’t fully written but based off the previous chunk, only listing the changes made. in a key, each possibility for a change in a chunk is written as a string and assigned to a character (eg. the character “A” converts to “001000” which means the third character will be changed). and since you know how much characters follow, you check the next blank amount of characters and apply changes to the previous chunk, giving you a new chunk
  7. finally, using the methods from #1 and #6, each region in the string will by defined with the “/” character. the following characters will be the min and max chunks. since regions only need two positions, it only checks the following two chunks, then resets

the system is very restrictive, especially since it only stores the block type and position, but that’s because it’s specialized for my game. though i’m sure these concepts could probably be used in a more generalized way. i think it’s cool though because since the character encoding relies on a keys, you could essentially obfuscate builds by changing their keys

i also want to flex that the original size for that build without any compression was 153kb, and only 5kb after. meaning there was a 3060% decrease in size!!

also the loading is slow on purpose, i’d probably be able to load them instantly if i really focused on optimizing it

2 Likes

Thanks for showing off! It’s a really cool system and honestly, you’ve given me the idea to try to make my own version of this.

… Not sure if I should thank or curse you for that though. Guess I’ll see eventually!

2 Likes

Does it work in game, like if you were to start the game? Like maybe if you press some bottom gui it’ll load?

thats very cool. btw did you use – or know about the new “buffer” data type… i only found out about it today… it v new out of beta. Seems like it might be the only way to reduce filesize even further…

P.s. flex away that a v v respectable reduction

Also: since today is my learning day i’ve also found out about the “–!native” script attribute, which is also in beta or something. but used in conjunction with the buffer data type can considerably speed up calculations, but not placing objects…

Dunno if this is helpful but whatever… cool project

This block-saving system looks VERY GOOD! It’s great! How long did it take to make for you?