How to setup the minimap - Step by step

Video Tutorial



Step 1 - Add the minimap to your project

After you've created your project open up the Epic Launcher and add the Dynamic UMG Minimap, if you haven't gotten it already you can look in the market place for Dynamic UMG Minimap or click here for the direct link.
Click on Add To Project and select your project.
The minimap files should be added to your project immediately (no need to restart)

Step 2 - Generate a texture of your map that we will use in the minimap

If you don't have a texture for your map you can use the scene capture 2d to capture an orthographic view of your map which you can then export and edit outside of the engine, then you can import it back and use it or you can simply use it as is for testing purposes.

Inside of the SentoRiousMinimap folder go to Minimap component >> Actors >> MapCapture2D there you should find a Map capture2D go ahead and drag and drop it in your world then while selecting it go to the details panel and change the location to (X=0;Y=0;Z=15000) change the Z (height) manually if you want just make sure it's up there in the sky so that it can capture your map from above, in the details panel find and change the Ortho width value so that you're capturing the entire map, in the same folder you have a render target named MapCaptureTopView as you change the Orthowidth value you'll be able to see the preview, change the Orthowidth until it's capturing the whole map.


Once done you want to remember that Orthowidth value because we'll need to provide it in the minimap settings, Right-click the MapCaptureTopView and click on Create static texture and now you should have a static texture go ahead and rename that static texture to something like myMinimapTexture now you can remove the Map Capture 2D from your map you no longer need it after we make a static texture.

We can use the myMinimapTexture with the minimap or if you need to edit it on Photoshop for example you can right-click it and go to Asset actions then Export, select export as an HDR go to Google and search for convert HDR to PNG and  find an online website to convert it to a PNG (Now you should be able to open it in Photoshop and edit it)

Step 3 - Create the minimap widget

Right click somewhere in your content browser and go to User interface then Widget Blueprint rename the widget Blueprint to something like MyMinimapWidget open up the MyMinimapWidget and in the palette search for Minimap Component then add it to your widget, change the size to something like SizeX=300 SizeY=300
Now let's go ahead and change some settings, make sure you're selection the minimap component you just added, change the Map texture to the static texture we made (myMinimapTexture) go to the Map Length in texture and put the Orthowidth value we selected in step 2. (in the video it was 14000)

Info: In case you didn't use the Map Capute2D to generate a texture of your map you'll need to provide the Map Length in texture for everything to work properly, this value is basically the width of your map that is displayed in your texture, you can use Step2 to get that value or change the view from perspective to to Top then hold the middle mouse button and calculate the distance.

Customize the other settings as you please for the ViewAngleTexture you can use the myViewAngle that comes with minimap files and change the size to something like (200;200) same thing for MyLocationTexture you can use MyPlayerPosition that also comes with the minimap files, or use whatever texture you want.


Step 4 - Add the minimap widget to the viewport 

Go to your character blueprint for example, Right click and add the Event Begin Play we will use the CreateWidget node to create a new widget, select the MyMinimapWidget we've created in Step3 Right click the return value of the CreateWidget node and select Promote to variable rename the variable Minimap drag a pin from the Minimap variable and look for Add To Viewport drag another pin from the Minimap variable and get the Minimap Component and drag a pin from it and look for the function MinimapStartUpdate in the owner pawn give it self (It's very important to give it an owner pawn)
Your script should look like this:


Save & Compile and play you should be able to see the minimap working.

Step 5 - Add something to track to the minimap

In my example I have a few characters with a quest icon above their head, and so I want to display a quest icon in my minimap so that I know where they are and that they give quests etc.
The character class is named AIQuestGiver so let's go ahead and add these characters to the minimap.
Let's go back to the character blueprint and add an event called AddCharacters inside it we will get all the AIQuestGiver characters in the map using the node Get All Actors Of Class then we will use the Minimap variable we've created earlier (Step4) to get the Minimap Component just like we did previously and from that Minimap Component we want to call the function Add Actors there's another function called Add Actor (without the s) but since we want to add multiple actors at once let's use the Add Actors function, the POIActors are the actors we want to add (We got them with GetAllActorsOfClass), let's leave Follow Actor Rotation unchecked because these characters are not moving and so we don't need to track their rotation, the only time you want to enable this options is when adding characters/cars (actors in general) etc that move around and rotate. (If you go to the Examples folder and open the map and play you'll see how the friendly and enemy AI characters are tracked in the minimap with Follow Actor Rotation enabled).
Texture is the texture we want to display in the minimap for these characters, and size is the size of that texture in the minimap, drag a pin from Color and type Make slate color and use that to pick a color, Show Height Indicator is a feature that allows us to tell if something is above or below our main character (a little arrow is displayed in the minimap automatically) for this example we'll leave that unchecked.
Your script should be something like this:
Now Let's call this event after we've created the minimap of course for this I'll add a sequence in the event begin play and call the event after we're done creating the minimap.
Here's the result:
In game
If you move far enough from the AIQuestGiver characters you will no longer see them in the minimap which is normal, but what if you want to constantly track their position in the minimap ? In this case you'll want to add these characters as Persistent Actors for this we'll need two textures instead of one, well it depends you can use one texture only if you want to keep the same texture at all time, for this example if we're too far away from the AIQuestCharacter instead of the quest icon texture we want to use a pointer texture, this makes it easy to tell what direction you need to go to find that object.

So instead of Add Actors we'll use Add Persistent Actors (again there's another function same name but without the s to add a single actor). This function is similat to Add Actors but with some additional options, the first one is the Out Of Minimap texture so this is the texture we want to switch to when the object is off minimap. Keep out of minimap texture straight if you're going to use a pointer like texture in the out of minimap texture always leave this unchecked, this option keeps the texture straight no matter the rotation, it's useful when adding a texture that doesn't change. (We'll see a usage example later) Show Only when Out of minimap this options allows you to only display that object in the minimap when it's off minimap, basically when you're too far to see it in the minimap (I recommend to test out these settings and see what happens)

Your AddCharacters event should now look like this instead
In game because the other 4 characters are off minimap now we see the Out Of Minimap Texture instead (This texture is probably not the best to use but it's just for the example) and the character near us is displayed with the normal quest icon because he's within the minimap scope.

More stuff coming soon.
Contact me: trafalgamer@gmail.com

Comments