Creating an artificial intelligence to pursue and locate a hidden target

Main menu

Category Archives: Uncategorized

Today was the last day I could work on the project. I’ve added a table to the test level. Initially I had problems with using concave collision meshes as they would fall through the floor. A fellow student then asked me why I didn’t just build a table in the level out of boxes? So I did, so now it looks a lot better showing off the difference between solid boxes and a table. The only bad thing is that I can’t move the table around as it will fall apart but one can’t have everything.

Other than that I’ve finished the report, the post mortem and the presentation.

Tomorrow will effectively be the last day I can work on the project. Friday will be occupied by every ones presentation.

Not much in actual progress where made. As I mentioned earlier, I try to keep myself from changing to much so I won’t break something. What I did fix was that the agent would get stuck in the “bend down” animation and start gliding around the floor when it would hunt the player again.

Otherwise most of the time has been spent on finishing the report, writing the post mortem and writing and setting up for the presentation at Friday.

I fixed a bug in the POM generator export code. Some times a node would be written twice, which caused quite some strange behavior from the agent as the grid where connected in a bizarre way.

I’ve added the ability for objects to block areas on the navigation mesh. This caused a rewrite of the navigation loading code and forced me to dive back into Detour as this functionality depends on the tile cache available in Detour. It’s the tiles of the navigation mesh compressed and kept in memory so when a obstacle is added, it’s easy to fetch a single tile, decompress it and rebuild it with the obstacle added.

The different planes of the POM is now functional. So objects that blocks the navigation mesh now also blocks nodes on the POM at appropriate levels. This fixes the issue where the agent tries to look at a node that is inside another object.

Other than that I’ve been working on the behavior. The roaming behavior is coming along a lot better. I’ve restricted the area to search close to the agent. This gives the result of a more directed and thorough search. Before the agent would run back and forth between locations.

Today I’ve improved the search behavior in the same way. By using the last known velocity of the target I can define an area where the agent can be in. This prevents the agent from walking away to another place that have accumulated a large probability over time.

I’ve also added the ability for the player to move objects and a simple reaction from the agent when a object is discovered in a new location. With this I also fixed some previously undiscovered problems with the navmesh blocking.

Today I fixed the thing I mentioned in the last post. I elevate the nodes to the agents height so I get all nodes inside the view frustum. It’s basically a cheap projection of the frustum onto the grid. The thing is these elevated points can’t be used for visual confirmation as they’ll check against the wrong parts of the depth buffer or in the case of the nodes close to the agent they’re outside the span of the buffer. So what I did in the end is to gather all nodes inside the “projected” frustum, handle those that can be translated into the depth buffer and for the others I cast a ray from the agents eye to the specific node and check for intersections. This isn’t all that demanding as only a handful of nodes needs to be checked with rays.

I then discovered an interesting bug: the POM loses it’s accuracy quite fast. I discovered that something weren’t right when I tried to implement weighted spreading in the last known velocity of the target. The total amount of probability should always be 1. For some reason I start to gain probability after a few updates and this error is quite significant as a lot of calculations assume the range of probability stays between 0 and 1. I’ve done some debugging but hasn’t been able to determine the problem. It might be floating point precision but that feels a bit unlikely as the error appears after the second or third update. The other possibility is that I’ve implemented the spreading wrong, but I can’t seem to figure out what the problem in that case actually might be.

This blog is for my specialization project for my studies at Luleå University of Technology. The area of interest I’ve chosen is artificial intelligence, in particular aimed for stealth-based games.

As the title suggest, the main focus will be how to implement a realistic search behavior in 3D space for an AI. This is so you can hide beneath tables and other objects and have the AI actually consider these locations instead of just looking behind them.

If you want to know more about me, go to the “About Me” page, or simply click here.

For more information about the project, The Project page should suffice.