Physics object path keeps changing?(solved)

This forum is currently in read-only mode.
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • In the following example, The player presses the 'launch' button to fire an object 'ball' at a group of boxes.(the boxes need to land in the tree branches)

    Why does the projectile's path change slightly on each press of the 'launch button?...Sometimes i can dislodge all the boxes at the first attempt, but the next time the projectile's path changes slightly?

    Start window

    <img src="http://dl.dropbox.com/u/22173473/Anrgy1.jpg">

    Goal

    <img src="http://dl.dropbox.com/u/22173473/Anrgy2.jpg">

    http://dl.dropbox.com/u/22173473/BlocksTest.rar

    Thank in advance.

  • It's because of timedelta. As your frame rate varies slightly timedelta changes slightly which affects the trajectory. Try ticking the "Override timedelta" tick box in Application properties->advanced. (this will make your game frame rate dependent btw)

    If you want your game to use timedelta, then you have to accept that you won't have perfect consistency.

  • It's because of timedelta. As your frame rate varies slightly timedelta changes slightly which affects the trajectory. Try ticking the "Override timedelta" tick box in Application properties->advanced. (this will make your game frame rate dependent btw)

    If you want your game to use timedelta, then you have to accept that you won't have perfect consistency.

    Thanks for the solution Davioware.

    Is over-riding time-delta and creating a game frame rate dependent not something you would recommend ?

  • No it's fine, I usually make my games with overridden timedelta. I like consistent pixel perfect movements. It really depends on the design of your game though. Some games can work well with timedelta, others suffer from problems/ annoyances. Also though, you have to turn off vsync (set fixed frame rate) for non timedelta games to run at the same speed on all pc's regardless of screen refresh rate. Some people don't like that (ashley ).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Be aware though, setting a fixed framerate means you rely on your player's hardware to be able to calculate that much frames of your game per second, which is not always given. Also, as soon as there is anything that inhibits the pc at times, your game will run much slower, etc.

  • Thanks for the tips. After reading through your comments -

    "Some games can work well with timedelta, others suffer from problems/ annoyances"

    "Be aware though, setting a fixed framerate means you rely on your player's hardware to be able to calculate that much frames of your game per second, which is not always given. Also, as soon as there is anything that inhibits the pc at times, your game will run much slower, etc."

    I'm gonna stick to using time-delta. Ive not even thought about how the 'Toggled events' will perform when i switch them back on.

  • "Be aware though, setting a fixed framerate means you rely on your player's hardware to be able to calculate that much frames of your game per second, which is not always given. Also, as soon as there is anything that inhibits the pc at times, your game will run much slower, etc."

    This is something I forgot to mention. When you don't use timedelta, your game will slow down when the pc can't handle putting out the frames, as opposed to moving the objects further each frame. It really comes down to choosing Slow down lag VS Frame skip lag. I prefer slowdown. What tulamide said isn't really clearly stated so i'll clarify: Not using timedelta is what will cause the slowdown type lag; it doesn't have to do with fixed framerate. You can set a fixed framerate and have the "lag" (framerate drops,sections where the pc can't keep up) be either slowdown type or frame skip type depending on whether your code uses timedelta. On the contrary, you can have slowdown type lag in a Vsynced game by not using timedelta.

  • Yes, I wasn't clear on that. Davio explained it better.

  • You could also set up the events so that you can only launch when fps optimal.

  • If you don't mind the game going slow-motion when the fps drops, you can safely override timedelta with a fixed value. For puzzle games and such, that's fine - it's more a problem for action games, where everything going in slo-mo can give you an unfair advantage since you have more time to react, or the change in game speed would be annoying. That's what timedelta is aimed at solving.

    Generally, though, I tend to say the best thing to do is enable timedelta, but not rely on pixel-perfection. That means don't make platformers with jumps that you can only make by a few pixels, or in your case, puzzles that can only be solved by a pixel-exact trajectory. Those are the things that might be affected by timedelta - and players might be less frustrated by your game if it's more tolerant, anyway

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)