Dungeon Defenders tutorial series:
Enemy Spawning | Treasure Chests | Minimaps | Pathing | Rewarding and Customising Items
Enemy Spawning | Treasure Chests | Minimaps | Pathing | Rewarding and Customising Items
Setting up Minimaps in Dungeon Defenders
Dungeon Defenders minimaps are a integral part of levels. They not only help people new to a level find their ways around, they allow users to plan out routes and tower placement. They indicate positions of all enemies, during the combat phase, especially helpful if a enemy gets stuck or lost somewhere. And they also let you see crystal, treasure and the forge location.
While they aren't overly hard to setup, they require a fair amount of messing about with to get right. I'll hopefully be able to let you know what needs to be done to set up the values required for your own map, because there are no perfect values that will fit every map.
Along with the minimap, ill show you how the wave billboards are set up to work, where they should be placed and how to adjust them, because inevitably there will be at least one that covers an important section of the minimap or is off screen.
For this you will need an external image editing program. I use Adobe Photoshop, however you can edit in any program, what ever suits your needs. If you don't have one, I suggest having a look at GIMP as it's free and does as much as you'll need it too.
The easiest way to go about creating your own minimap is to start with your map in-game. Using the top-down viewport, click the 'lit' icon on the viewport toolbar to put it into shaded/lit mode, you don't have to use lit, it's a personal preference, it can be easier to see complex shapes with this mode, sometimes a wireframe is easier for layouts though. Make sure you maximize the viewport with the furthest right icon on the viewport toolbar.
Using the top down view will also mean that when you create everything in your image editing program everything can be kept to the exact scale of your map. If you create it without using your map, it makes scaling setup harder and you have to spend more time resizing it.
Now remembering that treasure chests, crystals and spawn points are added by the game, you don't need to show these so you can select them, hide them and then unhide once you've taken a screenshot. Alternativley you can make use of editor shortcuts to hide meshes, CSG and the like, 'W' will hide/show meshes, or a much easier one is 'G' which will show the editor in 'game mode'.
When you create your texture try to keep it at 1024x1024. This size should fit on most screens without resulting in being overly pixelated, If you do decide to use another size keep in mind that any texture you import into the engine has to be a power of 2. Some examples include 512x512, 1024x1024, 512x1024, 2048x256, etc.
Trendy use a very simple theme for their minimaps, consisting of simple colours and minimal clutter. Just for reference here are the colours they (roughly) use and their hex codes. Stairs and ramps are gradients between the layers used.
- Outlines - White - #ffffff
- Lower Levels - Brown - #3c3121
- Mid Levels - Light Brown - #b9915d
- Upper Levels - Beige - #d5bf9e
- Top levels - Cream - #efe7db
- Lava - Orange - #ff8200
- Enemy spawn areas - Red - #e72217 (at about 70% opacity)
Trendy's minimaps also have a slight shadowing/black outer glow around the final product you can always add that if you want!
Or feel free to use this as a colour picker:
Once you've created your texture, you need to save it. If your texture doesn't reach the edge because your map isn't a perfect square remember to make those areas transparent so they don't look ugly on the minimap when you press shift.
Unreal supports few formats for images, the most common one is .tga or targa.
Here's how mine turned out:
Id recommend that when you create your texture if you can find the central point of the map from the top down view using the image editing program of your choice it will to be hopefully useful when placing the minimap in the world.
To import your minimap. Open up the content browser and hit import
Once you have located the file hit open and you'll be presented with the Import dialogue box. There are 4 things you need to check in this before hitting Ok.
The first is the package, we will use the map package (same name as your map). The reasoning behind this is if you start using other new external packages, these will also have to be found, cooked uploaded, keeping everything custom for your map in it's own package results in a single file to maintain.
You can set a group if you wish, it will be a sub folder of the package making organising easier, it's entirely up to you.
Again the choice of name is upto you, however keep it simple and something you can find easily.
Then we have to set two of the import options, the first is the 'LODGroup' this is the 'Level of Detail' a minimap is used for the User Interface so we'll select 'TEXTUREGROUP_UI'. This way the engine handles the texture keeping it at a higher resolution then some of the other options and not as much compression.
The next is enabling 'No Mip Maps?'. Which can be used for things, such as world textures, it basically lets the engine create multiple detail levels of the texture, for lower systems it drops the detail down for example. It can result in slightly more memory usage for a texture, but it's not normally a huge problem. But for visual needs of a UI texture it should be disabled.
SETTING UP THE MINIMAP
Now that we have this imported, we need to set up the minimap actor in the world. If you're using the DD_LevelTemplate map there is already a actor avaliable to use. If not then here's how.
Open the content browser, and at the top click on the 'Actor Classes' tab.
Once there, find and Expand 'Info' then select 'DunDefMiniMap', go back to your map, right-click in the world (preferably on a surface as where you click is where it will be placed)
Once you have placed it in the world, select it and open its properties with F4 and expand the 'DungeonDefense' section.
There are a fair few options here, here's a run down on how they appear to work.
- Enabled? - Allow the minimap in-game, yes/no
- Force Map Always on? - If you would like the map to always be on screen
- Map background Opacity - The transparency of the minimap overlay
- Mini Map Background Texture - The texture of your minimap
- Mini Map Center Tex Coords (x/y/z) - The centre point of your texture
- Mini Map Distance Scale (x/y/z) - x = top to bottom y = left to right. The distance of your minimap overlays
- Mini Map Icon Scale - The size of the overlay icons i.e. Treasure chests and crystals
- Mini Map Scale - The size of the minimap texture
- Mini Map Screen Draw Offset - Allows you to position the minimap and overlays around the screen
- Orig Map Tex Height - Height of the minimap in game
- Orig Map Tex Width - Width of the minimap in game
Now many of these settings depend entirely on the texture you're using and your own map. So while I will try my best to give you the information values will differ almost all the time.
It takes a bit of trial and error to get values correct for this, so it maybe take a few attempts before you get it right.
So the first thing to do is to insert your minimap texture, do this by selecting it in the content browser, then clicking the green arrow on the right side of the 'Mini Map Background Texture' row. And then you can set the 'Orig Map Text Height' and 'Width' values up. Now It appears that Trendy use the same values for all their maps that I checked, those are a height of 706 and a width of 984.
While you are free to use any settings you choose, I found the values Trendy provided stretch out most minimap textures if they're brought in at a 1024x1024 size. As such Id suggest values that are equal to create a square, 512x512, 600x600, 768x768 etc. They don't need to be powers of 2 here so any value that creates a square should be fine. For my final setup I used the value 768 in both Height and Width
From my testing you should set the X and Y values of 'Mini Map Center Tex Coords' to values that are half of the ones in use in 'Orig Map Tex Height' and 'Width'. This isn't a fool-proof method, it seemed to work fairly well, you may have to adjust your values slightly. Again for mine I used exactly half (384 for both), which seemed to be helped by the fact I knew my minimap in the world was lined up very close to the actual texture centre.
Now it's probably a good idea to note that the position of your 'DunDefMiniMap' actor is important! Place it as central in your map as possible. Where it is placed will be where the map texture centre is. So if you place it to one side you'll have to modify your map centre coords.
You can test it in-game now and it will show up, although chances are nothing lines up with the overlaid icons from crystals and so on.
If your map at least works, doesn't clip off screen for being too large, or is too small you can get to the lining up of the game rendered elements.
This is where it can be a bit tedious. There are no definite values for this.
The easiest way are to try some fairly opposite values, but note that the adjustments only need to be minor for this section. Start off with the default values, if they don't work, you can then start to go up or down depending on if you need to cover more or less distance with the objects.
This is a quickly done example to hopefully help you correct misaligned objects easily. This is the method I used with many values to adjust the distance scale with a few attempts.
This works on the basis that the centre of your map works, aka the middle of the map is the only bit that lines up with your position. (centre of the map should be located where you have placed the 'DunDefMiniMap' actor in the world.
If the treasure chest (B) was not in it's correct position (C) the value you have in the Y axis is too big. If the chest was in the position (A) the value you have is too small.
If it is off at a diagonal to where it should be. (1) your values in both the X and Y axis are too small. If it was in (2) then your values are too big in both axis.
If it is off in the position (!) the value in the X axis is too small, and if it is position (#) then the value is too large.
Values on the X axis are top to bottom and Y is left to right.
Now for your wave billboards for the spawns. These can be separately adjusted to position them on the minimap. This might not be required for every map, but at times it helps you reposition them if they happen to cover up something on the minimap.
Again if you're using the LevelTemplate map you should already have these in your map. If not however here is how to set them up.
You can locate them in the content browser, either by checking the My Collections > Misc. Or the 'DunDefArchetypes' package. You are looking for the name 'WaveBillboardArch'. Once found you can drag and drop it into your level.
You should have one for each spawn area. Now you need to connect them to the kismet sequence for spawning. The easiest way to figure out which spawn points are which is to right-click on one of the notes where enemies are spawned.
The rotation of billboards does not matter, when they render in-game they always face the camera.. However the positioning and height affect where they are rendered in the world and position is used by the minimap.
Once you have located the kismet for those particular spawns, you need to assign the 'Wave Billboard' to the 'Set Wave Billboard SpawnPoints'. This will allow the game to show the correct incoming enemies at the right spawns, to allow players to prepare.
If there is already a variable connected to the 'wave Billboard' node if it states something other then '???' you already have something assigned to it, if it's already a billboard you can right click and 'Select xxxxxx In Level' which will jump your viewports to it so you can move it.
If it's something else or wrong, or is nothing (???) you can easily assign the new one. Making sure you have the billboard selected in the level, right click the variable and select 'Assign DunDefBillboard_# To Object Variable(s)'
If you don't have a variable there you can create a new one by right clicking and using 'New Object Var Using DunDefBillboard_#'. Next click and drag from the 'wave Billboard' node on to your new variable.
Now when you test you should get wave billboards show up in-game and on your minimap! If positioned correctly they'll show up when you run around but could have issues with the minimap, like so:
So how do we go about fixing this?
Well thankfully it's fairly simple. If you select the problem billboard and open it's properties window. You'll see a fold down value named 'Mini Map Offset'. Now as before there are X, Y and Z values. Z isn't required as we're working with 2D, Y is up/down and X is left/right. As our billboard was too far down we need to move it upwards, so using a negative value of 50 put in to Y. Our billboard will move up on the minimap, but stay in the same place in the world.
And that's our issue resolved you can then edit any others that you need too.
I hope this quick tutorial has helped you with setting up a minimapand how to position it. If you still have questions feel free to check out the official DD forums.