Creating a new map using the RTS Engine menu will spawn a pre-made terrain where you can paint textures on it, raise it or lower it and customize it to your linkings. However a Terrain type object is not the only type of object that can server as a map, you can also use multiple tiles, platforms or simply planes to server as the basis of the map.
The Terrain Manager components handles everything terrain-related:
- Terrain Layer Mask: Specify here the layers that the terrain tiles have. It’s recommended to have one layer for all these tiles to avoid any confusion but having multiple layers is also possible. Just make sure that no other type of object in the map have this layer as well.
- Flat Terrain: It can be a simple plane (mesh renderer is also not required to be on the object, it just needs to have a non trigger collider). It is slightly longer and wider than the actual map. Placed at the center of the map but slightly lower than the main terrain tiles, this object is useful because it acts as the receiver of the raycast when attempting to select multiple units.
- Air Terrain: It can be simply a plane object. It’s used as the base Navigation Mesh for flying units if you are planning to support them in your RTS game. This one is normally placed over the main Terrain (must be placed exactly at the minimal height of the flying units in the game). This object’s layer can be set to “Hidden” or can be completely deactivated. Make sure it has only two components: Mesh Filter and Mesh Renderer.
Baking the navigation mesh:
When opening the “Navigation” menu (Window -> Navigation) you can see in the Area tab that are three built in areas/layers: “Walkable”, “Not Walkable” and “Jump”. In addition it is required to have another area for the air units if your RTS game is supporting them. That area should be already there when you import the asset under the name: “Flyable”. If it’s not there, simply create it.
When switching to the Object tab, the main terrain object/tiles must be set to “Walkable” and the “Air Terrain” navigation area must be set to “Flyable”.
In the Bake tab, you have a couple of settings to customize the behavior of agents inside the navigation mesh (how you want to go up on hills for example). For more information on this, please check out this page.
Each time you make changes to the map’s terrain, open the “Navigation” menu and bake the terrain again. Make sure that you hide every object in the scene that has a “Nav Mesh Obstacle” component (including resources, default map buildings, etc…) when baking the navmesh to get the most accurate result and then reactivate the nav mesh obstacle objects afterwards.