Less Project More Game

Today I decided I needed to start making this an actual “game” rather than just focusing on the asset side of things. To start I made a simple arena:

Essentially a bunch of walk-able pathways and two towers in the center. The goal was to essentially stress out the AI by putting a bunch of stuff in the way. This succeeded and I had to re-write a bunch of the AI tasks (luckily not the base ai tree too much).

Now the ai flow is:

1.) Check if it needs to reload
2.) Start fighting
3.) If it has ammo, try to move to a “strafeTarget” (i.e. a tactically relevant position) , if it doesn’t have one or can’t move to said target just generally move towards the target.
4.) Wait a few seconds to let some bulletsfly(firing timing happens in the patrol bot logic, not the ai logic)
5.) If you have ammo find a new tactically relevant position to stand in

In addition I have the AI and the patrol bots doing line traces from either the intended target position to the character to see if it can hit the shots it’s aiming for, or if it needs to move.

The big struggle today was setting up the AI settings for unreal, which in general are a real pain. I’m worried I made it basically unplayable on cheaper PC’s but I’ll need to get a build together for testers before I start optimizing. The way unreal’s AI works (and I think uniity is pretty similar) is by setting up a grid of points, then using an “navigation agent” to handle how pathfinding works. This navigation agent is a primitive object (I assume a cube but I’m not 100% sure) that is placed along projected paths to check if it’s possible to move to the target location. If unreal/unity Didn’t have this concept you’d hit a bunch of issues with the AI trying to navigate it’s body through a bunch of pinhole sized paths. So to handle cornering a bit better I started messing with the AI agent size: (Nav agent height near the bottom)

However, I quickly found out that A.) You need to change it int he “navigation Mesh” settings:

also, AND that if you don’t have dynamic re-generation on Unreal just starts saying that the nav mesh needs to be rebuild (and I wasn’t sure how to do that…). So I had to check the “FORCE REBUILD” guy and set the “runtime generation” to dynamic.

This biggest hit here will be performance but again I’d rather rush a build, have it run like crap then optimize as needed.

The bots are doing most of the main things that I think baseline quality AI does:
1.)Don’t shoot at you if it doesn’t see you
2.)Don’t get stuck on corners
3.)Play an animation when turning

The three things it still needs:
1.) Coordination between bots
2.) Less bumping into other bots.
3.) Some form of IK

But In my opinion those things are secondary at the moment. The next thing I want to jump on is a basic health + hud+weapon system so there’s a “game” part of this.

Also this needs to be fixed, but I’ll probably write up a whole thing about how Unreal’s deferred rendering kinda sucks for First person view models (even though the originally “Unreal” games were all first person shooters….)

Leave a Reply