Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How to remove Tunneling with Fixed time steps  (Read 1588 times)

0 Members and 1 Guest are viewing this topic.

Dark Nemesis

  • Newbie
  • *
  • Posts: 5
  • The Traumatized Deceiver
    • View Profile
    • Email
How to remove Tunneling with Fixed time steps
« on: January 24, 2014, 06:45:22 pm »
I am making a game and using the same code as mentioned in SFML Game Development Book.
I am using the fixed time steps method (where I send a fixed dt time every time I call update).
I have set my frame rate to 60.
Now the problem arises, I want to move 420 pixels per second, which makes up 7 pixels per frame (due to 60 FPS). This leads to tunneling/ghosting of my objects (as some collision objects are shorter). The only way to reduce tunneling is if i move less pixels per frame. That can be achieved either by increasing the FPS or by reducing the overall pixel/sec. speed of the object. The first thing causes performance issue, while the latter makes game play issues.
So is there any another way, other than these two, to remove tunneling (completely, if possible)??

Thanks
Please visit the site below to have a look at the game which I am currently working on.

bonktank.wordpress.com

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11016
    • View Profile
    • development blog
    • Email
AW: How to remove Tunneling with Fixed time steps
« Reply #1 on: January 24, 2014, 07:32:15 pm »
Of course there are other ways. Since you use the term tunnelling, did you ever try to make some research on it (e.g. google "collision detection prevent tunneling")?

The basic idea is, that you predict where the object will be in the next iteration and make sure it doesn't jump over other objects.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: How to remove Tunneling with Fixed time steps
« Reply #2 on: January 24, 2014, 08:49:02 pm »

 

anything