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

#1 2007-05-28 18:20:05

PatternsOfChaos
Scratcher
Registered: 2007-05-25
Posts: 13

Project doesn't work when uploaded

http://scratch.mit.edu/projects/PatternsOfChaos/7914

Brick Wall, v1.06A

Basically, everything works fine on my local machine, but when I upload it, nothing happens when you press <Space>

It might help to download the project

I have tried to trace this, and the best that I can come up with is that the MoveBall broadcast is being SENT, but is never picked up by the ball - I am setting a watch variable "SentMoveBall" to 1 after the broadcast - that works fine.  But I also make the ball say "Hello" when it receives MoveBall, and it never does.

Any ideas?

Offline

 

#2 2007-05-28 22:06:15

natalie
Scratch Team
Registered: 2007-03-07
Posts: 100+

Re: Project doesn't work when uploaded

I see what you mean--that it works within Scratch but not in the web browser. I'm looking into it now...

Offline

 

#3 2007-05-28 23:53:01

natalie
Scratch Team
Registered: 2007-03-07
Posts: 100+

Re: Project doesn't work when uploaded

Okay, after much experimenting I found a way to get it to work...

What I did was in the Stage scripts to change "broadcast MoveBall"
to this block:
"broadcast MoveBall and wait"

I'm not sure why yet, but that worked for me. Could you please try that and let me know if it also works for you?

The other thing I did was to remove all the "stop script" blocks, since they aren't needed at the bottom of a stack (only if you want to interrupt a script in progress). However, that probably shouldn't make a difference. (Note: I left on the "stop all" blocks, which are important.)

I really like the interaction and sound effects for your game!

Offline

 

#4 2007-05-29 00:58:53

PatternsOfChaos
Scratcher
Registered: 2007-05-25
Posts: 13

Re: Project doesn't work when uploaded

natalie wrote:

Okay, after much experimenting I found a way to get it to work...

What I did was in the Stage scripts to change "broadcast MoveBall"
to this block:
"broadcast MoveBall and wait"

I'm not sure why yet, but that worked for me. Could you please try that and let me know if it also works for you?

I'll check that out.

natalie wrote:

The other thing I did was to remove all the "stop script" blocks, since they aren't needed at the bottom of a stack (only if you want to interrupt a script in progress). However, that probably shouldn't make a difference. (Note: I left on the "stop all" blocks, which are important.)

DIdn't know that - I just figured all blocks should be terminated. Thanks for pointing that out

natalie wrote:

I really like the interaction and sound effects for your game!

Thank you!

Offline

 

#5 2007-05-29 01:28:04

PatternsOfChaos
Scratcher
Registered: 2007-05-25
Posts: 13

Re: Project doesn't work when uploaded

I tried using "Broadcast MoveBall and Wait", but now it runs painfully slow...

http://scratch.mit.edu/projects/PatternsOfChaos/7986

Last edited by PatternsOfChaos (2007-05-29 01:28:34)

Offline

 

#6 2007-05-29 08:26:34

natalie
Scratch Team
Registered: 2007-03-07
Posts: 100+

Re: Project doesn't work when uploaded

Thanks for trying that out. I'm going to ask others on our team to figure out what's going on!

Offline

 

#7 2007-05-29 09:10:05

natalie
Scratch Team
Registered: 2007-03-07
Posts: 100+

Re: Project doesn't work when uploaded

In the meantime, try this: after "broadcast MoveBall" add a "wait 0.0001 seconds" that also seems to work.

But I'll ask others here why the "forever if "broadcast"" without a wait doesn't work in the Java player.

Offline

 

#8 2007-05-29 12:58:41

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Project doesn't work when uploaded

The java player seems to use a different allocation algorithm for scripts than the squeak player.  Any program that relies on the way the CPU resources are allocated is likely to run into trouble.

All forever loops need to have a wait in them to have a chance of running properly on the java platform---I think that starvation (a common flaw in parallel programs) is likely to result without it.

Offline

 

#9 2007-05-29 15:33:25

twoPi
Scratcher
Registered: 2007-05-24
Posts: 1

Re: Project doesn't work when uploaded

