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

#1 2009-01-01 20:31:21

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Need help reducing lag in project

http://scratch.mit.edu/projects/archmage/358968

This is the project I want to run faster. Only essential scripts are running and I want to know if there is a way to reduce lag without changing the way the project preforms.

Any help is appreciated  big_smile


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#2 2009-01-02 10:02:01

Nick60
Scratcher
Registered: 2007-06-17
Posts: 100+

Re: Need help reducing lag in project

Cut on the graphic effects set by the project.  Also, lets say you had a sprite that was set on 'Forever' while changing colors/sprite.  Try and make it only change when you see it.


Let's  Be Blue!

Offline

 

#3 2009-01-02 14:30:54

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Nick60 wrote:

Cut on the graphic effects set by the project.  Also, lets say you had a sprite that was set on 'Forever' while changing colors/sprite.  Try and make it only change when you see it.

There are no graphical effects, just costume changes. Perhaps you can remix it to show how to increase it's speed?

I think I may be able to make it faster by fixing some redundancy that I over looked. It runs fantastically offline though.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#4 2009-01-02 15:10:39

Nick60
Scratcher
Registered: 2007-06-17
Posts: 100+

Re: Need help reducing lag in project

What parts cause the lag issue?

Last edited by Nick60 (2009-01-02 15:14:15)


Let's  Be Blue!

Offline

 

#5 2009-01-02 15:14:34

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Ok, I have pinpointed the source of the lag.
http://scratch.mit.edu/projects/archtest/369328

On this project, the character variable is set to 0. If you click one of the character buttons you can set it to a number and you can see the effect it has on lag.

I think that there are several thing that could cause the lag.

1. Too many if statements slow things down
2. Repeat loops are slowing things down
3. Repetitive calls the the animationDelay variable is slowing down the project.

Number 3 is the easiest to deal with so I will try to take out the variables and just put number in the wait blocks.

Last edited by archmage (2009-01-02 15:16:50)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#6 2009-01-02 15:17:33

Nick60
Scratcher
Registered: 2007-06-17
Posts: 100+

Re: Need help reducing lag in project

Too bad you can't create switch statements in Scratch.

Anyways, 1 shouldn't be much of a problem but 2 and 3 will.
EDIT: http://scratch.mit.edu/projects/Nick60/368572 (Know a way to fix the lag issues here.  I currently working on another version that will fix all Bomb related issues and guns.  But I'm afraid with the new update comes a lot more lag)

Ok, I have pinpointed the source of the lag.
http://scratch.mit.edu/projects/archtest/369328

That project isn't laggy at all.  Perhaps all the walking and fighting animations are the main problem.

Last edited by Nick60 (2009-01-02 15:21:59)


Let's  Be Blue!

Offline

 

#7 2009-01-02 15:42:14

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Nick60 wrote:

That project isn't laggy at all.  Perhaps all the walking and fighting animations are the main problem.

Yeah, thats what I was trying to get at. I should have made myself more clear.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#8 2009-01-02 17:26:54

archtest
Scratcher
Registered: 2008-11-11
Posts: 5

Re: Need help reducing lag in project

Ok, number 3 doesn't cause problems.
http://scratch.mit.edu/projects/archtest/369328

This project fixes in issue only in the Mario animations. I could not see a noticeable diffrence between animations that used the animationDelay variable and the Mario animations which did not use the animationDelay variable.

Again, help would be appreciated.

Offline

 

#9 2009-01-02 18:40:33

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help reducing lag in project

