Discuss Scratch

ChatUser2
Scratcher
100+ posts

Bad collision detection

Flash Scratch player has bad collision detection. It was pixel-perfect in 1.4. It breaks some Tetris games, though not my ones.
stickfiregames
Scratcher
1000+ posts

Bad collision detection

Can you link to a project that shows the bug?
ChatUser2
Scratcher
100+ posts

Bad collision detection

stickfiregames wrote:

Can you link to a project that shows the bug?
Many tetris projects have this bug.
https://scratch.mit.edu/projects/5072/ - original tetris
https://scratch.mit.edu/projects/11292/ - commonly remixed version
https://scratch.mit.edu/projects/2849035/ - someone's TETRIS MAX - includes problem notes
stickfiregames
Scratcher
1000+ posts

Bad collision detection

ChatUser2 wrote:

stickfiregames wrote:

Can you link to a project that shows the bug?
Many tetris projects have this bug.
https://scratch.mit.edu/projects/5072/ - original tetris
https://scratch.mit.edu/projects/11292/ - commonly remixed version
https://scratch.mit.edu/projects/2849035/ - someone's TETRIS MAX - includes problem notes
I don't have a solution but what I have found is that it fixes itself if you enable Stage3D. Similarly, the third one you linked works fine until I remove the graphic effects, and then it breaks.

I noticed that when Stage3D is on, the stamps don't exactly align with the grid. It could be that the pieces are actually at a non-integer x and y position, so it thinks they are colliding while the sprites shown on screen aren't.
stickfiregames
Scratcher
1000+ posts

Bad collision detection

stickfiregames wrote:

ChatUser2 wrote:

stickfiregames wrote:

Can you link to a project that shows the bug?
Many tetris projects have this bug.
https://scratch.mit.edu/projects/5072/ - original tetris
https://scratch.mit.edu/projects/11292/ - commonly remixed version
https://scratch.mit.edu/projects/2849035/ - someone's TETRIS MAX - includes problem notes
I don't have a solution but what I have found is that it fixes itself if you enable Stage3D. Similarly, the third one you linked works fine until I remove the graphic effects, and then it breaks.

I noticed that when Stage3D is on, the stamps don't exactly align with the grid. It could be that the pieces are actually at a non-integer x and y position, so it thinks they are colliding while the sprites shown on screen aren't.
If I replace the stamps with clones that also fixes it. It sounds like this is probably a bug with stamping rather than colour detection.
ChatUser2
Scratcher
100+ posts

Bad collision detection

stickfiregames wrote:

stickfiregames wrote:

ChatUser2 wrote:

stickfiregames wrote:

Can you link to a project that shows the bug?
Many tetris projects have this bug.
https://scratch.mit.edu/projects/5072/ - original tetris
https://scratch.mit.edu/projects/11292/ - commonly remixed version
https://scratch.mit.edu/projects/2849035/ - someone's TETRIS MAX - includes problem notes
I don't have a solution but what I have found is that it fixes itself if you enable Stage3D. Similarly, the third one you linked works fine until I remove the graphic effects, and then it breaks.

I noticed that when Stage3D is on, the stamps don't exactly align with the grid. It could be that the pieces are actually at a non-integer x and y position, so it thinks they are colliding while the sprites shown on screen aren't.
If I replace the stamps with clones that also fixes it. It sounds like this is probably a bug with stamping rather than colour detection.
What happens for me in all three (unmodified) is that empty spaces to the right of filled doesn't act like it's empty when stacking.
I checked code and found out that sprites are placed on integer positions and moved by integer amount of pixels. So I doubt that pieces are on non-integer position. They all belong to the same remix tree so I'm sure most of the projects here have this bug.
stickfiregames
Scratcher
1000+ posts

Bad collision detection

ChatUser2 wrote:

stickfiregames wrote:

stickfiregames wrote:

-snip-
I don't have a solution but what I have found is that it fixes itself if you enable Stage3D. Similarly, the third one you linked works fine until I remove the graphic effects, and then it breaks.

I noticed that when Stage3D is on, the stamps don't exactly align with the grid. It could be that the pieces are actually at a non-integer x and y position, so it thinks they are colliding while the sprites shown on screen aren't.
If I replace the stamps with clones that also fixes it. It sounds like this is probably a bug with stamping rather than colour detection.
What happens for me in all three (unmodified) is that empty spaces to the right of filled doesn't act like it's empty when stacking.
I checked code and found out that sprites are placed on integer positions and moved by integer amount of pixels. So I doubt that pieces are on non-integer position. They all belong to the same remix tree so I'm sure most of the projects here have this bug.
For me the first two have exactly the same glitch as you describe, but the third one (and presumably any remix that uses graphic effects) doesn't. Maybe your computer doesn't support Stage3D? Try pressing Ctrl+M on one of the projects and see if it makes a difference.

Last edited by stickfiregames (Feb. 26, 2017 11:58:44)

ChatUser2
Scratcher
100+ posts

Bad collision detection

stickfiregames wrote:

ChatUser2 wrote:

stickfiregames wrote:

stickfiregames wrote:

-snip-
I don't have a solution but what I have found is that it fixes itself if you enable Stage3D. Similarly, the third one you linked works fine until I remove the graphic effects, and then it breaks.

I noticed that when Stage3D is on, the stamps don't exactly align with the grid. It could be that the pieces are actually at a non-integer x and y position, so it thinks they are colliding while the sprites shown on screen aren't.
If I replace the stamps with clones that also fixes it. It sounds like this is probably a bug with stamping rather than colour detection.
What happens for me in all three (unmodified) is that empty spaces to the right of filled doesn't act like it's empty when stacking.
I checked code and found out that sprites are placed on integer positions and moved by integer amount of pixels. So I doubt that pieces are on non-integer position. They all belong to the same remix tree so I'm sure most of the projects here have this bug.
For me the first two have exactly the same glitch as you describe, but the third one (and presumably any remix that uses graphic effects) doesn't. Maybe your computer doesn't support Stage3D? Try pressing Ctrl+M on one of the projects and see if it makes a difference.
Well, Stage3D used to work on my computer, but the weird thing is that on the same glitch-showing project, now it tells that Stage3D is off, no matter how many times I press Ctrl-M.
The glitch-showing project is https://scratch.mit.edu/projects/94409099/

Edit: Stage3D works if I enable Chrome Hardware Acceleration, but I need it off for another website. In Firefox Stage3D seems to work. Let me test TETRIS MAX now.

Last edited by ChatUser2 (Feb. 26, 2017 12:25:40)

stickfiregames
Scratcher
1000+ posts

Bad collision detection

After looking around some more, the qrid squares in that project aren't all the same size I was looking in fullscreen, but it might still mean something, which almost certainly causes it.

Have you seen the bug on any projects that aren't based on that one? If you haven't then it's probably not a current Scratch bug, although I suppose it might have happened when that project was updated to 2.0.

Last edited by stickfiregames (Feb. 26, 2017 12:26:11)

ChatUser2
Scratcher
100+ posts

Bad collision detection

I have seen this bug in my Tetris Best (based on a different Tetris with a different engine than these ones, https://scratch.mit.edu/projects/140137647 ), but it doesn't exist right now. It was in the “read” sprite when I had the wrong costume. It's made to detect black color. Due to assymetry in collision detection, see the “read” sprite costume right now.

Try my project from signature!

Last edited by ChatUser2 (Feb. 26, 2017 12:46:33)

Powered by DjangoBB