Physics object path keeps changing?(solved)

For questions about using Classic.

Post » Fri Mar 25, 2011 8:37 pm

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


Goal


[url:9f25616h]http://dl.dropbox.com/u/22173473/BlocksTest.rar[/url:9f25616h]

Thank in advance.
B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300

Post » Sat Mar 26, 2011 12:33 am

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.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sat Mar 26, 2011 1:57 am

[quote="Davioware":139blq2o]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.[/quote:139blq2o]



Thanks for the solution Davioware.

Is over-riding time-delta and creating a game frame rate dependent not something you would recommend ?
B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300

Post » Sat Mar 26, 2011 3:44 am

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 :P ).
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sat Mar 26, 2011 10:30 am

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.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Mar 26, 2011 2:56 pm

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. :?
B
19
S
6
G
7
Posts: 1,206
Reputation: 7,300

Post » Sat Mar 26, 2011 8:30 pm

[quote="chrisbrobs":1f7j5018]"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."
[/quote:1f7j5018]

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.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sat Mar 26, 2011 10:08 pm

Yes, I wasn't clear on that. Davio explained it better.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Mar 26, 2011 10:42 pm

You could also set up the events so that you can only launch when fps optimal.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Mar 26, 2011 11:15 pm

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 :P
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests