Trying to Plan Enemy AI in Godot

preview_player
Показать описание
I'm not a game dev, I've never used a game engine before, but there's a first time for everything. I've been having a blast using Godot, so let's see what we can do with it. For this one, I tried my hand at figuring out how to make the enemy AI better in my game. Join me as I continue my journey trying to learn how to make a game.

You can watch the full video here:
Рекомендации по теме
Комментарии
Автор

GJ you officially made better AI than call fo duty zombies

purplefood
Автор

Another thing u could add is to add a collision box to the enemy so that they can collide with each other
Hope this helps!

kevin_eleven
Автор

You can try that at a certain distance away, the enemy will chase another enemy, it may help. I hope it will add And they probably won converge after they leave the area

Vensauno
Автор

I did not know you could do it like that!

Morrisistherealgod
Автор

i think another way to do this is to make enemies avoid each other by a slight distance

cq.cumber_offishial
Автор

That's a really good idea, thank you i'm gonna try it!!

kilokoins
Автор

I went down a trig rabbit hole and had the AI follow an interception path so they try to overtake you

MonolithproductionsT
Автор

For anyone wondering how you would actually do this if you are reading this way later, Godot 4.x has built in functions that deal with this type of thing and you'll use a Navigation2D node and the move_and_slide() function. Using these two in conjunction means you really don't have to program your own AI.

func MoveToTarget(delta: float) -> void:
= Target.global_position
var direction = - global_position
direction = direction.normalized()
velocity = velocity.lerp(direction * Speed, Acceleration * delta)
if velocity.x != 0:
$AnimatedSprite2D.flip_h = velocity.x < 0

move_and_slide()

Itll end up looking something like this.

NoahTaylor-rh
Автор

oh snap- is the navigation2d agent a new node? i just got into godot

thinktanium
Автор

I'm new to Godot, but why not just add another collisionshape2D to the enemy, make it slightly bigger and make it only collide to other enemies and not the player?

braveblade
Автор

I just did this wtf 😂 ❤ subbed. That's crazy, where were you yesterday?!

zenco
Автор

You can try to play Asgard's Fall: Origins and see how there enemies collide, I mean if you can do something similar like it, it would be awesome

trongthangg
Автор

I'm making a similar game, and I want to figure out AI too. I want enemies to be ships also

NicoFye