This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-06-06 18:26:33

boinoinoi
Scratcher
Registered: 2007-06-05
Posts: 500+

How would I make a project faster?

So I've been working on a project for about 2 years now, which means yes, I started with the first public version of Scratch. Anyway, when I try to play it, it runs really slowly. I was wondering if there was some sort of strategy on how to optimize scripts.

I'm really hoping for a response, as this would be another huge motivator to finally finish this project.


http://i30.tinypic.com/335fpxx.jpg
"Boinoinoi is the only person on the forums that I expect to be wearing a monocle all the time behind that screen, so I'm sure being as classy as he is, he knows what he's doing"        http://myfastcounter.com/count.php?c_style=88&id=1284259111http://myfastcounter.com/count.php?c_style=88&id=1286068127

Offline

 

#2 2009-06-06 18:29:17

fruit
Scratcher
Registered: 2009-04-24
Posts: 1000+

Re: How would I make a project faster?

You could try removing some of the <when green flag clicked> or

<forever> blocks. they cause a lot of lag.

Last edited by fruit (2009-06-06 18:29:52)


@savi3000 | hcsmp.com

Offline

 

#3 2009-06-06 18:48:19

Tag4eva
Scratcher
Registered: 2009-06-05
Posts: 100+

Re: How would I make a project faster?

boinoinoi wrote:

So I've been working on a project for about 2 years now, which means yes, I started with the first public version of Scratch. Anyway, when I try to play it, it runs really slowly. I was wondering if there was some sort of strategy on how to optimize scripts.

I'm really hoping for a response, as this would be another huge motivator to finally finish this project.

Compress sound and Images. Remove ineccesary music and large images. So on... Hope that helps! big_smile

Offline

 

#4 2009-06-06 19:01:04

SpriteX
Scratcher
Registered: 2009-06-02
Posts: 100+

Re: How would I make a project faster?

Tag4eva wrote:

boinoinoi wrote:

So I've been working on a project for about 2 years now, which means yes, I started with the first public version of Scratch. Anyway, when I try to play it, it runs really slowly. I was wondering if there was some sort of strategy on how to optimize scripts.

I'm really hoping for a response, as this would be another huge motivator to finally finish this project.

Compress sound and Images. Remove ineccesary music and large images. So on... Hope that helps! big_smile

Boinoinoi has been with us for a very lon time and i think he knows that...anyways if you read the post carefully he specificly is talking about how to make the scripts not interfer with the game and make it not lag


Click The Picture! SpriteX The Next Generation Of Sprites!
http://i42.tinypic.com/f3b8yu.png http://www.mysmiley.net/imgs/smile/characters/character0049.gif

Offline

 

#5 2009-06-06 19:04:24

Tag4eva
Scratcher
Registered: 2009-06-05
Posts: 100+

Re: How would I make a project faster?

SpriteX wrote:

Tag4eva wrote:

boinoinoi wrote:

So I've been working on a project for about 2 years now, which means yes, I started with the first public version of Scratch. Anyway, when I try to play it, it runs really slowly. I was wondering if there was some sort of strategy on how to optimize scripts.

I'm really hoping for a response, as this would be another huge motivator to finally finish this project.

Compress sound and Images. Remove ineccesary music and large images. So on... Hope that helps! big_smile

Boinoinoi has been with us for a very lon time and i think he knows that...anyways if you read the post carefully he specificly is talking about how to make the scripts not interfer with the game and make it not lag

I didn't try to say that boinoinoi didn't know what I said but I was just trying to help. That actually hurt my feelings that you would think my comment was useless.

Offline

 

#6 2009-06-06 19:09:39

SpriteX
Scratcher
Registered: 2009-06-02
Posts: 100+

Re: How would I make a project faster?

Tag4eva wrote:

SpriteX wrote:

Tag4eva wrote:


Compress sound and Images. Remove ineccesary music and large images. So on... Hope that helps! big_smile

Boinoinoi has been with us for a very lon time and i think he knows that...anyways if you read the post carefully he specificly is talking about how to make the scripts not interfer with the game and make it not lag

I didn't try to say that boinoinoi didn't know what I said but I was just trying to help. That actually hurt my feelings that you would think my comment was useless.

