I have a game with LOTS of code in it. It involves creating an account, and playing a bunch of hard science riddles. It has music, too, but all of this code and stuff is creating lag! It's all necessary for playing the game, but it's lagging so much, it's hard for me to work on it!Is there ANY way to reduce the lag?!!
Offline
It must be that there are a lot of scripts. To solve this, make each sprite hold a certain amount of scripts.
Offline
One of the biggest contributors to slow performance that's unrelated to slowness in the algorithm (basically, how efficient the script is) is having many scripts running at the same time. If you have several scripts with forever loops, try finding a way to reduce the amount of those loops, perhaps by consolidating scripts or using broadcasts instead.
Offline
As Harakou said, get rid of as many forever blocks as you can, possibly replacing them with blocks that only run when they are required. This can be done using broadcasts and if blocks.
Also, try to break up scripts into smaller ones.
Offline
l0ve1y wrote:
Like I said, this is ALL necessary. I can't remove any of it, or else the project won't work! It's not as laggy as you think, but it lags enough to make it frustrating.
![]()
Well I'm afraid there isn't a lot you can do about it... unless you upgrade your computer.
Also, try giving Scratch priority in the Task Manager so that it is allowed to use more resources and therefore run faster.
Offline
Can you upload the project? I want to see it.
Offline
Scratch=Lag
If you are advanced enough you might be able to use Stencyl
It’s a lot like Scratch but it’s a little more advanced. (It even uses the “drag ’n drop blocks” design!!) It wasn’t designed for things like animations, simulations, or art, but you could certainly do all of those things, and more!
Offline
jji7skyline wrote:
As Harakou said, get rid of as many forever blocks as you can, possibly replacing them with blocks that only run when they are required. This can be done using broadcasts and if blocks.
Also, try to break up scripts into smaller ones.![]()
Yes, like the project I am working on currently has about 160 scripts, and I am using so many broadcasts that there is already a more button to find more of those broadcasts! So remember to use: broadcasts, ifs, ifs-elses, and variables! They help a lot with big projects.
Offline
henley wrote:
Scratch=Lag
If you are advanced enough you might be able to use Stencyl
It’s a lot like Scratch but it’s a little more advanced. (It even uses the “drag ’n drop blocks” design!!) It wasn’t designed for things like animations, simulations, or art, but you could certainly do all of those things, and more!
-1,000,000. I hate Stencyl. It is impossible for me to use! Those drag 'n' drop blocks, did you see those? They confuse me so much! I like Scratch a million times better.
Oh and also, lovely, if you are having trouble, try restarting your computer a bit, or maybe the internet is just laggy.
Last edited by Thescratch3 (2011-09-18 12:13:08)
Offline
l0ve1y wrote:
I have a game with LOTS of code in it. It involves creating an account, and playing a bunch of hard science riddles. It has music, too, but all of this code and stuff is creating lag! It's all necessary for playing the game, but it's lagging so much, it's hard for me to work on it!Is there ANY way to reduce the lag?!!
![]()
I've been having lag problems too with a game I'm making...
When you score a point, the large numbers in the background (the score) flash white and fade, and it also triggers particle effects...and this caused MASSIVE lag spikes whenever you score. I reduced the length of the number flash -> fewer frames to update -> less lag--and it seems to run at a decent speed now
tl;dr: special effects slow down scratch. A lot.
Offline
Hm... well it isn't as laggy as another project I have made, of a cat spinning really fast, with the color, mosaic, and brightness effects on, getting bigger and smaller randomly. I can't do a THING while it's running.
Offline