Thanks all, I thought I was going crazy, because I had the same problem....
http://scratch.mit.edu/projects/twoPi/6402
This thing worked great on the standalone machine, but froze on the browser.  Subsequent tests (motionTest 1 - 4) prove that the problem is with the broadcast message call. 

If the broadcast is happening within a loop and the loop has a wait in it (the normal circumstance) that should do the job. 

Frog lunch 1.1

http://scratch.mit.edu/projects/twoPi/8158

shows this technique.

It still is a bit too slow. I don't know how much is the java engine and how much is the built-in delay. It was a touch slower on standalone, too, but .001 seconds shouldn't be any worse than the delay you'll already get from java. I can't imagine it's running at 100 frames per second. 

I am seeing an occasional lag.  Could be system resources are building up. Does the Java applet create a new Thread for each forever loop?

Offline

 

#10 2007-05-29 15:54:23

300pockets
Scratcher
Registered: 2007-05-27
Posts: 8

Re: Project doesn't work when uploaded

Now, that project is listed as an 'Invalid Request'. What's that mean? Was the project removed?


I am the original 300pockets of myspace.com/300pockets. I am quite young, and my interests include astrophysics, reading fantasy novels, and using programs such as Bryce5 to create 3D landscapes. I enjoy creating oceans, although I am afraid of swimming in the real seas. My cowardice does not overcome my sense for beauty.

Offline

 

#11 2007-05-29 18:04:55

tammy
Scratcher
Registered: 2007-03-07
Posts: 57

Re: Project doesn't work when uploaded

'Invalid Request' usually means that the project has been removed.

Offline

 

#12 2007-05-29 23:27:50

PatternsOfChaos
Scratcher
Registered: 2007-05-25
Posts: 13

Re: Project doesn't work when uploaded

300pockets wrote:

Now, that project is listed as an 'Invalid Request'. What's that mean? Was the project removed?

I accidentally deleted the project - I thought I was deleting a different version of it. The second one listed is still up & running.

kevin_karplus wrote:

All forever loops need to have a wait in them to have a chance of running properly on the java platform---I think that starvation (a common flaw in parallel programs) is likely to result without it.

I'm not too used to controlling execution in quite that manner - Although I've been programming quite some time, the last 10 years has been mostly Perl / PHP / JavaScript - not so much a concern on those platforms  smile

Given what's been said, I think I'm going to play with delays in the forever loop & see what I can get to work. Thanks to everyone for the input!

Offline

 

#13 2007-05-30 01:38:31

PatternsOfChaos
Scratcher
Registered: 2007-05-25
Posts: 13

Re: Project doesn't work when uploaded

http://scratch.mit.edu/projects/PatternsOfChaos/8270

Well, I got it working with a delay in the loop, but this time the ball seems to pass through the paddle. Ball_TestCollide is never broadcast

Best I can tell, the loop executes too quickly for everything to be called on every loop, and the delay either makes it too slow if the increment is small, or the increment is too large - in either case, the collision test fails.

I'd appreciate any other ideas on this - but it seems that the best course is looking at optimization of the MoveBall funcitons...

Offline

 

#14 2007-05-30 18:10:17

PeterB
Scratcher
Registered: 2007-05-18
Posts: 14

Re: Project doesn't work when uploaded

Not sure if my project may lend any weight on this investigation but I have the same issue, works fine locally, but falls apart when uploaded. Its a healthy size due to the graphics content (3.5mb) however the code blocks are really quite reasonable (or as reasonable as I can make them). Link to the project as follows http://scratch.mit.edu/projects/PeterB/8458.

Its kinda put the dampers on another project I had started preparing the graphics for on the basis of it potentially being slightly larger.

Offline

 

#15 2007-06-19 18:49:34

johnm
Scratcher
Registered: 2007-03-08
Posts: 100+

Re: Project doesn't work when uploaded

Hi, everyone.

I just fixed a subtle bug in the Java player that I think was responsible for many of the problems reported here. Those of you who worked around the problem by adding extra wait commands might try removing those wait commands.

Please let me know if you see any more cases where broadcasts are ignored in the Java player but not in Scratch.

Thanks for your patience.

  -- John

P.S. You may need to quit and re-start your browser to get the new player. You are running the new player if you see "v13" in tiny letters in the upper-left corner of the Player. The old one was "v12".

Offline

 

Board footer