Come join the Discord!
0:20
3 ай бұрын
Making a dev console in Godot
4:55
Starter state machines in Godot 4
10:58
Making tactical units - A devlog
12:24
An introduction to Utility AI
8:57
Godot 4 lambda functions
1:27
Жыл бұрын
Godot 4 beta + channel update
1:14
Kaiju Klash announcement
0:50
2 жыл бұрын
5 more quick GDScript tips
2:20
2 жыл бұрын
How to use the microphone in Godot 3
5:05
Scene transition effects in Godot 3
2:53
Godot's OS Class
1:46
2 жыл бұрын
11 tips for writing cleaner code
7:19
Пікірлер
@kingshahzad78
@kingshahzad78 8 сағат бұрын
Boiling Brain Concepts
@BrunoidGames
@BrunoidGames Күн бұрын
I like to make a stack of state pointers. Ex: A pause menu screen on top of your game layer. The menu (top state) process input, update and render, the game state process only render.
@salmonbamminfish2925
@salmonbamminfish2925 Күн бұрын
how in the world do you download crap off of github
@TheShaggyDev
@TheShaggyDev Күн бұрын
If you just want a quick, one-time download, go to the repo root (github.com/theshaggydev/the-shaggy-dev-projects/tree/main), click the green "Code" button, and then you can download a zip file.
@salmonbamminfish2925
@salmonbamminfish2925 Күн бұрын
@@TheShaggyDev thanks. I think I understand the state machine but parts of the code don’t recognize the class_name and I’m trying to figure out what I’m missing
@TheShaggyDev
@TheShaggyDev Күн бұрын
@@salmonbamminfish2925 as long as it's set up like in the sample project, it should work, but sometimes you need to restart Godot for class_name changes to take effect
@salmonbamminfish2925
@salmonbamminfish2925 Күн бұрын
@@TheShaggyDevthank you so much. I am very blind and missed the extends node inside the base state class. Appreciate your help
@TheShaggyDev
@TheShaggyDev 23 сағат бұрын
@@salmonbamminfish2925 Glad you got it sorted out!
@Vegan_Kebab_In_My_Hand
@Vegan_Kebab_In_My_Hand 2 күн бұрын
Thank you for the tips! I didn't know about most of these.
@Trading_Conquest
@Trading_Conquest 7 күн бұрын
Brruh your game looks so good
@TheShaggyDev
@TheShaggyDev 7 күн бұрын
Thank you!
@botondkoncz1961
@botondkoncz1961 8 күн бұрын
0.5 speed and still too fast -> PERFECT tutorial
@jena_thornwyrd
@jena_thornwyrd 8 күн бұрын
ULTRA ULTRA USEFUL !!! I copied the code, had to tweak it a bit for Godot 4.4, and now I have a decent way of making sloped platforms that doesn't sucks ! Two years later, and more thanks to you !!!
@TongThachPham
@TongThachPham 9 күн бұрын
What programming language do you code in? And which IDE do you use?
@TheShaggyDev
@TheShaggyDev 9 күн бұрын
What's shown here is mostly, maybe entirely, the built-in Godot code editor and its scripting language GDScript
@ChapC_YT
@ChapC_YT 13 күн бұрын
Helped me out big time 🙏Gonna give you an extra shoutout in my next devlog.
@TheShaggyDev
@TheShaggyDev 13 күн бұрын
@@ChapC_YT thank you! Glad I could help! 😃
@luckyknot
@luckyknot 13 күн бұрын
underrated video!! using debugger tools is a must thanks!!
@alexi2706
@alexi2706 13 күн бұрын
Is there a way you can reproduce how you created the grid movement?
@TheShaggyDev
@TheShaggyDev 13 күн бұрын
@@alexi2706 I had to set it up manually with AStar2D as this was made in 3, but in Godot 4 you can use the AStarGrid2D class to do grid-based pathfinding. I have a video and article on that if you're curious. The important thing to keep in mind for this game is that the logic is all 2D, despite the visuals being 3D. The vertical axis plays no role in game logic so I'm able to use 2D pathfinding and logic to manage everything.
@Skiggles
@Skiggles 18 күн бұрын
My implementation is very similar except I don't like specifying the player type for the parent as this ties to the state machine code to only work for the player class. Instead, I used CharacterBody3D since I am creating a 3D game. This means enemies could potentially use the same scripts but the down side is not having code completion for player specific variables. I guess you could cast the parent to a Player type within the individual states but I am still working that bit out. Good video.
@rileylovesee5899
@rileylovesee5899 20 күн бұрын
Very concise. As a beginner to Godot I understood what State Machines were, just didn't understand all the code. This video has certainly helped me out; although, I did have to watch it a few times to get it down. Very well done!
@sekto5
@sekto5 22 күн бұрын
It's a amazing job. I'm here because I need some inspiration for a game that I have in mind. I just don't know yet how to code properly, but your video gave me some important directions.
@ndriqa
@ndriqa 24 күн бұрын
For the ones that have a home menu with buttons that don't work because of this, just go into the ColorRect and set the mouse to ignore, so it doesn't consume the mouse events. Either way, The Shaggy Dev u earned a sub for this concise and beautiful tutorial
@MrBoingus
@MrBoingus 25 күн бұрын
excuse me, i believe i might be have noticed an issue with this node-based setup, and i figured i'd ask to see if im missing something. i'm using this currently, in the process of setting up a very basic testing character. it has an Idle state, and if the player's Input.x variable is anything but zero, it calls switch_state from the StateMachine and switches to the Move state. in doing some debugging, i did a test where i called Engine.get_physics_frames() (gets the current number of physics frames that the engine has run in total) and it noticed something. If you have the game print the current physics frames immediately before calling switch_state, and then immediately before move_and_slide is called inside the Move state, the second call is 1 frame more than the first one. this seems to imply to me that, the point where the game detects the Input.x and switches states, to the point where the character is actually moved via move_and_slide, does NOT happen on the same physics frame (as i believe it normally does) Is this true? am i misinterpreting the numbers?
@TheShaggyDev
@TheShaggyDev 24 күн бұрын
That's correct. On a given frame, the current state's logic is ran and a transition occurs if necessary. While the relevant enter and exit functions will run the same frame as the transition, frame-dependent logic does not, as the current frame has already been processed by the previous state. While you could have the new state process the current frame a second time, the implementation I show here isn't unusual in its one frame delay as it prevents frame data from being processed multiple times in the same frame.
@MrBoingus
@MrBoingus 24 күн бұрын
@@TheShaggyDev so the one frame delay in movement probably isnt something to worry about, you think? thank you kindly for taking time to respond, by the way. i worry im doing things wrong a lot in coding
@TheShaggyDev
@TheShaggyDev 24 күн бұрын
@@MrBoingus for most games, I think it's fine. If you had a game that required high precision inputs, like a fighting game or a high precision platformer, maybe you'd want to not have that delay. I also wouldn't stress tooooo much about doing it wrong if it works for you. We all code something ugly but functional at some point. Just gotta learn for next time 😊
@MrBoingus
@MrBoingus 24 күн бұрын
@@TheShaggyDev so i actually am making a fighting game 😅 are you able to tell me how to remove the delay? or would it be too complex to explain?
@MrBoingus
@MrBoingus 24 күн бұрын
if its an issue of your own personal time, i might be able to pay you something for the help. i know this could take away from time you could be working
@dziwic
@dziwic 27 күн бұрын
I would really love I you could say something about that x-com style ground highlight you did in your games. I'm uding AStar Grid and have collisions down, but struggle with that. That and textured lines, they work unitl I need to swap a texture.
@TheShaggyDev
@TheShaggyDev 26 күн бұрын
For that piece, I have a tilemap with a auto-tiling / terrain set up so I just need to feed it all the tiles for an attack or movement and it displays correctly. As for figuring out *which* tiles to highlight, I just brute force it and check every potential tile within range. Not exactly elegant, but it's simple and works.
@dziwic
@dziwic 23 күн бұрын
@@TheShaggyDev I went for similar brute force approach highlighting terrain just few days ago and seems to be working. But still stumped at the arrow thingie - wwould it be possible for you to make a video about this or maybe share the code snippet just for this bit on github or somewhere?
@TheShaggyDev
@TheShaggyDev 23 күн бұрын
@@dziwic Sure, but that's fairly simple. I have a Line2D node and just feed it the points that my pathfinding system prints out when I find a path from the player to the node they're highlighting. Doesn't let you do much in the way of styling beyond the simple colors shown here, but that's all I needed.
@dziwic
@dziwic 22 күн бұрын
@@TheShaggyDev Ah, for some reason I thought you had textured lines. Those I'm struggling with, corners prove to be a problem. The drawn ones I got down, thanks ;)
@thirteen3678
@thirteen3678 28 күн бұрын
Thanks man, this really helped!
@lautaromendieta9086
@lautaromendieta9086 29 күн бұрын
Use assert(), it's like push_error++ (pauses the execution when the given condition equals false)
@lautaromendieta9086
@lautaromendieta9086 Ай бұрын
This is so powerful, mainly for SceneTreeTimers, Tweens callbacks and signals
@Zewofficial
@Zewofficial Ай бұрын
New sub! Great stuff!! Im a noob into 2D godot. Keep it up!!
@adomasjarmalavicius2808
@adomasjarmalavicius2808 Ай бұрын
things have changed in two years, but it still holds up, thank you for the great video!
@jhyoon9174
@jhyoon9174 Ай бұрын
Great video, I learned exactly what I was looking for!
@aussiescorner3954
@aussiescorner3954 Ай бұрын
Question, can something like this be used to allow the player to write scripts to run in the game that are more then 1 command long? More or less I'm trying to create a mechanic like in "The Farmer was Replaced"
@TheShaggyDev
@TheShaggyDev Ай бұрын
Technically, I believe that would work, but you may not want to give the player full access to run code in your game using this method, at least not without being very careful about how you implement it. You wouldn't want them to be able to trigger Steam achievements, change internal values they shouldn't be changing, etc. Not saying it can't be done, just that you'd need to be mindful of your safeguards to prevent cheating.
@aussiescorner3954
@aussiescorner3954 Ай бұрын
@@TheShaggyDev This makes sense. I'm just looking for a way to make certain objects be controlled by code that the player can write. Sorta like a programming automation game.
@TheShaggyDev
@TheShaggyDev Ай бұрын
@@aussiescorner3954 Sure. I'm afraid I'm not exactly sure how you'd want to do that in Godot. I know Juan wrote about that on Twitter recently, maybe there's some insights there: twitter.com/reduzio/status/1811368725808918816
@aussiescorner3954
@aussiescorner3954 Ай бұрын
@@TheShaggyDev Thanks I'll give it a look.
@rossmurphy4593
@rossmurphy4593 Ай бұрын
at several times during this vid I found myself saying "dang that's smart". Great explanation. Sub earned.
@milesmungo
@milesmungo Ай бұрын
One thing I'm adding to my game is smash-style fast-falling. So the player can press the down button to fall faster. I think this is more relevant to action games that include air combat and an air moveset that's different from the ground.
@davariusaz
@davariusaz Ай бұрын
I don't see how this lets you reuse states on different objects. If you try to reuse your move state node on an object that can't jump, you'll have to make a new version of the move state script that doesn't allow transitioning to the jump state. Then when you want to tweak how the move state works for all objects, you'll have to make that same change multiple times for each object that uses it.
@CyonixOfficial
@CyonixOfficial Ай бұрын
Hey so there arent any errors in the code itself, but when trying to run the game it gives me the error (Invalid set index 'parent' (on base: 'Node') with value of type 'CharacterBody2D(Player)'). Not sure how to fix this and any help would be greatly appreciated. (Also i've been mixing and mashing tutorials together so maybe that could be an issue)
@lexolotlgod
@lexolotlgod Ай бұрын
LOVE seeing your node structure. This is the most helpful kind of video.
@SaturnnsStash
@SaturnnsStash Ай бұрын
As for the heirarchical states, i made a dash the same way you did, but since my move script changes its animation in process_physics() based on its current velocity.x, the dash animation is overriden after 1 frame with a movement animation. Any way i can ovveride that in the dash script?
@TheShaggyDev
@TheShaggyDev Ай бұрын
Sure, just use the same techniques shown in the video. It'll depend on how you've got it set up, but you could, for instance, move your animation code to a function that dash state overrides.
@pippybrown3634
@pippybrown3634 Ай бұрын
Can confirm this works in Godot 4.2.2
@bunnybreaker
@bunnybreaker Ай бұрын
That dictionary tip is going to come in really handy. Got yourself a sub, thanks! 👍🏽
@hidingdissident
@hidingdissident Ай бұрын
that was really a great video, thx for that! loving the quality! I"m wondering, have you found a good solution for showing movement range in a tactical combat system? your other videos often show highlighted tiles when selecting a unit so I guess you have. would you mind sharing your solution? or maybe just point me in the right direction. my current issue is that simply using the number of nodes in the path as a proxy for distance does not take into account that diagonal movement should be more expensive. i thought about using two grids (one without diagonal movement and one with) and comparing the path array size to infer the number of diagonal movement, but that seems stupidly expensive computationally. I wish the _compute_cost function would be accessible (rebuilding it seems kinda overkill)
@TheShaggyDev
@TheShaggyDev Ай бұрын
I think it depends on what you need the distance info for. I'm lazy enough, and AStarGrid2D is fast enough, that what I personally do to highlight cells is just run a pathfinding query on nodes in the grid to see where you can move to. Then the diagonal movement is taken into account by AStarGrid2D, I can easily throw whatever obstacles in that I want by toggling nodes on/off, and there's no potential for bugs on movement since what you're seeing is what you'll get when you actually move. If you need an actual numerical value, I might just iterate over the output and calculate the node-to-node distance directly, which would inherently count diagonals as longer.
@Dkerza
@Dkerza Ай бұрын
Whats the difference between state.gd and state_machine.gd, the former doesn't have any owner of a node while the latter has whichs state_machine.tscn?
@TheShaggyDev
@TheShaggyDev Ай бұрын
In short, state.gd handles the state-dependent logic where state_machine.gd handles coordination between states. So you might make a run state using state.gd, but let state_machine.gd handle transitions between states, dependency injection, etc.
@lloyd011721
@lloyd011721 Ай бұрын
this is cool. you should 100% expand on this.
@blairdog2581
@blairdog2581 Ай бұрын
Wish I I woulda watched this before making my platformer physics based😅. I just can't make it feel good.
@HlebLegendary
@HlebLegendary Ай бұрын
)ty a lot!)
@stevedowning3892
@stevedowning3892 Ай бұрын
Gold dust, dude! export_group and export_subgroup are going to come in incredibly handy
@Brokencircuitboard
@Brokencircuitboard Ай бұрын
Finally a basic explanation of fsm that i can understand. TBH, i never fully understand state machine even after watching many tutorial and sample project. You just make it all make sense. Turn up, i already using some kind of state machine in my project.. albeit primitive one 😆
@lukusridley
@lukusridley Ай бұрын
i followed this tutorial but i implemented it wrong and now i've been locked in my room for 3 months and i can't reach the key to escape send help
@3bears744
@3bears744 Ай бұрын
Woot! Much easier than in unity IMO :D Great tutorial, I was able to get this running fast!
@kieranjames2344
@kieranjames2344 Ай бұрын
Nice
@davisnoah347
@davisnoah347 Ай бұрын
how do I create a State class that godot will allow my state scripts to inherit? Because right now I get "Invalid inhereted parent name or path." whenever I create a script for my classes that tries to extend my State class. I am at my wits end with this.
@TheShaggyDev
@TheShaggyDev Ай бұрын
There are two ways to inherit from a class in GDScript. The easiest is to make sure that you have "class_name State" (or whatever the class name is) at the top of your script and then "extends State" in the script you want to inherit from. You can also just do "extends" with a path to the script, but that's cludgy.
@Shack263
@Shack263 Ай бұрын
I watched this video and it's precursor a while ago, and couldn't recall anything from it besides using nodes as states. This weekend I made my own implementation before rewatching these, and I did a surprising amount of things the same way. It's probably a combination of my subconscious, and the fact that there is a natural solution in Godot using nodes. I will detail some cool differences below.
@Shack263
@Shack263 Ай бұрын
Firstly, I made extensive use of custom component classes, such as a move component that moves a chosen physics body. Each state has export variables for the components it may affect (dependency injection). If one is left blank it won't error, so there is some flexibility. I also tried decoupling transition logic from state logic. I made a separate class of state transitions which could be children of states. That way, the transition logic can be customised for each entity. For example, some entities may have additional states to transition to from idle. The idle state only manages what it needs for an entity to be "idle", not when to change to another state.