Discuss Scratch

Zparx
Scratcher
500+ posts

Tips on reducing lag in my project?

As simple as the title. It's not too noticeable with a good computer, but on one of my games it's just laggy enough to surpass my liking.. Not too laggy, but it's not as smooth as I know it can get with the proper scripting. Are there any general tips for reducing lag?

Here's a link to the project in specific

Last edited by Zparx (June 2, 2013 19:57:19)

dracae
Scratcher
1000+ posts

Tips on reducing lag in my project?

It would help if we knew which project you're talking about…
Zparx
Scratcher
500+ posts

Tips on reducing lag in my project?

dracae wrote:

It would help if we knew which project you're talking about…
I didn't want help with a project in specific, just general tips to apply, as the project is quite large, but here you go!

http://scratch.mit.edu/projects/10107989
dracae
Scratcher
1000+ posts

Tips on reducing lag in my project?

Zparx wrote:

dracae wrote:

It would help if we knew which project you're talking about…
I didn't want help with a project in specific, just general tips to apply, as the project is quite large, but here you go!

http://scratch.mit.edu/projects/10107989

Thanks!
But I don't believe there's much to do for this project in particular.
Maybe cutting down on broadcasts?
Other than that, just realize that large projects are going to be at least a bit laggy, whether or not you add a few quirks.

But broadcasting is a mild lag-inducing feature.
Variables are preferred.

Anyways, I hope I help!
Zparx
Scratcher
500+ posts

Tips on reducing lag in my project?

dracae wrote:

Zparx wrote:

dracae wrote:

It would help if we knew which project you're talking about…
I didn't want help with a project in specific, just general tips to apply, as the project is quite large, but here you go!

http://scratch.mit.edu/projects/10107989

Thanks!
But I don't believe there's much to do for this project in particular.
Maybe cutting down on broadcasts?
Other than that, just realize that large projects are going to be at least a bit laggy, whether or not you add a few quirks.

But broadcasting is a mild lag-inducing feature.
Variables are preferred.

Anyways, I hope I help!

Thanks! I'll try to cut down on the broadcasts!
dracae
Scratcher
1000+ posts

Tips on reducing lag in my project?

Zparx wrote:

dracae wrote:

Zparx wrote:

dracae wrote:

It would help if we knew which project you're talking about…
I didn't want help with a project in specific, just general tips to apply, as the project is quite large, but here you go!

http://scratch.mit.edu/projects/10107989

Thanks!
But I don't believe there's much to do for this project in particular.
Maybe cutting down on broadcasts?
Other than that, just realize that large projects are going to be at least a bit laggy, whether or not you add a few quirks.

But broadcasting is a mild lag-inducing feature.
Variables are preferred.

Anyways, I hope I help!

Thanks! I'll try to cut down on the broadcasts!
Glad I could help!
mwiedmann
Scratcher
100+ posts

Tips on reducing lag in my project?

I tried it on a pretty modest computer and it seems to run great. I wouldn't worry about lag too much, I'm not seeing any. I have one other computer I can try it on later, but so far it runs great.

dracae is right though, if any of your sprites have broadcasts in their main loops you will notice that they will stutter. Only broadcast for “major” events if you can. Another thing I've noticed that can hurt performance is “if touching _ color” blocks. That seems to be an expensive operation and it will really lag if you get multiple sprites overlapping when that block is called. It's ok to use it, just limit it. Using “if touching sprite” is always better because there are a lot of optimizations that go into that call which make it very efficient.
-Scratcher-
Scratcher
100+ posts

Tips on reducing lag in my project?

mwiedmann wrote:

I tried it on a pretty modest computer and it seems to run great. I wouldn't worry about lag too much, I'm not seeing any. I have one other computer I can try it on later, but so far it runs great.

dracae is right though, if any of your sprites have broadcasts in their main loops you will notice that they will stutter. Only broadcast for “major” events if you can. Another thing I've noticed that can hurt performance is “if touching _ color” blocks. That seems to be an expensive operation and it will really lag if you get multiple sprites overlapping when that block is called. It's ok to use it, just limit it. Using “if touching sprite” is always better because there are a lot of optimizations that go into that call which make it very efficient.
Agree with @mwiedmann
Also, many clones can increase the lag a lot, size- and costume changing, effects like the fisheye or whirl effect too, a lot. These are all things you have to think about and try to limit to reduce the lag
Thejbomber
Scratcher
100+ posts