Ok, I have 1 idea (though I don't know if it will completely help), you know how when mario's standing he doesn't do any animations? Well you have those animation frames, and you should get rid of them. It should take away about 50 costumes, (out of 860 lol)

Last edited by Lucario621 (2009-01-02 18:41:50)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#10 2009-01-02 18:42:31

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Lucario621 wrote:

Ok, I have 1 idea (though I don't know if it will completely help), you know how when mario's standing he doesn't do any animations? Well you have those animation frames, and you should get rid of them.

Ok, the amount of costumes doesn't impact lag. I have confirmed this. The animation scripts are causing the lag. I am very sure of this.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#11 2009-01-02 19:03:22

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help reducing lag in project

archmage wrote:

Lucario621 wrote:

Ok, I have 1 idea (though I don't know if it will completely help), you know how when mario's standing he doesn't do any animations? Well you have those animation frames, and you should get rid of them.

Ok, the amount of costumes doesn't impact lag. I have confirmed this. The animation scripts are causing the lag. I am very sure of this.

So your saying, "The animation scripts are causing the lag. I am very sure of this." so the official problem is, how to fix it lol?


http://i.imgur.com/WBkM2QQ.png

Offline

 

#12 2009-01-02 19:06:40

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Lucario621 wrote:

archmage wrote:

Lucario621 wrote:

Ok, I have 1 idea (though I don't know if it will completely help), you know how when mario's standing he doesn't do any animations? Well you have those animation frames, and you should get rid of them.

Ok, the amount of costumes doesn't impact lag. I have confirmed this. The animation scripts are causing the lag. I am very sure of this.

So your saying, "The animation scripts are causing the lag. I am very sure of this." so the official problem is, how to fix it lol?

That is correct.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#13 2009-01-02 19:06:59

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help reducing lag in project

Ok, so I (sadly) perhaps don't know how to fix this problem on the character sprite, though I can definately make this project to have 6 less sprites:

-Only 1 character button
-Depending on the mouse x and y position it will brodcast the correct message.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#14 2009-01-02 19:08:22

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help reducing lag in project

P.S. When will you add the character "archmage"? I swear I'll play on that character till I've broken my videogame hands XD


http://i.imgur.com/WBkM2QQ.png

Offline

 

#15 2009-01-02 19:08:43

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Lucario621 wrote:

Ok, so I (sadly) perhaps don't know how to fix this problem on the character sprite, though I can definately make this project to have 6 less sprites:

-Only 1 character button
-Depending on the mouse x and y position it will brodcast the correct message.

That is definitely not necessary. I prefer to have actual buttons.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#16 2009-01-02 19:10:41

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help reducing lag in project

Ok, I have one (miniscule) idea, maybe you could get rid of the "if stance = 4" scripts, because their useless.


http://i.imgur.com/WBkM2QQ.png

Offline

 

#17 2009-01-02 19:10:46

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Lucario621 wrote:

P.S. When will you add the character "archmage"? I swear I'll play on that character till I've broken my videogame hands XD

I am working on it right now.

This is an archive of all the archmage sprites so far.
http://rapidshare.com/files/179195531/amage_sprites.rar.html


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#18 2009-01-02 19:11:49

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Lucario621 wrote:

Ok, I have one (miniscule) idea, maybe you could get rid of the "if stance = 4" scripts, because their useless.

Yeah I know. Scratch couldn't handle all the frames in the double jump without lag.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#19 2009-01-02 19:14:12

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help reducing lag in project

archmage wrote:

Lucario621 wrote:

P.S. When will you add the character "archmage"? I swear I'll play on that character till I've broken my videogame hands XD

I am working on it right now.

This is an archive of all the archmage sprites so far.
http://rapidshare.com/files/179195531/amage_sprites.rar.html

...these days I have no idea where you find such wierd and unknown websites.
[edit]for some reason I can only save it cuz its a .rar and I have no idea what da heck that is.

Last edited by Lucario621 (2009-01-02 19:18:30)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#20 2009-01-02 19:17:25

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

Lucario621 wrote:

archmage wrote:

Lucario621 wrote:

P.S. When will you add the character "archmage"? I swear I'll play on that character till I've broken my videogame hands XD

I am working on it right now.

This is an archive of all the archmage sprites so far.
http://rapidshare.com/files/179195531/amage_sprites.rar.html

...these days I have no idea where you find such wierd and unknown websites.

Weird and unknown? You have never heard of rapidshare? It is just a file hosting website.

PS: Everyone knows about rapidshare.com

Last edited by archmage (2009-01-02 19:18:01)


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#21 2009-01-02 19:19:13

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help reducing lag in project

archmage wrote:

Lucario621 wrote:

archmage wrote:

I am working on it right now.

This is an archive of all the archmage sprites so far.
http://rapidshare.com/files/179195531/amage_sprites.rar.html

...these days I have no idea where you find such wierd and unknown websites.

Weird and unknown? You have never heard of rapidshare? It is just a file hosting website.

PS: Everyone knows about rapidshare.com

uhh...*
anyway I can't open it cuz its an .rar, whats that?

Last edited by Lucario621 (2009-01-02 19:19:59)


http://i.imgur.com/WBkM2QQ.png

Offline

 

#22 2009-01-02 19:21:02

Nick60
Scratcher
Registered: 2007-06-17
Posts: 100+

Re: Need help reducing lag in project

Extract it to your desktop first.  (Use Winrar)


Let's  Be Blue!

Offline

 

#23 2009-01-02 19:22:40

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

It is in a .rar archive

http://www.rarlab.com/

Get winrar.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#24 2009-01-02 19:26:08

Lucario621
Community Moderator
Registered: 2007-10-03
Posts: 1000+

Re: Need help reducing lag in project

...nvm why did I even ask if I'm just going to get a * program that I'll rarely use...


http://i.imgur.com/WBkM2QQ.png

Offline

 

#25 2009-01-02 19:28:19

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Need help reducing lag in project

It doesnt matter too much. It will be done by the end of today.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

Board footer