Wednesday, September 15, 2004

Navigation Meshes and Artists that Love Me

I really hate it when I see guys z-clipping against each other in a game. We’ve been doing 3D games for a long time now and we have some good solutions for this problem. I use a thing called a navigation mesh. It’s a surface that guys walk on. I run A* path finding on the nav mesh so the guys can walk around each other without walking on top of each other.

Nav meshes are really fascinating things. Well, they fascinate me anyway. One reason for that is the complete lack of published information about them. There are a few tidbits here and there, but I’d be much happier with a full chapter in a Game Gems book. I’m writing about my experiences with nav meshes with the hope that some of you reading this will do the same.

Ok, so how do I make the nav mesh surface? That’s a good question. Let me start by explaining some ways bad ways to go about making a nav mesh. My favorite background artist at work is a guy named Calvin. He makes pretty things. Some of those things characters walk on. So why don’t we just use his 3D models as a nav mesh?

Reason #1: Calvin is good at making pretty things. He is bad at making technical things. Calvin knows what T-junctions are but has them all over his pretty backgrounds anyway. Now renderers hardly skip a beat with T-junctions, but I can’t keep my path finding algorithm from puking on them. I could tell Calvin to: quit making T-junctions, make all triangles about the same size, and have no vertical triangles. But I want Calvin to like me.

Reason #2: I’d rather have more art. Maybe you’re fortunate enough to be working on a game that has enough art. Man, I’m jealous of you. But I’m working on a 4+ year project that has plenty of programmers and not enough artists. Pretty much all new AAA titles are having this problem now. So I’m not gonna waste my artist’s time making crappy old nav meshes.

Reason #3: I have a lot of control if I auto-generate the nav mesh. I’ve gone through so many iterations of different types of nav meshes, it’s nice to be able to completely redo it without bugging Calvin much.

So at the end of the day, I’d rather let Calvin work on art and I’ll make the nav meshes myself.