I recreated L4D2's melee mechanic in Godot [See pin comment]

Поділитися
Вставка
  • Опубліковано 16 лис 2024

КОМЕНТАРІ • 55

  • @wolfsmith9342
    @wolfsmith9342  Місяць тому +20

    Since this video get more views than I expected, so I decided to claim how I create this.
    It's really simple, just imagine a sphere whitch center is the player camera's location, and the attack Hitbox's starting point is the player camera, the end point is one point on the sphere.
    Then the first question : How to get this point, here is a guide about opengl sphere www.songho.ca/opengl/gl_sphere.html
    Here is the code I write to get this point
    func sphereVertics(radius:float, leftRightAngle:float, UpDownAngle:float, sphereCenter:Vector3)->Vector3:
    leftRightAngle = deg_to_rad(leftRightAngle)
    UpDownAngle = deg_to_rad(UpDownAngle)
    # x = (r * cosϕ) * cosθ
    # x = (r * cosϕ) * sinθ
    # z = r * sinϕ
    var x = (radius * cos(UpDownAngle)) * cos(leftRightAngle)
    var y = (radius * cos(UpDownAngle)) * sin(leftRightAngle)
    var z = radius * sin(UpDownAngle)
    return Vector3(x,z,y) + sphereCenter
    * NOTICE that there are 2 types of coordinate axes, you need to do some conversions if you want you use the formula in this website
    Then the second question is that how to spawn them in a arc. It's even more simple, just use for loop
    func spawnHitDetectionVertical(firstAng:float, endAng:float, Step:float, interval:float):
    for i in range(firstAng,endAng+1,Step):
    spawnHitVertical(i) # spawn function, just use raycast to spawn them according to the angle
    await get_tree().create_timer(interval).timeout # the delay after spawn every one of them
    This is just the vertical one (Pitchfork's first attack animation

  • @alexarchivechannel6673
    @alexarchivechannel6673 Місяць тому +76

    No wonder why L4D2 has such fluid-feeling melee mechanics. It actually follows the arc of the attack rather than just attacking a point in the center of the screen or spawning a projectile

    • @Brain_rott-l3g
      @Brain_rott-l3g Місяць тому +6

      When fighting zombies is not really smooth or fluid... Is janky as hell , is worse if you dont have an good ping...

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому +16

      Yeah, but valve's bad network code ruined it :(

    • @alexandrefillot9600
      @alexandrefillot9600 Місяць тому +4

      This is also why you can attack multiple zombies at once when fighting them.

    • @thegibusguy4969
      @thegibusguy4969 Місяць тому

      ⁠@@wolfsmith9342Netcode is hard man.

    • @dramaticmudderer5208
      @dramaticmudderer5208 Місяць тому +2

      It's not like this, they use rays instead, this is actually better than l4d2

  • @Para_lellogram
    @Para_lellogram Місяць тому +50

    Pretty cool!
    I still hate that fucking pitchfork tho

    • @YoungeManly
      @YoungeManly Місяць тому +2

      Which melee had more damage im still comparing shovel to forks

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому +10

      ​@@YoungeManly Every melee deal the same damage, also the damage is percentage : common 100% special except charger 100% charger 50%(head 100%) tank 5% witch 25%

    • @jackxonlee8193
      @jackxonlee8193 Місяць тому +2

      It's the hitboxes problem,knife isn't helpful until Valve fixed the hitboxes and it's pretty good

  • @rasegybuldiga576
    @rasegybuldiga576 Місяць тому +8

    You should use quaternions so that the attacking arc don't get smaller when you look up or down

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому +4

      My current goal is recreate it, next step is improve it.

  • @Mcribbs28
    @Mcribbs28 Місяць тому

    Everytime I have no melee to be found I chose this and spin my mouse rapidly

  • @meancrank9039
    @meancrank9039 Місяць тому +2

    Neat! Nice jobreconstructing it!

  • @JanoschNr1
    @JanoschNr1 Місяць тому +6

    By Valves name, I'm offended on their behalf ...

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому +3

      The title is just a joke, I was just trying to make this mechanic in Godot

    • @JanoschNr1
      @JanoschNr1 Місяць тому

      @@wolfsmith9342 Did you change the title? I forgot the original, something alike "this dude stole L4D melee animations" wasn't it?
      Made you sound outraged over something that Valve actually doesn't mind and actually aproves of, given how
      many Half-Life'esk off brand games exist and they inspired. Being a copy cat is the biggest form of flattery.
      Well then everything is allight then isn't it. Sorry for not noticing your joke, honestly seemed you were serrious because you know ... nowadays ...

    • @spny1158
      @spny1158 Місяць тому +1

      @@JanoschNr1 usually a clickbait title that for some reason is a trend with source games on youtube, especially TF2

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому +2

      @@JanoschNr1 I am trying to make a zombie survivor game and I really like L4D2's melee hit detection, in fact, this is the best hit detection mechanic I have ever seen. So I decided to recreate it and improve it and use it in my game. And consider l4d2 source code never leaked, I guess it's leagal to use since I write all code myself

    • @JanoschNr1
      @JanoschNr1 Місяць тому +1

      @@wolfsmith9342 Yeah, as said, all fine. As said even if you copy pasted the code 1to1 I don't think there would be a issue on any side anyways for previous mentioned reasons.

  • @MHL5K
    @MHL5K Місяць тому +9

    its really cool, and i love the overly loud menu music that i can barely hear the "gameplay" sounds. (no hate tho)

  • @CRT_YT
    @CRT_YT Місяць тому +5

    cool stuff

  • @kuzter1737
    @kuzter1737 Місяць тому +9

    rad!

  • @thairh-wisan
    @thairh-wisan Місяць тому +4

    So rad . gj 🔥🔥

  • @ypupiaradasilva
    @ypupiaradasilva Місяць тому +2

    Damn! Thats sick!

  • @Nozal
    @Nozal Місяць тому

    dude this is sick

  • @bleyk_267
    @bleyk_267 Місяць тому +2

    niceeee mechainics.
    Visually, I really wished you used something like an axe or bat for the weapon of choice tho. the pitchfork is by far the least apealling melee in the game for me

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому

      I wanted to get the baseball bat to fully show the X shape, but I can't import the bat's animation in blender ( Every time I import it it just messed up ) So I decided to use the pitchfork, since this is the only weapon that has 3 type of hit detection (the vertical one sucks XD)

  • @leepik28
    @leepik28 Місяць тому +2

    dope

  • @kotorybeusz7246
    @kotorybeusz7246 Місяць тому +1

    Now obliged by law port godot into source engine

  • @px8
    @px8 Місяць тому +2

    coool... u should do a remaster of a campaign maybe ;D

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому

      Nah, then valve will be really angry about XD

  • @Playmaker-sl7et
    @Playmaker-sl7et Місяць тому

    Blood 1997 easter egg

  • @nilpyc307
    @nilpyc307 Місяць тому

    imagine l4d2 have guts and blackplower attack arc mechanic
    god please someone mod that in

  • @artgokrew
    @artgokrew Місяць тому

    this is cool may i use this for my left 4 dead inspired game am making using Godot?

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому

      This is totally fine, if you can't understand the pin comment, feel free to ask me for the source code !

    • @artgokrew
      @artgokrew Місяць тому

      @@wolfsmith9342 I understand it just asking for permissions but thanks

  • @AverageFunfact101
    @AverageFunfact101 Місяць тому

    Valve games are great

  • @adorablepyro9455
    @adorablepyro9455 Місяць тому +1

    我靠,前几天还在b站看到你嘞😀

  • @kozlorog
    @kozlorog Місяць тому

    See Mordhau for better melee mechanic.

  • @StrobaCat
    @StrobaCat Місяць тому

    recreated it with the worst melee on the game LOL

    • @wolfsmith9342
      @wolfsmith9342  Місяць тому +1

      Since Port tools issue, I can only get the pitchfork's model. Others are messed up XD

    • @fourlion_everywhere
      @fourlion_everywhere Місяць тому +1

      I reckon the worst one is CSS knife, as I've heard

    • @fruiteusfly5307
      @fruiteusfly5307 Місяць тому

      Nah, like the other commentor said the knife is the worst one since it undershoots your crosshair.

    • @StrobaCat
      @StrobaCat Місяць тому

      @@fruiteusfly5307 not anymore, it got updated so isnt the worst melee in the game now

    • @fruiteusfly5307
      @fruiteusfly5307 Місяць тому

      @@StrobaCat Oh, I'll have to check out the hitboxes again then!

  • @IrvanQadri
    @IrvanQadri Місяць тому +1

    subbing because godot :'3

  • @nunyanunya4147
    @nunyanunya4147 Місяць тому +2

    WOW! you did something someone else has already done! LATHER YOU IN PRAISE!
    Forward to complacency....

    • @roy7o9
      @roy7o9 Місяць тому +6

      Do you feel better about yourself now?

    • @nunyanunya4147
      @nunyanunya4147 Місяць тому +1

      @@roy7o9 :) please tell me why your apathetic copy/paste reply that counts as 'snark' is acceptable reply to condone my original snark.
      is this a 'fire with fire' thing. if it is. this only creates more fire. and as you can see. i wield it better than you do despite my dyslexia.
      should I point out that your daditute condemption ov my little outburst is meant to make me feel like a child and I should feel abash and chastised by the adult in the room turning their attention to me and looking down their nose from their proverbial high horse...
      do you feel better about engaging in this conversation? did you get the attention you think you deserved?
      what will you do with it now? something useful? or did you pull your willy out at the orgy before any girls showed up again?
      let me know when you wish to smother each other in idioms. my bag is full and you shall be found lacking.
      shalom

    • @unpseudototalementnormal517
      @unpseudototalementnormal517 Місяць тому +4

      And you did nothing, cry about it

    • @12KTOYOTA
      @12KTOYOTA Місяць тому +1

      ​@@nunyanunya4147how's the 8th grade going for ya