Tips on reducing lag in my project?

-Scratcher- wrote:

mwiedmann wrote:

I tried it on a pretty modest computer and it seems to run great. I wouldn't worry about lag too much, I'm not seeing any. I have one other computer I can try it on later, but so far it runs great.

dracae is right though, if any of your sprites have broadcasts in their main loops you will notice that they will stutter. Only broadcast for “major” events if you can. Another thing I've noticed that can hurt performance is “if touching _ color” blocks. That seems to be an expensive operation and it will really lag if you get multiple sprites overlapping when that block is called. It's ok to use it, just limit it. Using “if touching sprite” is always better because there are a lot of optimizations that go into that call which make it very efficient.
Agree with @mwiedmann
Also, many clones can increase the lag a lot, size- and costume changing, effects like the fisheye or whirl effect too, a lot. These are all things you have to think about and try to limit to reduce the lag
I find that sound can induce lots of lag as well.
Nyan_Banana
Scratcher
14 posts

Tips on reducing lag in my project?

I need to cut down lag on my game ( https://scratch.mit.edu/projects/59748630/ )
Any tips? I cannot cut down the number of clones/ scripts running as I have tried but failed.
firepaw_rusty
Scratcher
28 posts

Tips on reducing lag in my project?

I have lots of lag on my project, but I only just started it!! I still only have one sprite with two costumes, and I don't even have any scripts yet. But when I use the bucket or something, or try to draw something, it takes about 4 seconds for it to load. can someone please tell me what the problem is? And quickly too. Thanks!
wayyyy
Scratcher
500+ posts

Tips on reducing lag in my project?

It's pretty good even for My browser / operating system: Windows 7, Chrome 44.0.2403.107, Flash 18.0 (release 0) but the lag can be brutal in the editor.

For Scratch, get rid of unnecessary sounds like “pop” or “meow” or remove some of the bells and whistles.
Superdoggy
Scratcher
1000+ posts

Tips on reducing lag in my project?

wayyyy wrote:

For Scratch, get rid of unnecessary sounds like “pop” or “meow” or remove some of the bells and whistles.
That speeds up loading time, but not the project itself.
azure1025
Scratcher
30 posts

Tips on reducing lag in my project?

uhh, I have the same problem but I have no broadcasts (except for message1) and I have very little script. Is my laptop just bad?
P.S It's really severe I only get 1 FPS since the 1.0.3 update
azure1025
Scratcher
30 posts

Tips on reducing lag in my project?

ok I tried everything. none of them worked but the second I got rid of the song it worked fine
BoltLover
Scratcher
100+ posts

Tips on reducing lag in my project?

I am on a laptop and it's extremely laggy. I also need to test an AMV I am working on but I can't do it with the lag… I need the project finished by 5 PM today. Please help!
deck26
Scratcher
1000+ posts

Tips on reducing lag in my project?

BoltLover wrote:

I am on a laptop and it's extremely laggy. I also need to test an AMV I am working on but I can't do it with the lag… I need the project finished by 5 PM today. Please help!
If you want help it would be much more sensible to start your own topic rather than posting on someone else's.

Also remember that Scratch is used around the world so just saying 5pm will mean different things to different people - you posted after 5 pm where I am!
rhydian27
New Scratcher
1 post

Tips on reducing lag in my project?

I'm having trouble with the lag in my game. It's none existent in Level 1 but as you go to the second and third it gets unbearable. https://scratch.mit.edu/projects/106526692/ there's the link to it and if possible a quick reply would be nice. the games due in in a week.
Yours Faithfully
Rhydian27 (AXEarthquake)
Theunicornworld
Scratcher
100 posts

Tips on reducing lag in my project?

1) Lower the amount of scripts, sprite, sprite costumes, music, and/or backgrounds in the project. That would mean there would be less to load up.
2) Lower the amount of scripts that happen at the same time.
cs249156
Scratcher
3 posts

Tips on reducing lag in my project?

You don't use a script.
definerueducelagsayREDUCE LAG!for2secs

You use the keys Ctrl + m.

Powered by DjangoBB