Sign in to follow this  
too_many_stars

SDL 1.2, moving window, objects falling through tiles

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

 

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this