C2 games and 120hz monitors (*dt problem?)

0 favourites
From the Asset Store
Find pleasure in juggling balls with this basic HTML5 template
  • Nesteris normally, if there is a unit like "in pixels per seconds"or "in degrees per seconds", that means that dt is not needed (as one pixel per second is still one pixel per second, regardless of the framerate, due to the clear definition of a second on a fixed timescale)

    mostly, all behaviors related to movement should not need dt.

  • Refeuh

    Thank you very much! I appreciate that

    great art work, btw, I checked the links in your signature, very nice !

    Unrolling the x & y you end up with :

    dir.x = Player.ImagePoint.X - Gun.Pos.X

    dir.y = Player.ImagePoint.Y - Gun.Pos.Y

    dirLength = sqrt(dir.x^2 + dir.y^2)

    v.x = dir.x / dirLength

    v.y = dir.y / dirLength

    Gun.pos.x = Gun.pos.x + Gun.speed*dt*v.x

    Gun.pos.y = Gun.pos.y + Gun.speed*dt*v.y

    I don't fully understand this but, I think once I apply it and see it in action my visual brain will begin to grasp it.

  • I don't know if it makes sense, but here's a sincere feedback from a regular C2 user who sucks at math.

    The dt guide is very well written, and when you read it, you think(*dt) you understand it. I've read it, I don't know, maybe 50 or 60 times.

    But when you have to write tons of events, it would be so nice to have charts you can quickly reference to. Here on the forum, or even better inside C2.

    Something like this:

    lerp to an angle, use this:

    lerp to a position, use this:

    lerp to speed, use this:

    lerip to scale, use this:

    lerp to variable value, use this:

    every tick events: don't use if this and this. Use if this and this.

    every X second: don't use.

    I must sound super lazy to most of you, and I definitely understand this, but for average users it would be a freaking life saver.

    Yeah have to agree!

    After reading this thread several times, the dt guide a dozen times, and Ashley's latest blog that arose from this thread several times, I now have this fuzzy feeling in my head and a real lack of confidence with both lerp and dt.

    All I know is that lerp gives nice smooth movement effect, and that dt is required for a game to be frame rate independant.

    But as to how, when, and even if they should be combined, well I would say the general target audience of C2 should just not use it.

    Hehe I reckon this is pobably the most confusing thread I have read on these forums.

    Really wish I paid more attention to math at school now....

  • >

    > I don't know if it makes sense, but here's a sincere feedback from a regular C2 user who sucks at math.

    > The dt guide is very well written, and when you read it, you think(*dt) you understand it. I've read it, I don't know, maybe 50 or 60 times.

    > But when you have to write tons of events, it would be so nice to have charts you can quickly reference to. Here on the forum, or even better inside C2.

    > Something like this:

    >

    > lerp to an angle, use this:

    > lerp to a position, use this:

    > lerp to speed, use this:

    > lerip to scale, use this:

    > lerp to variable value, use this:

    > every tick events: don't use if this and this. Use if this and this.

    > every X second: don't use.

    >

    > I must sound super lazy to most of you, and I definitely understand this, but for average users it would be a freaking life saver.

    >

    Yeah have to agree!

    After reading this thread several times, the dt guide a dozen times, and Ashley's latest blog that arose from this thread several times, I now have this fuzzy feeling in my head and a real lack of confidence with both lerp and dt.

    All I know is that lerp gives nice smooth movement effect, and that dt is required for a game to be frame rate independant.

    But as to how, when, and even if they should be combined, well I would say the general target audience of C2 should just not use it.

    Hehe I reckon this is pobably the most confusing thread I have read on these forums.

    Really wish I paid more attention to math at school now....

    the smooth movement of lerp comes from an unusual use of it, so indeed it is not easy to think it right, as this use of lerp is already kind of weird (tbh, most people hère I have seen using it just thinks it "looks good, not sure why but I will keep it"), I can understand that ashley gives the "good formula" for people to fix their games, but that does not mean it is a good idea, I would rather see an exponential like interpolation being added.

  • I would rather see an exponential like interpolation being added.

    Yes! I remain perplexed that c2 doesn't contain a native set of tweening functions / behaviour.

  • But when you have to write tons of events, it would be so nice to have charts you can quickly reference to. Here on the forum, or even better inside C2.

    Something like this:

    lerp to an angle, use this:

    lerp to a position, use this:

    lerp to speed, use this:

    lerip to scale, use this:

    lerp to variable value, use this:

    every tick events: don't use if this and this. Use if this and this.

    every X second: don't use.

    If you're rotating, moving, accelerating or basically anything else, the answer is just add s * dt. "Every X seconds" is already framerate independent because it measures time, not frames, but people often get confused about it so the original delta-time tutorial specifically covers it.

    Lerp is kind of a special case so I added it to the tutorial. I think that basically covers everything?

  • Pretty cool : )

    Thanks a lot, Ashley! Very helpful : )

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Nesteris

    [quote:p0fplsk0]s * dt

    That would like "value + s * dt" right? I just want to be sure without a doubt

    If we used say, bullet behaviour or platform behaviour. Do we need to make events to add dt to the behaviour values or are they already incorporated?

    It seems from the updated tutorial that all behaviors already use dt. Except for the physics behavior.

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