Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Snap! user discussion
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
Are you doing sprite-sprite collision detection, or sprite-color? Sprite-sprite is way faster. Often you can get the effect of sprite-color by nesting sprites, so the blue (or whatever) part of the sprite is actually a second sprite attached to the first. It wasn't all that bad before we introduced collision detection, so I guess this is a real bottleneck.
- Jens
- Scratcher
100+ posts
Snap! user discussion
another idea is to avoid pixel-perfect collision detection altogether and only check for a threshold of DISTANCE TO, like NetLogo and many particle systems do. I'm not recommending this, because I love collision detection myself, but if that's the bottleneck on low-powered hardware it might be an idea…
- tcrass
- New to Scratch
7 posts
Snap! user discussion
Hi,
we're doing sprite-sprite collision detection, not sprite-color. (spaceship vs asteroid, you know… ;-)
Sigh… that's what I did in my first asteroid implementation some 25 years ago in TurboPascal… It seemed so promising to have “real” collision detection available in Snap!. (BTW, there sure is a bounding box overlap test prior to pixel-to-pixel comparison, right?)
Cheers –
– Torsten
Are you doing sprite-sprite collision detection, or sprite-color? Sprite-sprite is way faster. Often you can get the effect of sprite-color by nesting sprites, so the blue (or whatever) part of the sprite is actually a second sprite attached to the first.
we're doing sprite-sprite collision detection, not sprite-color. (spaceship vs asteroid, you know… ;-)
another idea is to avoid pixel-perfect collision detection altogether and only check for a threshold of DISTANCE TO, like NetLogo and many particle systems do. I'm not recommending this, because I love collision detection myself, but if that's the bottleneck on low-powered hardware it might be an idea…
Sigh… that's what I did in my first asteroid implementation some 25 years ago in TurboPascal… It seemed so promising to have “real” collision detection available in Snap!. (BTW, there sure is a bounding box overlap test prior to pixel-to-pixel comparison, right?)
Cheers –
– Torsten
- tcrass
- New to Scratch
7 posts
Snap! user discussion
OK, this is interesting…
Initially, we put the collision test into a generic “if <…>” start block. After moving it into the endless loop which moves the (asteroid) sprites, the animation looks a lot smoother! It seems the tests were performed way too often under the initial circumstances – perhaps for each sprite after each sprite's move (which for n sprites would sum up to n² tests, as compared to only n tests in the new implementation)?
Cheers –
– Torsten
Initially, we put the collision test into a generic “if <…>” start block. After moving it into the endless loop which moves the (asteroid) sprites, the animation looks a lot smoother! It seems the tests were performed way too often under the initial circumstances – perhaps for each sprite after each sprite's move (which for n sprites would sum up to n² tests, as compared to only n tests in the new implementation)?
Cheers –
– Torsten
- Jens
- Scratcher
100+ posts
Snap! user discussion
yes, Snap! performs a bounding box collision test before checking the pixels. Usually, sprite collision detection is really, really fast and efficient in Snap, because graphics cards kinda do it for almost free. Hmm, must be something about the Raspberry Pi that's slowing down graphics…
- Jens
- Scratcher
100+ posts
Snap! user discussion
Oh, I missed your second observation about optimizing performance by not using generic WHEN hat blocks! Great, I'm glad you found a way, yay!
- xly
- Scratcher
100+ posts
Snap! user discussion
Are you doing sprite-sprite collision detection, or sprite-color? Sprite-sprite is way faster. Often you can get the effect of sprite-color by nesting sprites, so the blue (or whatever) part of the sprite is actually a second sprite attached to the first. It wasn't all that bad before we introduced collision detection, so I guess this is a real bottleneck.
After further testing the DISTANCE method suggested by Jens is excellent.
Last edited by xly (Nov. 5, 2017 21:08:06)
- IAmTheGeekSquad1962
- New to Scratch
4 posts
Snap! user discussion
I would like some information about running Snap in a classroom setting.
Is it possible to install snap on a server and let 12 or so students do development using Chromebooks?
Is it possible to install snap on a server and let 12 or so students do development using Chromebooks?
- PullJosh
- Scratcher
1000+ posts
Snap! user discussion
Any particular reason you don't want to use Is it possible to install snap on a server and let 12 or so students do development using Chromebooks?the hosted version that's already online?
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
The normal thing is to run it from our web site. That does work on Chromebooks. If you want to install a local copy, it'll run, but you won't be able to log into our cloud server, so you'll have to save projects locally. I haven't used a Chromebook myself so I'm not sure, does it have local file storage? Is it possible to install snap on a server and let 12 or so students do development using Chromebooks?
- IAmTheGeekSquad1962
- New to Scratch
4 posts
Snap! user discussion
The normal thing is to run it from our web site. That does work on Chromebooks. If you want to install a local copy, it'll run, but you won't be able to log into our cloud server, so you'll have to save projects locally. I haven't used a Chromebook myself so I'm not sure, does it have local file storage? Is it possible to install snap on a server and let 12 or so students do development using Chromebooks?
I've tried to create an account, but was never asked for a password during setup. Instead I got “data is temporarily unavailable Error ID…” I never received any confirmation email from snap.berkeley.edu. I did try to create the account a second time, but the system now recognizes that the id is already taken. It looks like the account only got partially created.
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
I'm sorry you had that problem. If you email me (bh@cs.berkeley.edu) the user ID I'll see about getting you a password. I've tried to create an account, but was never asked for a password during setup. Instead I got “data is temporarily unavailable Error ID…” I never received any confirmation email from snap.berkeley.edu. I did try to create the account a second time, but the system now recognizes that the id is already taken. It looks like the account only got partially created.
Alternatively, click the “change password” item in the cloud menu and it should set a new password to your email on file.
- sonnyglau
- New to Scratch
1 post
Snap! user discussion
Hi,
I'm trying to help one of my students out. I'm trying to open her project and it is stuck in the “Opening project…” portion. The project will never open.
Here is the link to her project that won't open.
http://bjc.edc.org/snapsource/snap.html#present:Username=asmith8&ProjectName=snowman
Thanks!
I'm trying to help one of my students out. I'm trying to open her project and it is stuck in the “Opening project…” portion. The project will never open.
Here is the link to her project that won't open.
http://bjc.edc.org/snapsource/snap.html#present:Username=asmith8&ProjectName=snowman
Thanks!
Last edited by sonnyglau (Dec. 4, 2017 21:38:36)
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
It's too big to load. Here's a version with the costumes and the huge dictionary removed. She can put in a smaller dictionary etc. and try again: I'm trying to help one of my students out. I'm trying to open her project and it is stuck in the “Opening project…” portion. The project will never open.
http://snap.berkeley.edu/snowman.xml
- theLman
- Scratcher
81 posts
Snap! user discussion
Hi everyone,
I've been trying to get started on Snap a few times over the last year or so, but I can never seem to log on. When I try and re-set my password, it sends me a link, but when I (immediately) click on it I get the error message: “password reset key: <whatever it is> is no longer valid, please request a new one.” Has anyone else had this problem? I wonder if it's related to time zones?
Edit: By the way, the reference manual is amazing! It's so easy to follow. I wish all programming languages were documented in this style.
I've been trying to get started on Snap a few times over the last year or so, but I can never seem to log on. When I try and re-set my password, it sends me a link, but when I (immediately) click on it I get the error message: “password reset key: <whatever it is> is no longer valid, please request a new one.” Has anyone else had this problem? I wonder if it's related to time zones?
Edit: By the way, the reference manual is amazing! It's so easy to follow. I wish all programming languages were documented in this style.
Last edited by theLman (Dec. 19, 2017 14:13:56)
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
Sorry you're having this trouble! I've been trying to get started on Snap a few times over the last year or so, but I can never seem to log on. When I try and re-set my password, it sends me a link, but when I (immediately) click on it I get the error message: “password reset key: <whatever it is> is no longer valid, please request a new one.” Has anyone else had this problem?
This is a known problem. It happens rarely but persistently. We're working on it. Meanwhile, mail me (bh@cs.berkeley.edu) your Snap! login name and the email address you used, and we'll send you a password manually.
- theLman
- Scratcher
81 posts
Snap! user discussion
Sorry you're having this trouble! I've been trying to get started on Snap a few times over the last year or so, but I can never seem to log on. When I try and re-set my password, it sends me a link, but when I (immediately) click on it I get the error message: “password reset key: <whatever it is> is no longer valid, please request a new one.” Has anyone else had this problem?
This is a known problem. It happens rarely but persistently. We're working on it. Meanwhile, mail me (bh@cs.berkeley.edu) your Snap! login name and the email address you used, and we'll send you a password manually.
Thank you Looking forward to getting into SNAP!, the updates in 4.1 look great. Any updates on the rollout of the planned new front page?
- bharvey
- Scratcher
1000+ posts
Snap! user discussion
The latest theory is to have a beta release for brave people in Feb, and the big cutover in March. Any updates on the rollout of the planned new front page?
- theLman
- Scratcher
81 posts
Snap! user discussion
The latest theory is to have a beta release for brave people in Feb, and the big cutover in March. Any updates on the rollout of the planned new front page?
That's exciting. Good luck with everything.
- MichaelIsSoAnnoying
- Scratcher
3 posts
Snap! user discussion
I'm working on a hangman project, and I would like to generate random words from a java script dictionary. Is there any way I could do this?