DMMap Minimap System 2.0! Procedural, Multilayer & Vector-like maps, uGUI! NOW FREE and OPEN SOURCE

Sorry, just noticed one missing feature:
For a multilevel map, icons don’t have label specifications, which mean that they will show up on all layers. They will need a label field like the Map Shapes.

Hi @DMeville_1 , how do I modify the map icons to appear on specific layers for a multilevel set up?

Yep, you’re right. It looks like that was something I overlooked during the last update, however it should be trivial to add and I’ll get you a build with that fixed. Shoot me an email (info@dylanmeville.com) with your invoice number and I’ll send it over!

Did anyone else have their maps turn white after the latest Unity update? My DMMaps in every scene in my game show as a white circle now.

Aww man, did Unity 5.2 break something? :frowning:
I haven’t updated yet, but I’ll grab it and see what’s up.

@breakspirit I’ve just confirmed everything is working as it should with the Unity 5.2: Imgur: The magic of the Internet
If you’d like you can send me a small project where this is happening and I can take a look! (info@dylanmeville.com)

Thanks for checking it out. I’ll look into it on my own to make sure I didn’t mess anything up before I waste any more of your time.

It turns out I was unknowingly running an old version of DMMap and it didn’t want to work with the new version of Unity. I updated and all’s well.

While I have your attention, I’d like to suggest some changes. DMMap makes the assumption that the user will always have a scene containing both the map and the target.
My game has scenes that contain no map and the map target gets dynamically added to the scene at runtime.
I modified your scripts to work for me, but it would be awesome if you had options to account for that.
In DMMapIcon Start() method, all I do is check for DMMap.instance being null. If it is, I return. That prevents errors when the player moves to scenes without a map set up.
In DMMap, I hardcode the Setup() method to do FindGameObjectWithTag on my player’s tag. It would be cool if you added a tag selector in the editor to allow DMMap to dynamically find its target at runtime based on a given tag.

Thanks.

@breakspirit thanks for the suggestions!

  • Icons existing in a scene with no map is definitely a problem I overlooked! I’ll make it so it fails silently in these cases (without throwing a ton of errors)

  • I’d advise against changing around too much stuff in the DMMap classes, as it might break compatibility on updates. Additionally I like to leave things somewhat open ended for the user to use as they like, rather than adding in too many options many people will not use - however there are a few ways around this.

The target (among other things) is set up so you can easily assign it in any Start() functions or later, from anywhere using “DMMap.instance.configs[configNum].objectToFocusOn = gameObject.transform”

What I would suggest is creating a script that you place on your character prefab that gets spawned in, and does something like this, which is quick and easy, and saves you an expensive FindObjectWithTag call :wink:

//AssignMapFocus.cs
//Included in DMMap 2.2

using UnityEngine;
using DMM;

namespace DMM {
    public class AssignMapFocus : MonoBehaviour {
        void Start() {
            if (DMMap.instance != null) {
                DMMap.instance.configs[0].objectToFocusOn = this.transform;
            }
        }
    }
}

-= DMMap 2.2=-
Status: Accepted!

Changes:

  • Icons

  • Icons now have an additional “Layer” parameter - this defines that layer of the map the icon renders with (for multi-level maps). -1 corresponds to every layer, 0+ corresponds to the map layer with the same value. Assigning the icon layer value of 3, will have the icon only render with map layer 3.

  • If no map is present in a scene, icons can still exist on your prefabs without throwing errors. All behaviours just exit if DMMap.instance == null.

  • Misc

  • DMMap now throws an error if the Layer “DMMap” is missing.

  • DMMap automagically detects which layer it should be on at startup and sets the DMMapCamera.culling mask accordingly. This means if you change your DMMap layer (from user defined 8, to anything else) all changes will be reflected and just work.

  • All warnings were (finally) cleaned up.

  • New AssignMapFocus.cs script, which when assigned to a gameobject will set up DMMap to follow this object. Useful for characters spawned at runtime!

This looks super awesome, but are there any plans for fog of war ?

@LIVENDA_LABS Thanks!

Short answer is no; long answer is kinda.

Fog of War was on todo-list for DMMap V1, and I even had a simple prototype working but it didn’t perform well and was super slow. Fog of War is a tricky beast to conquer, and not a small undertaking. I haven’t figured an appropriate and quick way to do this that is a drag-and-drop solution, that works well for the different types of map configurations DMMap offers.

That being said, it is something I play with whenever I have the time or a free weekend (as DMMap is a weekend endeavour, and I have personal game projects I like to work on, too!), but I don’t want to make promises I can’t keep if this is something that never makes it to DMMap. I know it would be cool, and I would love to add it in, but no promises. Sorry!

I’ll try my best though :slight_smile:

Hi, is there a way to add an image as the background for the map instead of a solid color?

@Rusted_Games There isn’t currently. But I can whip up a shader that allows for this. So after a bit of work we have this.

