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

#26 2012-02-02 05:11:36

eventexception
Scratcher
Registered: 2011-04-08
Posts: 500+

Re: Is your game slow? Here's a guide to making faster projects!

More ideas: try to get access to the Scratch wiki, i think it belongs there too.
Edit your first topic post: link to other helpful articles and Scratch wikis.

Last edited by eventexception (2012-02-17 05:27:32)

Offline

 

#27 2012-02-02 07:55:03

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

AddInnovation wrote:

Great Tips - thanks for those.

Also on a point of faster processing AND Development,

I started looking at a breakout style game a while back, and one of the most frustrating elements was when making changes to the main script behind one "brick" sprite, and following that through to each other script and then personalising that script on each brick sprite.

E.g. I have one brick script I work concentrate on and refine the scripts for called R1C1, then I've got 5 rows, and 10 columns on each - 50 sprites in all. I'd refine the script on R1C1, then drag and drop onto each other sprite, and then change all of the references where necessary to the name of each sprite.

I've found a much better approach is to use one local variable with the sprite's name, and then use a list to represent the name of each visible sprite.

The upside is that it makes detections easier with a small script using a loop, the online downside could be in the extra time for loops, but overall it works faster.

I'd set up a game "Skeleteons in Wellingtons" with several scripts for the skeletons. There's a slightly different set of scripts of Skelly 1, but Skelly 2-5 are all almost exactly the same, and to add a new skelly I just duplicate the sprite and change it's "MyName" variable, then add it to the list of "monsters" - works great !

In my city game (link at the top) I had to make each individual tile a sprite and it took forever! The good thing was though that all I would have to do is change three numbers on this one sprite and it would effect the positions of everything else. It worked quite well, but I never knew you could use that script. One thing I would suggest it instead of dragging the scripts onto each one, just duplicated the script, change the necessary variables and re-duplicate so that A.You know you've done each one and B. you can quit at any time and know where you left off.


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#28 2012-02-03 07:45:31

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

Borrego6165 wrote:

eventexception wrote:

Great guide!
Is ´Show and tell´ the best category for? Ask a mod to move it  smile

Btw. ´ghosting´ slows down one of my projects running with the Flash player.

Maybe "help with scripts" would be best. where do you go to ask? and thanks, i'll add a bit about translucency.

I agree!  There is lots of useful information here.  But I don't want to set a precedent of allowing advertising in Help With Scripts.  Why don't you make a few changes so that you are not explicitly advertising and then let us know with the Report button again?  It's okay to link to projects to demonstrate key concepts...but advertising is not what HWS is all about.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#29 2012-02-03 11:05:36

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

Paddle2See wrote:

Borrego6165 wrote:

eventexception wrote:

Great guide!
Is ´Show and tell´ the best category for? Ask a mod to move it  smile

Btw. ´ghosting´ slows down one of my projects running with the Flash player.

Maybe "help with scripts" would be best. where do you go to ask? and thanks, i'll add a bit about translucency.

I agree!  There is lots of useful information here.  But I don't want to set a precedent of allowing advertising in Help With Scripts.  Why don't you make a few changes so that you are not explicitly advertising and then let us know with the Report button again?  It's okay to link to projects to demonstrate key concepts...but advertising is not what HWS is all about.

I half-advertised it so that it could go in show and tell, that's the only reason i did it like that. I'll change it!


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#30 2012-02-08 15:33:35

joshbradbury52
Scratcher
Registered: 2010-04-02
Posts: 3

Re: Is your game slow? Here's a guide to making faster projects!

okay i see how this is useful but with my minecraft world generator do you know how this can apply to it because i don't see how it will speed it up. look at V3 for the fastest version where i have tried to speed it up but i have to keep it on turbo speed for the generation to be fast enough to look nice with the movement but do you think you could look at it and try to see how to make it look smooth on normal mode? if you could it would be a great help.

Offline

 

#31 2012-02-08 17:47:24

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

check your comments!


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#32 2012-02-10 21:43:50

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

Wow! This is a great guide, maybe even sticky-worthy!


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#33 2012-02-16 21:28:45

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

ug, my stop motion animation was way to big! i compressed and everything!


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#34 2012-02-19 14:21:37

DaScratcher101
Scratcher
Registered: 2012-02-16
Posts: 41

Re: Is your game slow? Here's a guide to making faster projects!

I understand this guide, but I have no idea how to make my project smoother. It is VERY laggy. Could you take a look at it? Here's the link.
http://scratch.mit.edu/projects/DaScratcher101/2342062

Offline

 

#35 2012-03-20 14:11:00

Splodgey
Scratcher
Registered: 2011-04-26
Posts: 500+

