Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balls are stuck in mirror positions at intersection point #19

Open
seve opened this issue Jan 29, 2024 · 10 comments
Open

Balls are stuck in mirror positions at intersection point #19

seve opened this issue Jan 29, 2024 · 10 comments

Comments

@seve
Copy link

seve commented Jan 29, 2024

Left it on for about 30 minutes and it looks like the balls got stuck inside of each other's collision boxes.

Screen.Recording.2024-01-29.at.11.47.10.AM.mov
@erkantaylan
Copy link

image

since there is no random in the code. i got the exact same :D

@MattTheCuber
Copy link

chrome_Bnizk71FA8
same

@shmalex
Copy link

shmalex commented Feb 1, 2024

image

got absolutely the same situation

@thrust26
Copy link
Contributor

thrust26 commented Feb 1, 2024

I got similar results in my Atari 2600 version.

But after I improved the block collision detection, the problem disappeared. I only check collision with blocks into the ball's current direction. E.g if the ball moves left and up, I only check the blocks to the left and above.

@pathikrit
Copy link

Same, I got this too after an hour or so:

Screenshot 2024-02-02 at 4 46 59 PM

The code is fully deterministic. I would introduce a tiny random epsilon on each bounce angle

@masterfelu
Copy link

image

maybe random initial start position?

schlagmichdoch added a commit to schlagmichdoch/yin-yang-pong that referenced this issue Feb 8, 2024
…tween frames (fixes constant speed); Rewrite collision logic to check vertical, horizontal and diagonal collisions (fixes vnglst#6, vnglst#18, vnglst#19, vnglst#21, vnglst#22)
schlagmichdoch added a commit to schlagmichdoch/yin-yang-pong that referenced this issue Feb 8, 2024
… between frames (fixes constant speed); Rewrite collision logic to check vertical, horizontal and diagonal collisions (fixes vnglst#6, vnglst#18, vnglst#19, vnglst#21, vnglst#22)
schlagmichdoch added a commit to schlagmichdoch/yin-yang-pong that referenced this issue Feb 9, 2024
… between frames (fixes constant speed); Rewrite collision logic to check vertical, horizontal and diagonal collisions (fixes vnglst#6, vnglst#18, vnglst#19, vnglst#21, vnglst#22)
schlagmichdoch added a commit to schlagmichdoch/yin-yang-pong that referenced this issue Feb 9, 2024
… between frames (fixes constant speed); Rewrite collision logic to check vertical, horizontal and diagonal collisions (fixes vnglst#6, vnglst#18, vnglst#19, vnglst#21, vnglst#22)
@non-descriptive
Copy link

They gonna lock each other somewhere else. Mine stuck somewhere in the middle in even tighter position.

@serkonda7
Copy link

This position as well
image

@pathikrit
Copy link

pathikrit commented Mar 19, 2024

Ok idea to prevent loop (or a cycle of length = 1) - if same 2 positions are repeated as pairs across 4 ticks that means we are in a loop. For 5th tick, we skip and go to 6th tick. This will give a chance for a ball to move twice and clear the loop. Concretely:

tick1: position1, ball1
tick2: position2, ball2
tick3: position3, ball1
tick4: position4, ball2

if position1 == position3 and position2 == position4 then:
  // do nothing for tick5

tick6: position6, ball1

Now this prevents cycles of length=1. Its not clear if there could be longer cycles. If indeed, there are cycles of length>1, we can generalize to store last 2*length positions and see if we see the same pair of consecutive position twice

@Abyss-Seeker
Copy link

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants