Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

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

Discussion in 'Assets and Asset Store' started by DMeville, Aug 8, 2014.

  1. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    That sounds like a good suggestion, I should have done it earlier! I'll mark that on the todo list for the next update!
    The missing reference is something I overlooked and forgot to remove during the major refractor to uGUI, it's not anything important that's missing - I deleted that component and just forgot to remove it, whoops! :)

    Let me know if you have any other questions!
     
  2. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Really like this! However I'm having a feature request. All modern minimap systems (take for instance, the witcher 3, dragon age inquisition etc) have direction indicators (see my current system where the arrows point to something interesting like quests, treasures, etc...)
    ScreenHunter_208 Jun. 21 13.42.jpg
    This to make the gamer aware of something interesting on the map but not yet in his grasp.
    Would be nice if your asset could be able to display those as well. :p
     
  3. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    I'm also getting this error:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. DMMapPoint.OnDestroy () (at Assets/DMMap/Scripts/DMMapPoint.cs:11)
    This error popsup numerous times when exiting gameplay, it doesn't occur when running the game though only when clicking the stop button. Looks like some cleaning up isn't properly triggered.
     
  4. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @cygnusprojects I can't seem to reproduce this. By the start button you mean pressing the play button again to stop playback, right? Hmm, are there any other details you can share?
     
  5. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Indeed pressing the playbutton again to exit playmode does result in those messages. Maybe it's the way I've set up my gameobject to generate the map. I used a hierarchy of empty gameobject (for instance map) with empty child objects containing the shape script so everything is nicely grouped within one object. Let me see if I can reproduce myself on an empty project and I'll let you know my findings.
     
    DMeville likes this.
  6. TechiTech

    TechiTech

    Joined:
    Dec 13, 2014
    Posts:
    212
    I'm interested in this feature too.

    So is that something you're working on?
     
  7. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Yep, slowly though. I admit I don't have too much free time to work on features, it's mostly a weekend endeavour and I squeeze in a few hours whenever I can. Because of this I can't really give an accurate ETA. The update I'm working on right now is:
    • Moving the icons out of the RT and into individual uGUI textures.
    • Minimap <---> worldspace position conversion.
    • Upgraded icons: direction indicators, distance fading
    • EDIT: Map Detailing/different materials per layer
    • misc fixes
    I'm hoping to get all this finished up next weekend/early July, then I can return experimenting with FOW :)
     
    Last edited: Jun 24, 2015
  8. TechiTech

    TechiTech

    Joined:
    Dec 13, 2014
    Posts:
    212
    ok thanks :)
     
  9. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    I've got some more info when this errors are raised. When you have a collection of mappoints and you are assigning those manually to the parents map shape. While testing I did something stupid leaving me with only the mappoints object so I parented them manually below a shape setting it's collection. Aparantly the parent-child like isn't properly maintained though.
     
  10. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Ah yes, it sounds like it lost a linkage it needs. When you create a new point by clicking the "New Point" button on the DMMapShape component it does a few things:
    - creates a new gameobject with a DMMapPoint component
    - adds the new point to the "verts" list on the DMMapShape.
    - assigns the DMMapPoint.parentShape variable to the DMMapShape which created the point.

    By the sounds of it that last step got messed up. So when the points are being destroyed (via exit game, etc) it's trying to remove each point from a list on the parent shape, but it can't find this list because the linkage is missing!

    Here's a hotfix; If you replace the script DMMap/Editor/DMMapShapeEditor.cs with the code here: http://pastebin.com/CYxce7uH
    It will add a new button below the "New Point" button on the DMMapShape component. "Restore Parent Shape References". Clicking this will iterate through all the mappoints in the verts list and fix any mappoints whose parentShape is null.

    Hopefully this will fix the issue :)
     
  11. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Thanks will give it a try. Another question, well actually 1 question and one feature request:
    - what's the best approach for inserting points to a shape. Let's say I won't to add some extra details to the shape how would I do that? Maybe provide some insert, delete, move up and move down functionality?
    - I won't for instance to mark specific landmarks on my map (for instance a river, or a house). Can you provide a way to add those to the map? For instance a river is a shape with a special shading (lines for instance going from top left to bottom right) or a house with yet another type of shading.
    Hope I'm not to demanding ;)
     
  12. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Right now it's best to do it all at once. There's no way to add more points to a shape, other than at the end. With that script I sent you though you can always duplicate a map point, increase the size of the verts list and drop the new point in there, or reorder any way you like. Then click the "Restore Parent Shape References" to clean up any missing references. I'll consider adding some tools to make this easier.

    Like have the map/outline render differently? Or have certain shapes render differently? Or mark it will an icon?
    The next update will include adding waypoints/icons to the may by clicking the minimap.
    If you want to do something more special you can always customize the shader used, and that will affect all meshes generated.
    To have certain shapes render differently right now that's not possible - but since each Layer creates it's own mesh you could extend it so each layer uses a different material/shader as well. I'll have to think about the best way to integrate this though, as it slightly goes against the way things are currently set up. Hmm

    I know it's possible though, as the guys doing Satellite Reign did this successfully. http://i.imgur.com/mSX2uxA.jpg
     
  13. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    I'm indeed referring to this rendering of certain shapes differently. I'll try to fidle myself (just maybe a different color to start with) and see how it goes. Thanks!
     
  14. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    So.... In Illustrator I made a vector top down view of one of my levels, is there a way to use that png?
     
  15. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    I'm afraid not. You would have to recreate the map with DMMap. Sorry!
     
  16. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    It's ok.

    So... how does this look with normal terrain then? Really interested, cause all the other minimaps are outdated :(


    EDIT**
    Looks like @cygnusprojects has already made the suggestion :)
     
  17. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192
    actually.... show a quick pic of how it does the outline of a terrain.

    This might be perfect.... to capture the oldschool zelda world map look. would be something that could make my day :)
     
  18. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @AlanGreyjoy I'm afraid you've gotten me a bit confused! DMMap doesn't do anything "automagically" to Unity terrain, you have to do a little bit of set up (see an example at 3:00 here:
    )
    Note: this tutorial is for version 1 and out of date(we're on v 2.0 now), but the same process is used for creating the map shapes.

    The goal of this asset was to have a nice way to create minimaps that look similar to this or this. I've also used it in a small prototype I made (that features dungeons similar from the oringial LoZ)

    Does this answer your question?
    What do you mean by "all other minimaps are outdated"? :)
     
  19. AlanGreyjoy

    AlanGreyjoy

    Joined:
    Jul 25, 2014
    Posts:
    192

    Oh S***!....

    Sold on friday :)


    Like the the two major ones... ninja and kfg or something like that. They are outdated and do not work..... another classic example of why Unity needs to clean up that damn store.... but hey... they get money for broken stuff, so i guess that's why they don't care :p
     
    nuverian, TechiTech and DMeville like this.
  20. IndieGameHustle

    IndieGameHustle

    Joined:
    Jul 25, 2012
    Posts:
    65
    @DMeville Just wondering, I may have over looked it but I was not sure how the full screen option works.

    Thanks!

    Edit:

    I found it, just change the Config on the Prefab DMmap to 2.

    You can also change the config at runtime with
    “DMMap.instance.LoadConfig(int).
     
    Last edited: Jun 24, 2015
    AlanGreyjoy and DMeville like this.
  21. toomasio

    toomasio

    Joined:
    Nov 19, 2013
    Posts:
    195
    for some reason my map doesn't go fullscreen when I change the loaded config at runtime.

    It doesn't move to the Fullscreen-RectTransform it seems.

    Edit: yeah thats def the problem...it doesnt change transforms at runtime.

    Edit: nvm...need to do it through a command. woops
     
    Last edited: Jun 25, 2015
    DMeville likes this.
  22. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Hey guys. I had some time to get a headstart on this weekends todo-list. :)
    Check out this fancy gif! http://i.imgur.com/GpdhYEP.gif
    - code is namespaced
    - icons are now rendered with uGUI separately from the map RT.
    - DIRECTION icons!

    Have a bit more work today to deal with fixing icon scaling and rotation but woohoo! :D
     
  23. IndieGameHustle

    IndieGameHustle

    Joined:
    Jul 25, 2012
    Posts:
    65

    Looking good!
    When this asset is updated will I need to redo anything?
    I am starting to integrate it into my project. Should I wait?
     
  24. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    You shouldn't have to. There might be some adjustments you'll need to make to the icon related properties (global scale, setting another texture on the icons if you want to use the direction indicators), but it should be a relatively quick and simple process :)
     
    IndieGameHustle likes this.
  25. CoderPro

    CoderPro

    Joined:
    Feb 21, 2014
    Posts:
    324
    I think if we can covert the mesh of minimap to sprite image, it will be come very good :) But i think its difficult right now :)
     
  26. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    The minimap is already rendered into a sprite - or do you mean instead of having the map geometry in the scene convert that to quads with images of the map? If so, that's something I considered back in version 1 and would still like to do to increase performance for more complex maps.

    There would be a tradeoff though, rendering your map this way instead of with the mesh removes the "vector-like" quality of the minimap.

    It's definitely on the road map :)
     
    Last edited: Jun 26, 2015
  27. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    We now have waypoints! http://i.imgur.com/Dm6BCni.gif :D

    Waypoints are represented in world-space, so you can click on the map and instantiate a gameobject at the spot you click, which is handy if you want to mark that position in your game world too (perhaps with a big beam of light visible from far away, etc)

    Also there is now a way to easily extend the icon behaviour if you wanted to animate the icon with a spritesheet, or flash colours, etc :)
     
  28. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    Really liking the progress on this asset, truly the best minimap system in the asset store at this moment (especially with the upcoming features). Waiting patiently :D
     
  29. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    More updates!
    - Map layer meshes can now have different materials. (new "diagonal" shader included in the demo, useful for showing different regions on the map, rivers, etc, or create your own custom shaders/materials to use!)
    - You can now add different UI elements to the map. This includes text, or other images.

    Looks like I'm on track to have this update submitted before the weekend is up!
    Time to clean everything up, make it all pretty, and create new demos and documentation :)


    Screen Shot 2015-06-26 at 8.50.02 PM.png
     
    cygnusprojects likes this.
  30. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    -= DMMap 2.1=-
    Status: Accepted!


    [Demo 2.1]
    Changes:
    • Configs
      • Configs now have names. You can use these names to load the config by string. DMMap.instance.LoadConfig("Minimap");
      • Configs now have a list of materials "Mesh Layer Material". These materials are assigned to the corresponding map mesh. (map layer 0 will be assigned the material in materials[0]). If no material is found for a layer, the default material is used.
      • Configs have a new float property. "Icon Distance Threshold", which determines the spherical min distance before an icon switches to a directional icon.
    • Rendering
      • Map layers now can have individual materials applied per mesh.
      • Removed DrawMode.Detail. Detailing a map can now be done with additional shape layers and using a different material to colour these details.
      • Added two new shaders for different rendering options: Diagonal and Texture.
    • Icons
      • Icons are now entirely rendered and represented with individual uGUI Images. Now instead of using Texture2D on the DMMapIcon component it now uses Sprites. (you will need to convert your textures to sprites in the inspector otherwise you will get a type-mismatch)
      • Icons can have behaviors added to them easily. (See DMMap/Demo/DemoAssets/IconFlash.cs and the Waypoint.prefab)
      • Icons can have additional UI elements added to them (text, images, etc; See DMMap/Demo/DemoAssets/DMMapIconLabel.cs)
      • Icons now have 3 new additional properties.
        • bool useDirectionIndicator
        • Sprite directionIcon
        • float rotationOffset
        • if useDirectionIndicator is true it does a distance check against the currently loaded configs .distanceThreshold. If this check passes it swaps the icons texture for the direction icon. Rotation offset is to manually adjust the rotation of the icon so that your sprite points in the correct direction (outwards)
    • Misc
      • Waypoints! We can now convert between map-space and world space (and vice versa) with DMMap.instance.UIToWorld() and DMMap.instance.WorldToUI(). There is also a helper function DMMap.instance.CreateWaypoint(), which will check to see if your mouse is overlapping with the map and if it is, places a gameobject (with a DMMap icon) at the clicked world-space position! (See DMMap/Demo/DemoAssets/DMMapWaypointDemo.cs)
      • Code is namespaced to DMM
      • DMMapShape editor has a "Restore Parent Shapes References" button. Clicking this will iterate through all MapPoints in it's verts list and reassign references. This is useful if you are duplicating verts and assigning to the verts list manually.

    Woohoo! :D
     
    Last edited: Jun 29, 2015
    IndieGameHustle likes this.
  31. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    DMMap Version 2.1 was just accepted to the asset store! :) Let me know if anyone has any issues!
     
  32. IndieGameHustle

    IndieGameHustle

    Joined:
    Jul 25, 2012
    Posts:
    65

    Hello,
    With the new update,
    I am getting a error:

    The name `DMMap' does not exist in the current context.

    This is in reference to the script I am using to Tag the Player.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class assignTagDMMap : MonoBehaviour {
    5.  
    6.     // Use this for initialization
    7.     void Awake () {
    8.  
    9.  
    10.         DMMap.instance.configs[0].objectToFocusOn = GameObject.FindWithTag("Player").transform;
    11.  
    12.    
    13.  
    14.    
    15.    
    16.     }
    17.    
    18.     // Update is called once per frame
    19.     void Update () {
    20.    
    21.     }
    22. }
     
  33. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Move your code to Start instead of Awake. Sounds like your code is being executed before DMMap's Awake function is called and DMMap hasn't had a chance to initialize/assign the DMMap.instance variable yet :)

    If that doesn't fix the problem could you please send me the detailed error message? You can get this info by clicking the error in the console and it'll bring up the function callstack and the line the error was thrown at.
     
    Last edited: Jun 30, 2015
  34. IndieGameHustle

    IndieGameHustle

    Joined:
    Jul 25, 2012
    Posts:
    65

    Here is the Error Code:

    Scripts/assignTagDMMap.cs(10,17): error CS0103: The name `DMMap' does not exist in the current context
     
  35. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Oops, I should really test things out and make sure my solutions work before answering :)

    I overlooked the namespacing that I added, and you'll need to add that by adding this to the top of your script so you can access any of the types used by DMMap

    Code (CSharp):
    1. using DMM;

    Perhaps I shouldn't have namespaced the main DMMap class, hmm...
    Thanks for bringing that up, sorry the confusion!
     
    IndieGameHustle likes this.
  36. IndieGameHustle

    IndieGameHustle

    Joined:
    Jul 25, 2012
    Posts:
    65
    No Worries! Thank You!
     
  37. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,084
    Great job on the new version :)
     
    DMeville likes this.
  38. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    I did the upgrade to 2.1 and besides I had to reassign all the icons I'm pleased with it. Going to play with the layers now :p
     
    DMeville likes this.
  39. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    I'm having an issue when using DMMap in combination with Dialogs for Unity. At game startup and before any dialog the minimap looks as expected:
    PreDialog.jpg
    However after the dialog has closed the map is drawn before the frame:
    PostDialog.jpg
    This is the code I use within my dialog presenter:
    Code (CSharp):
    1. public override void Close()
    2. {
    3.     DMMap.instance.gameObject.SetActive(true);
    4.     if (ActionBarHUD != null) ActionBarHUD.SetActive(true);          
    5.          
    6.     base.Close();
    7. }
    It looks like the z-order is different after the DMMap.instance gameobject has been reactivated. Is there a better way to hide the minimap generation without setting the gameobject of the map to disabled?
     
  40. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    @cygnusprojects I can't seem to reproduce this without the package, and it's unfortunately one I do not own. I've opened up the TopDownDemo scene included with the package, and added this code to the DMMapUIControls.cs

    Code (CSharp):
    1.  public bool toggle = false;
    2.     public void Update() {
    3.         if (Input.GetKeyDown(KeyCode.Space)) {
    4.             toggle = !toggle;
    5.             DMMap.instance.gameObject.SetActive(toggle);
    6.         }
    7.     }
    Everything works as expected, no sorting issues! The Dialog system must be doing something regarding sorting (perhaps the DMMap UI images are being reordered in the hierarchy or something)?

    Sorry I can't be of more help.
     
  41. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    766
    After further test and trial efforts I found the source and solution to my problem. My UI is within a different layer called UI, while DMMap is requiring DMMap as layer. Disabling and reenabling DMMap.instance does result into always drawn on top op the UI (as Unity doesn't know how to sort both layers I'm guessing, on startup the top down approach of the transforms seems to be respected until you fiddle with the gameobjects).
    What I did was creating a Map and Icons duplicate of those below the Canvas from the DMMap object and move those to the UI layer and position them with the structure of my UI. Maybe a simple Z value of the DMMap canvas would be the alternate solution but won't test this as it's working now. Have to remember though when upgrade DMMap to adjust the gameobject references. :oops:
     
    DMeville likes this.
  42. IndieGameHustle

    IndieGameHustle

    Joined:
    Jul 25, 2012
    Posts:
    65
    Hello,

    Has anyone tried to apply the Full Screen Map into their setup. Just wondering what would be the best way to apply it.
    The Mini Map works like a charm, just not sure how to use the full screen map.

    To be clear I do have it calling using the "X" Button
    Here my Code:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using DMM;
    4.  
    5. public class callMap : MonoBehaviour {
    6.  
    7.  
    8.     // Use this for initialization
    9.     void Start () {
    10.    
    11.     }
    12.    
    13.     public bool on = false;
    14.    
    15.     void Update()
    16.  
    17.     {
    18.             if(Input.GetButtonDown("Map"))
    19.             on = !on;
    20.  
    21.         if (on)
    22.             DMMap.instance.LoadConfig (1);
    23.         else if (!on)
    24.             DMMap.instance.LoadConfig (0);
    25.  
    26.     }
    27. }
    Think of a JRPG and you have a world map showing the location of major areas, or even the current level you are on.
    Any thoughts?

    thanks!
     
  43. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Both the mini-map and the fullscreen map function the same, they just are using a different set of options set in the configs - loading the config like you've done will work without a problem!
     
  44. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hi @DMeville , I just found a bug:

    If you set DMMap to any layer other than layer 8 (the first User defined layer), the asset won't work.
    Could you please fix this? I can't use layer 8 in my current game unfortunately.
     
  45. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Hi @Eyehawk Although DMMap uses layer 8 by default, I just confirmed that things do work fine with any other layer.

    If you want to use a different custom layer follow these steps:

    1 - Create the custom layer named DMMap on any layer.
    2 - Find the DMMap prefab and set it's layer to "DMMap". Choose "No" when it asks if you want to set the children's layers as well.
    3 - Find the DMMapCamera object (the first child of the prefab) and set this layer to DMMap as well.
    4 - On this same DMMapCamera object, set the "Culling Mask" property on the Camera component to only DMMap
    5 - Make sure all other normal cameras in your game (ie main camera) is set to NOT render this new custom layer (by going to your main camera's culling mask and ensuring the "DMMap" layer is NOT checked)

    After that it should work without any problems :)
     
    Eyehawk likes this.
  46. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Awesome thanks DMeville, for the great help and ultra fast response - this works perfectly :)
     
    DMeville likes this.
  47. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Hey guys, just a dumb question: how do I get the DM Camera to track the player?
     
  48. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Set the objectToFocusOn on the DMMap config to the object you wish to track :)
     
    Eyehawk likes this.
  49. DMeville

    DMeville

    Joined:
    May 5, 2013
    Posts:
    418
    Was notified earlier that lots of the links on the main page were dead from a recent website host change I did. That should all be fixed and working now!
     
  50. Eyehawk

    Eyehawk

    Joined:
    Dec 24, 2012
    Posts:
    288
    Awesome thanks again DMeville ;)