Discuss Scratch

Coltroc
Scratcher
8 posts

Miner Cat 4 is to laggy

Hello everyone! Currently working on Miner Cat 4 but I've stumbled upon a problem that I can't fix. The game gets really laggy over time. I've tried to remove code, run it on HTML5, turbo warp, and so on but it still gets super laggy. I've had the same issue with miner Cat 3. At the beginning of the game, it's fine but over time it gets unplayable. I have no idea what's causing the lag and it would be super helpful if anybody knows how to optimize projects.

The file size is about 20-30 MB and there are more than 100 clones on the screen at pretty much all times. More than 10,000 blocks of code and hundreds of costumes, also about 20 Sprites. The problem could be that it's a massive project but I don't see why it gets laggy after some time and not all the time.

I know that it's hard to solve this problem since there isn't too much information but I just have no idea how to fix it, this is my last resort pretty much.
deck26
Scratcher
1000+ posts

Miner Cat 4 is to laggy

So is it shared?
Coltroc
Scratcher
8 posts

Miner Cat 4 is to laggy

It isn't, but Miner Cat 3 which has the same problem is shared. You can find it on my profile. MC 3 is about 40 MB.

Last edited by Coltroc (Feb. 19, 2021 13:49:37)

deck26
Scratcher
1000+ posts

Miner Cat 4 is to laggy

So is there an easy way to see the problem? I'm not interested in playing the game.
Coltroc
Scratcher
8 posts

Miner Cat 4 is to laggy

deck26 wrote:

So is there an easy way to see the problem? I'm not interested in playing the game.
There might be, but I don't know. and that's a part of the problem. Do you know any normal problems which cause lag? that could help a lot as well.
deck26
Scratcher
1000+ posts

Miner Cat 4 is to laggy

Common causes for lag

- touching colour block
- too many forever loops
- deleting and recreating clones instead of reusing them
- custom blocks with no screen refresh that don't finish in short enough time

Try creating a copy and deleting scripts or sprites and testing to see if the lag goes. That can help reduce the number of possible causes.
deck26
Scratcher
1000+ posts

Miner Cat 4 is to laggy

But avoid things like this in Sound

foreverifitem2oflistthensetvolumetosetvolumeto100%elsesetvolumetosetvolumeto0%

Volume will presumably only change occasionally so you don't need to set it 30 times a second. Wherever the project changes volume just make a broadcast.

Last edited by deck26 (Feb. 19, 2021 14:12:12)

Coltroc
Scratcher
8 posts

Miner Cat 4 is to laggy

deck26 wrote:

Common causes for lag

- touching colour block
- too many forever loops
- deleting and recreating clones instead of reusing them
- custom blocks with no screen refresh that don't finish in short enough time

Try creating a copy and deleting scripts or sprites and testing to see if the lag goes. That can help reduce the number of possible causes.
Thanks a lot for the help! I'll see what I can do.
Coltroc
Scratcher
8 posts

Miner Cat 4 is to laggy

deck26 wrote:

But avoid things like this in Sound

foreverifitem2oflistthensetvolumetosetvolumeto100%elsesetvolumetosetvolumeto0%

Volume will presumably only change occasionally so you don't need to set it 30 times a second. Wherever the project changes volume just make a broadcast.
I'll try that as well. I'm so thankful for your help!
awesome-llama
Scratcher
1000+ posts

Miner Cat 4 is to laggy

I think I know what it is. You'll have to test it too and see if this is happening for you too.

Your project has a lot of scripts. Being inside the editor has a huge impact on performance as not only does your game have to run, but all the blocks have to be loaded and rendered at the same time. If you were to view it only in the project player (not going in to the editor at all), then there will be no lag. The moment you go in, the lag will start and even trying to go back out of the editor the lag seems to stay.
WarriorDragonID
Scratcher
31 posts

Miner Cat 4 is to laggy

try forkphorus it helps with blocks and lag if that dosen't work, you might just have to share it, give them a warning that it is very laggy
Coltroc
Scratcher
8 posts

Miner Cat 4 is to laggy

awesome-llama wrote:

I think I know what it is. You'll have to test it too and see if this is happening for you too.

Your project has a lot of scripts. Being inside the editor has a huge impact on performance as not only does your game have to run, but all the blocks have to be loaded and rendered at the same time. If you were to view it only in the project player (not going in to the editor at all), then there will be no lag. The moment you go in, the lag will start and even trying to go back out of the editor the lag seems to stay.
I've noticed this myself and running the game in for example turbo warp seems to solve that problem, it still lags though after playing for some time. thanks for the help!
Coltroc
Scratcher
8 posts

Miner Cat 4 is to laggy

WarriorDragonID wrote:

try forkphorus it helps with blocks and lag if that dosen't work, you might just have to share it, give them a warning that it is very laggy
Forkphorus is terrific in making projects run faster, but it makes my game display wrong . I'm using turbo warp instead which is made by the same guy and does pretty much the same thing. Also, yeah I might have to just share it with a warning. Would be bad but it's better than nothing.
danec_qwerty
Scratcher
39 posts

Miner Cat 4 is to laggy

i wish it was in scratch so we could make mods
098765432154321
Scratcher
500+ posts

Miner Cat 4 is to laggy

danec_qwerty wrote:

i wish it was in scratch so we could make mods
Please don't necropost, this topic is from February.
nzishi
Scratcher
1 post

Miner Cat 4 is to laggy

Try Adding 1 - 5 Blank Sprites. Also Remember Scratch Does Not Allow 300+ Clones
Don't Do This

repeat400createcloneofmyself

Do This

repeat400stamp

If You Want To Delete Stamps Do This:
clear

Also Try To Use TurboWarp To Remove Clone Limits & To Avoid Lag. Remember To Include That Is Is Laggy In The Instructions!
Please Subscribe To My Youtube Channel & Follow My Scratch Account

Last edited by nzishi (Jan. 9, 2022 11:29:36)

EliTheLegoBrick
Scratcher
27 posts

Miner Cat 4 is to laggy

If anyone has a problem that no more code fits in the project, contact me on my profile ok?
098765432154321
Scratcher
500+ posts

Miner Cat 4 is to laggy

EliTheLegoBrick wrote:

If anyone has a problem that no more code fits in the project, contact me on my profile ok?

nzishi wrote:

Try Adding 1 - 5 Blank Sprites. Also Remember Scratch Does Not Allow 300+ Clones
Don't Do This
-snip-
Also Try To Use TurboWarp To Remove Clone Limits & To Avoid Lag. Remember To Include That Is Is Laggy In The Instructions!
Please Subscribe To My Youtube Channel & Follow My Scratch Account
Please don't necropost, this topic is from February of last year.
- Me, August 2021

Powered by DjangoBB