Path-finding for stealth

One of the problems I have with Spamocalypse is how to build light intensity into the player’s ability to hide. Most of the stealth-based games I’ve played include a mechanism like this, and I think it’s worth adding. My problem is how to do that, especially given that I’m using Unity Free and don’t have access to things like Light Probes.

The solution I’ve come up with is to add illumination to the pathfinding system. However, for that I’ll need to build one. This is something I did for my M.Sc. (see the Completed Projects page), but it had a few problems. Firstly, the mesh for each level was generated from scratch upon runtime, and the nodes were essentially limited to a two-dimensional array. Due to the level design, I also had a lot of unreachable nodes that were simply wasted space. While premature optimisation is a bad idea, I still hate the idea of useless data.

So far, I’ve managed to create a mechanism for serialising and deserialising the navigation meshes to the disc, allowing me to save and load navmeshes at runtime. I also have a template for adding nodes underneath obstacles, although it doesn’t quite work yet. Finally, I have managed to add an illumination variable to nodes, so that part of the system is done. At the moment, what I have left to do is to finish an A* implementation, and I should be fine.

I’ve decided to put this up as a GitHub repository, partly for storage, partly to track my changes, and partly so other people can use it, and it can be found here. When it’s finished, I will also add it to Dropbox as a Unity Package.

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.