Godot 4 Sourcelike FPS Character Controller Tutorial | Smooth Movement, Bhop, Surf, And More

Поділитися
Вставка
  • Опубліковано 27 тра 2024
  • The first video of a series where we will build an FPS game. This video shows how to implement source engine like movement mechanics.
    STARTER PROJECT: github.com/majikayogames/Simp...
    Full Playlist: • Godot FPS Tutorial
    GitHub Repo: github.com/majikayogames/Simp...
    All source code and included assets are licensed under the CC0/public domain license.
    Dot product interactive web demo used in the video: majikayogames.github.io/dot%2...
    How Godot's Transform3D Type Works: • How Godot's Transform3...
    Contents of this video:
    0:00 - Basic setup
    3:20 - Hide player model from player camera
    4:36 - Aim with mouse
    7:57 - Basic movement, jump, gravity
    16:00 - Headbob effect
    20:10 - Auto jump & input actions
    21:28 - Gamepad/controller aiming support with smoothing
    25:12 - Advanced air movement/strafe
    31:24 - Advanced ground movement with friction/bhop
    35:32 - Surf with clip_velocity
    40:31 - How to make surf ramps
    42:30 - Outro

КОМЕНТАРІ • 39

  • @MajikayoGames
    @MajikayoGames  8 днів тому

    Hi everyone! Thanks for watching. If you enjoyed this video, make sure to check out the full FPS tutorial playlist where we will add many other features to the FPS controller we built in this video.
    Full Playlist: ua-cam.com/play/PLbuK0gG93AsHID1DDD1nt4YHcdOmJvWW1.html

  • @Potato6153
    @Potato6153 18 днів тому +7

    You are quickly becoming one of the best tutorial creators, as You are going very in depth and it's great not only for beginners

  • @Jetiix
    @Jetiix 8 днів тому +1

    Amazing work, your solutions are much more elegant than mine, with the same principles! You are a real pro at this!
    I tried to make the crouch jump by moving one collision box into another, and the stair stepping with an area cast, but they were both really buggy, your tutorials have been helping me a lot, I hope your channel grows a lot.

    • @MajikayoGames
      @MajikayoGames  8 днів тому +1

      Appreciate your comment! Glad you enjoyed :) I'm gonna be making a lot more videos so hopefully people will continue to find my tutorials and code useful.

  • @traumwelt1975
    @traumwelt1975 7 днів тому +1

    might be too advanced for me but thanks a lot for the share of knowledge.

  • @fluttershy3642
    @fluttershy3642 17 днів тому +2

    Are you serios, I've spent so long trying to code source style movment and failing. You're a god's send!

    • @MajikayoGames
      @MajikayoGames  17 днів тому +2

      Glad I could help :D let me know if you have any questions about it. I'm also going to be doing some more videos soon to get sourcelike stair handling, ladders, water, and some more stuff.

    • @fluttershy3642
      @fluttershy3642 16 днів тому +1

      @@MajikayoGames Really intresting, will you try and get the ladder speed bost thing aswell? When you look up sideways on the ladder while holding (A or D) + W it dobbles the speed. You know what I am talking about? And isen't stair handeling usually just an invisible hitbox that is sloped for smooth ups and downs?

    • @MajikayoGames
      @MajikayoGames  16 днів тому

      @@fluttershy3642 I think I've seen videos of the ladder boosting, but I'm not 100% sure what it is. If you want, I can send you the current build of what I'm working with and planning on doing the next few videos on. Then you could tell me if it is correct behavior or not. My discord is @majikayogames

    • @blossomcherrypink
      @blossomcherrypink 12 днів тому

      ​@@fluttershy3642 Bro you just reminded me so hard of CS 1.6 surf maps

  • @mirage3dee
    @mirage3dee 13 днів тому +1

    Wonderful content. Thank you for your time and effort.

  • @Kolbiathan
    @Kolbiathan 18 днів тому +2

    You are a LEGEND! Thank you so much for your clear and in-depth explanations of these topics.

  • @tedmosby1235
    @tedmosby1235 16 днів тому +1

    Ooooh nice bro ! helping a lot !

  • @tuxhome3686
    @tuxhome3686 18 днів тому +1

    Was looking to learn 3d in Godot, will be following this tutorial!

  • @Marandal
    @Marandal 17 днів тому +1

    Awsome. i love me some Source movement. Thank you Maj

  • @sinecure5
    @sinecure5 18 днів тому +2

    Excellent stuff, you're a great teacher.

  • @TRUFANATIC
    @TRUFANATIC 17 днів тому +1

    THIS IS INSANE

  • @saveborg1091
    @saveborg1091 15 днів тому +1

    i have a question... does the "hide child" by switching layer mask would let me setup a multiplayer game? i have this issue where I CANT find a way to hide myself and not the other player.
    Edit: fucking god this video it's insanely well done! the snippet codes explaination... for example what .basis it's litterally the best thing you could've done. PLEASE continue like this.

    • @MajikayoGames
      @MajikayoGames  15 днів тому

      Yes later in the tutorial series (which may take some time to get the videos out) we will use the layer mask feature to help us create a multiplayer game. What you would do here, is only call the code to hide each player's model, on their own machine in _ready(). You can use is_multiplayer_authority() for that, if each client is given authority over their own CharacterBody3D which is probably the approach I'll go with. Then, only the local player model will be hidden and the rest will be shown. You can also just set the nodes to invisible in _ready() depending on which client the code is executing on. Super glad the basis explanation was well received! Goal was to make it accessible to new learners.

  • @nataliereilly7895
    @nataliereilly7895 13 днів тому +1

    👍🏽👍🏽👍🏽

  • @RamS-xz6ku
    @RamS-xz6ku 7 днів тому +3

    Amazing vid rly helpful, do you think there would be a way to combine surfing and titanfall style wallrunning code ?

    • @MajikayoGames
      @MajikayoGames  7 днів тому

      Yeah this sounds like a pretty fun idea for a high skill cap movement fps game. I had a similar idea before. It's pretty easy to check when in surf mode. Probably just checking if clip velocity was called on a wall of some angle. Maybe some walls you can only surf, and others are too steep so you can wallrun, if that's what you mean.

    • @RamS-xz6ku
      @RamS-xz6ku 7 днів тому +2

      @@MajikayoGames yeah exactly provided you have enough momentum to wallrun but also are there any similarities between wallrunning and surfing logic

    • @MajikayoGames
      @MajikayoGames  7 днів тому +1

      @@RamS-xz6ku I haven't implemented wallrunning before, but I guess it would depend on how you implement it. Off the top of my head, with how I have this controller currently set up, maybe you would add a _handle_wallrun function like the others, which would run in the case of maybe having a sufficient amount of some wallrun which gets depleted, and exits right away if not is_on_wall() and the wall is not a correct angle. You could do wall_normal.angle_to(Vector3.UP) and wallrun if it's between like deg_to_rad 85 and 95 degrees or so. I would think wallrun code would be a bit different as you want the play to stick to wall more cleanly and not just slide based on gravity vs strafe as we do here. Could be a fun tutorial, I'll add it to my ideas list.

    • @RamS-xz6ku
      @RamS-xz6ku 7 днів тому +1

      ​@@MajikayoGamesthx for explaining how i could go about it I'll try it out, looking forward to ur vids tho

    • @RamS-xz6ku
      @RamS-xz6ku 7 днів тому +2

      Umm also I noticed that if ur jumping forward in air and click the s key all your forward momentum just stops would there be a way for momentum to change more naturally?
      Edit nvm I'm dumb changing that makes it feel more natural yes but i can't do those fast look around boost things anymore so... Smh

  • @raminkuntopolku8636
    @raminkuntopolku8636 9 днів тому +2

    How would one implement ramp sliding like in source games? Like when you hit a slant/ramp straight on at a high speed, you just keep sliding. Currently in this project the player character just slows down aggressively. Also it seems like bunnyhopping without airstrafes seems to slow you down because the friction is applied from the first frame you touch the ground. How could i make bunnyhopping conserve the speed i have?

    • @MajikayoGames
      @MajikayoGames  9 днів тому

      Not sure what you mean about bunnyhopping without airstrafes slowing you down. I'm not sure exactly how source does it, do they actually wait a frame before applying any friction? I though they just applied a small amount of friction each frame you're on the ground, so if you gain speed faster than the friction by air strafing, you can speed up. You can adjust the character's ground friction to change how this behaves.
      The issue of sliding on slopes, I'll make a note of that, I already have a similar issue here on github that I want to look into. Looks like a few mechanics depend on slope angle:
      github.com/majikayogames/SimpleFPSController/issues/1

    • @raminkuntopolku8636
      @raminkuntopolku8636 9 днів тому

      @@MajikayoGames I mean just hopping straight (simply holding space with autobunnyhop) should let you conserve all of your speed and not slow down a little bit each time you touch the ground. I don't know how source does it but that's what cs bunnyhop and surf servers feel like.
      I don't want to lower the friction since that would make the regular ground movement slippery right? and that wouldn't eliminate the issue completely either.

    • @MajikayoGames
      @MajikayoGames  9 днів тому

      @@raminkuntopolku8636 i think they just have less friction than this controller does by default. try lowering the ground_friction and ground_decel values a bit. yes it is more slippery but source games are more slippery than this controller by default too. also in source there is a different crouch friction which i didnt add yet.

  • @PastaMaster115
    @PastaMaster115 6 днів тому +1

    Is there a benefit to nesting your if statements instead of just using "and"? Especially if there isn't expected to be an elif or else.

    • @MajikayoGames
      @MajikayoGames  6 днів тому

      Nope no difference. Sometimes I do it in my own code if I feel it makes it more clear and easier for me to read, or if I'm planning to add some more code there later.

  • @gronko_chug_butter
    @gronko_chug_butter 6 днів тому +1

    Is there any reason to use the self keyword, or is it just for readability.

    • @MajikayoGames
      @MajikayoGames  6 днів тому

      nope it is implicit for all variables/funcitons in scope of current node but I like to put it there to make it more clear for myself personally

  • @jamesoneill4607
    @jamesoneill4607 18 днів тому +1

    What about those stairs though? 😁

    • @MajikayoGames
      @MajikayoGames  17 днів тому +3

      Tutorial for those should be out in a few days as part of this series :) have 1 short vid to make before that