Building a Better Jump in Godot 4

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ต.ค. 2024

ความคิดเห็น • 45

  • @Chaff_Games
    @Chaff_Games  8 หลายเดือนก่อน +1

    To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/ChaffGames . The first 200 of you will get 20% off Brilliant’s annual premium subscription.

  • @NoobGaming97346
    @NoobGaming97346 8 หลายเดือนก่อน +19

    i am a begineer to godot and game making , so i just saved it because it looks like there's something useful in this video that i gonna need later on.

  • @leonardoraele
    @leonardoraele 8 หลายเดือนก่อน +7

    I did it for jump height in my game, but not for jump distance. Makes sense to do for jump distance too

    • @Chaff_Games
      @Chaff_Games  8 หลายเดือนก่อน +2

      Definitely something that gets looked over. Maybe less important for non precision games but still makes designing so much easier.

  • @CrushingJosch
    @CrushingJosch 7 หลายเดือนก่อน +2

    This. Is. Just. So. Nicely. Done. :)
    I was not happy with the jumping behavior in my project but didn't really know of how to address it. Your video solves that sooo elegantly :) Thanks a lot!!

  • @comfyzenny
    @comfyzenny 8 หลายเดือนก่อน +2

    Chaff, yet again you have blown me away. I thought this video would be about frictions and air control and such, but instead, this information helps immensly regardless of deeper mechanic specifics. TYVM

  • @red3tango
    @red3tango 7 หลายเดือนก่อน +2

    Note: Incorrect Graphic at 5:08 should be "JumpVelocity = Gravity * JumpPeakTime" as "Vo+at" reduces to "at" as "Vo = 0"... code shown at 8:40 is correct.

    • @Chaff_Games
      @Chaff_Games  7 หลายเดือนก่อน +1

      Oh yeah look at that. Lol

  • @Dartiniuss
    @Dartiniuss 2 หลายเดือนก่อน +2

    This is a really cool jumping system, my only concern is that it seems very hard to tweak the numbers because of how the formulae work and are connected to each other. Like if I want to change the jump peak time then that messes every other number up.
    I'm using Godot 4.2 and converted the code to C# if any of that would be a problem, though that may just be how it has to work and not me implementing it wrong.

  • @owenlloyd2528
    @owenlloyd2528 8 หลายเดือนก่อน +1

    Thank you

  • @QatariGameDev
    @QatariGameDev 8 หลายเดือนก่อน +1

    Fantastic video!
    Appreciate the insight on improving jump mechanics.

  • @djdavidj
    @djdavidj 8 หลายเดือนก่อน +1

    Thank you, this is perfect, thank you.

  • @AndreaTerenziani
    @AndreaTerenziani 6 หลายเดือนก่อน +1

    that was an actually useful thing that I didnt think of, well done
    Tho I think it's better to solve for time instead of speed so that the gravity stays the same as that used by the physics objects

    • @Chaff_Games
      @Chaff_Games  6 หลายเดือนก่อน

      It really just depends on what you want for your project 😊

  • @paandock
    @paandock 4 หลายเดือนก่อน +1

    the footage of the time travel game in the background was so distracting that I forgot I was watching the video to learn, and I was sucked back to reality with the knowledge that I learned nothing and needed to go back XD
    maybe good old gaussian blur would be a better choice next time?

    • @paandock
      @paandock 4 หลายเดือนก่อน

      I watched the segment again and I'm still periodically zoning out. This usually doesn't happen to me, and I'm able to focus on the knowledge I desire. It's just very flashy and pulls me away from the learning :V

    • @paandock
      @paandock 4 หลายเดือนก่อน

      even with the issue, this video has been very helpful! thank you!

    • @Chaff_Games
      @Chaff_Games  4 หลายเดือนก่อน

      Sorry about that. It was an intentional choice, I will keep it in mind for future videos.

    • @stabbedbyapanda
      @stabbedbyapanda 3 หลายเดือนก่อน

      @@Chaff_Games Not to beat the dead horse, but i actually agree, usually i don't and just go rewatch it. But in this case I was actually struggling to understand Titanfall 2s relation to the video, and realized i got so absorbed in that line of thinking i had to go back several times. I think the issue wasn't titanfall 2, but just the fact it looked like you were more showcasing the dimension/time shifting rather than jump height and jump distance. Everytime you switched to Metroid Dread it was like a teacher yelling at me to focus (which was a good thing) xD

  • @simonbenjamin1
    @simonbenjamin1 8 หลายเดือนก่อน +1

    Great job, mate! I'm loving these so much! Question, if one feels that the player's walking/running speed needs to be tweaked, do we scale the existing Speed equation relative to it? E.g Still wanting to have a jump distance of 4 but wishing to make the walking speed a bit quicker.

    • @Chaff_Games
      @Chaff_Games  8 หลายเดือนก่อน +1

      It’s all possible. In the equation for speed we take distance/time. If we have a known speed we’re targeting (say half the current speed) you could substitute in the known values current speed/2 = distance/time. You say you want to keep distance at 4 so you can re arrange the formula time =distance/speed. Then you would also need to have a way to re calc your jump so that the new time spent in the air was updated and re calculated. Hope that makes sense, I’m on my phone. Personally I prefer to reduce distance when slowing the player down, since it only requires changing one variable and recalculating speed.

    • @simonbenjamin1
      @simonbenjamin1 8 หลายเดือนก่อน +1

      @@Chaff_Games That makes so much sense, jumping distance and walking speed i.e. how much you move "forward" are pretty proportional, aye? Cheers very much, fellow Aussie! Keep up the great work!

  • @starphaserdisco
    @starphaserdisco 7 หลายเดือนก่อน +3

    any help on getting this to work in a 2d project? i managed to get the gravity working fine if i changed the velocity.y -= to velocity.y +=, but i can't actually jump at all

    • @starphaserdisco
      @starphaserdisco 7 หลายเดือนก่อน +4

      nevermind! just changed the jump function from velocity.y = jump_velocity to velocity.y -= jump_velocity. now i've just gotta implement buffer and coyote time, which i've done before on 3,x

    • @Chaff_Games
      @Chaff_Games  7 หลายเดือนก่อน +1

      Nice work. Also in 2D everything is in pixels per second . So jump distance and height will need to suit.

    • @dhdr27
      @dhdr27 5 หลายเดือนก่อน +1

      Thank you for this comment you saved my life, I’m a complete beginner and was totally confused why this isn’t working

  • @dhdr27
    @dhdr27 4 หลายเดือนก่อน +1

    Any idea what to do if the jump peak and fall time also influences the jump height and distance. I have a 2D project and already suited the Jump Hight and distance (*16) I my case. But if I set the jump peak time to “1” I jump >400 pixel high, with a jump_height of 64. I watched this video 6-7 time already and I didn’t find my error. Any advice is appreciated thanks

    • @cjmars
      @cjmars 3 หลายเดือนก่อน

      I'm having the same issue

    • @dhdr27
      @dhdr27 3 หลายเดือนก่อน +1

      @@cjmars i fixes this, In my case was the peak and fall time not close enough (like peak time 0.5 fall time: 0.2) now I have both times around 0.4 and the jump height Ist fixed at 32 pixels. Did you convert the jump height to pixels by multiplying them with 16?

    • @cjmars
      @cjmars 3 หลายเดือนก่อน

      @@dhdr27 Yes, I did all that. My jump/peak times were always within .2 of each other (and often equal) and always within the .2 to .5 range. My map tiles are 16x16 so I was going for 32 on height and 48 or 64 on distance (I played with increments of 16 between 16 and 96 for both). There were some configurations where the jump felt good, but never matched the parameters, ie. height and distance values did not match the pixels on the screen.

  • @garmadon-vo2yg
    @garmadon-vo2yg 8 หลายเดือนก่อน +3

    1:05 what how did you get it

    • @Chaff_Games
      @Chaff_Games  8 หลายเดือนก่อน

      Sorry what do you mean?

    • @garmadon-vo2yg
      @garmadon-vo2yg 8 หลายเดือนก่อน +1

      @@Chaff_Games i mean how did you get that meme

    • @Chaff_Games
      @Chaff_Games  8 หลายเดือนก่อน +1

      @garmadon-vo2yg it was in my to be sorted folder 😝.
      In all seriousness I spent ages looking for a gravity related meme.

    • @garmadon-vo2yg
      @garmadon-vo2yg 8 หลายเดือนก่อน

      @@Chaff_Games haha 😃

  • @rogerluizm
    @rogerluizm 8 หลายเดือนก่อน +1

    if you are try to using in a 2d game try multiplay the jump height and jump distance by the grid size ex: 2 * 32

    • @Chaff_Games
      @Chaff_Games  8 หลายเดือนก่อน

      Ah yes, something I forgot to mention is that 2D uses pixels not metres.

    • @dhdr27
      @dhdr27 5 หลายเดือนก่อน

      I don’t know if this is the smartest way, but I created 2 new variables. Pixel_jump_height = (16*jump_height) and in the calculation function I replace every jump_height with pixel_jump_height.
      If there is a more elegant way to do this please let me know

    • @dhdr27
      @dhdr27 5 หลายเดือนก่อน

      Should I also multiply jump peak and fall time ?

  • @pipacombate393
    @pipacombate393 2 หลายเดือนก่อน

    i wish i was good at math bro :(

  • @Roddev776
    @Roddev776 8 หลายเดือนก่อน +1

    Godot 4.2 or 4.1

    • @Chaff_Games
      @Chaff_Games  8 หลายเดือนก่อน

      Both? I don’t think there’s any thing exclusive to 4.2 here

  • @jaxson4809
    @jaxson4809 7 หลายเดือนก่อน +1

    'promo sm' 👊