SDL 1.2, moving window, objects falling through tiles

Started by
2 comments, last by Kaptein 9 years, 10 months ago

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

Advertisement

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.

2. Add more information to the problem. Try to be as descriptive as possible.

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?

As you can see, more information is needed.

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.

Sean Middleditch – Game Systems Engineer – Join my team!

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.

This topic is closed to new replies.

Advertisement