Member-only story
Making a RTS game #15: Adding a minimap and fog of war 3/3 (Unity/C#)
Today, let’s continue our RTS programming tutorial and finish up our minimap and fog of war features!
⬅️ Tutorial #14: Adding a minimap and fog of war 2/3| TOC | Tutorial #16: Introducing a sound system 1/2 ➡️
📕 Get the ebook and bonus material on Gumroad!
🚀 Find the code of this tutorial series on my Github!
These past few weeks, we’ve been working on the minimap and the fog of war systems for our RTS game. They allow us to get a bird’s-eye view of the terrain and to distinguish unexplored, already explored and in-sight areas. We have a little UI indicator to better materialise the part of the map currently in view of the main camera and some game parameters to easily change the settings of the fog of war.

In this final part, we’re going to wrap this up by adding some final touches:
- a mechanism for direct camera “teleportation” when we click on the minimap
- a small “fade-in” effect on units FOV so we transition a bit from dark to light when we place a building or create a character unit
- conditional rendering for the scene objects depending on their type and on whether they are currently in an in-sight area or simply in an already discovered area
Moving the camera when we click on the minimap
Instant camera teleportation is neat because it allows the player to quickly go to the other edge of the map without having to continuously press some arrow key or stick your mouse on a screen border during dozens of seconds.
So like in most RTS games, we’ll implement this “minimap click”: whenever the player clicks somewhere on the minimap (in an explored zone or not), the camera will move instantly so the matching point in the 3D scene is in the middle of the main camera screen. We will even make it so we can click and drag the minimap indicator and automatically update the main camera accordingly (watch the mouse cursor on the minimap in the bottom-left corner):