Practical Use — Creating the Playable Terrain
For a practical and simpler example of game AI and logical systems, I am going to reconstruct a “Duck Hunt” style game; the player will sit off the map with a firearm and attempt to pick off enemies who are navigating the map towards an exit.
The first step (once construction is done) is to create the navigable area for the enemies. In this case, I want them to go from the spawn door to the end door.
Navmeshing this level is as simple as selecting the floor tiles and ramps I want the AI to use and baking them as walkable in the navigation window.
Once the desired terrain is selected, navigate to the navigation window (Window>AI>Navigation)
This will open a new window that looks like this.
We simply need to check “Navigation Static” and select “Walkable” from the “Navigation Area” dropdown menu on this screen (make sure you still have the desired floor selected in the editor window).
Finally, swap to the “Bake” tab at the top and on the bottom right press “Bake”
Repeat this process for the rest of the desired walkable area.
Next, the same process needs to be done for obstacles (railways, pillars, etc) but instead of “Wsalkable” selected from the drop down, “Not Walkable” must be selected. Without this step your AI will move through walls!
With that, the terrain is set. Next up will be getting the AI to navigate from the start to the finish.