• Create Account

## SDL 1.2, moving window, objects falling through tiles

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

3 replies to this topic

### #1too_many_stars  Members

Posted 12 June 2014 - 10:08 AM

Hi Guys,

As the tilte suggests, I am using SDL 1.2, with a tiled world. Whenever I move the game window around however, especially up and down, all my game entities start falling through the tiles. Does anyone have any idea how to solve this problem? It's been bothering me for a long time and I really need to learn how to deal with it.

Thanks,

Mike

### #2Sunsharior  Members

Posted 12 June 2014 - 10:49 AM

Hi too_many_stars,

there is not enough information to solve the problem without going into speculations.

1. Try posting code you think might be the culprit.

3. Explain how your game work. What is normally supposed to happen when you move the game window?

4. Do you use other library or engin?

Since you mention SDL, i assume this is a simple 2D game. What kind of physic do you use?

### #3SeanMiddleditch  Members

Posted 12 June 2014 - 12:01 PM

POPULAR

As the tilte suggests, I am using SDL 1.2, with a tiled world. Whenever I move the game window around however, especially up and down, all my game entities start falling through the tiles. Does anyone have any idea how to solve this problem? It's been bothering me for a long time and I really need to learn how to deal with it.

This could be something else with how you're mapping window/screen coordinates, but the most likely case in my experience is tunneling. Moving a window will often cause large amounts of lag (the event loop stops responding during the move). This means that, after the move, your next time_delta is really huge. If you apply only simplistic physics integration (say the usual Euler p = p + v * t) then due to that large time delta the object ends up moving far further than normal, and jumps entirely past tiles without the collision engine realizing it. The solutions range from capping your time delta to all the other solutions to "game physics tunneling" (that's the term to search for).

You should follow Sunsharrior's advice. Err on the side of giving too much information rather than too little.

Game Developer, C++ Geek, Dragon Slayer - http://seanmiddleditch.com

C++ SG14 "Games & Low Latency" - Co-chair - public forums

Wargaming Seattle - Lead Server Engineer - We're hiring!

### #4Kaptein  Prime Members

Posted 12 June 2014 - 04:15 PM

As the tilte suggests, I am using SDL 1.2, with a tiled world. Whenever I move the game window around however, especially up and down, all my game entities start falling through the tiles. Does anyone have any idea how to solve this problem? It's been bothering me for a long time and I really need to learn how to deal with it.

This could be something else with how you're mapping window/screen coordinates, but the most likely case in my experience is tunneling. Moving a window will often cause large amounts of lag (the event loop stops responding during the move). This means that, after the move, your next time_delta is really huge. If you apply only simplistic physics integration (say the usual Euler p = p + v * t) then due to that large time delta the object ends up moving far further than normal, and jumps entirely past tiles without the collision engine realizing it. The solutions range from capping your time delta to all the other solutions to "game physics tunneling" (that's the term to search for).

You should follow Sunsharrior's advice. Err on the side of giving too much information rather than too little.

Good catch. Probably it.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.