How to create Enemy AI? – Blueprint


Hello kind people reading my post,

Don’t know if this is the right place to ask this but I just have no clue where to post it. I’m new to Unreal Engine and have very little knowledge about blueprints (coding in general). I’ve managed to create a player, and everything needed for the game I’m trying to make, the only thing missing is the enemy that I’ve been trying to create for a week now, with no progress.
I feel so dumb for posting this, but I just can’t figure it out. If someone is willing and knows how to do this, please help. Here is what I need:

I need to make an enemy AI that is moving forward at a constant speed;

When a wall is in front of the enemy it checks for walls on the left and right;
If there is no wall on the left it turns to the left (90°) and goes forward,
and if there is no wall on the right it turns to the right (90°) and goes forward;
If there are walls on both sides it turns back (180°) and goes forward,
it also turns back (180°) and goes forward, if it collides with another enemy;

If there are no walls on either left or right it checks for the Player “location”,
and moves in the “direction” based on whether the Player is to the left or to the right of the enemy
(it only checks for left and right, it doesn’t matter if the Player is in front or behind of the enemy);

However if the Player is straight behind the enemy (in the same straight line (X or Y Axis)), the enemy will turn (180°) and move forward
(This applies whenever a wall is in front of the enemy, no matter if there are side walls)

To define the enemy movement a little further:
It constantly checks for the Player “location”;
It can’t turn if a wall isn’t in front of it;
If it collides with another enemy it can only turn (180°);
It can’t move diagonally in any case;

Thank you for reading my essay.

Hey @NIkolami! Welcome to the forums!

There are multiple ways to go about this (blueprints, behavior trees, etc.). Since it seems you are starting from square one, check out this non-Epic affiliated tutorial to help get the ball rolling:

I hope the above points you in the direction you need!



Source link

Leave a Comment