1- Download the DMMap2.shader attached to this post, import it into your project.
2 - Right click the DMMap2.shader and choose Create > Material. This will create a new material using this shader named DMMap2.mat
3 - Select the DMMap > Canvas > Map object in the hierarchy. Replace the Material property on the Raw Image component to the new material we just created.
4 - Press play to see it in action. You will need to change the Map Background Color’s alpha on the DMMap component’s Configs to 0 before your texture shows up (as it’s rendered behind). Changing the opacity slider on the DMMap config changes the opacity of the MAP only (not the background). You can change the Background Tex and Background Text Opacity properties on the new material. Play with those until you find some combination of opacities that work.

Hope that works for ya!

Additionally, looks like Unity UI materials have been fixed, which means I can use shaderforge for them. Few months ago when I tried this it didn’t work, so that’s nice :slight_smile:

(This was tested on Unity 5.2, may not work on older versions because of the bug mentioned above)

2304433–155249–DMMap2.shader (4.99 KB)

Excellent it works like a charm.

@Rusted_Games Glad to hear it!

On a side note DMMap 2.2 was just accepted! Woohoo!

If you like DMMap, and think I’m doing a good job with the product and support, PLEASE take a moment to rate or leave a review on the asset store. :slight_smile:

Is there a way to have the Mini Map follow the player using a tag instead of its transform? I am switching characters mid scene in and out and it seems to break the connection.

Nevemind…:slight_smile: I didn’t place my code in the Update :slight_smile:

    // Update is called once per frame
    void Update () {


        DMMap.instance.configs[0].objectToFocusOn = GameObject.FindWithTag("Player").transform;

        DMMap.instance.configs[1].objectToFocusOn = GameObject.FindWithTag("Player").transform;


    }
}
1 Like

Finally purchased DMMap and glad I did. I could feel a lot of my frustrations lift when I deleted the other asset from my project.

Some thoughts / experiences / etc. using version 2.2:

  • How would you disable all maps, so none are being viewed at all? Loading configuration 0, 1, etc. makes sense for switching between map views, and that is awesome… reminds me of many games such as Torchlight, etc. where you can switch between the map views on your screen.
  • A lot of demos didn’t work completely: dropping waypoints, map creation after procedural generating a map, multilevel movement. Regardless, the demos were helpful and I presume they just were broken on some Unity / DMMap update.
  • Make the DMM.DMMapIcon RotateIcon() method virtual. I made an override for my wonky-as-heck player rotation.
  • Tweening the zoom in/out levels would be awesome. I’ll probably get to this when I have time, which might be never, but using LeanTween or something would be awesome.
  • It took me a while to realize that you were overriding any changes I made to the size of the overlay, etc. all to fit within the rectTransform for the specific map. On one hand, this is awesome, on the other… if my overlay has any translucency on the edges of its texture, you can see the map underneath as it moves. Perhaps a setting for ‘padding’ the edge of the map in case your texture has some shading/transparency near the edges. I was going to go a mess with the code to make it do this, but just used a different texture. The option would be nice.
  • The asset store picture has a version as the bottom, which is the wrong version.

Side note: the fact that my rotation woes took less than an hour to fix by finding the rotation part of the icon and changing it to my needs was more than awesome. It took me multiple hours in many, many different parts of the code for other map assets.

That’s it for now. Back to playing with the map.

1 Like

@Yukichu Thanks for the comments!
-What version of Unity are you using? All the the demos should be working. I just tested with 5.2.1f4 and all the demos work properly in a new project out of the box (after adding in the DMMap layer in the layer tabs, which is the only setup step). The only issue I found was movement isn’t working on the multi-level demo for some reason. What issues were you seeing?

-If you want to disable all the maps (but still leave the map “area”, overlay etc) still visible you should be able to just disable the Mesh object. Otherwise you should be able to just disable the entire DMMap object without issues to remove it all temporarily Here’s some code you can paste into the DMMap.cs, and can call via DMMap.instance.

/// <summary>
        /// Disables the map rendering (map + icons) while still keeping the overlay, and other map areas visible
        /// </summary>
        /// <returns></returns>
        public void DisableMap() {
            meshContainer.SetActive(false);
            iconContainer.SetActive(false);
        }
        /// <summary>
        /// Enables the map rendering.
        /// </summary>
        /// <returns></returns>
        public void EnableMap() {
            meshContainer.SetActive(true);
            iconContainer.SetActive(true);
        }

Good ideas on the other points, adding tweening on the zooming should be pretty trivial (adding a new float and using that to control the zoom that slowly moves towards the normal zoom variable, using some easing method or animation curves), I’m not sure about adding in another package to DMMap, but I’m sure I can add something to make the process slightly easier.

It might be easier to just add the padding to the image in photoshop rather than adding another (possibly confusing) property and aligning things on the rect transforms in the editor, but it’s an interesting idea.

I need to update the asset store images :stuck_out_tongue: