Here we go! Our first blog about Seacurity Breach and its development. And the game hasn't even hit early access yet. You might be interested, why now? Our goal with these blogs is to show you our development process. To showcase the inner workings of a small indie game studio (even if you can't find us on the map) and to build a connection with the people that enjoy our games.
And now let's dive into some sexy talk about Unity NavMesh system! Don't worry! If this isn't something you are interested in, there is always the next week.
What is Unity NavMesh? Simply put, it's a navigation system that allows your created characters to come alive and move around your beautiful maps. It creates pathways and shows your units all the obstacles in their way, so they can go around them, jump over them etc.

Now let’s use our newest project as an example. Wait, before that we should explain a thing or two. Seacurity Breach is a Tower Defense game with an increased focus on map verticality and PUNS. We can’t forget those glorious puns. Now back on topic. Like in every Tower Defense game your ultimate goal is to stop your enemy before it reaches its target. So, using the NavMesh system, during level loading, your enemies plan the shortest way to their target and off they go! March towards a potential booty.

Cool stuff, right?
And this is where it gets interesting. In the grand scheme, for a TD game, it's all you need. A path from point A to point B. But it felt too static and we weren't just gonna stop there. Our goal was for a player to make meaningful decisions, interact with enemies. Plus, we got all this map verticality untapped. The first step we decided on is to give enemy units the MIGHTY ABILITY OF JUMPING. The great thing about Unity engine’s NavMesh system is that it can automatically map multiple layers of your level as walkable objects.

As you can see, right now our enemies can walk on an elevated ground, but they can’t get there. And this is where jumping comes into play. But for the unit to jump somewhere you need two things. First, an Off-mesh link that shows the AI that it can move from his current location to another mesh if a gap between them exists. Secondly, a proper jumping animation, we don't want to see a static seahorse flying. That's a scary sight.

o we link both layers together as pictured by the red nodes and our unit knows that it's ok to jump on and off it. With that jumping is done.
Now some units can jump (one block high)! Open the champagne! Ok, it's not that impressive, jumping was already a thing when Atari ruled the world. But that's how a game gets built. Small things stacked one onto another.
Our next idea was, what if a unit had an ability to wallcrawl and reach places that a player might not account for. Honestly, we don't know any other Tower Defense game that has done it. And that's how an assassin character was born. Like we stated previously, Unity is great at automatically making NavMesh on multiple layers. The issue arises when it comes to walls. Then it's a little bit different story.
In the early stages of development, we went with the optimistic, naive approach. NavMesh is built (generated) everywhere and units have a path from point A to point B. Everything should be fine and work as intended. And it did, it was beautiful! But everyone wants for their game to look pretty, have a particular art style, so do we. So you add decorations, buildings, plants etc. And that's when we hit a small snag with NavMesh generation. Who would have thought that making a game more pretty would create technical problems. The issue was that some of our decorations ended up creating 'holes' in the NavMesh, particularly on walls. Thus prohibiting assassin units from traversing those blocks. One way of dealing with that issue is to remove colliders on decorations. But we weren't fans of that. Units clipping trough world objects isn't a good look. Like always in life, the simplest solution almost always is the best one. If a block isn’t used for the assassins wall crawling ability or it has objects attached the engine will automatically skip NavMesh generation for those walls. Unless we have manually tagged particular walls/blocks, then it's just business as usual for the engine (which is great for performance).

This time focus on the green nodes. They are indicating to the engine that it needs to generate a NavMesh on the tagged surfaces and to also create an Off-mesh link (on first and last 2 nodes so the unit can step on the wall and step off it on the top.

As you can see the unit can reach places on a map that a player might not think at first. That adds an extra layer and planning aspect to the game when the player knows that he/she will have to deal with that particular unit.
Now let's see both of those units in action. Quick prototype 'island' to show off how it works.
http://soaphog.com/wp-content/uploads/2018/09/test1.gif
And that's the 'short' version about our experience with Unity engines NavMesh system in our latest project. We had some issues, some things we had to learn. But for everything to work and look like you want it, well that takes a little bit more work and knowledge.
See you next time!
Feel free to follow us on social media
Twitter: https://twitter.com/SeacurityBreach
Facebook: https://www.facebook.com/SeacurityBreach/
P.S. For regular blog posts on other things besides game development visit Soaphog.com. We are planning on adding weekly blog posts about all kinda topics there.
