4 Hugues Ross - Blog: 300 (Teapots)
Hugues Ross

12/13/14

300 (Teapots)

Ever wondered what a gang of 300 mobile teapots looks like?

...No?

Well, too bad:
Apparently, 300 teapots

Now, as funny as it would be to just leave this image here without context, I think I should explain what's going on here.

This strange scene is from a class project for my recently completed AI programming course. This was actually the midterm, but I was too busy to share it at the time. With the semster over, though, I can finally write again!


Background

Like any good course on game AI, this one featured a section on pathfinding. Our instructor gave us a basic rundown of Dijkstra's Algorithm and A*, then let us group up and research some more advanced techniques. With Peter off doing who-knows-what, I paired up with Johnathan O'malia, a pretty great coder who I met in the class.

The Project

For our main technique, we looked at using navigation meshes to generate pathfinding graphs from 3D environments. To create the navmesh, we used Recast, a peice of open-source middleware. If you look below, you can see screenshots showing the test mesh with and without the pathfinding graph displayed:
Before...
...and after!
Now, if you've worked with navigation meshes before you might find the result overcomplicated. You'd be right to think that, as the resulting graph is actually a subdivided version of the original navmesh. We did this so that we could work with a relatively simple node array, rather than pathfinding with the mesh itself. Because of that, we nedded to subdivide the mesh to produce some in-between nodes that would allow us to produce straighter, more direct paths.

The Teapots

As you may know,the teapot model in our project is an old favorite known as the 'Utah Teapot.' If you know what it is, it should be pretty obvious why it was used. However, the fun part comes when you consider the context. The teapots are AI agents that need to path to a specific location, in our case the camera, and so we ended up with the strange situation of being followed by a group of strangely intelligent teapots!

The nature of the assignment also lead to a few odd visuals, like these teapot centipedes:
I especially like this image


So, uh..... yeah. Teapots!

The red lines that you can see in the first image denote the paths calculated by the teapots. Johnathan added some sort of smoothing function to the paths, and I've got to say that the result is quite nice in action! Another thing that you might notice is the rudimentary lighting engine. I wrote that part, and expanded further it in a later project, but that's a topic for later.

I'll leave you with an aerial view of the map, with only the paths shown:
As you can see, the teapots have just finished their long march to the top

No comments: