Compress / Optimize Datastore - Roblox Scripting Tutorial

Discord: / discord
Patreon: / suphi
Donate: www.roblox.com/games/7532473490
developer.roblox.com/en-us/ar...
00:00 - Intro
00:53 - Spawn parts
01:36 - Datastore data
03:18 - Analyse data
06:24 - Compress / Optimize data
15:17 - Number bases
20:11 - ModuleScript
42:43 - Overview
47:16 - Outro

Пікірлер: 85

  • @Joshlarios
    @Joshlarios2 жыл бұрын

    I like how you are different from other yt devs, you actually explain like a real teacher with a high IQ. *Believe it or not you are actually doing a really good work, keep it like that!*

  • @5uphi

    @5uphi

    2 жыл бұрын

    Thank you

  • @RayZin

    @RayZin

    Жыл бұрын

    Fr, they just say shit and avoid explaining it 💀

  • @robocu4
    @robocu4 Жыл бұрын

    I have to tell you, as someone who has been on the platform for a very long time and already considers themselves an entirely competent developer, I still stand to gain something from EVERY one of your uploads. Your clarity is unmatched, you do not miss. You'll definitely be one of the resources I recommend to newer developers I meet going forward. Now, if you could upload a tutorial demonstrating use-cases for Actors and thread desyncs, you'd rlly make a difference in my understanding because I don't get how to implement it

  • @robocu4

    @robocu4

    Жыл бұрын

    update: after watching Infinite Scripter tutorial I think I have a much better conceptual grasp on the point of desynchronization

  • @koneeche
    @koneeche Жыл бұрын

    You are, quite possibly, the most in-depth and concise guide I've ever seen on this topic. Keep up the good work! Thanks for the help.

  • @Sand.
    @Sand. Жыл бұрын

    man i love your content, its explained so well that i think i could do this from memory. like i just watched this tutorial start to finish for entertainment. i love to watch your channel & you touch on the parts of roblox scripting that not many people touch on. thank you for the great tutorial, i loved it.

  • @artvor0
    @artvor0 Жыл бұрын

    Sadly, there's not much of KZreadrs like you that explaining parts that not all developers need and doing it with such a quality. Keep up the good work! I bet you're helping many developers.

  • @Rocush
    @Rocush5 ай бұрын

    Ive been waiting for a tutorial like this for years. This is a video that answered a question ive had from the minute i stored my first data. And you explained everything that i was thinking in one single video perfectly. I wondered how games like build a boat saved data and to know the solution to the question ive had is so relieving. Thank you ❤

  • @DanielMoleGuacamole
    @DanielMoleGuacamole Жыл бұрын

    Thanks a lot! ive been looking for something like this for ages but couldnt find anything :D

  • @5uphi

    @5uphi

    Жыл бұрын

    No problem

  • @jokesflyovermyhead7491
    @jokesflyovermyhead749110 ай бұрын

    Quite possibly one of the only people who actually know what they're talking about, most of professional developers avoid/don't want to create educational videos like these, your channel is a life saver for new people that want to become scripters, after watching your videos I actually understand and remember the infromation that was shown/explained in the video, and I can actually apply it somewhere.

  • @blockered
    @blockered Жыл бұрын

    This is useful I am planning to use it in a game so if you put your tool from the starter pack to the backpack or vice versa it saves

  • @FEG_Studio
    @FEG_Studio Жыл бұрын

    I like how you are different from other yt devs, you actually explain like a real teacher with a high IQ. Believe it or not you are actually doing a really good work, keep it like that! (copied)

  • @duckyslay346
    @duckyslay346 Жыл бұрын

    this is super useful, im creating a game with something like Minecraft that place blocks etc etc, storing and compressing each block's cframe was a hassle until i found this video :D

  • @5uphi

    @5uphi

    Жыл бұрын

    Don't save the cframe just save the position and 1 number for rotation

  • @duckyslay346

    @duckyslay346

    Жыл бұрын

    @@5uphi now ive thought about it, it would be a lot easier and more smaller to store since u can only rotate on a specific axis 🤔. Thx for giving me that reminder

  • @dfzoz9032
    @dfzoz90322 жыл бұрын

    You can also compress building repetitions by saving only 2 opposite corners. (Example, you dug a 2x3x1000 tunnel, you just save the high-left-front corner position and the low-right-back position). Instead of saving 6000 dug positions, you just need to save 2 of them.

  • @5uphi

    @5uphi

    2 жыл бұрын

    Yup that's also possible

  • @NeverEverFaceTheDark

    @NeverEverFaceTheDark

    6 ай бұрын

    I've seen this stated before, but...how

  • @Archetype784
    @Archetype784 Жыл бұрын

    You are probably the best roblox studio channel on youtube

  • @5uphi

    @5uphi

    Жыл бұрын

    Thank you

  • @rashy15
    @rashy152 жыл бұрын

    ive recently found your channel and im in love with it

  • @5uphi

    @5uphi

    2 жыл бұрын

    :)

  • @renzyh
    @renzyh2 жыл бұрын

    good work bro

  • @denissinitskiy9021
    @denissinitskiy9021 Жыл бұрын

    Instead of manually setting the 0 key in a table and then using ipairs in the for loop you can do this for i, character in next, characters, -1 do end also for commenting multiple lines you can use the ctrl+/ keybind

  • @b_mbyz
    @b_mbyz Жыл бұрын

    this man types like a robot wow

  • @majenbej
    @majenbej2 жыл бұрын

    if slietnick actually uploaded

  • @AlexisAutotte
    @AlexisAutotte18 күн бұрын

    Is that possible to use DataCompression with BigNum library ??

  • @aiki5487
    @aiki548710 ай бұрын

    Don't quite understand, function Encode do reverse translating? I mean it's like 123 (decimal) => 7B (hex), but your func do 123 => B7 ?

  • @5uphi

    @5uphi

    10 ай бұрын

    Correct the encode function does not order the output like hex

  • @salami6721

    @salami6721

    9 ай бұрын

    If you want you could fix this by storing if the number is negative or positive (or just use another "prefix" string). Then do "text = characters[value % base] .. text" instead of text coming first. Decoding it would be a little different, what I did was make --power = math.pow(base, value:len())-- power = math.pow(base, value:len() - (value:find("-") ~= nil and 1 or 0)) then replace "number += numbers[character] * power power *= base" to "power /= base number += numbers[character] * power" (This might be a little slower than the method in the video, but more readable when using Encode)

  • @Cafendless
    @Cafendless2 жыл бұрын

    Hey, a little question about the plugin. So let's say i have my infinite terrain done, and i want to start adding stuff. (roads, models, meshes) For example, that video of the cruising drone. Will the terrain just act normally as if I'm just adding terrain without the plug-in? - What happened to the roads i placed, will the act the same way as the plugin? Will it spawn with the Terrain or just float because the terrain hasn't loaded? - Second question, can i start generating from a specific point to a specific length? (Like not infinite) - And third, can i make the terrain interact/spawn next to my originally placed terrain or will it just spawn/generate over my already placed terrain? Would appreciate the answers! Thanks for the read.

  • @5uphi

    @5uphi

    2 жыл бұрын

    Each player generates the terrain around there camera so each player will have different parts of the world generated depending on where they go in the world and the server does not generate any terrain So if you have network steaming turned on then parts like roads will load in like the terrain so they will not be floating but if you don't have network streaming then all parts will load when the player first enters the game but you can use things like atmosphere to hide them If you don't want infinite terrain then just don't create the localscript and generate the terrain in studio and don't clear the terrain The plugin will not overwrite any terrain that's already in the world so if you make custom terrain the plugin will just generate terrain where ever there is air

  • @Cafendless

    @Cafendless

    2 жыл бұрын

    @@5uphi will it be better optimized if i have streaming enabled for the players? Mobile players example (all the parts loading in might cause lag or..?)

  • @5uphi

    @5uphi

    2 жыл бұрын

    Streaming enabled has no effect on the plugin because the terrain is 100% generated on the client side so no information is being sent from the server to the client to generate the terrain but streaming enabled does effect other things you add to your world like parts and meshes If you have streaming turned on then the server will only tell the clients about the parts once they walk within range where if you have it turned off the server will send all parts and meshes to the client as soon as they enter the game So the benefit of streaming is that if you have a very large world the server will not waste time sending all the parts of the game to the client but only if the client walk to that area

  • @lennyprogrammer
    @lennyprogrammer Жыл бұрын

    There is a built in function to convert the bases. I can send you the script if you want (much shorter than yours). I also use base 36 (max base that the built in function can convert). Good video btw.

  • @5uphi

    @5uphi

    Жыл бұрын

    What's the built in function to convert base 10 to base 36?

  • @lennyprogrammer

    @lennyprogrammer

    Жыл бұрын

    @@5uphi apologies, there is a function that converts base x to base 10, but your approach to convert base 10 to 19 is correct. To convert base x to base 10 you can use the simple tonumber method: tonumber(numberInBaseX, X) -- returns numberInBaseX in base 10.

  • @5uphi

    @5uphi

    Жыл бұрын

    I'm aware that tonumber can be used to go from base 36 to base 10 and you can use string.format to go from base 10 to base 16 but there is no built in functions to go from base 10 to base 90 and from base 90 back to base 10 like I show on the video also it's important to be able to select the characters to use as some characters consume 2 or more bytes in the DataStore so by providing a custom list of characters we can make sure that them characters are not used

  • @lennyprogrammer

    @lennyprogrammer

    Жыл бұрын

    @@5uphi OOOOOOOO, I though you where saying base 19, apologies, don't know a built in function for that

  • @lennyprogrammer

    @lennyprogrammer

    Жыл бұрын

    @@5uphi Technically you can go up to base 110000, by using all ASCII characters

  • @D.y.l.a.n
    @D.y.l.a.n Жыл бұрын

    you're really quick at typing!

  • @uniquelyrics2331
    @uniquelyrics23319 ай бұрын

    Great video but the data being compressed/optimized are numbers. What about strings?

  • @5uphi

    @5uphi

    9 ай бұрын

    if you have a limited amount of characters in your strings it can be done but if your going to allow all characters in the alphabet upper and lower case then its not worth it

  • @Kni0002
    @Kni0002 Жыл бұрын

    How would this compare to something like bitbuffer module made by stravant?

  • @5uphi

    @5uphi

    Жыл бұрын

    iv never used bitbuffer but it looks like its has about the same outcome as what I'm doing you could maybe improve the performance of my method by using table.concat() instead of text = text .. characters[value % base]

  • @iquantem8757
    @iquantem875710 ай бұрын

    I am confused on how the equation works in 5:21 works. The length of 1000 parts * the amount of parts (1000), does not equal to 1 part's length. Shouldn't it be maxLength / (length / 1000)? - - local MaxParts = 4.000.000 / (length / #parts)

  • @5uphi

    @5uphi

    10 ай бұрын

    Let's say the datastore can store a max of 10 characters and each part uses 2 characters to save the position and let's say I have 3 parts so the length will be 2 * 3 = 6 So when we do 10 / 6 * 3 = 5 We get the value 5 showing that we can have 5 parts before we run out of characters

  • @iquantem8757

    @iquantem8757

    10 ай бұрын

    @@5uphi My issue is not that I don't understand the math but that the math seems wrong to me without the information I require to see the math correctly. Multiplying the length of 1000 parts with the total number of parts that are there, makes no sense, so the length variable doesn't equal to the 1000 part's encoded JS0N length but rather to one part's encoded JS0N length. What I don't understand is, why the predefined length variable does not equate to an estimate of 56, 000 characters when it was set to that but rather to a single part's character count. If I were to try to grasp how it works on my own, I would come up with the following reason: The variable length is equal to a function meaning it can go through change when called upon in a surrounding of altering elements such as arithmetic operations and when it's multiplied with a list it's logic is advanced enough to adjust to the list by understanding that it wants to set itself to what it's function is but for the individual part's sub-value from the list. I was told that scripts run from the first to the last line and the functions inside of it are just called once, unless they're conditional or called/required somewhere further down the script. Note: I am new to scripting and so I don't understand a lot of the things, considering I've never encountered such logic ever before. I'm here to try to understand topics precisely and what I refer to as complex, is probably just the easiest thing in the world for you which could mean that you leave things like that out because they're obvious to you. That's why it's so hard for me to understand stuff like that. It's hard to teach beginners something 'complex' in simple words because they keep on asking "why's that?, how does it work?, where else could I use it?" and 'skipping' over what you're trying to say, since the logic involved in the explanation is unfamiliar and disconnected to them.

  • @5uphi

    @5uphi

    10 ай бұрын

    Ok so lets continue with max = 10 length = 6 parts = 3 So 3 parts use a total of 6 characters to workout how much each part uses we do 6 / 3 = 2 so we can see that each part uses 2 characters Now we need to see how many 2s can fit in 10 10 / 2 = 5 So we can see that 2 can fit into 10 5 times So the formula is 10 / (6 / 3) = 5 Another way to write this is 10 / 1 * 3 / 6 = 5 Another way to write this is 1 * 10 / 6 * 3 = 5 Another way to write this is 10 / 6 * 3 = 5 Another way to write this is 10 * 3 / 6 = 5 So X/Y*Z is a simplified version of X/(Y/Z)

  • @iquantem8757

    @iquantem8757

    10 ай бұрын

    10 / (6 * 3) = 10 / 18 ~ 0.56 0.56 * 100 = 56.0% ~ 5 Isn't 10 / (6 / 3) a better version though? Also, how did you come up with that and why? Is there a mathematical rule to this?

  • @5uphi

    @5uphi

    10 ай бұрын

    I'm not really sure what you mean by better it would be like asking if 5 * 2 is better then 2 * 5? 10 / 6 * 3 is a tiny bit faster then 10 / (6 / 3) but the difference is so small you don't need to worry about it so there is no such thing as better pick the one you like the best I come up with this by experimenting I never went to school so everything I learnt about math is by playing around with numbers for fun I personally dont like parentheses in my formulas so that's why I try to not use them when I don't have to but I'm crazy you don't have to copy me I think there is a rule for it but as I taught myself I don't know what the rule is called

  • @wisedredd8203
    @wisedredd82032 жыл бұрын

    Its amazing, how do you type so fast? and so smooth too, I need fingers like that!

  • @5uphi

    @5uphi

    2 жыл бұрын

    autohotkey.com

  • @pieTone

    @pieTone

    2 жыл бұрын

    @Kebaburon ?

  • @rashy15

    @rashy15

    2 жыл бұрын

    you do realize its pretyped and he just lets a software type it out for him as he explains it right? YOU NEVER QUESTIONED WHY HE COULD MOVE HIS MOUSE AND TYPE AT THE SAME TIME!???

  • @wisedredd8203

    @wisedredd8203

    2 жыл бұрын

    @@rashy15 oh man! I did notice the mouse move sometimes, just thought he was bumping it while typing lol.

  • @wisedredd8203

    @wisedredd8203

    2 жыл бұрын

    @@5uphi program looks very useful, thanks for sharing : )

  • @goreacraft1994
    @goreacraft19942 жыл бұрын

    in your example '100' should be '1a ' not 'a1' in base 90.. but you are saving it in reverse because of simplicity ?

  • @5uphi

    @5uphi

    2 жыл бұрын

    yes your correct technically it should be 1a but to keep it simple and have better performance we just keep it in reverse

  • @rashy15

    @rashy15

    2 жыл бұрын

    @@5uphi whats the difference?

  • @5uphi

    @5uphi

    2 жыл бұрын

    It has no effect on the datastore it's like if you counted like this 0 1 2 3 4 5 6 7 8 9 01 11 21 31 41 51 61 71 81 91 02 So while technically this is the incorrect way of counting to 20 it still works you don't need to worry about it

  • @goreacraft1994

    @goreacraft1994

    2 жыл бұрын

    @@5uphi thank you for your answer, i am not a mathematician so i just wanted to make sure i understand base 90. great video btw

  • @5uphi

    @5uphi

    2 жыл бұрын

    Maybe some more things that might help you understand base for instance computers work with binary one's and zero's so that's base 2 because there are only 2 states a character can be in and you would count that like this 0, 1, 10. 11, 100, 101, 110, 111 if we are doing base 4 meaning there are 4 characters we can use to count (0, 1, 2, 3) are the 4 characters we will use then it would be 0, 1, 2, 3, 10, 11, 12, 13, 20, 21

  • @uniquelyrics2331
    @uniquelyrics23319 ай бұрын

    how does bro type so fast that is mad skill nice

  • @5uphi

    @5uphi

    9 ай бұрын

    AutoHotKey

  • @lewisbeith
    @lewisbeith2 жыл бұрын

    First

  • @helkade
    @helkade2 жыл бұрын

    ok.

  • @utbay5467
    @utbay5467 Жыл бұрын

    By somehow ur typing but ur not typinf

  • @No.God.except-Allah
    @No.God.except-Allah2 жыл бұрын

    « إِنَّ اللَّهَ وَمَلَائِكَتَهُ يُصَلُّونَ عَلَى النَّبِيِّ ۚ يَا أَيُّهَا الَّذِينَ آمَنُوا صَلُّوا عَلَيْهِ وَسَلِّمُوا تَسْلِيمًا ».

  • @iambench3841

    @iambench3841

    Жыл бұрын

    why?

  • @utbay5467
    @utbay5467 Жыл бұрын

    Bro using AI on his keyboard

  • @1DontNoclip

    @1DontNoclip

    Ай бұрын

    What does that mean

  • @hyt4le
    @hyt4le25 күн бұрын

    yk it's a good tutorial when it helps 2yrs later