Discuss Scratch

Malicondi
Scratcher
1000+ posts

Is there any way to reduce lag further?

Currently, I'm making a 100% pen game, and before you ask, yes i use custom blocks with minimal code. But i still have over 900 blocks and starting to experience lag. Is there any (effective) way to reduce lag?

my project

Last edited by Malicondi (Feb. 6, 2024 15:08:49)

EDawg2011
Scratcher
1000+ posts

Is there any way to reduce lag further?

Please share the project and give us the link so that we can help better.
Malicondi
Scratcher
1000+ posts

Is there any way to reduce lag further?

EDawg2011 wrote:

Please share the project and give us the link so that we can help better.
im just looking for general tips, rather than code optimization, for now.
EDawg2011
Scratcher
1000+ posts

Is there any way to reduce lag further?

Malicondi wrote:

EDawg2011 wrote:

Please share the project and give us the link so that we can help better.
im just looking for general tips, rather than code optimization, for now.
But it's hard to give you much help without the project.
“Sorry, you have to wait 60 seconds between posts.”
Malicondi
Scratcher
1000+ posts

Is there any way to reduce lag further?

EDawg2011 wrote:

Malicondi wrote:

EDawg2011 wrote:

Please share the project and give us the link so that we can help better.
im just looking for general tips, rather than code optimization, for now.
But it's hard to give you much help without the project.
“Sorry, you have to wait 60 seconds between posts.”
my code may be a little messy but heres the project: https://scratch.mit.edu/projects/961633917/
ProfessorUelf
Scratcher
100+ posts

Is there any way to reduce lag further?

Malicondi wrote:

EDawg2011 wrote:

Malicondi wrote:

EDawg2011 wrote:

Please share the project and give us the link so that we can help better.
im just looking for general tips, rather than code optimization, for now.
But it's hard to give you much help without the project.
“Sorry, you have to wait 60 seconds between posts.”
my code may be a little messy but heres the project: https://scratch.mit.edu/projects/961633917/
It is not shared. A project shouldn't lag already at 900 blocks.
Cool_Dude2022
Scratcher
500+ posts

Is there any way to reduce lag further?

Malicondi wrote:

Currently, I'm making a 100% pen game, and before you ask, yes i use custom blocks with minimal code. But i still have over 900 blocks and starting to experience lag. Is there any (effective) way to reduce lag?

my project
The project is unshared. This lag could be due to the amount of clones, variables, or even using the pen's “stamp” feature can cause this.
Malicondi
Scratcher
1000+ posts

Is there any way to reduce lag further?

Cool_Dude2022 wrote:

Malicondi wrote:

Currently, I'm making a 100% pen game, and before you ask, yes i use custom blocks with minimal code. But i still have over 900 blocks and starting to experience lag. Is there any (effective) way to reduce lag?

my project
The project is unshared. This lag could be due to the amount of clones, variables, or even using the pen's “stamp” feature can cause this.
i have 0 costumes, and 1 sprite and only 17 variables, with 0 clones, also screen is cleared every tick so theres no pen build up.
also i did share the project let me see if i gave the wrong link.

link: https://scratch.mit.edu/projects/961633917/
maybe its just me or my operating system, but it's laggy.

Last edited by Malicondi (Feb. 6, 2024 15:09:36)

Jareddddddd
Scratcher
1000+ posts

Is there any way to reduce lag further?

Normally in pen projects, the main source of lag comes from the amount of moves that the renderer moves. An average computer can run anywhere from 2000 to 5000 moves in a frame.

Now I can't do much without Turbowarp's features regarding specifically this project, but I can suggest a few changes

1 - Use an engine
Now I know some people don't like the idea of using someone else's code, but in cases such as yours, an extremely optimized engine such as this tris filler by @MentalBox. I know there's a better engine by someone named @Rex or something, but I can't find it.

2 - Using stamping to replace movement
Many simple lines or boxes can be replaced by a well-placed stamp. This can reduce the moves needed by about 1 or 2, but this adds up real quickly.

3 - Minimize loops
A static screen can be optimized to run only once. In your example, instead of redrawing the “Loading” text fully for the 3 dots, draw it once, and only reset it once you need to.
Malicondi
Scratcher
1000+ posts

Is there any way to reduce lag further?

Thanks for the help everyone!

Powered by DjangoBB