Monday 26 November 2018

Minimap/Radar

My first attempt at making a game featured a mini-map in the corner of the screen. It was a little redundant, simply showing an orthographic view of the level from a second camera mounted above the players head. This camera was then fed to a Render Target, through the use of the Scene Capture Component 2D. Finally, the Render Target is turned into a material which can be added to the players View Port.

The mini-map in the shooting range
game. The arrow in the middle was just an
image on top of the map. A blue tint was also added.


For my new game, I wanted less of a map, and more of a radar which could show enemy positions in relation to the player. I found a useful tutorial about creating a simple mini-map on YouTube. I had previously used a second camera to track the player, however this tutorial suggested using a component called a Spring Arm. The Spring Arm essential works like a camera boom, allowing you to attach components to the end of it, which then translate the players movements, offset by the length of the Spring Arm. In this case, it translates the players position to the Target Render. The player position is then indicated on the Target Render by a arrow icon, which is hidden from the players main view. The tutorial also explained how to hide elements of the level being rendered on the map, using the details panel on Scene Capture 2D Component. I decided to hide everything, apart from the icon representing the player, to create something more akin to a radar.

The new mini-map works more like a 
radar, displaying the player and enemy icons only.


The last problem I faced was getting the enemy icons displayed on the radar, this was not part of the tutorial. At first I thought reverse engineering the same technique I had used to display the player icon on the map/radar, but not the main scene. This didn't work, as the AI character was the owner, and was only hidden for that actor. I thought there must be a way to do this through Blue Prints, and then I stumbled across the Set Owner No See node, this allowed me to change the owner of the Sprite icon attached to the AI character to the player character, therefore it would now only show on the radar.

This Blue Print allowed me to change the only of the
Enemy Sprite to the Player Character.
  

No comments:

Post a Comment