well i am sorry if my post hurt your feelings but read my post again please. i was just Correcting you....also NOWHERE in my post said that your post was useless and i was just informing you ABOUT Boinoinoi. Also it sounds like you are trying to make me feel bad and i know you are trying to help. Sorry for any misunderstanding and Scratch-On! Hope you understand what i was trying to say.


Click The Picture! SpriteX The Next Generation Of Sprites!
http://i42.tinypic.com/f3b8yu.png http://www.mysmiley.net/imgs/smile/characters/character0049.gif

Offline

 

#7 2009-06-06 19:14:57

Tag4eva
Scratcher
Registered: 2009-06-05
Posts: 100+

Re: How would I make a project faster?

SpriteX wrote:

Tag4eva wrote:

SpriteX wrote:


Boinoinoi has been with us for a very lon time and i think he knows that...anyways if you read the post carefully he specificly is talking about how to make the scripts not interfer with the game and make it not lag

I didn't try to say that boinoinoi didn't know what I said but I was just trying to help. That actually hurt my feelings that you would think my comment was useless.

well i am sorry if my post hurt your feelings but read my post again please. i was just Correcting you....also NOWHERE in my post said that your post was useless and i was just informing you ABOUT Boinoinoi. Also it sounds like you are trying to make me feel bad and i know you are trying to help. Sorry for any misunderstanding and Scratch-On! Hope you understand what i was trying to say.

It's ok, I'll forgive you! Are we friends again? Well, I am! big_smile

Offline

 

#8 2009-06-06 19:18:05

SpriteX
Scratcher
Registered: 2009-06-02
Posts: 100+

Re: How would I make a project faster?

Tag4eva wrote:

SpriteX wrote:

Tag4eva wrote:

I didn't try to say that boinoinoi didn't know what I said but I was just trying to help. That actually hurt my feelings that you would think my comment was useless.

well i am sorry if my post hurt your feelings but read my post again please. i was just Correcting you....also NOWHERE in my post said that your post was useless and i was just informing you ABOUT Boinoinoi. Also it sounds like you are trying to make me feel bad and i know you are trying to help. Sorry for any misunderstanding and Scratch-On! Hope you understand what i was trying to say.

It's ok, I'll forgive you! Are we friends again? Well, I am! big_smile

Yes we are and lets get back to topic!  smile


Click The Picture! SpriteX The Next Generation Of Sprites!
http://i42.tinypic.com/f3b8yu.png http://www.mysmiley.net/imgs/smile/characters/character0049.gif

Offline

 

#9 2009-06-06 20:06:51

fruit
Scratcher
Registered: 2009-04-24
Posts: 1000+

Re: How would I make a project faster?

Lawl, flame wars all over the place lately.


@savi3000 | hcsmp.com

Offline

 

#10 2009-06-06 20:22:21

ScratchX
Scratcher
Registered: 2009-05-05
Posts: 1000+

Re: How would I make a project faster?

fruit wrote:

Lawl, flame wars all over the place lately.

ok fruit...it is not a FLAME WAR...a FLAME WAR is if we called eachothers names like idiot or make fun of them...have i said any of thse things? No i haven't. All i have done is correct people that is it..So would you refer this as a Correct War?lolz


Happy New Year!
http://i45.tinypic.com/1nyasi.pnghttp://i50.tinypic.com/219pez8.pnghttp://i49.tinypic.com/e5s4zr.pnghttp://i48.tinypic.com/23l18hf.jpghttp://i49.tinypic.com/66zymu.png

Offline

 

#11 2009-06-06 22:30:56

cheddargirl
Scratch Team
Registered: 2008-09-15
Posts: 1000+

Re: How would I make a project faster?

Okay, the little tiff between Tag4Eva and SpriteX has been resolved, no need to discuss that any further.

Anyway, back on topic:
I've heard that using Scratch's variable display can make a project sluggish. If you have variable displays showing and don't need the variable displays showing, have then hidden.

Other than that and what's given in other posts above, I can't think of anything else, except for perhaps rewriting the code for optimal use.  hmm


http://i.imgur.com/8QRYx.png
Everything is better when you add a little cheddar, because when you have cheese your life is at ease  smile

Offline

 

#12 2009-06-06 22:55:36

Tag4eva
Scratcher
Registered: 2009-06-05
Posts: 100+

