Behavior tree AI in under 10 minutes! Godot 3.5 Tutorial

preview_player
Показать описание

In this Godot Engine tutorial, I show you how to write AI logic based on behaviour trees for your RPG! Perhaps you always wanted to teach NPCs to perform tasks like villagers in Minecraft or Stardew Valley. With this tutorial you'll learn the basics to achieve this. In addition, Godot 3.5 is coming with a bunch of very cool features that I am showing off in this video too, such as NavigationAgent2D and scene unique names!

⌚ Timestamps

0:00 Intro
0:18 Scene overview
0:57 Behavior tree basics
2:17 Download Beehave addon
2:24 Lumberjack AI
6:04 Trader AI
8:35 Forester AI
9:38 Outro

#gamedev #tutorial #godot #gamedevelopment #bitbrain #fast #quick #godot #godotengine #2d #animations #rpg #godot3 #behaviourtree #ai #rpg

Music Credits

Рекомендации по теме
Комментарии
Автор

I'm making a game where you employ NPCs to do things like chop trees, mine, craft, whatever. This couldn't be more perfect.

killax
Автор

Thank you a lot for watching! Subscribe to my channel for more gamedev stuff and let me know in the comments what you want me to do next!

⚠ EDIT: as raised by Gareth Somers, at 5:45 we also have to wrap the condition inside a SelectorComposite as shown in the video (I forgot to mention it)

bitbraindev
Автор

This is literally what I've been struggling with today!! Really cool, thank you! :)

Luisa-muyw
Автор

I love it! Considering I started learning Godot one month ago and game development in general, I believe it will take me some time to completely understand how the code works, although I checked the code and have an inkling of an idea. But before that even happens, gotta practice a lot of mechanics. Either way, thank you for the video; I will come back to it when the time comes :D

ThunderThoster
Автор

3:14 WlakToClosestTree seems to be "closest in a straight line", but "closest by walking distance" (ie taking into account the path it can actually use) would probably be what the user expects. Of course, that's more expensive to calculate, but you can limit the calculation to the closest (in straight line) 10-20 trees for a good enough heuristic.

PMX
Автор

Oh nice you wrote a behavior tree plugin! I was thinking of doing this eventually, so you probably saved me a bunch of time :)

KyleLuce
Автор

This is so cool I was just trying to do this in my own game!

slothinahat
Автор

Well done. Beautifully simple implementation.

miragedee
Автор

This is a very intersting video, I always like AI stuff. In a past tutorial I made on my youtube I did something similar but in pure C#, and it was quite efficient. I am a programmer so I think I prefer having it in my text editor over being a node, but I guess for most people it would be the other way around. Either way a great tutorial

beidero
Автор

This is mind blowing. Great job!!! Can't wait to try this out

vojtastruhar
Автор

Oh, wow, this is really good! Good job dude.

API-Beast
Автор

I’d love to see complex enemy pathfinding in another video - my top down game often has enemies get stuck on corners when they chase the player and it can be kind of easy to cheese them.

ezrawallet
Автор

Can we get a part two/followup? I'm a bit confused on a few things that were explained too fast. Like, why do I need an inverter "HasNoTreeAvailable" with a "HasTreeAvailable" check after?

Could you make some enemy AI examples using your addon too? Or could i look at more examples from your game

teo
Автор

This is a very well done tutorial, thank you!

One small improvement I'd make is to have nodes initialize themselves with relevant values (e.g. the stash_area), so the root does not need to know about what subnodes need. The way I'd do this in the _ready function of the root, it'd visit all subnodes and if they have for example an "initialize" method, it would call that with itself as param. Then, when a subnode's initialize is called, it could pick whatever relevant value (e.g. stash_area) and set it on itself.

FlorianHanke
Автор

@bitbraindev been studying and practicing your addon for developing enemy AI for a top-down shooter game. Has been boggling me why Godot 4 does not have such a system backed into it, but this has been a welcoming lesson. Still need to understand a few more things to make a better enemy AI behavior.

Wishing you the best in the future!

mythology
Автор

My man, you made an add-on for a thing that I needed ❤

AdemOmerovicBA
Автор

Beautiful tutorial, it helped me so much to understand the chapter 6 of game ai pro book

CirculensProductions
Автор

Will have to check out this addon, love the name!

_gamma.
Автор

This is the best behavior tree Godot tutorial, the other ones are really simple. Great job! =) Btw I've seen on the assetlib two BehaviorTree plugins, is there a reason why you decided to create your own?

MegaZumo
Автор

This is still very valuable information. Thank you!

yayvey