Discuss Scratch

bobbysq
Scratcher
100+ posts

Too many clones will cause large FPS drops

If you play my project “Clone Pong,” if you're good enough at it, you can seriously lag Scratch due to all the clones. I checked Task Manager and there were no large spikes in memory or CPU usage.
Browser: Chrome
Project: Link
Edit: New discovery: The lag only happens when a clone is the one reproducing.

Last edited by bobbysq (Jan. 29, 2013 00:04:21)

jvvg
Scratcher
1000+ posts

Too many clones will cause large FPS drops

That's because it takes up more memory, and Flash is only allocated a certain amount. If it starts to run out, then it will slow down.


Professional web developer and lead engineer on the Scratch Wiki
Maybe the Scratch Team isn't so badWhy the April Fools' Day forum didn't work last year
bobbysq
Scratcher
100+ posts

Too many clones will cause large FPS drops

jvvg
That's because it takes up more memory, and Flash is only allocated a certain amount. If it starts to run out, then it will slow down.
Is there a way to give Flash more RAM? I have 8 gb, so I should be fine giving it more.
jvvg
Scratcher
1000+ posts

Too many clones will cause large FPS drops

bobbysq
jvvg
That's because it takes up more memory, and Flash is only allocated a certain amount. If it starts to run out, then it will slow down.
Is there a way to give Flash more RAM? I have 8 gb, so I should be fine giving it more.
Not that I know of.


Professional web developer and lead engineer on the Scratch Wiki
Maybe the Scratch Team isn't so badWhy the April Fools' Day forum didn't work last year
bobbysq
Scratcher
100+ posts

Too many clones will cause large FPS drops

New discovery: The lag only happens when a clone is the one reproducing.
technoguyx
Scratcher
500+ posts

Too many clones will cause large FPS drops

bobbysq
Is there a way to give Flash more RAM? I have 8 gb, so I should be fine giving it more.
From Stack Overflow:
fenomas
As long as your application keeps using more memory, desktop Flash will keep requesting it from the OS, until the OS runs out of memory or something crashes. Of course you the developer should limit your memory usage as appropriate, but Flash won't force you to do so.

Though if it's only clone scripts causing the problem, it may be the program's fault.

Scratcher since 2008.
johnm
Scratcher
100+ posts

Too many clones will cause large FPS drops

Clones don't take very much memory, so more memory probably wouldn't make it faster. I suspect either (a) the graphics or (b) sound playing. You could try removing the “play sound” block to see if that speeds things up. A good trick to speeding up graphics is to set the ball's rotation style to “don't rotate”, which you can set in the sprite info. This saves Flash from having to rotate the sprite as it changes direction. (But perhaps it's already doing that.)

Nice idea to combine Pong and clone. It gets harder really fast!
bobbysq
Scratcher
100+ posts

Too many clones will cause large FPS drops

johnm
Clones don't take very much memory, so more memory probably wouldn't make it faster. I suspect either (a) the graphics or (b) sound playing. You could try removing the “play sound” block to see if that speeds things up. A good trick to speeding up graphics is to set the ball's rotation style to “don't rotate”, which you can set in the sprite info. This saves Flash from having to rotate the sprite as it changes direction. (But perhaps it's already doing that.)

Nice idea to combine Pong and clone. It gets harder really fast!
I noticed that the ball is already on “don't rotate.” Does it reset on clones?

Powered by DjangoBB