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

#1 2010-11-08 20:51:38

josc4941
New Scratcher
Registered: 2010-10-20
Posts: 7

BYOB Project

Hi everyone.

I'm and Engineering student at University of Colorado at Boulder and am working on a scratch based game coded in BYOB 3, and integrated with a PiCo board.  The general premise of the game is to have a player run in place on a DDR like board in which the alternating foot motions will close and open circuits which the PiCo board can sense.  When the circuits are alternating closed and open the program reads that the player runs forward, and if the circuits are not alternating the player travels backwards in the game.  Jumping is also determined by whether the player jumps on the board (think both feet leaving either side of the board at the same time). 

Anyways, I have the program almost fully functional, but it has become very slow to run on any computer that I try to run it on.  I'm looking for tips on how to make this program run well again.  I thought someone with a more intimate knowledge of Scratch/BYOB could best assist me.

You can download the BYOB project at...
http://www.mediafire.com/?4zzfxuqycxi1lft

Thanks,
Joseph

Offline

 

#2 2010-11-09 00:27:49

tinoesroho
Scratcher
Registered: 2010-04-26
Posts: 100+

Re: BYOB Project

Joseph,

Have you tried combining all the different scripts under "when green flag pressed"? I'm trying to make sense of the code at the moment, and with only less than ten minutes to get this done in, I'm giving it a quick shot.

I've noticed in my own testing that the timer moves jerkily on my computer. In my project Bounce!, I used a forever block and had <Timer> set to (Timer).

EDIT:
I've succeeded in crashing the project completely. Note to self: Do not set custom blocks to be atomic.

EDIT:
Successfully combined scripts for backgrounds and terrain.

EDIT:
Is that set x y position block necessary? I'm not sure.

Last edited by tinoesroho (2010-11-09 00:38:11)


 Maurer Rose by TheVikings Should be featured. See the project in action here and my reasons here. 

Offline

 

#3 2010-11-09 00:45:09

josc4941
New Scratcher
Registered: 2010-10-20
Posts: 7

Re: BYOB Project

haha...

Most of the custom blocks are made simply to make the overall code less cluttered and easier to read, without any functional difference between how they could be coded in Scratch vs BYOB.  Some on the other hand are very useful and make coding faster.

I think that combining scripts which contain forever loops with other scripts that contain forever loops doesn't work.  I'll try to take out the forever loops inside my custom blocks and put them within one forever loop. This may yield better performance. (Hopefully)

I've tried just about every combination of atomic and non atomic blocks/scripts but none have yielded any performance improvement.

Joseph

Offline

 

#4 2010-11-09 00:53:59

josc4941
New Scratcher
Registered: 2010-10-20
Posts: 7

Re: BYOB Project

Hmmm... Can't figure out how to edit posts! Anyways, the Set XY position block is unnecessary.  It was originally intended to use so I could carry the X and Y position of the character between sprites (To make the hit tests move with the character) but then I discovered the GoTo block.

Offline

 

#5 2010-11-09 01:41:46

josc4941
New Scratcher
Registered: 2010-10-20
Posts: 7

Re: BYOB Project

It is necessary actually... was wondering why the scrolling wasnt working!

Offline

 

#6 2010-11-09 10:36:30

tinoesroho
Scratcher
Registered: 2010-04-26
Posts: 100+

Re: BYOB Project

Joseph,

Editing posts is limited to "Scratchers" AKA members who've been active for over a month. I'll take another shot at it this morning, since I've got practically nothing else to do.

Putting things in one forever loop might cause problems while the other blocks are executing. The result would be that the inches forward.

Hmm.... *looks at project*
Well....


 Maurer Rose by TheVikings Should be featured. See the project in action here and my reasons here. 

Offline

 

#7 2010-11-09 12:36:23

josc4941
New Scratcher
Registered: 2010-10-20
Posts: 7

Re: BYOB Project

Thanks again, I'm curious to see what you've done and if the program runs any faster.  Combining all of my scripts that just set variables into one forever loop did seem to help a little. (or I'm imagining it)

Offline

 

#8 2010-11-09 12:51:57

tinoesroho
Scratcher
Registered: 2010-04-26
Posts: 100+

Re: BYOB Project

Unloading unused blocks seems to help. I can't get the file to save (Perhaps it's the permissions I've set - further study required), but I did notice quite the speed improvement.

However, combining scripts on the cloud/background sprites doesn't speed it up. I'm going to try setting the clouds as part of the stage in about half an hour.


 Maurer Rose by TheVikings Should be featured. See the project in action here and my reasons here. 

Offline

 

#9 2010-11-09 14:00:17

josc4941
New Scratcher
Registered: 2010-10-20
Posts: 7

Re: BYOB Project

I'm not sure what exactly you mean by "unloading" unused blocks.

Offline

 

#10 2010-11-09 17:41:50

tinoesroho
Scratcher
Registered: 2010-04-26
Posts: 100+

Re: BYOB Project

Edit -> Unload Unused Blocks

I theorize that doing this actually does nothing except trick BYOB. I also ran it in "turbo" mode to double check.

EDIT: I've changed file permissions, so I can drop the modified file onto the net.

Last edited by tinoesroho (2010-11-09 19:23:43)


 Maurer Rose by TheVikings Should be featured. See the project in action here and my reasons here. 

Offline

 

#11 2010-11-10 00:57:18

josc4941
New Scratcher
Registered: 2010-10-20
Posts: 7

Re: BYOB Project

Cool sounds good.

I've down converted back into scratch for the time being and the lag is non-existent.  Also, running the scratch program in BYOB runs buttery smooth too.  It must have something to do with some of my custom blocks, or with BYOB limitations.

You can look at the scratch version(And see how well it runs)...
http://scratch.mit.edu/projects/josc4941/1406324

Offline

 

Board footer