Using Composition to FINALLY Make A Shotgun in Godot 4

Поделиться
HTML-код
  • Опубликовано: 17 ноя 2024

Комментарии • 32

  • @Chaff_Games
    @Chaff_Games  10 месяцев назад +3

    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.

  • @n41sd
    @n41sd 10 месяцев назад +12

    Funny, I didn't know that name, but I coded my weapons system exactly that way. It makes expanding a lot easier, I even created a base class that controls all the items, where I leave the 3D model scenes, icons, name, description, it helps a lot! Other than that, great video as always!

  • @BlueAvi8
    @BlueAvi8 9 месяцев назад +3

    yes, realistically, shotguns are very lethal (with one shot) at 30m, and the pellets can kill out around to 100m, though at that range they have slowed down significantly and have spread enough that one pellet hitting a man sized target would be considered a maybe.

  • @notimportant3033
    @notimportant3033 10 месяцев назад +3

    (2:11) LOOK MA I'M ON TV
    And yes, a tutorial going more in-depth into this would be great.

  • @gorrrroto
    @gorrrroto 10 месяцев назад +5

    Still haven't gone through the entire video but I actually gave it a shot to make my own weapon manager from scratch last year and came up with a fairly clean solution so i thought i'd share it! It is true that i made it in 2d so not exactly the same but i think some concept would translate very effectively.
    The main thing to consider is that i did not have a shotgun class perse; i had automatic fire, semiauto and manual classes but other than that everything was the same, i also didnt't have hitscan weapons son that simplified it a bit.
    Now for the interesting part; every weapon had a bullets_per_shot variable and a spread_angle variable. Everytime a shot was called the direction angles of each bullet(the raycasts in this case) where randomized withing the spread angle range, this process was put into a for loop that repeated for the amount of bullets in the shot. This made really easy to implement a shotgun, high spread angle high amount of bullets but it was equally easy to make a pistol, very low to none spread angle and just one bullet.
    If anyone is interested on the code i can send it via email or whatever, fair warning it's very messy, it was my first project but still i hope it can help someone

  • @w花b
    @w花b 4 месяца назад +1

    I ran into the same issues about empty exported variables and all these things I went crazy. Byt then I remembered it's fine for it to be a bit dirty if it's for a game and not a template.

  • @biglootums5243
    @biglootums5243 10 месяцев назад +1

    Always encouraging to see people making cool stuff like this in Godot. Keep up the great work!

  • @Jun-o3l6t
    @Jun-o3l6t 10 месяцев назад +1

    Finally a new shotgun spread tutorial, very nice

  • @stickguy9109
    @stickguy9109 10 месяцев назад +1

    This is a perfect use case for interfaces.

  • @amirosman8797
    @amirosman8797 10 месяцев назад +1

    Looks amazing, a tutorial will definitely be great help

  • @wimdyslim
    @wimdyslim 10 месяцев назад +2

    Shotgun spread in videogames is one of those things that gets on my nerves, so hearing you say 30m is not very realistic for shotguns is funny, because actual shotguns have a pretty tight spread, and can be lethal out to 50m to 75m. So comparatively, its pretty realistic, especially if its a rather short barrel shotgun with no choke.
    Anyway, great video!

    • @Chaff_Games
      @Chaff_Games  10 месяцев назад +2

      Yeah, the lethal range IRL is way higher. After making one in game i kind of understand why it's so different in video games, it would be very op.

  • @JoeCentralGaming
    @JoeCentralGaming 10 месяцев назад +1

    Best channel for godot !

  • @yee2343
    @yee2343 10 месяцев назад +1

    Will there be a more in depth video? Feels like you sorta glossed over everything but good none the less.

    • @Chaff_Games
      @Chaff_Games  10 месяцев назад

      Yes, kind of torn on presentation but hopefully next week full tutorial. And I’m also considering a from scratch video as well. Since the weapon manager is a bit of a beast at this point.

    • @yee2343
      @yee2343 10 месяцев назад

      @@Chaff_Games yeah, I feel you. It’s probably really hard to be entertaining while also being in depth about this stuff. I will say though, you were really good at being entertaining this video! I do hope for a in depth about the shotgun cause for some feedback these are somethings you didn’t talk about the last video which made this video a bit confusing: recoil, what node the projectile code was on, and spray. using the template you provided I noticed that for the weapons resource code get_point_count() is on a base Nil. If you’d like. I can provide screenshots!

  • @rozaco_games
    @rozaco_games 10 месяцев назад +1

    I got stuck because I can't pick up things like key,
    I want to learn pick up system

  • @archieh-d1828
    @archieh-d1828 10 месяцев назад +1

    Alternatively, you could also just make every shotgun only fire slugs.

    • @Chaff_Games
      @Chaff_Games  10 месяцев назад +1

      Yeah that’s totally fine too.

  • @xyonblade
    @xyonblade 5 месяцев назад +1

    shotguns in video games are often disappointing compared to real shotguns, or so I hear, being that "pellets" are not the only type of shotgun.

    • @Chaff_Games
      @Chaff_Games  5 месяцев назад

      I agree. there’s a really good video out there explaining why.
      ruclips.net/video/gJ5xDfIjjKQ/видео.htmlsi=MnQbvyijAYqCLBoz

  • @TheGobou77
    @TheGobou77 10 месяцев назад +1

    am i the only one that code in a fucked up way ?
    i don't even know if what i do is composition. but i sure don't use inheritence.
    and yes, it's basically a 500 lines code for a node, this node pocess an other node with 300 lines code, which then set up projectiles, which will set up explosion.
    the explosion can be setup by anything if i decide (melee, laser, self-destruct if i want)
    i'm making a 2d game with godot 3 :/

    • @TheGobou77
      @TheGobou77 10 месяцев назад

      correction, i have over estimated the size of my code
      250 lines and 200 lines

    • @Chaff_Games
      @Chaff_Games  10 месяцев назад

      I think if it works, it works. I wouldn’t stress too much. For my project this is what I needed.

  • @rozaco_games
    @rozaco_games 10 месяцев назад +1

    Please reply me!
    Hey chaff would you help me. If we use navigation enemy automatically finds us but I don't want it.i want that when my player enters enemy's area enemy should follow and hit the player

  • @Strixluca
    @Strixluca 10 месяцев назад +1

    Yooo

  • @lx2222x
    @lx2222x 2 месяца назад +1

    aaaa

  • @Boildroid
    @Boildroid 10 месяцев назад +1

    this is cool. For spread pellets i used math but it get worse.

    • @Chaff_Games
      @Chaff_Games  10 месяцев назад

      I avoid math at all points haha.

    • @Boildroid
      @Boildroid 10 месяцев назад +1

      @@Chaff_Games Deus Ex MD devs get circle and pellets flies randomly inside circle