Time is a force…

Recast graph and triggers for AI agent’s ears and eyes

…and it will surely take its course.

Hello friendlies, enemies and neutrals!

This line got stuck in my head after playing Superbrothers: Sword & Sworcery EP. It seemed quite fitting when I wrote this update. I wanted to post something really cool today. A playable demo showing the current state of character controls and AI, but time was just not enough. I’ve spent a lot of it checking out solutions for local avoidance and AI steering as well as reading a book I’ve recieved last week, Artificial Intelligence for Games. Maybe thursday or next week.

I’ve been working on testing the recast graph of the A* project I use. So far it seems to generate really nice navmeshes and I’m really pleased with it. I’m saying this after a very limited amount of testing, but still I’m optimistic about working with it. The picture of the first update showed a grid graph, which is often used for RTS game. In today’s picture you can see the same test level with the recast generated navmesh.

Also you can see a large green capsule shaped wireframe object and a similar cuboid object. The capsule is the trigger for the agents hearing, when a noise maker gets inside this range, it starts sending noise messages. The cuboid will be replaced by a cone or a frustum. When the player gets inside this the ai starts to use linetracing to check for visibility. These things are performed using the Advanced CSharp Messenger from the Unity wiki. This project shows the amazing work of the community pretty well. It developed from the kind of shared iteration process, that open source makes possible. Credits go to Rod Hyde, Magnus Wolffelt, and Ilya Suzdalnitski .

I’ve made a list of the things I’ve got so far. It’s pretty short since I only list the things that I did myself, so no pathfinding for example:

  • basic patrolling behaviour
  • basic movement functions for AI
  • basic noise perception and sight
  • some crude player controls
  • some basic camera control implementations for testing
  • first try of a system to hide level geometry that’s above the player

So after this I decided I wanted to work on improving the AI and test the last point on the list. For this I created a somewhat more complex building. I still have to finish UV mapping, which is the reason for not having the demo today.

My AI movement is rather stupid at the moment. When the agent decides on a goal, it uses pathfinding to get an array of points that will get it to the goal. Then it simply moves from point to point until it reaches its final destination. If two agents happened to cross paths, they would make no attempt to avoid collision. They would simply bump into each other and because they have a capsule shaped collision geometry, they would eventually slide off of each other and continue on their routes.

The A* project actually has a local avoidance implementation in beta and there is UnitySteer. It is a project by Ricardo J. Méndez based on OpenSteer. It looks very good with a lot of behaviour already in there. Unfortunately it isn’t that well documented for someone new to it. Without a brief getting started guide, I always find it a bit difficult to find my way through the code.

Here is a little video to demonstrate local avoidance:

I will get straight to rambling this time. I realize that if I want to keep my updates reasonably short, I won’t have space to write about things like why I have chosen Unity, or gameplay concepts. For this reason I will probably make some extra posts. On the other hand if I have even less real progress to report next time I could just dedicate a whole regular update to some of these subjects. I have plans of writing some sort of design document. That would make things easier for me in two ways; communicating my ideas to you and setting a clear direction for work.

That’s it for now. See you next time I hope. Bye!

Advertisements

Tags: , , , , , , , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: