State of the A.I

I've been trying to repair the A.I today, and to a certain degree, I have. Getting the A.I to react to sound has worked to a degree, but it's currently disabled as I can't get it to really integrate at the moment.

How it works;

The enemy uses several scripts, each handling a different area. The first just returns a load of variables based on certain things; can he see the player, is he in cover ect ect. The second uses these values to determine what state the A.I should use, based on conditions and current state. The third, which is a set of scripts, acts upon the current state.

State 0 is the idle state. Currently, the enemy just stands. I want him to fidget, and patrol if given a path. I tried this before, and unfortunately the patrolling was suuuper buggy. It's one to fix, though.

State 1 tells him to search for cover. If there's no cover in range, this is ignored. Otherwise, he moves to the nearest good cover facing the player. Good cover is determined by it's position in relation to the player -- if there's an unobstructed line between the cover and the player it's not classed as good.

State 2 is the fire state, when in cover or when no cover is present.

State 3 is the chase state, wherein the enemy will chase the player if he saw him but lost sight of him. This can chain if he regains sight of the player, and subsequently loses him again.

State 4 makes the enemy give up the search and just return back to it's origin point. This can be interrupted if the player is sighted again.

Known existing flaws / bugs;

Enemies snap to face the player; this is something that is fixable but requires a lot of tweaking to ensure the A.I cannot spot the layer before their sprite is facing the right direction, ect ect.

Enemies overlap; this gets very noticeable when there's scarce cover. And once they overlap, they pretty much don't separate. I'll be frank here, this is one that's going to cause some trouble just purely because getting the A.I to move to an unoccupied space is going to have to override most of the A.I functions.

Enemies sometimes don't investigate, or don't return to their origin; this is one I don't really understand. It's under certain replicable conditions, so it's not going to be rocket science.

- Rob

Comments

Popular posts from this blog

A productive day!

Tile Bleed & Looking at Art Style (Again)

Moveset Expansion (and controller support!)