Sign in to follow this  
  • entries
    235
  • comments
    509
  • views
    172039

No AI is an Island...

Sign in to follow this  
SimmerD

122 views

More good progress on the level editor today.

I added a 'select seam vertices' button, that searches the whole level for problem vertices. Basically, for each vertex, i make a small bounding box around it, and look for nearby tris ( not necessarily connected tris ).

Then for each of these, I see if my test position is included as one of the tri corners. If not, I then test the closest distance from the position to the triangle, and if it's close ( < 2 cm ), and not a part of the triangle, I flag it as a 'seam vertex' for display.

The idea is that any sufficiently close tri to a vertex should probably be tessellated into tris that do include the vertex position in question.

Very convenient. Most issues can be fixed with the Fix T-junction button, but others are just where static meshes abut the world tris. I may add a another tool to fix these point over tri type issues.

The border stitcher works great, and has allowed me to clean up some nasty tris on some levels, and replace them with a nicer set of grid tris.

I also played with the lighting a bit. I tested a 'back-light' idea a while ago- basically a directional light that comes from the opposite direction of your main light that gives a little color to the underside of things - sort of like hemisphere lighting.

I had to tweak the lightmap algorithm to ignore these lights ( any non-shadowing directional light for now ), so it wouldn't get shadowed by the ground polys. I like the effect, but I think I will roll this into the ambient/emissive lighting pass instead of making it its own render pass.



AI-wise, I added a ledge where a cultist can attack you on my new prototype level. Unfortunately, he's not attacking. Turns out there is a bug in the AI where the enemies will never attack you if they can't find a path to their desired shooting spot. That needs to be fixed - but a more serious issue is that the AI doesn't seem to be able to find a valid shooting spot at all at times.

My navgrid can be discontinous. It starts by filling in walkable areas from the player, and then uses enemy spots and other triggers marked as nav_seeds to fill in other walkable areas with a flood-fill type approach. The bad news is that an AI currently doesn't know that he is on a 'nav-grid' island, so his choices of shooting & hiding spots are ending up on the main AI map, where he can't find a valid path.

Here is a shot of the AI ( in the tunnel ), trying to path to the white cube in order to shoot the player.

I plan to fix this by having each Node know what 'island' its in, where an island is defined as a set of mutually-connected nav grid cells. The main AI grid will be island zero, and there will be some other # of islands as well on most levels. I will track a bounding box for each island, but not a big list of nodes per island. This way, the AI can improve its spots in two ways :

1) it can restrict its choice of random spots by restricting to the bounding box of the island its in now
2) it can quickly tell if the spot its chosen is in another island, and therefore not navigable by definition

Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now