Pathfinding update

So, an update on my pathfinding system. I recently imported it into Spamocalypse, and there were a few things I had to change.

For starters, I can’t store the neighbours of a Node inside that particular Node, or else Unity tells me I’ve reached the serialisation limit. In hindsight, this isn’t a surprise: if each node stored references to their neighbours, then referring to another neighbour would have in turn referred to the neighbours of that neighbour…and so on. Recursion is not a good idea, so I’ve had to make finding the neighbours of a particular Node a run-time method, i.e. it’s calculated on the fly while the game runs. So far, I haven’t run into any problems when testing that, but I’ve only used a single agent to test it.

I’ve also added a few useful things to the editor script that builds the navigation meshes. For starters, I’ve added in options to specify the walkable layers in the project. These work fine, although in Spamocalypse it seems to reset the walkable layers to include the bots and walls when starting up again, but in spite of that the code works. I’ve also added sections to change the square footprint of a cell, along with it’s max and min height, and finally managed to clamp light intensity. Light intensity will be clamped to a range between 0 and a value set by the user, if they wish to enable this.

So, I have the core changes uploaded into the repository. For those who don’t have or don’t know how to use Git, I’ll probably make a Unity package that you can import directly into the editor at a later stage.

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.