Warp effect and TimeDelta

This forum is currently in read-only mode.
From the Asset Store
A total of 214 high quality and unique magic sound effects suitable for RPG, Battle Arena and more!
  • Hi all,

    I'm afraid I need another helping hand. The project I'm working on will be independent of the framerate, so I heavily make use of TimeDelta.

    The warp effect doesn't seem to be safe in this matter. Using a value for the speed leads to nice results as long as the framerate doesn't change drastically. So I tried to use a formula with TimeDelta to compensate and put it in an Always-event. But then the warp effect changes its behavior randomly and drastically in very short periods of time.

    The .fx file uses framecounter and multiplies it with the speed, so basically changing speed in relation to timedelta should lead to the result I need, meaning that the warp moves with exactly the same speed no matter how high or low the framerate actually is. At least I think it should

    I have set up a cap to show what I mean. Play around with v-synced or unlimited on. There is also a checkbox to switch between the default values and the TimeDelta formula. I only set the speed values as long as the checkbox is checked. When you uncheck, the last set value will be used - and the strange behavior disappears. But then of course it's frame dependent again instead of time dependent.


    Does anyone have a solution?

    p.s. I couldn't figure out how to switch between v-synced and unlimited mode via events/actions. I try to implement an options menu to let the player decide. I might have missed something, so if anyone can point me in the right direction...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hmm, noone who can help?

    The warp effect can help with quite nice rain or water effects, but if the speed is so different on a 60Hz-Monitor compared to a 120Hz one, it ist not reliable enough and the impression you intended may even be broken. And compensation of framerate dropping isn't possible, too.

    (Edited first post to set the link. The old one was outdated.)

  • I see what the problem is. Your code is always changing the speed while the box is checked. This results in minor variations in speed each time it's set. If you set the speed only once -- for example, by adding a "Trigger once" condition to the bottom of the event checking the state of the checkbox, or simply setting the speed using your formula at the start of the layout -- the effect won't jump around.

    Of course, this won't help when the framerate drops, but it will at least make the speed consistent for all people as long as the game is reaching V-sync rate.

  • Thank you very much, linkman, for taking the time to check it.

    Of course, this won't help when the framerate drops, but it will at least make the speed consistent for all people as long as the game is reaching V-sync rate.

    That's why I tested the framerate constantly. But after your post I tried things a little different. Let me mention that the warp effects speed is framerate dependent. If I have a v-synced rate of 60Hz and another gamer has 120Hz, he will see the effect moving twice as fast. If I want every gamer to see the effect the way I intended it, I have to change the speed value at least once during gameplay.

    The compromise between having a constant movement of the warp effect throughout every computer, and the little glitches is that the code counts the frames four times a second. An always event tests if the framerate changes by more than 10% and only then sets a new speed value. This way, the speed will be left untouched on a fairly stable system once the value is set, but the code ist still fast enough to react within 250 ms on a drastic change on the framerate. The 10% are acceptable, because one would barely notice an increase or decrease of this amount the way I use the warp effect. (btw: with this procedure the warp effects speed reacts to timescale changes also)

    Thanks again

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