D9790: Fix slowdown issue

Julian Helfferich noreply at phabricator.kde.org
Wed Jan 10 19:20:44 UTC 2018


helfferich added a comment.


  Do you mean switching the interval/substeps/speed? Or switching from a change in timer interval to the substeps?
  
  I'll try to explain:
  
  1. Why change the interval? The basic loop is: Move ball -> Check for collisions -> Change direction, perform actions, according to collisions, etc. -> Move ball -> ... The speed determines how far the ball is moved during the "Move ball". If the ball is moved too far, the collision detection might be inaccurate (E.g. the extreme case is the ball moving through a brick with no detected collision). To avoid such bugs, we move the ball only half the distance, but twice as often.
  2. Why use substeps now? In the original code, this was done by cutting the gameTimer interval in half. However, this broke during the port to QML, because QML timer have a minimum interval of 16ms. Cutting it in half to 8ms does not have any effect. The alternative approach is to keep the gameTimer interval, but perform the basic loop twice.
  
  I hope this made it a little bit more clear. I am still wondering if the new approach has performance issues (moving the balls sequentially, instead of in parallel), but I don't think it matters as the collision detection, which is much more costly, is done sequentially as well.

REPOSITORY
  R393 KBreakout

REVISION DETAIL
  https://phabricator.kde.org/D9790

To: helfferich, #kde_games
Cc: schwarzer, #kde_games
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-games-devel/attachments/20180110/73868a60/attachment-0001.html>


More information about the kde-games-devel mailing list