CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Follow publication

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!

Mina Pêcheux
CodeX
Published in
9 min readJun 17, 2021

--

⬅️ 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 and to . 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 when we click on the minimap
  • a small so we transition a bit from dark to light when we place a building or create a character unit
  • 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 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 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):

--

--

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Mina Pêcheux
Mina Pêcheux

Written by Mina Pêcheux

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)

Responses (3)

Write a response