There seems to be a bug in the new version of the Online-Player:
http://scratch.mit.edu/projects/MartinWollenweber/8708
doesn't work anymore correct in Online (Ball bounces often before it hits the Collision-Object).
It has worked some weeks ago Online and it still works Offline.
The problem seems to be something with the "distance to(Sprite)"-Block or with the"touching(Sprite)"-Block. Can somebody of the SCRATCH-Team find out it and fix it?
Thank you in advance!
Last edited by MartinWollenweber (2007-07-14 16:27:55)
Offline
Hi Martin,
Sorry for the delay! We will investigate! Please let us know if you happen to have any other new clues about what the issue may be. (The main thing changed on the online player was with timing of broadcast.)
Offline
Hi, Martin. Nice project!
I'm sorry its not working right in the online version.
The online version does appear to be working for me, but I may not be recognizing the problem when I see it.
There were no recent changes to the distanceToSprite or touchingSprite blocks but one of the other changes could be responsible. (For example, we changed the color test for touching black and, as Natalie says, we changed how broadcasts and script scheduling interact.)
Have you upgraded your Java recently? (It probably doesn't matter but I just want to eliminate that from consideration.)
I will look into it. If you can create a simple test case, that would be a huge help.
-- John
Last edited by johnm (2007-07-20 09:45:40)
Offline
Hi, Martin.
I did some more investigation. I can reproduce the bug (and my Java has not changed) so its definitely a player bug. It may have something to do with broadcast scheduling, but it's very subtle.
To simplify the problem, I removed all by one collision object and one ball. The project still works in Scratch and fails in the player. If I then remove the "turn turnspeed degrees" block from the "when I receive col1Touched" script, the ball bounces correctly in the player. So the fact that it is turning seems to be causing the problem. But I can't figure out why that should make a difference, can you?
I'll keep exploring but if you have any insights or a simple test case that fails in the player that would be a huge help...
-- John
Offline
Hi, Martin.
I think I found it. If I increase the constant "distanceCorrection" from 81 to 90, it seems to work the same in both the Player and in Scratch. Possibly some number between those two would also work.
Explanation: Since Java and Scratch use different underlying graphics packages, there is not exact pixel-level fidelity for image operations such as scaling and rotation. It looks as though the distanceCorrection was just enough to move the ball away from the collision object in Scratch but left it still touching in the Player. This caused the ball to get stuck on the edge of the collision object. The bug in broadcast scheduling was masking this problem in earlier versions of the Player.
-- John
Offline
Hi John: Thank you very much for your investigation. I made the same experience with changing the "distanceCorrection", but I it doesn't look natural, if the ball is teleported to that distance when bouncing. Because that bug seems to be very special, it's perhaps better that I find sices of collisionObjects balls and distance, that looks good and works in both Online+Offline.
I tried but I didn't find the right relation at (http://scratch.mit.edu/projects/MartinWollenweber/23257 ).
In the Original version ( http://scratch.mit.edu/projects/Canthiar/7369 ) that seems to work. Perhaps Canthiar can help?
Last edited by MartinWollenweber (2007-07-21 06:45:49)
Offline
The balls are teleported because I don't want them to get stuck. Most of the numbers in there are magic because I didn't really take the time to measure anything. It could be that the center points on the balls is off center so the combined radius between the two objects is wrong. I will take a closer look and see if I can find out what is going on.
Offline
I think John is on the right track. The small balls that you are using are slightly larger than the small balls that I was using so it would need a slight larger combined radius. I know in my application the large collision objects aren't perfectly circular and when I spin them I can see them wobble. This coupled with the fact that the Java application uses a Java API for the rotation and scaling may cause differences between the two applications because the initial collision is based on the touch logic code rather than distance. I'm sure it wouldn't be that hard to switch it to distance rather than touching.
Offline
Thank you for your help Canthiar and John: I replaced the non-deterministic "touching"-block by distance measuring. Now it works the same Offline+Online.
Offline