Enemy AI Series 1: The State Machine

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 มิ.ย. 2024
  • -- Social --
    Discord: the discord server has been shut down, sorry!
    Twitter: / garbaj2
    -- Links --
    Github: github.com/GarbajYT
    -- About --
    Dummy Model: github.com/GarbajYT/video-gam...
    State Machine Template Code: github.com/GarbajYT/godot-bas...
    Today we begin a brand new tutorial on this channel where we cover artificial intelligence and how to create AI in your video game projects. In this Godot tutorial, we're learning about the foundation on top of which all game AI is built: The State Machine.
  • เกม

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

  • @rafaelgpontes
    @rafaelgpontes 4 ปีที่แล้ว +23

    I sincerely think that state machine is one of the most important topics to learn in game dev.

    • @garbaj
      @garbaj  4 ปีที่แล้ว +5

      I agree, it's so useful!

  • @_mickmccarthy
    @_mickmccarthy 4 ปีที่แล้ว +26

    Awesome! Thoroughly looking forward to the rest of this series!

    • @garbaj
      @garbaj  4 ปีที่แล้ว +3

      Thanks!

  • @ishkapoor7931
    @ishkapoor7931 4 ปีที่แล้ว +33

    somehow in just love with your tutorial... you are an amazing tutor and a guide... Hope to really amazing stuff from you(greedy). though you have already made some really amazing tuts!!!

    • @garbaj
      @garbaj  4 ปีที่แล้ว +1

      Thanks for your support!

    • @raghavendrabhat6035
      @raghavendrabhat6035 3 ปีที่แล้ว +2

      @@garbaj you deserve so much more from youtube man

  • @UlfgrimRaneth
    @UlfgrimRaneth 20 วันที่ผ่านมา

    Finally! I've been stuck with trying to make the AI for my game work for weeks and every tutorial just told me what to do instead of actually teaching how it works.
    Your video is a godsent. Thank you so much.

  • @jlewwis1995
    @jlewwis1995 3 ปีที่แล้ว +34

    11:34 *yanderedev has entered the chat*

  • @mr0o
    @mr0o 4 ปีที่แล้ว +9

    Just found your channel yesterday and holy shit this is great stuff! I am learning a lot more than I have from other tutorials

    • @garbaj
      @garbaj  4 ปีที่แล้ว +1

      Welcome! Glad you're finding my videos helpful

  • @davidfilus1741
    @davidfilus1741 2 ปีที่แล้ว +3

    Such an amazing explanation! Can't wait for the rest of the series!

  • @BrianRogers3D
    @BrianRogers3D 3 ปีที่แล้ว +3

    great job explaining some programming basics and common approaches. I'm more of an animator and 3D guy than programming. I've decided to make something in VR using Godot, so I watch every vid you make, because you are such a great teacher. Really appreciate your efforts.

  • @sigitsatriap6505
    @sigitsatriap6505 4 ปีที่แล้ว +18

    State machine ??
    Finally !!
    Please make player state machine in the next video, can you make it with 3rd person ? Its more easy to see player action i think
    I can’t understand at other video tutorial,
    Your explanation was easy to understand
    I’m joining your discord !
    🥳

    • @garbaj
      @garbaj  4 ปีที่แล้ว +5

      Thank you! Also, this state machine can be used for anything, including player characters and 3rd person as well. It's all the same

    • @jamesxxxyz8775
      @jamesxxxyz8775 4 ปีที่แล้ว +1

      th-cam.com/video/LaNaTmYq3kY/w-d-xo.html there is a download link for 3rd person controller.

    • @sigitsatriap6505
      @sigitsatriap6505 4 ปีที่แล้ว

      JamesXXXYZ thanks alot !!! Really u know what i looking for 👍🏻

  • @bity-bite
    @bity-bite 4 ปีที่แล้ว +12

    love how you explain everything!

    • @garbaj
      @garbaj  4 ปีที่แล้ว +1

      Just trying to do my best!

  • @nomadic_shadow
    @nomadic_shadow 2 ปีที่แล้ว

    Thanks, Garbaj. This was really helpful in me making my basic patrolling AI that uses raycasts to detect collisions.

  • @yamen._.m
    @yamen._.m 4 ปีที่แล้ว +3

    Please continue all of these amazing and clear tutorials please please
    Thank u soo much
    I have some difficulty in stuff like this
    And what u are doing helps me a lot
    I can finish earlier as well as learn tons of stuff
    Again, Thank u man :-)

    • @garbaj
      @garbaj  4 ปีที่แล้ว +2

      Hey! Glad my videos are helping you

  • @nightcode3171
    @nightcode3171 4 ปีที่แล้ว +9

    Very simple and very helpful, thanks for the tutorials

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      Glad it helped!

  • @NOPerative
    @NOPerative 4 ปีที่แล้ว +16

    Garbaj != garbage
    state isTrue == TRUE
    Awesome stuff as usual. One's trash may be another's treasure - would agree considering this video.
    Excellent example and discussion - topic & delivery 10/10.

    • @garbaj
      @garbaj  4 ปีที่แล้ว +2

      Wow, thanks for the words of encouragement! I'll continue to do my best

  • @denizdemir9255
    @denizdemir9255 4 ปีที่แล้ว

    This was really easy to understand! Another amazing tutorial.

  • @shakthinandan7124
    @shakthinandan7124 3 ปีที่แล้ว

    I watched state machine videos before but never understood the topic State Machines this better
    The way your explain is so good
    Keep making more videos

  • @drew230
    @drew230 3 ปีที่แล้ว +1

    Just found this today,man this is what I needed fam

  • @mlnz2991
    @mlnz2991 3 ปีที่แล้ว

    your tutorial is so easy to understand, thanks

  • @travisratto5418
    @travisratto5418 2 ปีที่แล้ว

    I'm glad i found this channel. Plus you update your code.

  • @nicholasdellipaoli226
    @nicholasdellipaoli226 ปีที่แล้ว

    So happy to see that the first clip of gaming used in a video titled about creating AI, is Halo Combat Evolved. The best enemy AI in any FPS ever!

  • @notplushh
    @notplushh 3 ปีที่แล้ว

    TYSM YOUR TUTORIALS ALWAYS GET THE JOB DONE 99.99% OF THE TIME

  • @vatan2578
    @vatan2578 4 ปีที่แล้ว +2

    Thank you very much for your educational sharing. I wish you Health and Success.

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      Thanks, much appreciated

  • @jesustzinon
    @jesustzinon 4 ปีที่แล้ว

    Bro, this is a very good tutorial, this is very well explained! keep making these vids!

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      Thanks, will do!

  • @cybergeek199
    @cybergeek199 3 ปีที่แล้ว +1

    You're the best ONE to make Godot tutorials

    • @garbaj
      @garbaj  3 ปีที่แล้ว +1

      Thanks!

  • @arturbrilliant
    @arturbrilliant 4 ปีที่แล้ว +2

    Thank you for your videos, bro! :)

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      You're welcome

  • @mahmoud_ali_963
    @mahmoud_ali_963 4 ปีที่แล้ว

    Im really thankful

  • @pascalcasier959
    @pascalcasier959 4 ปีที่แล้ว

    Thank you so much for another great tutorial.

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      You're welcome!

  • @HalfAsleepSam
    @HalfAsleepSam 2 ปีที่แล้ว

    AI gets me excited instead of nervous

  • @disdis6127
    @disdis6127 3 ปีที่แล้ว +1

    Great video!

  • @luh034
    @luh034 3 ปีที่แล้ว

    why is this channel so small? It deserves way more subs i think.

  • @redsnow579
    @redsnow579 4 ปีที่แล้ว +1

    Start sharing this like crazy people! Indie game devs need to know that these tutorials exist!

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      Thanks for the support! And yes, please share my videos with the world!

  • @NgaeGameStudio
    @NgaeGameStudio 3 ปีที่แล้ว

    Yeah thats what exactly i did last year with gamemaker in 2d fighting game, i use health and stamina to take decision for the AI, if AI health less than 1 then ai will do something or if gun low ammo then ai will do something 👍 keep that good work bro

  • @classicguy7813
    @classicguy7813 4 ปีที่แล้ว +1

    Subbed and amazed . Love Turkey

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      Thanks for the sub, glad to help!

  • @christianbatista0
    @christianbatista0 2 ปีที่แล้ว

    Thank you for telling me there is more then IF and ELSE

  • @drbjbpog9956
    @drbjbpog9956 2 ปีที่แล้ว

    this is great

  • @lezharayman9897
    @lezharayman9897 4 ปีที่แล้ว +1

    PLZ make more and more and more ..... Keep them coming. A BIG SUBSCRIBE FOR YOU !!!

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      Appreciate the sub! Welcome to the channel

  • @enclonstudio2525
    @enclonstudio2525 4 ปีที่แล้ว +2

    ТЫ красава,успехов тебе

    • @garbaj
      @garbaj  4 ปีที่แล้ว +1

      благодарю вас

  • @Evangelion09
    @Evangelion09 2 ปีที่แล้ว

    IT IS SO F GODD TUTORIAL!!!!!!! perfect

  • @handsome_lad
    @handsome_lad 4 ปีที่แล้ว +1

    Nice :D

  • @shayneoneill1506
    @shayneoneill1506 3 ปีที่แล้ว +5

    If your getting into fairly advanced stuff, its worth looking into Behavior Trees, which dont have a lot of the downsides of state machines. That said there aren't a lot of good implementations of behavior trees on Godot. (The one I use I had to hack extensively to implement a blackboard. One of these days I'll either push the changes back, or upload it myself, but its a bit of a dirty hack that needs some cleaning.

  • @heawon78
    @heawon78 4 ปีที่แล้ว

    Thank you

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      You're welcome!

  • @ahmadtakhimi6839
    @ahmadtakhimi6839 4 ปีที่แล้ว

    Thank you for the tutorials. Can you please do a ragdoll setup and ingame usage ? Thanks

    • @garbaj
      @garbaj  4 ปีที่แล้ว +1

      Hope to do a video on this soon

  • @juancarlosblanco5259
    @juancarlosblanco5259 20 วันที่ผ่านมา

    eres el mejor

  • @FletcherGaddy
    @FletcherGaddy 2 ปีที่แล้ว

    Aw looks like this series kinda died, shame. Love your content in general man, keep making awesome videos!

  • @abhishekfarshwan3085
    @abhishekfarshwan3085 2 ปีที่แล้ว

    spartans assemble

  • @mahmoud_ali_963
    @mahmoud_ali_963 4 ปีที่แล้ว

    Pro you grate

  • @OmegaF77
    @OmegaF77 2 ปีที่แล้ว

    It's perfect aside from the fact that the states are still smeared across the logic. The better way would be have different functions as states and run those functions in the match/case (switch) statements. Each function would have their own logic and animation.

  • @unfa00
    @unfa00 3 ปีที่แล้ว

    Oh wow, I wish I've watched this *before* I implemented my super crappy state machine based on strings rather than enums...

  • @justalemur5285
    @justalemur5285 4 ปีที่แล้ว +1

    you the best

    • @garbaj
      @garbaj  4 ปีที่แล้ว +1

      Thanks!

  • @s.s.scriptties
    @s.s.scriptties 3 ปีที่แล้ว +1

    I have a problem in line 19 if raycast.is_colliding( ): it is saying its a debugging error : Attempt to call function 'is_colliding' in base 'null instance' on a null instance . I'm new to programing so don't know what any of dat means so can u pls help

  • @jamesxxxyz8775
    @jamesxxxyz8775 4 ปีที่แล้ว

    Can you simulate viewing cone with raycasts? Position should be where the eyes are and in the idle state, enemy should look in random directions. When enemy detect the player he should turn to the player (while moving?).

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      Yes, you can. It requires some math that I don't understand, but it's definitely possible

  • @seopterleo7934
    @seopterleo7934 3 ปีที่แล้ว

    Is the game that u played the first made with godot. By the way amazing tutorial

    • @garbaj
      @garbaj  3 ปีที่แล้ว

      No, that's Halo: Combat Evolved, made by Bungie for Xbox

    • @seopterleo7934
      @seopterleo7934 3 ปีที่แล้ว

      Oh

  • @Chevifier
    @Chevifier 3 ปีที่แล้ว

    Ive been using Godot for years and didnt realize I dont have the give the Enumerator a name lol I usually do something like
    enum PlayerState = {
    IDLE,
    WALKING,
    JUMPING
    }
    then call it like state = PlayerState.IDLE

    • @garbaj
      @garbaj  3 ปีที่แล้ว

      it's probably a good idea to name them so things don't get mixed up, but yeah you don't actually have to do it

  • @Fropaa
    @Fropaa 3 ปีที่แล้ว

    i have a problem in 11:00 the dummy doesnt play the animation when the raycast is collision help

  • @mahmoud_ali_963
    @mahmoud_ali_963 4 ปีที่แล้ว

    I wish you make tutorial on export game in godot
    I made a simple game in godot and after exporting it ..it can't change the menu sean to the game sean

  • @velot1eksedimoi417
    @velot1eksedimoi417 4 ปีที่แล้ว

    I want to write it in c# , if i follow along your videos and just change syntax to c# , is it enough for it to work? Why wont you write your game code in c#?

    • @garbaj
      @garbaj  4 ปีที่แล้ว +1

      I don't know if it's just a matter of changing the syntax. I'm clueless when it comes to C#

  • @nightcode3171
    @nightcode3171 4 ปีที่แล้ว

    Can u do an item or inventory system, i-if it's not to much.

    • @garbaj
      @garbaj  4 ปีที่แล้ว

      Hope to do this eventually, just gotta learn how

  • @gimong5537
    @gimong5537 3 ปีที่แล้ว

    can i make him chase the character? please show me how

  • @judelingan5863
    @judelingan5863 3 ปีที่แล้ว

    this is really good, but how is an enumerator better than an array?

    • @garbaj
      @garbaj  3 ปีที่แล้ว +1

      It's not necessarily better, but being able to refer to a state by it's name rather than by it's array index is a little easier to explain in a tutorial

  • @ranjithrans
    @ranjithrans 4 ปีที่แล้ว +1

    How could you read my mind???

    • @garbaj
      @garbaj  4 ปีที่แล้ว +1

      Muahahahaha!

    • @frankoesavage8314
      @frankoesavage8314 4 ปีที่แล้ว

      .......plot twist i was thinking the same thing

    • @nightcode3171
      @nightcode3171 4 ปีที่แล้ว

      Ikrr

  • @cybergeek199
    @cybergeek199 3 ปีที่แล้ว

    6:46 how to get that code in my case?

  • @roflman
    @roflman 2 ปีที่แล้ว

    "Can't we just use a bunch of if statements instead?" No Yandere dev, go away

  • @jackthejzsc1629
    @jackthejzsc1629 2 ปีที่แล้ว +1

    0:45 Squid game?

  • @vsevolod_pl
    @vsevolod_pl 3 ปีที่แล้ว

    How to import .blend model in godot?

    • @garbaj
      @garbaj  3 ปีที่แล้ว

      You first need to export the model to a 3d format (obj, gltf, dae) before you can import it into Godot. A .blend file by itself wont import

    • @vsevolod_pl
      @vsevolod_pl 3 ปีที่แล้ว

      @@garbaj Thank you! Which 3d format is better to choose?

  • @mali-wp8wc
    @mali-wp8wc 4 ปีที่แล้ว +1

    First