I started to notice a lot of traffic coming in from KZbin and I think I just found one of the reasons why. Thanks for linking my sprites. 😊
@Bitlytic Жыл бұрын
Thanks for making such great sprites! They're one of the first ones I reach for when prototyping. I'm happy you don't mind me using them in a video like this
@alt-q1y6 ай бұрын
I feel like I've used your dinos for prototyping every platformer I've made, you're a legend within my group
@ArksDigital3 ай бұрын
@@alt-q1y That honestly almost made me tear up...
@captainnelson98333 ай бұрын
@@ArksDigital My whole college class uses your sprites! :D They're too cute.
@bunnybreakerАй бұрын
Yeah those dinos are super cute. I kinda wanna make a whole game using them (maybe one day) 🖤
@ArtyMartyD4 ай бұрын
Unashamed to admit I set the speed of the video to 0.75 and rewound the video dozens of times.
@mojojojo65352 ай бұрын
How else would you learn
@micahrobbins835327 күн бұрын
I understand almost none of this. I tried to follow, but my brain keeps tuning out lol
@ArtyMartyD27 күн бұрын
@@micahrobbins8353 Do it in bite size amounts.
@rashulsel Жыл бұрын
so you are telling me that there is better way to manage code than writing 2000+ lines in single Gdscript?
@liondovegm Жыл бұрын
@@impregnat0rjust write good code lulz (obv joke is obv)
@MFJoyBoy8 ай бұрын
😂😂😂
@rmt35897 ай бұрын
Can I get a side of garlic bread with that spaghetti code? 🍝 🍝 🍝
@H3_remix7 ай бұрын
@@impregnat0rI mean if you are coding you should take it into consideration yourself. Also, most people don’t start coding with GDScript. Surely some do, but not the majority. In those instances they should already be familiar with scripts working in conjunction with one another. I’ve never thought to put all my lines in one single script, but I also am in school for computer science and have had an advantage of learning good habits because of that.
@asdfghjkl-jk6mu6 ай бұрын
@@impregnat0r also the approach of using dictionaries in this tutorial is an inefficient method.
@Bitlytic Жыл бұрын
UPDATE: For this video, I wasn't able to release the source code because of paid assets, but I have created a new project for my most recent video and it uses nearly an identical state machine. If source code would help, I highly recommend checking that out: github.com/Bitlytic/Strategy-GDScript/tree/master/Objects/Scripts/Enemy ERRATA - For the state class, the Process and Physics_Process functions are different than the built in _process and _physics_process functions. This should be clearer and I recommend using names like state_process and state_physics_process to avoid confusion. - 3:31, the enter and exit functions called off of current_state and new_state should be capitalized
@Theburninbeaver10 ай бұрын
THANK YOU!
@zysdota10 ай бұрын
Im confused, so is it supposed to be _process and _physics_process like in the video, or Process and Physics_Process like in the comment?
@Theburninbeaver10 ай бұрын
@@zysdota The main issue for me was my Exit and Enter functions weren't' capitalized
@nicowagner86559 ай бұрын
a good idea. Thank you for your great video. Ill propably input an "EnemyState" extending "State" as for my navigation code i am working with a NavMesh and the export values are already exploding
@nicowagner86559 ай бұрын
@@zysdotaas far as i understood he is using "Process" because it gives him more control as in the State Manager he then assignes _process() state_process is just a better name to differenciate it from the base godot class
@OHTASISAN Жыл бұрын
Just wanna say that you did a great job explaining everything. Lots of youtubers often forget to bridge the gap between what they know and what actual beginners know. In the military we used to call it "barney style". Directions given in a way that a child could understand, and under the assumption that an adult could then branch out and use these tools for a complex mission.
@csih2119 Жыл бұрын
this is what everyone needs to adopt!
@Afreshio11 ай бұрын
I concur. This youtuber has the good stuff in regards to teaching absolute beginners to understand things like State, Finite Machine State, etc. This channel is a treasure for indie godot devs.
@PhotoBomber10 ай бұрын
definitely not a beginner tutorial, way too fast and didn't explain a lot of things, or maybe i'm just slow
@OHTASISAN10 ай бұрын
@@PhotoBomber unfortunately tutorials are very general and you wont find perfectly catered material online or even in a classroom the only way you can achieve that is with a 1 on 1 tutor. i will say if it didnt make sense to come back to it after taking some notes and see if it comes together better with a different perspective. remember that learning how to code or really any skill has less to do with curriculum and more with immersion. aka if you want to learn how to code a game, the most efficient way is to actually code a game. along the way you will be able to identify what you know / don't know and then tutorials like this will become much more useful.
@PhotoBomber10 ай бұрын
@@OHTASISAN I'm using chatgpt to learn to code, it's quite the 1 on 1 tutor, and catered to my preferences
@ShinSpiegel Жыл бұрын
I really love this tutorial, Simple straight to the point and very intuitive. Thanks for the amazing tutorial.
@lowirq4 ай бұрын
If I hadn't known Finite State Machines for years beforehand, I would definitely know by now! Your concise concept & excellent explanation makes FSMs - an often over-complicated yet rather basic topic - easily understandable by beginners as well as intermediate developers IMHO. Awesome content quality I have rarely encountered with video tutorials, and especially on KZbin. Nicely done, keep it up!
@HeraldOD3 ай бұрын
Awesome video! A neat trick for switching states: using the return value from the state's process function instead of signals. That way, you can have @export variables for each state to define its next potential states, and return them to the state manager that does the switching This also removes the need for a dictionary!
@88Factor10 ай бұрын
Please keep doing more Godot tutorials! Even as a total beginner who knows nothing about coding, I was getting something out of this.
@annabellerice83918 күн бұрын
So much of this is flying over my head, I weep
@annabellerice8394 күн бұрын
UPDATE I'VE MADE IT WORK for 2d side-scrolling character controller. ... and I only slightly don't understand how it works
@4dragons632 Жыл бұрын
I dont even understand state machines yet, I used this purely for knowing how to make something which follows the player. Already its been an incredible help, given a few months of learning I imagine the other parts of this will help me too. For some reason the previous things I'd tried like 'get_root' and copying node path were not working and I don't know why. But this worked, and knowing about groups is good too!
@Anisometry6 ай бұрын
For anyone who is encountering an "invalid call" error, change the .exit() and .enter() at the bottom of the state machine scripts to .Exit() and .Enter() , this fixed all my issues.
@allHailKingJulien Жыл бұрын
This is the most beautiful explanation of state machine I have come across. Kudos!
@Haxses. Жыл бұрын
I LOVE your Godot tutorials, I really hope you keep doing them!
@BlackMoonFox2 ай бұрын
fairly dense for me but VERY helpful and not too dense to implement one step at a time. This is exactly what I needed.
@itsdabenji9518 Жыл бұрын
I've watched so many tutorials on state machines and never understood them until now. Thank you very much!
@Hamza-qs7ez2 ай бұрын
To those unfamiliar, don’t be hard on yourself. There’s layers of abstraction operating to grasp this easily. One can recommend: To understand state machines or the state pattern; learn design patterns; to learn patterns learn oop to a basic degree; to understand oop learn programming at a procedural basic level There’s layers here, I genuinely went from this video before my Java oop course building a gui learning about polymorphism, encapsulation, overloading and overriding , events and interfaces And now coming after that I grasp everything instantly
@nathanbanks235410 ай бұрын
Good example! Nice and simple. I usually use an enum for the states instead of strings...though this can be mildly difficult in Godot since the enum has to be imported into everything somehow. For one project I had an autoload class just for all the enums, but I'm not sure this is the best way to do it. I like the way the editor knows what the states are called after because these are in the enum. Maybe it's not as simple, but I find it harder to mess up.
@seroleyat2 ай бұрын
as a complete beginner to godot but experienced with programming i could hardly follow sometimes, but its a good toturial and in the end it made sense
@josephsavio1972 Жыл бұрын
I do not comment that much on KZbin videos. However I wanted to say that I wanted to learn how states machines were implemented on Godot and I never really grasped how. But this video that I found randomly explained perfectly the way. It changed my to make enemy AI. Thank you so much !
@AgnisNeZvers Жыл бұрын
I used this approach for a while in situations when the `match` switch approach gets too complicated. In a project with action platformer controls this approach wasn't enough too. So I blended it with the behavior tree style - states having under states that get checked every frame if that will execute its logic for the current frame. Like PrimaryState (WallSlide, Fly up, Fall, Run, Idle) and JumpGroup( Walljump, JumpBuffer, DoubleJump, JumpDown, Jump). In a hierarchical order. Now I'm thinking about ways to improve it.
@zarblitz Жыл бұрын
For me, the next step was to define hierarchical states so that shared behavior can be defined in ancestor states. For example, WalkState inherits TravelState. TravelState exports a speed property that it uses to determine velocity along with the input_direction property that it inherits from the DirectionInput state. Most of my states also are descended from an AnimationState which exports a property for the animation name, the animated sprite node, and starts the animation in the enter method. The downside to this approach in Godot 4 is that since there is no longer any implicit super() call, you need to remember to call that anytime you override one of the state methods, and as well check if the superclass logic returned a new state that you should transition to instead. Lastly, there's also no reason your StateMachine class can't also inherit State and be a state of its own with its own child states to further modularize your behavior, especially if there's cases you want to consider some external conditions and don't want to bloat your root state machine.
@jethdaflip774111 ай бұрын
@@zarblitz Do you guys use gdscript or C# for your code? Would writing state machines be better in one or the other? Do you have source code for your method? I'm just interested in learning how your method works.
@FlummoxTheMagnificent Жыл бұрын
Holy shit this is actually really high quality
@AndrewTSq2 ай бұрын
This looked really complicated :D I will watch again and see if I can understand.
@altf4216 Жыл бұрын
man's literally fireship
@iothemighty Жыл бұрын
not yet.... not enough memes
@vicentvalls164710 ай бұрын
Man, this tutorials are amazing. I subscribed and I'm waiting for more. Thanks
@catcactus12343 ай бұрын
Pro tip: if you’re designing your state machine to check if the state is valid _inside_ the state itself rather than the main state, make sure to set current_state = new_state _before_ state.enter() is called on the State Machine, otherwise your entity will get stuck in the transition forever. E.x. the main “idle” state will always transition to “move” if an input is pressed, then “move” checks if it’s actually _allowed_ to move in the enter() function before deciding to continue or transition back to the idle state. I’m doing this for my player’s state machine because there’s a lot of variables to check per state if the player is actually allowed to enter the state, and it’s easier to check within the state’s enter() function rather than the main state.
@mariovillegas8211Ай бұрын
A little too fast-paced but I get it from a video that says "under 10 minutes" great way to explain things dude! I learned a lot
@ShiloBuff11 ай бұрын
This is one of the best tutorials and implementations I have ever seen. It's a shame that you haven't posted any recent videos as your content is very helpful. :(
@Bitlytic11 ай бұрын
I'm actually working on more videos! I'm just a terrible procrastinator
@ashgtd11 ай бұрын
yeah! go go go@@Bitlytic
@pliniojrm10 ай бұрын
@@Bitlytic Please make a "Utility AI" tutorial video. I know how to create a Utility AI in Unity, but Godot structure is different and really mess with my way of thinking.
@hiiambarney4489 Жыл бұрын
Good Tutorial. However when it comes to somewhat beginner Tutorials like this one, I'm a big advocate of "Show, don't tell". The examples at the very end are certainly worth tackling, if not for code-re-usability and decoupling, which is a hard concept to grasp for game development. The Video being this short would certainly not be degraded by 3 more minutes of you showing these concepts, at least briefly.
@ArtyMartyD4 ай бұрын
What I think is great about this tutorial is that you don't need to know about the way each state behaves. I like that this isn't the main focus as each state for each game is different for each game dev. At the same time, each state explained here is also extremely versatile due to it's simplicity so if you wanted to you could still use it and just iterate upon it later. But just to know how states work is quite wonderful.
@clintmilner2365Ай бұрын
I loved that you pre-typed/pasted your code to make it faster and remove typos while going, and holy cow that went by fast! I'm going to have to really rely on the spacebar 😅, but I really liked the content! Very clean explanation.
@quondamreveries725811 ай бұрын
I want you to know that your Godot tutorials are very good, and that you should continue making more of them.
@TheCrybn10 ай бұрын
You have made the best Godot tutorials i have seen. You explain everything so clearly. Keep up the good work.
@risingpheonix77406 ай бұрын
Super good video, great outline to start making Finite State Machines in a game. Used this with other tutorials to get a basic Idle/Run/Airborne state machine working in a 2D platformer. Great lesson overall! Took a little while to realise i needed to add "owner" as the prefix to a lot of values, as it's not the state nor statemachine that was holding the velocity and gravity variables, but the Player Object instead.
@jamesodonnell47718 ай бұрын
Wow thanks m8, this worked like a charm for my own project. I can't wait to keep building on it! With component architecture, Godot really is so unbelievably intuitive relative to other software.
@soundrogue44728 ай бұрын
Wait how did you get past the error with the transition?
@jamesodonnell47718 ай бұрын
@@soundrogue4472 What do you mean. Signals handle state transitions as per the video
@rogen582229 күн бұрын
Your tutorials are so easy to understand! Thanks for being such a good teacher!
@lucasenglish664110 ай бұрын
I really like how the tutorial is fast paced but still gives enough info to understand the code
@flamebeard10339 Жыл бұрын
ideally you would want to have the states to be independent of each other, since if you wanted to create a new enemy that instead of following, it runs away when the player you would have to make minor rewrites to your states to make it work. (Instead of using the same wander state, and just changing export variables for example)
@entropywilldestroyusall1323 Жыл бұрын
In that case is it best for the machine itself to decide which state to transition to?
@flamebeard10339 Жыл бұрын
@@entropywilldestroyusall1323 you could either extend the state machine class for more complicated ai, or you could create an event listener that waits for a condition or a set of conditions ( probably just a signal) and then asks the standing to transition to another state
@inkweeper7 ай бұрын
Long time had i suffered having no idea how to build such a state machine thing, before I found this. This tutorial is of great help. Thanks a lot for your work!
@thedarkestone24593 ай бұрын
The way you explain things helped me understand Godot so much better. Thank you : )
@theyellowarchitect45049 ай бұрын
One of the best godot tutorial videos. In the past with Unity, I had built a very complicated state machine without any tutorials, and I wish I had seen something such as this, because I wouldn't have so much spagghetti (e.g. once the physics state machine was merged with AI behaviour, tech debt was sealed)
@tobinrysenga189411 ай бұрын
Just getting into Godot myself. Interesting use of nodes for the state machine.
@virtual__ Жыл бұрын
I got into Godot literally yesterday, and I've already watched all your videos on it. You provide perfectly concise and understandable content. Thank you for doing what you do, will be looking forward to more!
@chunkyquailАй бұрын
Coming from Unity my first approach was to create states as Resources and add them in a list in the State Machine. Your solution utilises the Node methods like Update, which I had to call externally from the state machine. It looks like a logical way of doing it matching the usual Godot modular architecture.
@Mgbeatz_Icrowdx9 ай бұрын
a good tutorial that doesnt start with a 2hours intro , thank you
@andreypap3087 Жыл бұрын
Finally! I find tutorial with good code. With early return implementation, value verification and without other smell code. It's simple and brilliant 👏
@sloydd18008 ай бұрын
This was one of the best videos on FSM. I hope you start to post more. like Player Movement / Attack and how you would handle that in a FSM.
@stesproject Жыл бұрын
That's the most intuitive implementation of a finite state machine I've ever seen 👍
@emovard3n Жыл бұрын
I did not see such useful video for a while. Al three for Godot actually. Subscribed. So please do more :) It really helps me to structure knowledge I already have and get new tricks to use.
@jack7cdusm710 ай бұрын
HEY YO MY MAN im one of those that spends hours researching tutorials and i have a very large bone to pick with how the majority of people (even in great istitutions like universities) teaches things. and since others already pointed it out im not gonna repeat myself and just say: you u got som good shit goin. please keep on making godot/gamedev tutorials im sure your following will grow! and of course, thank you very much for the effort you put in making these videos!
@zombiecarz Жыл бұрын
My godot game and game dev skills grow stronger with every video! Thank you so much!
@redshepard53067 ай бұрын
I really hope these tutorials continue. I watch it slowed down a bit because you speak quickly, but your concise and informative so I subbed
@user-rb9uc8rz6y8 ай бұрын
thank you so much. this guide helped me alot. I ended up re-writing the whole player code but I've finally managed to implement player movement and auto attack system without weird ass bugs. so it was worth it!
@laby18279 ай бұрын
Thanks for the tutorials ! I'm still new at Godot, you really helped me well !
@MrDahunta11 ай бұрын
Nice. Very clean. It is also no problem to introduce more states and transitions between them.
@kerrycodev Жыл бұрын
Such a simple and brief, straight to the point tutorial. I'd like to see more states as a part two, like one to circle/strafe around the player and attack, and maybe a second type of attack.
@Weirdo_Studios20617 күн бұрын
Im gonna have to rewatch this video so many times
@saintnight9792 Жыл бұрын
Got to say, this channel is truly underrated and it needs more audience, your videos so far are all I need for my new project using Godot 4. Thanks :)
@ArtyMartyD4 ай бұрын
After watching this a number of times now, I've noticed that the exit() function is never actually used, it hasn't got any defined instructions in either of the states.
@kboltiz7 ай бұрын
As a code architecture and statemachines fanatic, I thank you for this.
@pietricele Жыл бұрын
Great explanation, as always! 💙
@greg214tx211 ай бұрын
Loved the video! Can't wait to get home to set it up. Thanks.
@omaryahia9 ай бұрын
this is incredible🌟 thank you for all those clean useful concepts please make more Godot tutorials
@HarbingerSh Жыл бұрын
Great tutorial! maybe you should make one about context-steering behaviour to make the enemy moves smarter around
@metropolis1012 күн бұрын
Love this state machine!
@flowfrog101 Жыл бұрын
Very quality video for such a small channel. Looking forward to more
@_trion9 ай бұрын
Dude this is best tutorial for State machines!
@CeePritch10 ай бұрын
Top marks from me! I particularly like how you've approached decoupling the reference to the CharacterBody in the state by using an exported variable. This was always my gripe with other implementations and didng feel very clean at all.
@dondernerd Жыл бұрын
Nicely explained. Will definitely use this one to show to others on the beginnings of a FSM!
@KevinNijmeijer Жыл бұрын
Amazing tutorial! I would love to hear your explanation on concurrent state machines as that's still something I'm struggling with. (For instance: Having a bird enemy which can idle, wander, follow and attack, but also be on the ground or flying, without having to make 8 states in a single state machine)
@billwadsworth6102 Жыл бұрын
Your video are so great! i really want to see more.
@lukazgarza40756 ай бұрын
I don't think I ever learned things regarding Godot or coding as fast as I do here. Also I like your voice.
@ashgtd11 ай бұрын
Please keep making more the last 3 videos are amazing.
@priziuss9 ай бұрын
This channel motivated me to start learning Godot the explanations are soooo good
@NoelCav Жыл бұрын
These videos are great. Cant wait for whatever you ake next.
@Qwasieee_P Жыл бұрын
One of the few good tutorials on godot
@SolartDevАй бұрын
I loved your code! Thanks for sharing :)
@jardorook8259 Жыл бұрын
Thanks for this, really helped to see a bare bones example. Was able to easily adjust for 3D nodes
@HamoodyDarbaDoody10 ай бұрын
Really love your tutorials. Hope you make more, im learning a lot from them
@georgea.corman22268 ай бұрын
Awesome explanation! This helped me out a lot! Good mix of theory, then demonstrating on how to put it into practice.
@underscorerx10 ай бұрын
Great tutorial. Eagerly waiting for your next one
@DiSyllar25 Жыл бұрын
Great video, I was actually looking to clean up the way I handle state machines in my game, and this video is going to be very helpful!
@Seckie Жыл бұрын
It would be awesome if you could provide the source code for this tutorial so it would be easier to reference ^.^
@user-rb6bx9sd8h Жыл бұрын
There's a much simpler way to visualize a state machine. to implement any state machine that is valid for ANY kind of state, you only need 1 function, one function that takes a state as input and returns a state as output. so change_state(new_state: State) -> State If you accomplish that, through category theory analysis you have a complete functional and valid state machine. Cuz a state machine is just a monoid in the category of types. (if you want to know the theory and rigorous reason why is that true is because a state machine can be defined by a monoid in the category of types) and that's also why languages that dont have strong typing like python are obsolete in comparisson to C# or C++, cuz type matching allow you to use category theory to simplify your code by an insanity. the way i do it is simply inside the change_state function that is a public method in the state_machine class i call only 2 things. first i change the current_state property of the state_machine to be equal to the new state, then i call new_state.onAttach(state_machine, Entity) the onAttach is a method that is present on every single State object (which can be guaranteed to be true using interfaces) and is the basic functionality that must be called at the momment that state is activated. this method also allows that this same state machine structure can be used for anything in my code, player, NPC's, animations, sounds, events, anything that requires state changing i can control using the same structure. if anyone is interested in learning more about this functional approach for statemachines just call me out.
@protecta2211 ай бұрын
Hello, I'm super interested, any code snippet to provide as a base example?
@tomsterbg8130Ай бұрын
This is insanely good because the tutorial doesn't go *too* deep into telling you what happens, there's enough information for you to know exactly what's going on. Also there's the highlighting of the new code in between the cut and a few words on what it does. This means the tutorial is very good at picking the level of skill that's needed for the person who watches, but also makes it super easy to follow and learn, without directly copying as there's some things already done in the background. I've been coming back to your channel a lot and I believe the reason is because each video is very high quality and straight to the point with no boilerplate.
@davidb4020 Жыл бұрын
Used the basics of it in my game. Great video thanks.
@princeedhwardhezmi646911 ай бұрын
I'm absolutely subbing and keeping this as my note on gd script thanks
@GameGW935 Жыл бұрын
I hope we are going to see more videos like this in the future from you.
@Outfrost18 күн бұрын
As an experienced programmer who has had to deal with node-based state machines written by others: please start using enums and stop overcomplicating state machines with subnodes, signals, impostor update functions, etc.
@bjkloss5 ай бұрын
Watching this i felt like the Kel meme from Good Burger. "Yes I know some of these words". Im far too green at coding for this but saving it for later when hopefully I can understand more than the first 1.5 minutes.
@rockyhitcha960410 ай бұрын
How a awesome tutorial! it's clear and useful. I am newbie in program and i can understand from this video. I really hope you keep doing them! I miss you Bro😄
@Fatalhck7 ай бұрын
Awesome tutorial, although the fast pace not typing kind of make it hard to do it at the same time, a lot of times I needed to pause and go back.
@serahsquarepantsАй бұрын
Really good video, pretty useful to get the concept. I would consider using owner logic to prevent code dependency to Enemy tho
@tofuryu35677 ай бұрын
yes! I found the best godot tutorial ever
@indierusty Жыл бұрын
Thank you a lot! Excellent Explanation
@TommyLikeTom6 ай бұрын
thanks so much for this. I'm currently splitting up my 2000 line single script into 10 smaller scripts
@davigamer21447 ай бұрын
More videos like this, this is great!!!
@zachnewby47398 ай бұрын
Thank you man! I'm going to use this!
@fuzzy-02Ай бұрын
I ran away from frontend, thank you
@pogolaugh6 ай бұрын
Great video man, very helpful. But man do you go fast in some parts. i had to throw it on .25 speed at 5:40 to see what you were even doing. Edit: I spent at least half an hour trouble shooting errors I kept getting. Turns out it was the fact that I capitalized the "player" group so it wasn't finding the player's global position because it was searching for "player" not "Player". Gotta love case sensitive code...
@Themrsnappyify4 ай бұрын
im begging you to explain, I went to on base nil error to on base GDScript error doing what you said