Re: Is your game slow? Here's a guide to making faster projects!

OK, I'll have a look at this later. The main reason why I am posting is so that I will remember this as it will appear when I view my posts.

Offline

 

#36 2012-04-06 07:00:29

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

bumpio


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#37 2012-04-09 15:10:29

LiquidMetal
Scratcher
Registered: 2011-06-15
Posts: 500+

Re: Is your game slow? Here's a guide to making faster projects!

Very thorough, useful, guide. Nice work!

Offline

 

#38 2012-04-09 15:42:12

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

LiquidMetal wrote:

Very thorough, useful, guide. Nice work!

thanks!


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#39 2012-04-10 03:41:19

Splodgey
Scratcher
Registered: 2011-04-26
Posts: 500+

Re: Is your game slow? Here's a guide to making faster projects!

Nice guide.

"Merging" sprites seems to be a good way of improving performance. If you have 2 different menus (a main menu and an options menu) Then you can use the "options" button in the same sprite as the "back" button. You would need something like this:

when [options/back v] clicked
if <(costume#) = [1]> //Costume 1 is options and costume 2 is back.
broadcast [options v] //or whatever it does
switch to costume [back v]
goto the right place
else
broadcast [title v]
switch to costume [options v]
goto the right place
end
That way you need one less sprite. Having less sprites seems to have surprising impact on performance. You could probably do a similar thing to merge the player with the play button if you don't have an options menu. But this wouldn't have the else and, animation might get in the way.

Offline

 

#40 2012-04-10 13:05:31

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

Splodgey wrote:

Nice guide.

"Merging" sprites seems to be a good way of improving performance. If you have 2 different menus (a main menu and an options menu) Then you can use the "options" button in the same sprite as the "back" button. You would need something like this:

when [options/back v] clicked
if <(costume#) = [1]> //Costume 1 is options and costume 2 is back.
broadcast [options v] //or whatever it does
switch to costume [back v]
goto the right place
else
broadcast [title v]
switch to costume [options v]
goto the right place
end
That way you need one less sprite. Having less sprites seems to have surprising impact on performance. You could probably do a similar thing to merge the player with the play button if you don't have an options menu. But this wouldn't have the else and, animation might get in the way.

God I'm such an idiot! I do that all the time and I never thought of putting it in! Thanks for reminding me  big_smile


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#41 2012-04-10 13:23:00

SOScratch
Scratcher
Registered: 2010-02-01
Posts: 100+

Re: Is your game slow? Here's a guide to making faster projects!

I have had a lot of problems with lagging scratch projects but for some reason, they work fine online and lag when downloaded.
But this helped!
Even though, I guess there eventually is a limit because you can't just go on forever, even with really efficient programming.


-SOScratch
Scratch On!

Offline

 

#42 2012-06-23 11:27:02

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

bump- hope this helps!


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#43 2012-06-23 16:26:54

Pawnfork
Scratcher
Registered: 2011-02-06
Posts: 14

Re: Is your game slow? Here's a guide to making faster projects!

I have seen some programs here with large numbers of event activated scripts that got stuck and actually were doing things in peculiar order.  Thanks for your kind words supporting neoclassical architecture by using variables more.  Also, if you had a bunch of scripts be activated by say the same keystroke, would that many of us really have the discipline to make sure all the scripts are done and really ready to move on?  Some days its good to be an old fart.

Offline

 

#44 2012-06-23 16:51:32

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

Pawnfork wrote:

I have seen some programs here with large numbers of event activated scripts that got stuck and actually were doing things in peculiar order.  Thanks for your kind words supporting neoclassical architecture by using variables more.  Also, if you had a bunch of scripts be activated by say the same keystroke, would that many of us really have the discipline to make sure all the scripts are done and really ready to move on?  Some days its good to be an old fart.

well this is an old guide and in my Rayman 4 game I scrapped the S,D,F,code and used an auto-mated one that re-shuffled the layers every time you started it. I just forgot to put it into the guide

Last edited by Borrego6165 (2012-06-23 16:51:48)


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#45 2012-06-24 14:32:12

Borrego6165
Scratcher
Registered: 2011-03-10
Posts: 1000+

Re: Is your game slow? Here's a guide to making faster projects!

bump


Generation:4001 Build a beautiful city, with over 50 objects and over 10000 tiles per city! This simulates traffic, pollution, tourism, crime and more!

Offline

 

#46 2012-06-25 09:49:17

Splodgey
Scratcher
Registered: 2011-04-26
Posts: 500+

Re: Is your game slow? Here's a guide to making faster projects!

SOScratch wrote:

but for some reason, they work fine online and lag when downloaded.

Flash player is a lot faster than the offline scratch player.

Offline

 

Board footer