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 fit the RTS game you’re creating.
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 plane objects to serve as the basis of the map.
The Terrain Manager components handles everything terrain-related.
When creating a new map using the RTS Engine menu, this component is attached to an object called ‘TerrainManager’.
- Ground Terrain 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 has this layer as well.
- Air Terrain: The air terrain is required to have flying units. This can also be as simple as a plane with no additional components (no collider is required). It must have a different area assigned to it when baking the navigation mesh. Its unique area will be assigned to the flying units’ Navigation Agent components to distinguish them from non-flying units. The height of this terrain defines the height where units fly. After baking the navigation mesh, the Renderer component of the air terrain object can be disabled so it won’t be displayed in the actual game.
- Map Size: Approximate size for the map (this can be as simple as the width*height).
Baking the navigation mesh:
When opening the “Navigation” menu (Window -> AI -> Navigation) you can see in the Area tab that are three built in areas/layers: “Walkable”, “Not Walkable” and “Jump”. If you have flying units, make sure to define a new area for it, for example call it “Air”.
When selecting a terrain tile/object, you can click on the Object tab of the Navigation menu to see/assign the area of the selected terrain tile/object. Make sure that the ground terrain object/tiles have their area set to “Walkable” and that the air terrain object has its area set to “Air”.
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 them again after the baking is done.