Re: How would I make a project faster?

cheddargirl wrote:

Okay, the little tiff between Tag4Eva and SpriteX has been resolved, no need to discuss that any further.

Anyway, back on topic:
I've heard that using Scratch's variable display can make a project sluggish. If you have variable displays showing and don't need the variable displays showing, have then hidden.

Other than that and what's given in other posts above, I can't think of anything else, except for perhaps rewriting the code for optimal use.  hmm

Great tips! Maybe you can ask Archmage for some tips since he is optimising Super Smash Scratch?

Offline

 

#13 2009-06-07 03:14:04

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: How would I make a project faster?

So... Here it goes:

• Make sure you hide all variable displays - they can in some cases slow down projects with 50%. You could use health bars etc instead.
• Try to avoid one of the following blocks in a forever loop:

[blocks]
<set[  ]effect to(
<change[  ]effect by(
<hide>
<show>
[/blocks]

Hide/Show blocks should only be run once, so, say you want to hide a sprite when it touches another sprite; you could do this:

When GF clicked
forever
   if touching sprite1
      hide
   else
      show
---

which slows down a project a lot, since you keep "activating" hide or show. Use this instead:

When GF clicked
forever
   wait until touching sprite1
   hide
   wait until not touching sprite1
   show
---

• Split up your scripts in different parts as much as you can - scripts work perfetly parallel but long scripts run really slow. If you are using a long calculation in your scripts, you could for example take it out and put it into another script (or even sprite!)
• When you need to do a whole bunch of calculations, put them on a different sprite and hide it.

Maybe you could upload your project and we can try to make it faster? I understand if you don't want to, I also have those 2yrs projects and in myn case, I'd like to finish them on my own xD


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#14 2009-06-07 11:08:54

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: How would I make a project faster?

boinoinoi wrote:

So I've been working on a project for about 2 years now, which means yes, I started with the first public version of Scratch. Anyway, when I try to play it, it runs really slowly. I was wondering if there was some sort of strategy on how to optimize scripts.

I'm really hoping for a response, as this would be another huge motivator to finally finish this project.

Instead of 40 variables use 1 list with 40 items. Use replace item (number) blocks instead of add and set to blocks. You may need to write down what number each variable is but I believe this will speed up the project...
This is 1.3 and beyond. There are no lists before that.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#15 2009-06-07 11:10:04

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: How would I make a project faster?

juststickman wrote:

boinoinoi wrote:

So I've been working on a project for about 2 years now, which means yes, I started with the first public version of Scratch. Anyway, when I try to play it, it runs really slowly. I was wondering if there was some sort of strategy on how to optimize scripts.

I'm really hoping for a response, as this would be another huge motivator to finally finish this project.

Instead of 40 variables use 1 list with 40 items. Use replace item (number) blocks instead of add and set to blocks. You may need to write down what number each variable is but I believe this will speed up the project...
This is 1.3 and beyond. There are no lists before that.

Only problem with this is you can't really display... But like cheddagirl said, that will slow things down.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#16 2009-06-07 12:42:17

boinoinoi
Scratcher
Registered: 2007-06-05
Posts: 500+

Re: How would I make a project faster?

JSO wrote:

• Split up your scripts in different parts as much as you can - scripts work perfetly parallel but long scripts run really slow. If you are using a long calculation in your scripts, you could for example take it out and put it into another script (or even sprite!)

That strikes me as somewhat funny, since I had been putting the scripts into single long scripts. Time to take 'em apart XD

juststickman wrote:

Instead of 40 variables use 1 list with 40 items. Use replace item (number) blocks instead of add and set to blocks. You may need to write down what number each variable is but I believe this will speed up the project...
This is 1.3 and beyond. There are no lists before that.

I'm not sure whether that would help or not. I have about 20 variables, all used extensively, and redoing them all would be a real pain. What would help would be a make-your-own-boolean.

Tag4eva wrote:

boinoinoi wrote:

So I've been working on a project for about 2 years now, which means yes, I started with the first public version of Scratch. Anyway, when I try to play it, it runs really slowly. I was wondering if there was some sort of strategy on how to optimize scripts.

    I'm really hoping for a response, as this would be another huge motivator to finally finish this project.

Compress sound and Images. Remove ineccesary music and large images. So on... Hope that helps!  big_smile

Haha, you actually have a point. For the last few versions, I've had WAY too much music.

JSO wrote:

Maybe you could upload your project and we can try to make it faster? I understand if you don't want to, I also have those 2yrs projects and in myn case, I'd like to finish them on my own xD

There have been 7 versions I've put up already, but the current one is a lot different and is saved in 1.4... So even if I DID share it, only a select few would be able to help me.

Anyways, more help is always appreciated, and this is serving as a great distraction for my term paper. Don't think that you can't still help.

Last edited by boinoinoi (2009-06-07 12:42:42)


http://i30.tinypic.com/335fpxx.jpg
"Boinoinoi is the only person on the forums that I expect to be wearing a monocle all the time behind that screen, so I'm sure being as classy as he is, he knows what he's doing"        http://myfastcounter.com/count.php?c_style=88&amp;id=1284259111http://myfastcounter.com/count.php?c_style=88&amp;id=1286068127

Offline

 

#17 2009-06-07 21:08:01

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How would I make a project faster?

Loops really slow things down. Avoid them when you can.
(e.g. instead of two forever loops combine them into one)

Offline

 

#18 2009-06-08 14:04:54

yambanshee
Scratcher
Registered: 2007-11-06
Posts: 500+

Re: How would I make a project faster?

this is where the difference comes between a good programmer, and a really good programmer. Basicly, its all about the details. Every block that you use, but don't need is a waste of space and will slow everything down. Loops must be used with care, if you dont need it, once again, dont use it. go through everything, and make sure that you cant think of a better way to calculate something using less (maybe more complex) scripts. Good luck optimizing  big_smile . One day i will check to see which work better, built in scratch blocks V more basic blocks to acomplish the same task as the built in (using sine/cosine instead of move X blocks, and so on...)

Offline

 

#19 2009-06-08 16:07:53

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: How would I make a project faster?

boinoinoi wrote:

JSO wrote:

• Split up your scripts in different parts as much as you can - scripts work perfetly parallel but long scripts run really slow. If you are using a long calculation in your scripts, you could for example take it out and put it into another script (or even sprite!)

That strikes me as somewhat funny, since I had been putting the scripts into single long scripts. Time to take 'em apart XD

juststickman wrote:

Instead of 40 variables use 1 list with 40 items. Use replace item (number) blocks instead of add and set to blocks. You may need to write down what number each variable is but I believe this will speed up the project...
This is 1.3 and beyond. There are no lists before that.

I'm not sure whether that would help or not. I have about 20 variables, all used extensively, and redoing them all would be a real pain. What would help would be a make-your-own-boolean.

Tag4eva wrote:

boinoinoi wrote:

So I've been working on a project for about 2 years now, which means yes, I started with the first public version of Scratch. Anyway, when I try to play it, it runs really slowly. I was wondering if there was some sort of strategy on how to optimize scripts.

    I'm really hoping for a response, as this would be another huge motivator to finally finish this project.

Compress sound and Images. Remove ineccesary music and large images. So on... Hope that helps!  big_smile

Haha, you actually have a point. For the last few versions, I've had WAY too much music.

JSO wrote:

Maybe you could upload your project and we can try to make it faster? I understand if you don't want to, I also have those 2yrs projects and in myn case, I'd like to finish them on my own xD

There have been 7 versions I've put up already, but the current one is a lot different and is saved in 1.4... So even if I DID share it, only a select few would be able to help me.

Anyways, more help is always appreciated, and this is serving as a great distraction for my term paper. Don't think that you can't still help.

I can help, I got 1.4


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#20 2009-06-09 10:50:44

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: How would I make a project faster?

As I said - two loops is better as one long! Believe me...

Loops don't slow things down if you follow up everything in my post above.


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#21 2009-06-09 11:33:39

Awsome-me
Scratcher
Registered: 2008-10-11
Posts: 59

Re: How would I make a project faster?

What is it? If it has choices to choose different sprites, make those sprites one. THIS IS MY 50'th POST! YAY!


Check out my awsome stuff at http://scratch.mit.edu/users/Awsome-me
I've even got youtube: http://www.youtube.com/user/LegoPatapon

Offline

 

Board footer