Discuss Scratch

benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

Nearly all of my recent projects, I've had to abandon because Scratch isn't capable of running them fast enough (or maybe it's just my inefficient way of programming).
So for my newest project, I've took up making the player use Turbo Mode. However, I'm now running into another problem.

The project does not quite run perfectly in the downloadable player, but it's fast enough to be easily playable. However, online, on my computer, it runs much slower (generally when many actions are running at once). However, I haven't yet had this problem on school computers. I plan to test it again after the school holidays.

I've come up with two potential courses of action if this is a problem: one is to make the player (or at least ask them to) play the project in the download player. The other, if it works on some computers but not others, is to make a separate gameplay option (still in Turbo Mode if possible) which makes compromises to make the game playable.

My question is, should this be a concern? Is there a way around this, or will I have to either start making compromises to make the games playable or give up? I really don't want to give up Scratch (and this is not a threat to do so) but I am concerned about this. If this does work, I should dedicate more of my time to single projects, as I have a few ideas for potentially expandable ones.

Last edited by benjamin2 (Jan. 2, 2014 21:37:38)

turkey3_test
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

In my tower defense game, I have about 70 clones all in constant motion, and I don't experience any lag on various computers. What graphics are you using? Bitmap or vector? That can help me figure out the problem, as I expertise in graphics.
AonymousGuy
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

Have you ever used “run without screen refresh” in a custom block?
Also, more forever loops can make the project slower.

I'm not sure if “there is a way around this”, but if you reduce forever loops, that helps, and to run calculations really quickly, put them in custom blocks that run without screen refresh.
benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

turkey3_test wrote:

In my tower defense game, I have about 70 clones all in constant motion, and I don't experience any lag on various computers. What graphics are you using? Bitmap or vector? That can help me figure out the problem, as I expertise in graphics.
Nearly everything in the game is vector graphics. I use vector whenever I can. There are just one or two bitmap costumes that would be too difficult to make in vector (although I've just realised that I could make them in bitmap then convert them).
drmcw
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

Scratch is actually pretty fast. What are you trying to do?
benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

drmcw wrote:

Scratch is actually pretty fast. What are you trying to do?
The level where the most problems are experienced is a simple level involving moving with the mouse to avoid moving objects (simple gray squares and circles). This level can have about ten moving clones on the screen at once but lag occurs with just one or two.
The clones are deleted once they've done their job.

Would you like me to upload a version of the project as it stands now to my test account?

AonymousGuy wrote:

Have you ever used “run without screen refresh” in a custom block?
Also, more forever loops can make the project slower.

I'm not sure if “there is a way around this”, but if you reduce forever loops, that helps, and to run calculations really quickly, put them in custom blocks that run without screen refresh.
I never use custom blocks, so I don't know what ‘run without screen refresh’ does. Would executing actions such as ‘move 2 steps 100 times with 0.01 second delays between each’ be best done with custom blocks?

Last edited by benjamin2 (Jan. 2, 2014 16:20:47)

turkey3_test
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

benjamin2 wrote:

turkey3_test wrote:

In my tower defense game, I have about 70 clones all in constant motion, and I don't experience any lag on various computers. What graphics are you using? Bitmap or vector? That can help me figure out the problem, as I expertise in graphics.
Nearly everything in the game is vector graphics. I use vector whenever I can. There are just one or two bitmap costumes that would be too difficult to make in vector (although I've just realised that I could make them in bitmap then convert them).
Try smoothing out your shapes. Use the reshape tool in the vector editor, and delete as many control points as you can while still keeping the shape smooth. When vector graphics are rendered, the computer goes from point to point, so the less points you have, the less it has to process.

Edit: never mind, you just have squares and circles… Hmm…

Last edited by turkey3_test (Jan. 2, 2014 16:20:59)

turkey3_test
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

Benjamin, run this project http://scratch.mit.edu/projects/12999385/ and tell me if you experience lag.
drmcw
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

benjamin2 wrote:

drmcw wrote:

Scratch is actually pretty fast. What are you trying to do?
The level where the most problems are experienced is a simple level involving moving with the mouse to avoid moving objects (simple gray squares and circles). This level can have about ten moving clones on the screen at once but lag occurs with just one or two.
The clones are deleted once they've done their job.

Would you like me to upload a version of the project as it stands now to my test account?
Yes. Seeing the project would certainly help understand and possibly solve this problem.

Last edited by drmcw (Jan. 2, 2014 16:22:56)

turkey3_test
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

Wait!!! Does your project use any graphic effects?
benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

turkey3_test wrote:

benjamin2 wrote:

turkey3_test wrote:

In my tower defense game, I have about 70 clones all in constant motion, and I don't experience any lag on various computers. What graphics are you using? Bitmap or vector? That can help me figure out the problem, as I expertise in graphics.
Nearly everything in the game is vector graphics. I use vector whenever I can. There are just one or two bitmap costumes that would be too difficult to make in vector (although I've just realised that I could make them in bitmap then convert them).
Try smoothing out your shapes. Use the reshape tool in the vector editor, and delete as many control points as you can while still keeping the shape smooth. When vector graphics are rendered, the computer goes from point to point, so the less points you have, the less it has to process.

Edit: never mind, you just have squares and circles… Hmm…
The game is not solely made up of squares and circles, just the level with the biggest problem is. I'll try to list all the shapes to the best of my memory here:

Main menu, instructions, ending, etc.: Just rectangles and text.
Level 1: Circles and text.
Level 2 (biggest problem): Squares/rectangles and circles.
Level 3: Rectangles, lines and text.
Level 4: Rectangles.
Level 5: Rectangles, coloured areas and text. Uses some bitmap graphics.
Level 6: Not yet developed.
Level 7: One ‘arch-shape’ bitmap graphic and some circles.
Level 8: Not yet developed
Level 9: Will not be a concern (I can't say any more without giving away what it is)
benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

turkey3_test wrote:

Wait!!! Does your project use any graphic effects?
I'm aware of this problem. As such, color effects are avoided completely (though there may be some ‘change color effect by 0’ blocks floating around, but they should be harmless. Ghost and pixelate effects are used, because from what I can tell they cause no problems. Try it yourself - they do no noticeable harm.
benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

turkey3_test wrote:

Benjamin, run this project http://scratch.mit.edu/projects/12999385/ and tell me if you experience lag.
I will run it and keep checking back to this thread.
turkey3_test
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

What are your computer specs?
benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

turkey3_test wrote:

What are your computer specs?
Windows 7, about 3 years old?
I am not 100% sure how much RAM I have, but even if I have a poor computer, it would still worry me because some other people will experience the same problems as me.

Oh, and I've played 2 rounds of the game so far with no lag. Nice project, by the way!

I'll upload a test version of the game to my test account and then link to it here.
turkey3_test
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

benjamin2 wrote:

turkey3_test wrote:

What are your computer specs?
Windows 7, about 3 years old?
I am not 100% sure how much RAM I have, but even if I have a poor computer, it would still worry me because some other people will experience the same problems as me.

Oh, and I've played 2 rounds of the game so far with no lag. Nice project, by the way!

I'll upload a test version of the game to my test account and then link to it here.
Okay. I was just making sure you weren't on Windows Millenium try running the Windows Task Manager while you run your project, and as you experience lag, check how much percent of your CPU and RAM are being used up.
benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

http://scratch.mit.edu/projects/16149056/
Here is a test version. This is the same (very incomplete) version that I am using except for the added title screen text. Also, if you go to the Stage in See Inside mode, I've left a comment showing a way to very easily edit the level you start at (level 2 is the one with the problems I talked about earlier).
(Note: Levels 4, 6, 8 and 9 are unfinished)
I will now run Level 2 of the project online and report Task Manger readings.
EDIT: Oh, and thanks for your help so far.

Last edited by benjamin2 (Jan. 2, 2014 16:39:07)

benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

When the game is inactive, my CPU usage fluctuates but never exceeds about 15-20%.
When the title screen was running, the usage peaked at 38%.
During level 2 running the usage peaked at around 60%.
It was always fluctuating. My internet security did not warn me of high usage.

A thought came to my mind. The +25 bonuses moved really fast (way too fast, actually) and they run on a ‘repeat x, move y steps’ basis, whereas the obstacles (which lag) run on glide blocks (because I could use glide blocks there and thought it would be better). Could this be a cause of the problem?
turkey3_test
Scratcher
1000+ posts

A concern I have about the running speed of Scratch projects

benjamin2 wrote:

When the game is inactive, my CPU usage fluctuates but never exceeds about 15-20%.
When the title screen was running, the usage peaked at 38%.
During level 2 running the usage peaked at around 60%.
It was always fluctuating. My internet security did not warn me of high usage.

A thought came to my mind. The +25 bonuses moved really fast (way too fast, actually) and they run on a ‘repeat x, move y steps’ basis, whereas the obstacles (which lag) run on glide blocks (because I could use glide blocks there and thought it would be better). Could this be a cause of the problem?
Possibly… I personally never use the glide blocks myself because they can not be stopped when gliding and are not really used in other languages.
benjamin2
Scratcher
63 posts

A concern I have about the running speed of Scratch projects

turkey3_test wrote:

benjamin2 wrote:

When the game is inactive, my CPU usage fluctuates but never exceeds about 15-20%.
When the title screen was running, the usage peaked at 38%.
During level 2 running the usage peaked at around 60%.
It was always fluctuating. My internet security did not warn me of high usage.

A thought came to my mind. The +25 bonuses moved really fast (way too fast, actually) and they run on a ‘repeat x, move y steps’ basis, whereas the obstacles (which lag) run on glide blocks (because I could use glide blocks there and thought it would be better). Could this be a cause of the problem?
Possibly… I personally never use the glide blocks myself because they can not be stopped when gliding and are not really used in other languages.
I only use them when I can (eg. I don't need to interrupt them). Would they hurt though?

Powered by DjangoBB