[Kde-games-devel] Review Request 128472: KBreakout: Fix Collision Detection

Julian Helfferich julian.helfferich at googlemail.com
Sun Jul 17 17:59:44 UTC 2016



> On July 17, 2016, 6:32 a.m., Frederik Schwarzer wrote:
> > src/qml/logic.js, line 609
> > <https://git.reviewboard.kde.org/r/128472/diff/1/?file=471890#file471890line609>
> >
> >     Oh my. :)
> >     Is there no way to make JavaScript bail out on these kind of errors?

The script throws an error message here (it continues running, however), but since this branch of the if-else clause was never taken, it went through unnoticed until now.


- Julian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/128472/#review97493
-----------------------------------------------------------


On July 16, 2016, 9:38 p.m., Julian Helfferich wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/128472/
> -----------------------------------------------------------
> 
> (Updated July 16, 2016, 9:38 p.m.)
> 
> 
> Review request for KDE Games.
> 
> 
> Bugs: 328812
>     http://bugs.kde.org/show_bug.cgi?id=328812
> 
> 
> Repository: kbreakout
> 
> 
> Description
> -------
> 
> Bug 328812 describes the situation where the ball reverses direction when hitting a block. This bug is very easy to reproduce in Level 11, where the ball is required to bounce through a narrow area.
> 
> The problem turned out to occur when the ball hits two bricks at once. The inteded way to handle this situation was:
> 
> 1. Calculate the area of intersection of the ball with each of the two bricks.
> 2. Take the brick for which the intersection is larger.
> 3. The ball collides with this brick.
> 
> However, the function "collideWithTwoBricks" passed "ball" instead of "ballRect" to the function "intersectArea" which means that the calculated area was always NaN. Thus, the ball always collided with the second brick, even if the intersection area was tiny.
> 
> It is not too difficult to imagine this bug leading to a situation where the reversal of direction happens. I strongly assume that this patch also fixes bug 354517, and bug 328003 which are also caused by the ball not bouncing correctly off of two bricks. However, they are much more difficult to reproduce, so I am not sure.
> 
> 
> Diffs
> -----
> 
>   src/qml/logic.js 9dac82b 
> 
> Diff: https://git.reviewboard.kde.org/r/128472/diff/
> 
> 
> Testing
> -------
> 
> I activated the cheats and always skipped directly to Level 11.
> 
> * I confirmed that the reversal in direction takes place frequently in Level 11 before applying the fix.
> * I confiremd that the reversal in direction no longer takes place after applying the fix.
> 
> 
> Thanks,
> 
> Julian Helfferich
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20160717/bb75fe90/attachment.html>


More information about the kde-games-devel mailing list