Discuss Scratch
- Discussion Forums
- » Bugs and Glitches
- » Misconceptions about the project size limit
- XretroperX
-
100+ posts
Misconceptions about the project size limit
Heh. I had a project that exceeded the max size in it's current state, so I had to cut out a TON for it to properly save after it was changed lol. Still runs great, somehow.
- scratchfan321
-
100+ posts
Misconceptions about the project size limit
Finally. I can fit Terraria on Scratch in 4Mb!
- tyjinw1
-
100+ posts
Misconceptions about the project size limit
how about a blank sprite with infinite size?
- Flowermanvista
-
1000+ posts
Misconceptions about the project size limit
(snip)Okay, so I did some math. This post is truly a modern classic - but the thing is, it's not entirely correct. I've done some experimentation of my own and found out that it's actually possible to make a project smaller (and thus, bigger) than this post says. We're going to throw any concept of “reasonability” out the window and focus solely on completely maximizing the number of assets we can cram into the new, smaller JSON size limit of 5,242,880 bytes (about 0.136% smaller than the old 5,250,000 byte limit that was in effect when that post was made, LAME!).
First, the smallest possible project that will successfully load without errors (223 bytes): I've found that a surprising number of properties are entirely optional and can be omitted completely - particularly, you'll notice something pretty major missing around the part where it stores the assets:
{"targets":[{"isStage":true,"name":"Stage","variables":{},"blocks":{},"costumes":[{"assetId":"cd21514d0531fdffb22204e0ec5ed84a","name":"","dataFormat":"svg"}],"sounds":[]}],"meta":{"semver":"3.0.0","vm":"0.2.0","agent":""}}
{"assetId":"cd21514d0531fdffb22204e0ec5ed84a","name":"","dataFormat":"svg"}
5,242,730 divided by 74 (the comma separating assets adds an extra byte) is about 70,847.702…
we'll floor that to 70,847 assets that can fit in project.json.
70,847 times 74 is 5,242,678 (then we subtract 1, since the last asset doesn't need a comma, so 5,242,677).
Then, when we add back the 150 bytes of the rest of the project, that gives us 5,242,827 bytes for the JSON file.
70,847 assets times 10,000,000 bytes each is 708,470,000,000 bytes - then, adding back in the size of the JSON file gives us a final size of 708,475,242,827 bytes (708.4 GB, 659.8 GiB) for the theoretical largest Scratch project that could be saved online, under the current size limits.
Is there any point to this absurd minmaxing experiment? No, not really. But is it fun? …I'll leave answering that as an exercise for the reader.
- DIAVLODUDE
-
76 posts
Misconceptions about the project size limit
(snip)Okay, so I did some math. This post is truly a modern classic - but the thing is, it's not entirely correct. I've done some experimentation of my own and found out that it's actually possible to make a project smaller (and thus, bigger) than this post says. We're going to throw any concept of “reasonability” out the window and focus solely on completely maximizing the number of assets we can cram into the new, smaller JSON size limit of 5,242,880 bytes (about 0.136% smaller than the old 5,250,000 byte limit that was in effect when that post was made, LAME!).
First, the smallest possible project that will successfully load without errors (223 bytes): I've found that a surprising number of properties are entirely optional and can be omitted completely - particularly, you'll notice something pretty major missing around the part where it stores the assets:I'd like to draw your attention to the lack of the “md5ext” property, which, as far as I can tell, is entirely optional. This significantly reduces the size of the asset object - this one weighs in at only 73 bytes:{"targets":[{"isStage":true,"name":"Stage","variables":{},"blocks":{},"costumes":[{"assetId":"cd21514d0531fdffb22204e0ec5ed84a","name":"","dataFormat":"svg"}],"sounds":[]}],"meta":{"semver":"3.0.0","vm":"0.2.0","agent":""}}Our project without that asset is 150 bytes, giving us 5,242,730 bytes to work with.{"assetId":"cd21514d0531fdffb22204e0ec5ed84a","name":"","dataFormat":"svg"}
5,242,730 divided by 74 (the comma separating assets adds an extra byte) is about 70,847.702…
we'll floor that to 70,847 assets that can fit in project.json.
70,847 times 74 is 5,242,678 (then we subtract 1, since the last asset doesn't need a comma, so 5,242,677).
Then, when we add back the 150 bytes of the rest of the project, that gives us 5,242,827 bytes for the JSON file.
70,847 assets times 10,000,000 bytes each is 708,470,000,000 bytes - then, adding back in the size of the JSON file gives us a final size of 708,475,242,827 bytes (708.4 GB, 659.8 GiB) for the theoretical largest Scratch project that could be saved online, under the current size limits.
Is there any point to this absurd minmaxing experiment? No, not really. But is it fun? …I'll leave answering that as an exercise for the reader.
That's cool! But then, how do we remove all this code to make it 708,475,242,827 bytes or higher than 5 MB?
- DIAVLODUDE
-
76 posts
Misconceptions about the project size limit
Assets are using POST method wich have large limit. The project.json uses PUT method and it's more limited. My project couldn't save because the server returned error 413 (Request Enity Too Large) when posting project.json using PUT method. My project.json had size greater than 5MB. So the limit isn't 10MB but 5MB.
I had to reduce the size by removing some of the scripts.
The full size of my project is 22MB.
Cool!
- plane_space_test
-
34 posts
Misconceptions about the project size limit
Hey there. I'm a fairly frequent user of the Scratch Forums, and I often see misconceptions about the project size limit. Most of these misconceptions came from the era of Scratch 2.0, where projects had a hard 50 MB limit for the entire project. However, that's not necessarily true anymore, so let me tell you about the 2 new size limits in Scratch 3.0:What does this mean? Essentially, an asset is a costume or sound file. If any one asset exceeds 10 MB in size (usually a sound file), then the project will refuse to save. (Note that it is possible to have multiple assets that total to over 10 MB, as long as none of the assets are over that size on their own.) You can usually get around this by converting the sound file to MP3 or splitting the sound file into chunks, or both if really necessary.
- No asset can exceed 10 MB.
What does this mean? The project.json file is a file inside the Scratch project that stores, among other things:
- The project.json file cannot exceed 5 MB.
Most of these take up very little space, but it is possible to exceed the limit by accident. Keep in mind that this limit applies to the uncompressed size of project.json, and not its compressed size - for example, if project.json is 5.1 MB uncompressed but only 900 kB compressed (when it's inside the project file), the project will refuse to save.
- all code in the user's project
- information about sprites and assets
- any list values that were saved with the project
It's worth noting that these are the only size limits - there is no limit on overall project size. You can have a project that's 100 MB or more, as long as it does not exceed either of these limits (although such a project will take a very long time to load and save).
Although these are the most common causes of projects that don't save, there are a few other causes, such as login issues and other things that aren't relevant to this topic.
To the best of my knowledge, these are the current and only size limits. If any authoritative source that is not outdated says something else, please let me know. Thanks!
Edit: So somehow this got stickied. Thank you to everyone involved in that.
but if the limit for assets is 10 mb and the limit for code is 5 mb that would make the biggest possible project 15 mb, while many projects have exceeded that. pls help i dont understand
- CST1229
-
1000+ posts
Misconceptions about the project size limit
The limit is 10MB but if the limit for assets is 10 mb and the limit for code is 5 mb that would make the biggest possible project 15 mb, while many projects have exceeded that. pls help i dont understandper asset, not in total for every asset in the project.
- Flowermanvista
-
1000+ posts
Misconceptions about the project size limit
(edit: ninja'd)
but if the limit for assets is 10 mb and the limit for code is 5 mb that would make the biggest possible project 15 mb, while many projects have exceeded that. pls help i dont understand
(Note that it is possible to have multiple assets that total to over 10 MB, as long as none of the assets are over that size on their own.)
Last edited by Flowermanvista (March 21, 2022 15:20:50)
- B123code
-
5 posts
Misconceptions about the project size limit
I should also add that this “50 MB for the code” thing I've been saying might either be wrong or vague. Listen to what @Paddle2See says above.
However, in this sense I do believe that you can technically make projects that are larger than 50 MB total under this system.
I know that scratch has it's own server, I just can't understand why you need that server when you could just use FireBase Realtime Database, FOR FREE WITH UNLIMITED DATA STORAGE!!! FireBase runs on Google, and Google has the biggest servers on the PLANET!!! If scratch switched to FireBase, That could mean that:
1. projects would have NO STORAGE LIMIT
2. cloud variables would be able to store letters, with no length limit.
- imfh
-
1000+ posts
Misconceptions about the project size limit
I believe storage limit is there to prevent large projects (with big empty lists) from crashing mobile browsers rather than to save storage space. Cloud variables can’t contain letters to make it harder to make cloud chats. They have a length limit because of server issues (not related to space) in the past when there was no limit. It’s pretty hard on the server to have huge variables being transferred multiple times per second by multiple Scratchers on many projects.I should also add that this “50 MB for the code” thing I've been saying might either be wrong or vague. Listen to what @Paddle2See says above.
However, in this sense I do believe that you can technically make projects that are larger than 50 MB total under this system.
I know that scratch has it's own server, I just can't understand why you need that server when you could just use FireBase Realtime Database, FOR FREE WITH UNLIMITED DATA STORAGE!!! FireBase runs on Google, and Google has the biggest servers on the PLANET!!! If scratch switched to FireBase, That could mean that:
1. projects would have NO STORAGE LIMIT
2. cloud variables would be able to store letters, with no length limit.
Last edited by imfh (March 23, 2022 22:39:23)
- thatwasdeadsimple
-
100+ posts
Misconceptions about the project size limit
They don't want cloud variables with letters in them because it would make it easy for anyone to make chatrooms in a project using cloud variables. 2. cloud variables would be able to store letters, with no length limit.
- musicROCKS013
-
1000+ posts
Misconceptions about the project size limit
So, does this mean that the If project.json is 5.1 MB uncompressed, the project will refuse to save.hypohetical .json file size, or the size the file would be if you export it, or only if you try to import the file? I'm just curious.
- CST1229
-
1000+ posts
Misconceptions about the project size limit
(#73)The size the file would be if you export it.So, does this mean that the If project.json is 5.1 MB uncompressed, the project will refuse to save.hypohetical .json file size, or the size the file would be if you export it, or only if you try to import the file? I'm just curious.
- Tunde123
-
1000+ posts
Misconceptions about the project size limit
Please snip your quotes next time. -MASSIVE SNIP-
That lagged my computer
- Thethree13
-
42 posts
Misconceptions about the project size limit
I wonder why they changed it from 50mb to 5mb for the project.json
- MonkeyBean2
-
100+ posts
Misconceptions about the project size limit
The code is in project.json There's also a 50 MB limit on the code.
- bloctans_4
-
1000+ posts
Misconceptions about the project size limit
if its a limit for POST and PUT, then would a websocket work?
- Discussion Forums
- » Bugs and Glitches
-
» Misconceptions about the project size limit