Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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.

  • You cannot reply to this topic
3 replies to this topic

#1 too_many_stars   Members   -  Reputation: 212

Like
0Likes
Like

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



Sponsor:

#2 Sunsharior   Members   -  Reputation: 476

Like
0Likes
Like

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.

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.



#3 SeanMiddleditch   Members   -  Reputation: 6466

Like
5Likes
Like

Posted 12 June 2014 - 12:01 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.

#4 Kaptein   Prime Members   -  Reputation: 2175

Like
0Likes
Like

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.



PARTNERS