Download

Help with simple AI for networked game

My friend and I are working on a game we’d like to make, and one of the main components of this would be some enemies to shoot and interact with. Therefore, I know I will have to get into all the fancy AI things that UE4 has to offer. However, we are starting with a simple enemy that would constantly move forward and shoot. I have a base down, but with it being a simple actor and everything scripted in. I was just wondering if making this object a pawn or anything else would increase or decrease performance server side. Here’s a quick snippet of the code and a gif of what it is currently doing.

As you can see I am setting location every tick for it’s motion, is this really inefficient or is it the same thing as setting velocity with a movement component? This enemy is a giant wheel that will basically drive by you, turn around after a certain distance, and rinse and repeat until its death. I’d also try to add in a sort of “pack” behavior if there are multiple close to each other, and then a wall / collision avoidance function.

4ad1b9599a4f8a180481bcb0a21c89ac546b4186.png

96b2e3684c5fa85c0f281dc84d5a6f11fdf60d68.png

9dff56162eeb66cd4f5c9d9f56ec16d9675c37d2.png

9c26b68bea8c393dc51aab72a5a4a911c9de849c.png

I’m pretty certain that after you put a navMesh volume in your level (press P to see the volume data), duplicate your character BP and place it in the level, in the copy add a simple move to node with the desired location set on event begin play and you should have a simple ai guy moving about. You can add an event that finds player that gets fired off after x amount of time and then it would look for you and keep chasing you.