There’s a lot of poorly presented Godot tutorials around - too fast, too slow, not enough explanation, too much explanation, too short, or just way too long. This is none of those things, it’s a Goldilocks tutorial, it’s just right. Thank you, keep it up.
This is frustrating, as someone who makes tutorials on my other channel, non are this good!! Your examples and explanations work so well with my learning style. Thanks man!
this is weirdly one of the most useful tutorials I've seen on Godot yet. Would love to see you explain more of the most commonly useful GDScript things at this same level. Thank you!!!
@@Blargis3d I appreciate how you recreated the InvokeRepeating function from Unity. I'm curious about other useful Unity functions that can be recreated using Godot 4 concepts. I believe this topic would be interesting to many Unity expats who are accustomed to certain features they are comfortable with, but find themselves lacking out-of-the-box functionalities like interfaces, event delegates, and so on.
This is super usefull, i would like more! this is the king of tutorial that helps, not that "do this", but "understand this and apply yourself", thank you!
I am grateful for this tutorial. That util function is required for any serious game, and its as clean as it gets. That array mapping via callable got me surprised as I was like "Why obscure when you can do foreach array element loop and call your function" then it got to the filter part.
This was a fantastic video. Super useful and probably the best intermediate/advanced GDScript content I've seen. I see you haven't made another deep dive in a while, but really hoping you do. I'd pay for more content like this. I had no idea GDScript was functional like JavaScript with first-class functions and lamda functions. I'd love to see more videos about GDScript, perhaps how first-class functions can be used even further like you demonstrated with the InvokeRepeating utility. How those array functions like map and filter can be used in the context of game development as well. Please make more videos like this!
One thing to note, you can still name your lambda function. It helps if the lambda function has an error in it, such as trying to call a function on a null object, because then the debugger shows the name of the lambda function instead of .
You are an excellent teacher. I haven't seen godot video explained with such clarity yet. Thanks for making these man! Hope you continue making such videos. Liked and subbed.
"Static" confused me :D But everyting else is sooo cleeear with your explanations, thank you so much for being such a nice person and share this kind of knowledge. I am waiting for more!
I'm so happy you found it helpful!! As for "Static", this topic can be a little confusing when you're first learning so I totally understand. I hopefully will have a video on this soon! In the meantime, here is a brief explanation: In the video, I declared the static method in my "Util" class. So normally to call a method in a class, you need to create an instance of that class, for example: var my_util_instance = Util.new() my_util_instance.run_periodically(parent, function, period) But because I declared "run_periodically" as "static", I am saying that this method applies to the Util "type" as a whole, not just instances of the Util type. In other words, I am telling Godot that I don't need to create an instance of Util to be able to call "run_periodically(...)". So since the method is static, we can just say Util.run_periodically(parent, function, period) This is cleaner and also saves memory because now we're not creating new objects if we don't have to. The main restriction with using "static" methods is that they can't rely on any data that would normally be tied to an instance of that class. So for example, for the class Vector3, we can create an instance of a Vector3, then get its length by calling "instance.length()" like this: var my_vector = Vector3(5, 2, 6) var length = my_vector.length() The method "length" is a non-static method. It can't be static because it needs data specific to instances of Vector3. For example, it makes no sense to do: var length = Vector3.length() What would this even return? We don't have an instance of a Vector3 yet so there is nothing to calculate. Because this makes no sense, the "length()" method is a non-static method and if you try to do the above it will just cause an error saying 'Cannot call non-static function "length()" on the class "Vector3" directly. Make an instance instead.` Hope that helps! If it's still a bit unclear, I should have a video on this soon!
You know, you could have made it simpler by using bind. With bind, you can preset arguments. Whenever a callable is called, all of it's potential arguments get passed in before bind, so in your examples: you could have used print(get_function_runtime(count_to_number.bind(10_000)). where calling bind returns a new function, which has it's last x arguments bounded to the parameters passed in by bind. This is especially useful for signals, where you have to pass in some kind of data, based upon an instance of something.
Good point, this is definitely valid and a great way to do it if it meshes with your brain. I remember learning JavaScript bind() syntax many years ago when I was learning the React web dev framework, and it made absolutely no sense to my noob-coder brain. In my opinion the way I showed is a bit easier for a beginner to reason about, which is why I didn’t even mention bind() syntax. I’d certainly be curious to know if you or others think otherwise though
@@Blargis3d I personally don't think that bind is too complicated. Because it's basically like instead of passing in a function, you're assigning some data to it as well, It's just that this data can be accessed as the nth argument. In most cases, you're not going to pass in data with the function call as well, so this data will be the first argument. But even if you do, that's only 1 more little complexity thing, which you could teach later.
wow!!! ty !!! even with coffee this was alot to absorb. but I think I finally got it straight in my head. now I just need to apply this in a few practice code sessions and I will be good to go.
You could also technically test the greeting function by having its argument be person:="jim" that way there's a default value, and you can call it without any arguments.
y'know, I *would* like to see more about static functions... also how dot products work. Like I know they can be used to compare angles, so I want to experiment using dot products to determine whether a character is facing perpendicular to a wall or parallel to it. That way a character can either do a wall run or slide down the wall and do a wall jump based on character orientation instead of using button combinations. Jeez, I could make quite the list of things I want to know more about... I started coding 3 weeks ago, so I have a long road ahead lol. This helped me figure out why i couldn't successfully use get_wall/floor_normal (I forgot the parenthesis... lol ) I'm trying to figure out how I can use surface normals to detect ramps so I can adjust momentum based on angle. more weight makes climbing and stopping harder emphasized by angle of descent/ascent. One thing I'd really like to find out is if meshes can be drawn curved using the surface tool. I'm doing a voxel-style game, but I want to bevel the edges to give it a softer feel without increasing the number of vertices. might be impossible, idk yet.
Hey loved the video! Could you explain what add_child(timer) is doing exactly. You said it adds it to the tree, I’m guessing you mean the node tree but I don’t understand why you have to do that. I appreciate any response :)
Hello author, thank you for your video creation. It's very friendly to me as a beginner. In my country, there are very few video tutorials about Godot. Can I share your video on domestic websites, including your link and creative information? Looking forward to your reply. Thank you
Wait, technically function.call is also a callable. So that means you can do: var x = function.call x.call() which basically means no one's stopping you from doing function.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call()
You know, it's only just occurred to me that the word Godot is really weird. How is it pronounced? Does it rhyme with Robot? It would make sense because the logo is a robot. Is it good-oh? Because Americans say it like that. Personally I always call it "God O"
I think the word is french or is based off of some french movie named Godot. Because of its french roots I think that is why the T is silent. In the movie a bunch of guys were waiting around for something that never came. The first devs felt like that about game engines and so they made their own.
@@VaSoapman I know about waiting on godot but I still don't know why the logo is a robot if it isn't pronounced like robot, and why it's "gud-oh" and not "god-oh"
There’s a lot of poorly presented Godot tutorials around - too fast, too slow, not enough explanation, too much explanation, too short, or just way too long. This is none of those things, it’s a Goldilocks tutorial, it’s just right. Thank you, keep it up.
Most of the Godot tutorials are hacky and crappy code. Just outright terrible practices.
Why can't more tutorials be like this? Clears up any confusion I had before.
This is frustrating, as someone who makes tutorials on my other channel, non are this good!! Your examples and explanations work so well with my learning style. Thanks man!
this is weirdly one of the most useful tutorials I've seen on Godot yet. Would love to see you explain more of the most commonly useful GDScript things at this same level. Thank you!!!
The practical example is the key. It makes everything so much clearer. Without it, it's a bit abstract for a beginner. Good one, mate!
I'm really liking your teaching style! Keep doing more of these deep dives on the Godot engine, please!
Thank you so much! I definitely will! Are there any topics in particular that you would like to learn more about?
@@Blargis3d I appreciate how you recreated the InvokeRepeating function from Unity. I'm curious about other useful Unity functions that can be recreated using Godot 4 concepts. I believe this topic would be interesting to many Unity expats who are accustomed to certain features they are comfortable with, but find themselves lacking out-of-the-box functionalities like interfaces, event delegates, and so on.
That is a great point, I've been thinking it would be cool to make a video like this. I will look into it!
Super useful video. You explain everything so thoroughly, and yet so dynamically that I rewatched it twice and never felt bored. Amazing teacher!
I'm a non-game programmer trying to learn godot and this helped so much.
This is super usefull, i would like more! this is the king of tutorial that helps, not that "do this", but "understand this and apply yourself", thank you!
god damn this was such a clear and concise tutorial, just subscribed thank you!
I am grateful for this tutorial. That util function is required for any serious game, and its as clean as it gets. That array mapping via callable got me surprised as I was like "Why obscure when you can do foreach array element loop and call your function" then it got to the filter part.
This was a fantastic video. Super useful and probably the best intermediate/advanced GDScript content I've seen.
I see you haven't made another deep dive in a while, but really hoping you do. I'd pay for more content like this. I had no idea GDScript was functional like JavaScript with first-class functions and lamda functions.
I'd love to see more videos about GDScript, perhaps how first-class functions can be used even further like you demonstrated with the InvokeRepeating utility. How those array functions like map and filter can be used in the context of game development as well.
Please make more videos like this!
From zero to understanding, great tutorial.
Im 3 days into programming, and this even made sense to me. Very well put together tutorial. You've got a new sub
One thing to note, you can still name your lambda function. It helps if the lambda function has an error in it, such as trying to call a function on a null object, because then the debugger shows the name of the lambda function instead of .
your teaching steps is professional
Thank you for enlightening me about the concept of Callable, which I never quite understood before, it must come in handy.
Cristal clear explainations, thank you so much ! I'd love to see more.
Saving this for later 😊
You are an excellent teacher. I haven't seen godot video explained with such clarity yet. Thanks for making these man! Hope you continue making such videos. Liked and subbed.
That’s really nice of you to say, thank you!
"Static" confused me :D But everyting else is sooo cleeear with your explanations, thank you so much for being such a nice person and share this kind of knowledge. I am waiting for more!
I'm so happy you found it helpful!!
As for "Static", this topic can be a little confusing when you're first learning so I totally understand. I hopefully will have a video on this soon!
In the meantime, here is a brief explanation:
In the video, I declared the static method in my "Util" class. So normally to call a method in a class, you need to create an instance of that class, for example:
var my_util_instance = Util.new()
my_util_instance.run_periodically(parent, function, period)
But because I declared "run_periodically" as "static", I am saying that this method applies to the Util "type" as a whole, not just instances of the Util type. In other words, I am telling Godot that I don't need to create an instance of Util to be able to call "run_periodically(...)". So since the method is static, we can just say
Util.run_periodically(parent, function, period)
This is cleaner and also saves memory because now we're not creating new objects if we don't have to.
The main restriction with using "static" methods is that they can't rely on any data that would normally be tied to an instance of that class. So for example, for the class Vector3, we can create an instance of a Vector3, then get its length by calling "instance.length()" like this:
var my_vector = Vector3(5, 2, 6)
var length = my_vector.length()
The method "length" is a non-static method. It can't be static because it needs data specific to instances of Vector3. For example, it makes no sense to do:
var length = Vector3.length()
What would this even return? We don't have an instance of a Vector3 yet so there is nothing to calculate. Because this makes no sense, the "length()" method is a non-static method and if you try to do the above it will just cause an error saying 'Cannot call non-static function "length()" on the class "Vector3" directly. Make an instance instead.`
Hope that helps! If it's still a bit unclear, I should have a video on this soon!
@@Blargis3d It is clear AF to me :D Thank you once again!
I love the way you explain things. Thanks for the tutorial
Thanks you, this was a great one. Also showing practical examples at the end is quite valuable
You know, you could have made it simpler by using bind. With bind, you can preset arguments. Whenever a callable is called, all of it's potential arguments get passed in before bind, so in your examples: you could have used
print(get_function_runtime(count_to_number.bind(10_000)).
where calling bind returns a new function, which has it's last x arguments bounded to the parameters passed in by bind. This is especially useful for signals, where you have to pass in some kind of data, based upon an instance of something.
Good point, this is definitely valid and a great way to do it if it meshes with your brain.
I remember learning JavaScript bind() syntax many years ago when I was learning the React web dev framework, and it made absolutely no sense to my noob-coder brain.
In my opinion the way I showed is a bit easier for a beginner to reason about, which is why I didn’t even mention bind() syntax. I’d certainly be curious to know if you or others think otherwise though
@@Blargis3d I personally don't think that bind is too complicated. Because it's basically like instead of passing in a function, you're assigning some data to it as well, It's just that this data can be accessed as the nth argument. In most cases, you're not going to pass in data with the function call as well, so this data will be the first argument.
But even if you do, that's only 1 more little complexity thing, which you could teach later.
Thank you, this is very useful!
Glad it was helpful!
wow!!! ty !!! even with coffee this was alot to absorb. but I think I finally got it straight in my head.
now I just need to apply this in a few practice code sessions and I will be good to go.
You are a wonderful teacher, please post more tutorials, I love you and support you with all my heart.♥♥♥
I’m glad you liked it, thank you for the kind words! ❤️
You just made me subscribe. I like the way of presenting and explaining. Very understandable, very clear, very good, very thank you. 😘👍
Seconded.
Thanks! Your tutorial is awesome (and a gold mine!) not sure why my algorithm dont suggest them.
freakin awesome man. exactly what i was looking for!
Thanks for making this tutorial! I got so much out of it!
i FINALLY understand lambdas lol, after I've 100%'d AP CS A, the AP Test, and the Harvard cs50 course
This video was super helpful. Thanks a ton man!
Liked the dep dive. Want more deep dives. Liked. subscribed. 😄
thank you! this has been very helpful
> Deep dive
> No mention of bind()
You could also technically test the greeting function by having its argument be person:="jim"
that way there's a default value, and you can call it without any arguments.
very good explanation, thank you!
很好的教學影片! 讓我學到很多~
y'know, I *would* like to see more about static functions...
also how dot products work. Like I know they can be used to compare angles, so I want to experiment using dot products to determine whether a character is facing perpendicular to a wall or parallel to it. That way a character can either do a wall run or slide down the wall and do a wall jump based on character orientation instead of using button combinations.
Jeez, I could make quite the list of things I want to know more about... I started coding 3 weeks ago, so I have a long road ahead lol.
This helped me figure out why i couldn't successfully use get_wall/floor_normal (I forgot the parenthesis... lol ) I'm trying to figure out how I can use surface normals to detect ramps so I can adjust momentum based on angle. more weight makes climbing and stopping harder emphasized by angle of descent/ascent.
One thing I'd really like to find out is if meshes can be drawn curved using the surface tool. I'm doing a voxel-style game, but I want to bevel the edges to give it a softer feel without increasing the number of vertices. might be impossible, idk yet.
Hey loved the video! Could you explain what add_child(timer) is doing exactly. You said it adds it to the tree, I’m guessing you mean the node tree but I don’t understand why you have to do that. I appreciate any response :)
you are my hero
Great tutorial thank you!
thanks
make a video about static vars and functions
It is really cool.
son of a bitch this is the clearest godot tutorial i've ever watched
thank you!!
Hello Blargis!
Hello Blargis!
Hello author, thank you for your video creation. It's very friendly to me as a beginner. In my country, there are very few video tutorials about Godot. Can I share your video on domestic websites, including your link and creative information? Looking forward to your reply. Thank you
Sure! I appreciate the share!
Thanks!
MOAR
Hmmm like function pointers I guess?
Yes!
Wait, technically function.call is also a callable.
So that means you can do:
var x = function.call
x.call()
which basically means no one's stopping you from doing function.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call.call()
You know, it's only just occurred to me that the word Godot is really weird. How is it pronounced? Does it rhyme with Robot? It would make sense because the logo is a robot. Is it good-oh? Because Americans say it like that. Personally I always call it "God O"
I think the word is french or is based off of some french movie named Godot.
Because of its french roots I think that is why the T is silent.
In the movie a bunch of guys were waiting around for something that never came.
The first devs felt like that about game engines and so they made their own.
@@VaSoapman I know about waiting on godot but I still don't know why the logo is a robot if it isn't pronounced like robot, and why it's "gud-oh" and not "god-oh"
@@JacobKinsleythe Devs said to pronounce it however you like.
@@danielphil4976 I'll pronounce it "godot" (it's pronounced "godot", but spelled as "godot")
9:40 we could make profiling function with 2 arguments, one for callable, another for it's arguments... But yeah..
Thank you, like n sub