Sunday, 17 November 2013

Navigation Mesh

When making a game there are certain things which are highly taken into account like engine fundamentals and basic gameplay. However, how can one go about creating a path that defines where a character should go and how to get there? This is why we use navigation meshes.

What is a Navigation Mesh?

It is a path defined as a series of nodes. This path can define the areas in which a character, enemy, or any dynamic object can walk through in the game world. So if an enemy needs to go from point A to point B, it can follow through the various nodes to get there. An example of this would be if an enemy is following the main character to intercept and fight, he or she needs to be directed to the best way to get there through these series of nodes. It would not look very realistic if the enemy were to follow a path that is a straight line. And what if something was in the way like a wall or a rock? Remember the nodes will be positioned in a way based on the design of the game world. If the nodes were a straight line the enemy would not get to the destination very easily unless you want your enemy to run through walls and what not that's your own decision. The point is you want your characters' walkabouts to look as realistic as possible.




As you can see in the first image that there is a destination depicted by Node A and Node B. The path used to get from Node A to Node B is shown in yellow. In addition, the nodes themselves form triangular meshes because they are a great representation for larger and more complex environments in the game world. 

Video

I this specific class Professor Hogue showed us a video about navigation meshes. We looked at how the makers of Resistance 2: Fall of Man used their navigation mesh. So I am going to give a hopefully detailed description of what I learned from this video.

Navigation Usage & Path-finding

The use of navigation can be great for any character to go to a specific point. So, like I said earlier realistic movements from point A to point B. It is great for valid target scanning and AI threat perception. Through navigation meshes you can have various world representations no matter how complex there are. You can even have them if the field is aggressively evolving in the game world.

Resistance:Fall of Man

In this game, the makers used a designer laid navigation mesh in Maya. They used the tools to build a convex poly mesh for runtime. Initially they wanted to have a poly mesh to be used with A* pathfinding algorithm. This did not end well at all bottle-necking and having only an eight player A* navigation at a time. Those were some of the issues they worked on for Resistance 2. 


Resistance 2

Early goals for this game included fixing  PPU bottle-neck, having a 9x nav-mesh poly load target, and removing AI load restrictions. An eight player co-op mode was planned as well. One improvement included using a 3-sided poly mesh instead of a 8-sided poly mesh. This prevented any overlapping within the polygons of the mesh not cause any confusion with the A* navigation. Path caching was added as well. 


Resistance 3

In Resistance 3, the makers included a Bezier curve to be computed from each node for a smoother interpolation. So for example, if an enemy were the turn around a corner, they will not have a sharp turn. They will have a smooth curved turn for the bend point.



Conclusion

Navigation meshes allow game developers to incorporate immersive and fun NPCs in their games. It also brings more realism in character movements from node to another. I think Insomniac has done a fantastic job in generating navigation meshes in their AI. Of course there is still need for improvement, but with the knowledge and skills known to game developers now we can pretty much pull off something awesome either way.




No comments:

Post a Comment