Discuss Scratch

JakePuebla0212
Scratcher
2 posts

My project's file size is too big. What do I do?

Hi there,
So I have been working on a battle-royale style game called “Battallia” for the past two-three years. I have released constant updates and new content in my game. A few weeks ago, I logged on to edit the game in order to release my next update (version 0.0.3.4). However, I realized the project wasn't saving as I edited. I looked into this issue and I found out that version 0.0.3.4 Battallia's project.json folder was at 5.0 MB (the maximum firle size limit). I looked through the game's code and I couldn't find any ways to save storage on my project. I want to turn Battallia into a full-on game, but I don't know what to do. Here's the link to version 0.0.3.3 of Battallia (the previous and current update) if anyone wants to take a look at the code to help me out: https://scratch.mit.edu/projects/562272939/ If anyone has any suggestions, please comment below.
-Thank you
ocuious
Scratcher
1000+ posts

My project's file size is too big. What do I do?

Hi there! I'd suggest taking a look at ways you can compress different codes in your project. Take a code that you know is large and see if there are any places you can take out blocks or make a more efficient script. It may be tedious, but if you repeat this with all of the (many) sprites in your project it'll add up and you'll be able to make changes again. Another thing- remember that scratch is where coding endeavors start and you may reach a point where your project is truly at it's maximum. When you get there, you might have to switch to a different coding software such as unity. Hope this helps! ^-^
PhiPhenomenon
Scratcher
500+ posts

My project's file size is too big. What do I do?

I have an extension that allows me to see the number of blocks you have in your project. Currently, it totals about 24.5k (wow!). Every block would average around 200 bytes, so you'll have to make some micro-optimizations to get as much space as you can.

I know that you've posted that you've tried to save storage by looking through the game code, but maybe you need to look a little closer. I see that you have a ton of scripts that are basically tens of if statements stacked on top of each other. Here's an example of that in the sign in keys sprite:


I see the jist of the script is to combine the letters together. Here's a script to make it compatible with all lengths of sign in keys:
set [INDEX v] to [1]
set [OLDLENGTH v] to ((length of (sign in type))-(1))
repeat (OLDLENGTH)
set [sign in type v] to (join (sign in type) (letter (i) of (sign in type)))
change [i v] by (1)
end
With this, you can free up over 400 blocks. Try doing something like this for the rest of your project.
PhiPhenomenon
Scratcher
500+ posts

My project's file size is too big. What do I do?

Another example would be in the Log In sprite.

These three scripts are essentially the same thing except for a few variable definitions and if conditions. You can combine them like this:


I think your main issue is the Weapon sprite. You have a ton of code that is almost the exact copy of others, which can be converted into a function with parameters.

Powered by DjangoBB