Discuss Scratch

LG125
Scratcher
500+ posts

Is there lag?

https://scratch.mit.edu/projects/517860402/

I’m not sure if there really is a bug, my friend just told me some time ago that there was massive lag some part in the game.

I identified the lag, but didn’t know how to fix it.

I worked on some code completely unrelated to that problem, which i later implemented. A few seconds ago, I got a supportive comment, but nothing about lag.

Has my script unintentionally fixed the lag? If there still is lag, is there a way to fix it?
Hero_man_555
Scratcher
72 posts

Is there lag?

Tried running it on turbo warp and the page froze up. Not sure what the issue is though, but whatever it is it's pretty bad.
LG125
Scratcher
500+ posts

Is there lag?

Hero_man_555 wrote:

Tried running it on turbo warp and the page froze up. Not sure what the issue is though, but whatever it is it's pretty bad.
When was this? In the middle of the game?
Hero_man_555
Scratcher
72 posts

Is there lag?

Right after the main part of the game loaded (after selecting a difficulty). Tried it again and it seems to be working a bit better though. Not really sure why you need fake loading screens, but ehh it doesn't really matter.

Last edited by Hero_man_555 (Nov. 3, 2021 23:04:37)

LG125
Scratcher
500+ posts

Is there lag?

Hero_man_555 wrote:

Right after the main part of the game loaded (after selecting a difficulty). Tried it again and it seems to be working a bit better though. Not really sure why you need fake loading screens, but ehh it doesn't really matter.
Turbowarp or scratch?
supergamer10000
Scratcher
1000+ posts

Is there lag?

Hmm, I think this might help you. Also you should remove the fake loading screens since they might cause some lag.
dave-alt-4
Scratcher
1000+ posts

Is there lag?

its not lag at all for me (even at scratch)
I'm using
Windows 11 Home Single Language
AMD Ryzen 5 4600H with Radeon Graphics 3.00 GHz
64-bit operating system, x64-based processor
8 MB ram
Thingied
Scratcher
1000+ posts

Is there lag?

After a little digging. I found the problem.

What's happening is that the difficulty buttons are still running so when a player clicks on them it's going to broadcast the “Load Game” message, it causes a ton of bombs to spawn because clones also receive broadcasts. But you may be saying, “The sprites are hidden though.” Well, this is part of the problem. Sprites can still detect if the mouse pointer is touching them even if they're hidden. Best fix is to stop all the other scripts instead of just hiding.
New script:


One more thing before this post ends is to merge as many loops that start with the same hat. I see a lot of this

(in the Achievements sprite)
which is can get messy because it's harder to organize the code when there's more loops.
Merged version:

Powered by DjangoBB