Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Map Magic World Generator - a node based procedural and infinite game map tool

Discussion in 'Assets and Asset Store' started by Wright, Mar 10, 2016.

  1. shebotnov

    shebotnov

    Joined:
    Jun 3, 2018
    Posts:
    20
    What version of MM does the demo use? It seems to be very old, it doesn't have the contrast nodes nor does it have the preview of maps. What version is the demo?
     
  2. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    687
    Not really...As i don't want to use MM interface to scatter objects... or else...:p
     
  3. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    For MM2 users - the new version (2.0.3) is available at the asset store. It brings:
    - Import node scale and performance fix
    - The experimental right-click menu. It based on the same principles as Shader Graph's Create menu. Some might find it more convenient, and, the more important, it works with Unity 2020 Beta. This feature is enabled in Windows -> MapMagic -> Settings -> enable Experimental Features.

    EDIT: unfortunately modules were not updated. Can't roll it back to the previous version, and it will take some time for modules to being reviewed. This Structs.cs file in MapMagic/Tools should fix the compile errors.

    Just to clarify - are you using the old CTS version, or CTS 2019? These are different assets, and they work a bit different when it comes to integration.

    I'd rather recommend you using MM2. MM1 will be still supported for some time, but I don't plan any new big features here.

    Thanks for reporting this, will look into it!

     
    Last edited: May 14, 2020
    Lars-Steenhoff likes this.
  4. lofwyre

    lofwyre

    Joined:
    Apr 19, 2007
    Posts:
    148
    Hi Denis

    I'm liking mm2 free so far and will probably get the objects plug in next. I have a question though in trying to make islands. You mentioned to use a raw input file earlier in this forum thread, I'm assuming it acts as a mask to lower the edges..?

    upload_2020-5-15_16-15-14.png

    This is my scene there are 9 tiles making up the map.

    How would you add a mask to this so it flattens the edges down to appear like an island?

    Cheers
    Matt
     
  5. taylank

    taylank

    Joined:
    Nov 3, 2012
    Posts:
    170
    The simplest way is to use a simple shape node, a cone, scale it so that the cone covers a 3x3 area, and blend that as a multiplier with your island. Of course you'd end up with a somewhat circular shaped island this way, but you could do the same blend with a raw input of any shape that has feathered edges, so that it smoothly fades to 0 alpha.
     
  6. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    Yep, that's right:
    SimpleIsland.png
     
    EnriquePage91 likes this.
  7. FractalCore

    FractalCore

    Joined:
    May 15, 2009
    Posts:
    146
    I just figured out why the little Add button in the corner of the graph editor had never been showing up for me. I was assuming it was because of the beta version I was trying. But it's still doing it with the full release.

    Turns out, it's because I'm using the Windows 10 display setting that lets you scale the UI of all programs that support it. I've got it set to 125%. At 100% everything is fine, but any higher and the little button flys off the side.
     

    Attached Files:

  8. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    687
    @Wright

    Yes i'm Using MM1 and when i put VsPro on pined terrain i have texturing issues with VSpro.
    I only use MM1 ofr generating terrain not texture it...

    It's like it paints all over the terrain without considering slope ...it's like a "world space" texturing that looks random...don't know how to express it right...
     
  9. julianh65

    julianh65

    Joined:
    Mar 17, 2020
    Posts:
    5

    Hi are there any updates on how to make it work on mac? :)
     
  10. lofwyre

    lofwyre

    Joined:
    Apr 19, 2007
    Posts:
    148
    @Wright and @taylank

    Thanks for the assistance, I hadn't realised the use of blend. I tried adding it but the interface is a bit different now with the first layer being back ground

    this is what I have now.

    upload_2020-5-16_10-56-9.png

    I've tried switching around to have the noise input as the background, adding a second layer to the blend and having on additive and the other multiply, etc, but getting the same results.

    Any thoughts?

    Cheers
    Matt
     
  11. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    Just saying again to some who have missed it: in order to make MM 2.0.3 and MM Objects 2.0.2 compile please use this patch (copy to MapMagic folder). Objects 2.0.3 is currently pending Unity review.

    This patch might fix the Simple Form producing flat terrain issue as well.

    I've tried it on 2 macs, but it seems to be working here. However, I have some idea at least about the colors: could you please try this file (MapMagic/Tools/Extensions) to see if it will make headers colored. As FractalCore said the button isues should be related with the system interface scale, I'm currently working on it and plan to fix for the next update.

    Oddly enough since the terrain created with MapMagic should not differ from the one created manually. I will look into it. A screenshot might come in handy to ensure that I've reproduced it right.

    It might be my fault: could you please try the simple form patch?
     
    Last edited: May 16, 2020
  12. sammi32

    sammi32

    Joined:
    Feb 19, 2014
    Posts:
    16
    Hi,
    I have Map Magic 2 (with the newest Patch)
    Unity 2019.3.9
    CTS 2019 Terrain Shader

    but if i will use the the Node it Comes:


    Draw Graph Window failed: System.InvalidCastException: Specified cast is not valid.
    at MapMagic.Nodes.GUI.CTSEditor.DrawCTS (MapMagic.Nodes.MatrixGenerators.CTSOutput200 gen) [0x00001] in C:\Users\logic\Documents\Unity\MapMagic_Test\Assets\MapMagic\Compatibility\Editor\CTSEditor.cs:35
    at Den.Tools.GUI.Draw.Invoke[T] (System.Delegate action, T obj, System.Object[] args) [0x0001e] in C:\Users\logic\Documents\Unity\MapMagic_Test\Assets\MapMagic\Tools\GUI\Editor\Draw.cs:1312
    at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,System.Delegate,object,object[])
    at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) [0x00035] in <351e49e2a5bf4fd6beabb458ce2255f3>:0

    and the CTS Node are Empty

    please have you any Idea

    by the Way Map Magic 2 is a wonderfull tool , thanks
    best regards
     
  13. dmenefee

    dmenefee

    Joined:
    Oct 14, 2019
    Posts:
    17
    Hi Denis. I'm using the Microsplat support code with URP and noticed the same issue as was reported by shebotnov. My console log has a number of messages complaining about a bad cast:

    Thread failed: System.InvalidCastException: Specified cast is not valid.
    at MapMagic.Nodes.MatrixGenerators.MicroSplatOutput200.Finalize (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x000f7] in /Users/dave/Documents/Unity/Projects/Tales from the Living Earth - MM2+URP/Assets/MapMagic/Compatibility/Runtime/MicroSplatOutput.cs:53
    at MapMagic.Nodes.Graph.Finalize (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00088] in /Users/dave/Documents/Unity/Projects/Tales from the Living Earth - MM2+URP/Assets/MapMagic/Nodes/Graph.cs:805
    at MapMagic.Terrains.TerrainTile.Generate (MapMagic.Nodes.Graph graph, MapMagic.Terrains.TerrainTile tile, MapMagic.Terrains.TerrainTile+DetailLevel det, MapMagic.Products.StopToken stop) [0x0007c] in /Users/dave/Documents/Unity/Projects/Tales from the Living Earth - MM2+URP/Assets/MapMagic/Terrains/TerrainTile.cs:665
    at MapMagic.Terrains.TerrainTile+<>c__DisplayClass38_1.<StopEnqueueTask>b__0 () [0x00000] in /Users/dave/Documents/Unity/Projects/Tales from the Living Earth - MM2+URP/Assets/MapMagic/Terrains/TerrainTile.cs:617
    at Den.Tools.Tasks.ThreadManager.TaskThreadAction (Den.Tools.Tasks.ThreadManager+Task task) [0x00002] in /Users/dave/Documents/Unity/Projects/Tales from the Living Earth - MM2+URP/Assets/MapMagic/Tools/ThreadManager/ThreadManager.cs:125
    UnityEngine.Debug:LogError(Object)
    Den.Tools.Tasks.ThreadManager:TaskThreadAction(Task) (at Assets/MapMagic/Tools/ThreadManager/ThreadManager.cs:128)
    System.Threading.ThreadHelper:ThreadStart()

    I suspect that this is the culprit... Attaching a screenshot.
    Screen Shot 2020-05-16 at 12.07.56 PM.png
     
  14. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    42
    Thanks so much!
     
  15. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    687
    upload_2020-5-16_23-30-17.png upload_2020-5-16_23-30-17.png upload_2020-5-16_23-31-6.png upload_2020-5-16_23-30-17.png upload_2020-5-16_23-31-6.png upload_2020-5-16_23-32-24.png
    thx in advance
     
  16. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    687
    the vspro heatmap looks good though....?! but the texturing is not
    upload_2020-5-16_23-35-57.png
     
  17. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    42
    Hey Dennis,

    I'm working in HDRP:

    The MM2 "Pin New Tile" and "Unpin" buttondon't seem to be working in HDRP. I create a new MM2 object, then create a MM2 graph, then create a "Constant"-node in the graph. I now have a flat terrain. Then I click "Pin New Tile" and it doesn't work. If I want to "Unpin" the tile that I already have, it just selects the terrain instead of unpinning it.
    It's as if the Unpin button wasn't even pressed and I'm just selecting the terrain (although Unpin button is highlighted as "active" in the inspector after I click on it). Same for the Pin button.

    Also, in HDRP, I often get the problem that my changes to graphs aren't updating. For instance if I add an Object-Node and put a prefab in there, the object doesn't show on my terrain. The only way I can get to make it work is when I delete my current Map Magic terrain, create a new one with the old map magic graph and then the object is shown on the terrain and it works correctly for a short while. Then the problem happens again.
    Same goes for other nodes. For instance, in the Adjust node if I want to adjust the height of an object that I have previously added, it doesn't update the height. Nothing happens in the scene. I have to recreate the Map Magic terrain and add the Map Magic graph to it again for it to work momentarily.
     
    Last edited: May 18, 2020
  18. Morgrhim

    Morgrhim

    Joined:
    Jun 19, 2015
    Posts:
    8
    Just purchased... well all of MM2 and its modules. I'm having a slight issue with Objects, as seen in the attached thumbnail.

    This is with Windows 10, Unity 2019.3.13f1, MapMagic 2 2.0.3, and MapMagic 2 Objects 2.0.2.

    I can fix the conversion, Just wondering if maybe I need to apply a patch, my searching and going back to the release announcement didn't turn up anything, and didn't want others to run into this if it's an actual issue.

    EDIT: So I'm digging into this further, I see these conversions already exist in the Vector2D, so I'm not sure why I'm seeing this.

    EDIT 2: It appears this was related to the conversions being explicit. By making them implicit and fixing up some ambiguous math that caused, everything is fine now, at least on the surface. I'm making some test graphs now.

    Final Edit: And.. I just found the Gitlab, where I see an issue for this and what caused it. For anyone else who may run into this before Objects 2.0.3 is approved and on the store, The following link contains a fix from Denis and explains why this is happening:

    https://gitlab.com/denispahunov/mapmagic/-/issues/328#note_343077702
     

    Attached Files:

    Last edited: May 18, 2020
    Wright likes this.
  19. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,556
    D
    Doesn't work here either, and there is no button to generate a grid like their was in MM1. It was working for a while, but just stopped. When it does work, it doesn't work properly if you move the base mapmagic gameobject.

    Generate graph buttons stop working, on MapMagicObject script and in graph. Maybe it's having multiple MapMagicObject scripts that causes some issues.

    If we have to delete other MMObjects to create another, then the settings should be moved to a scriptableobject or into the graph.

    EDIT: I moved the MapMagic folder to Assets/MapMagic and I can pin terrains again.

    This is in built-in renderer.
     
    Last edited: May 19, 2020
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    Note that to see the terrain tiles grid, as well as pin or unpin tiles you've got to have gizmos enabled in the scene view. Could you please make sure you've got the Gizmos checkbutton pressed in the scene view window?

    Sounds like a generate error, but wondering why it goes on working after re-creating MapMagic. Is there any error in the console when it's stuck? Is pressing the Generate button of MapMagic object has any effect?

    What is your MapMagic version (MapMagic object -> About)? This should be fixed for 2.0.3, but I might have missed something. If you use 2.0.2 I'd rather recommend you hold off the update - 2.0.4 is coming soon.

    I've fixed this issue for 2.0.4, but thanks for letting me know about it anyways!

    Still it's not clear what's wrong with the texturing. It might be not textured right, according to the graph? Maybe the graph screenshot can clarify it, could you please post it here?
     
    Last edited: May 19, 2020
  21. eaque

    eaque

    Joined:
    Aug 20, 2014
    Posts:
    687
    if you mean MM1 texture graph, i don't have any ...That was my main question, do i need one?
    I only use vspro template i will send a pic of it
    thx
     
  22. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    Yes, I'd rather recommend you using texturing with MM. You can use the slope node for adding cliff texture on the inclined surfaces, and a texture output with 2 layers.
     
  23. holdingjason

    holdingjason

    Joined:
    Nov 14, 2012
    Posts:
    103
    In MM2 do you have any different way to handle manual modifications to terrain, I know this is an issue that was unsupported in MM. So if we made a change to one of the terrains there was no way to "preserve" that change if we modified the other options. Was thinking perhaps with the biomes option there would be a way to mask out an area so that we could then modify that but my guess is when the terrain is regenerated it would wipe that. So currently in MM we use MM to generate the terrain tiles, modify the ones we wanted, then keep MM from generating them again which meant having to turn off MM or use the pin function. This ended up with a lot of persistent terrain objects, if that makes sense since we had a lot of custom areas that we wanted to do specific things at.
     
  24. dajnooo

    dajnooo

    Joined:
    Feb 22, 2019
    Posts:
    10
    Does Map Magic work with World Streamer looped worlds?
     
  25. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    42
    Hmm my MapMagic folder is already in Assets/ but I can't pin or unpin terrains (in HDRP).

    Yes I have enabled Gizmos but I still can't pin/unpin terrains in HDRP. I remember that it worked in Legacy Pipeline (with MM2).

    I've found out why it won't update after a while:
    The "Duplicate" button has a bug. When I create the following graph: Scatter > Adjust > Object,
    and then I plug a prefab into the "Object"-node and then I select all three nodes and duplicate them, I get an error in the console that says that a key is already present. So I'm assuming this happens because the same prefab is present in two object nodes (the original object node and the duplicated object node). After that error, MM2 stops working and I have to create a new MM-Object for my graph to work again.

    The workaround is to only duplicate empty Object-nodes. Then the error doesn't appear.

    Thanks for the help!
     
    Last edited: May 24, 2020
  26. nerdax

    nerdax

    Joined:
    Dec 27, 2018
    Posts:
    2
    Hi Wright! I have been enjoying MM2's speed and responsiveness. I am wondering if you can help me with a grass issue I am having. My grasses seem to be leaning over and skewed, rather than straight up as they should be. The grasses are added as an unlit object in the grass node. In the attached image, I have dragged a prefab of the same grass onto the terrain, and show that it is behaving normally, compared to its friends which are being applied through the MM2 Grasses node. Any ideas?

    MM_Grasses.png
     
  27. ChezDoodles

    ChezDoodles

    Joined:
    Sep 13, 2007
    Posts:
    98

    I have the same problem, both in legacy and hdrp. Creating a new project, importing only MM2. Cant see the terrain grid, nor can I pin/unpin. Have all Gizmos enabled, using Unity 2019.3.14 and MM2 1.0.4 with all three extensions.
     
  28. ChezDoodles

    ChezDoodles

    Joined:
    Sep 13, 2007
    Posts:
    98
    yeah, looped worlds would be a great feature.
     
  29. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    You might be talking about the locks:


    I have not looked into World Streamer compatibility, but pinned terrains for MapMagic are nothing more than the regular Unity terrains. Don't know if WS requires tiled terrain or creates transition itself - in last case it might work with MM.

    Oddly enough - just checked it working in HDRP for me. Maybe there's something else in settings prevents it from showing? Could you please try resetting the GUI layout?

    Even more odd - just tried duplicating Objects Output this way, everything seems to be working. If it's not too much trouble - could you please email me the graph, the prefab and these instructions on how to reproduce this?

    Seems to be the way grass wind works in Unity. Try resetting wind speed/bending/size in Trees, Details and Grass properties.
     
    runningbird and nerdax like this.
  30. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    Hi, this is a really awesome tool! I'll most likely be purchasing the paid addons, if only to support you, as the free tool is amazing by itself and worth $$. Quick question, is there the ability, or plans to add the ability, to generate the Terrain in Awake or Start? I am managing all terrains myself (actually, I have my own product on the Asset Store and am working on making it compatible with your tool), so basically all I am doing to create the terrains is to create the MapMagicObj in the scene, call TerrainTile.Construct, set the coords of the tile, then call StartGenerate.

    This works great, however it would be beneficial for compatibility reasons to have an alternative method to do a sort of single frame generation, which could be used in either Awake or Start (using it in Awake and then having access to the generated terrains in Start would work fine too). I understand that it wouldn't be very performant, but that's okay for my use case.

    Really it's not a big deal to have this feature, so mainly I'm wondering whether if it's possible to do this with the current code base?

    Edit: A second question. Is it possible to have the terrain game objects completely inactive for the entirety of the generation? Or is it necessary for them to be in an active state?

    Edit 2 (Apologies): I seem to be having an issue with textures not aligning properly:
    texture_alignment_issue.png

    This is using the Demo Simple Graph and the standard Unity Terrain shader, so no third party texturing tools. I thought perhaps it is an issue with my TerrainTile generation, since I am not using the automatic creation feature, however when pinning terrain tiles in the editor I see this issue as well, and I assume welding should be done properly there? If it is some kind of issue with my manual terrain generation, is there any way to force welding of the textures?

    Thanks x 100000!
     
    Last edited: May 27, 2020
  31. nnurgle

    nnurgle

    Joined:
    Nov 22, 2014
    Posts:
    12
    Hi, I've been using Map Magic for years and decided to upgrade. Unfortunately, using MM 2.04 with all MM2 packages (splines, objects, biomes) and Unity 2020.1.0b9 on a MacBook Pro I get the following compile errors.

    Screen Shot 2020-05-26 at 10.39.01 PM.png

    Using latest Unity 2019 LTS and MM 2.04 without any other packages I cannot view any of the graphs with the demo files. I get the errors in the second image.

    Screen Shot 2020-05-26 at 10.15.15 PM.png

    Sorry If I missed a post with a fix, I searched but could not find anything. I even tried using the 2.03 compile patch listed above with no luck.
     
  32. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    So you need to stop executing everything unless MapMagic is generated? You can stop current thread and wait for MapMagic to generate (spinlock), however I don't think it's an elegant solution. The player will just see the old-style static picture while generating, with no loading gauge moving, menu called, etc. Instead I'd rather recommend making a scene initialization switch (static bool, for example) - while disabled the player will see the loading screen, with no controls, sounds, etc. enabled.

    It's not necessary, but if I get you right the player should see only the skybox while generating? Is that is what you mean?

    You can hide the seams by increasing the main tile margins. However I can't find such an issue in a pure demo scene at first glance, could you please hint it's coordinates?

    Unfortunately I can't maintain the compatibility with all the Beta releases. MM2 works fine with 2020.1.0b7, but it seems that they changed something in 2020.1.0b9. Probably it was not intentional, because judging by the error code they might broke many user projects.
    This issue may also occur when copying MM2 version designed for 2018 to 2020. If so, try downloading it from the Asset Store instead - it will automatically select the proper version.

    Can't find any information about LTS of 2019. What is the version exactly?
     
    protopop likes this.
  33. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    I agree, it is not a very elegant solution and I would agree that displaying a loading screen and performing the generation of the terrain over time is best. I think it's best that I explain my particular use case. While I likely use Map Magic in personal projects, my current aim is to provide compatibility between it and my Asset Store product (Terrain Slicing & Dynamic Loading Kit). In my product, I offer users the option to use different ways of loading objects into the scene. Typically this revolves around loading assets from the project, either prefabs, scenes, or Asset Bundles, but I would like to add the ability to load terrains created via your Map Magic software (assuming they have your software installed of course).

    It's working wonderful, however my product has the option for existing loaders to load the objects in a single frame. It's not a particularly great feature, and I do recommend to my own users to not make use of this feature but instead make use of the gradual load operations and put up a loading screen like you suggested yourself, however it can be useful for testing purposes.

    So yes, basically I was just looking for a way to run the generation process on the main thread and have it be a blocking operation, so that it can be executed in either Awake or Start when all the other components in the scene have their Awake and Start method called. I'll look into your idea about spinlock, but honestly this was just a curiosity on my part. If it is not possible than it is no big deal.

    Yes, basically that's it. I want to leave the game object that the terrain is attached to in a deactivated state while the generation is working. Is it possible, or does the game object need to be activated for some reason? It seems like your code reactivates it after I deactivate it, but I can't figure out why. This is mainly about compatibility with my Asset Store product, as I try to keep everything deactivated until the objects (in this case the terrain) are in a correct visual state to be presented to the user.

    Edit: I just tested parenting the tiles to a deactivated game object while they are generating and it seems to work well enough. I set their parent to null after generation so they actually become activated. Do you see any issues with doing things this way?

    Tile 0,0 and Tile -1,0 (I disabled drawing grass to see the issue). I am on standard non render pipeline Unity 2019.3.7f1 if that matters.
     
    Last edited: May 28, 2020
  34. DougieJones

    DougieJones

    Joined:
    Aug 15, 2018
    Posts:
    10
    Thank you Denis, I had the same problem! :D
     
  35. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    42
    Getting this error when creating the CTS output node in HDRP:


    "Draw Graph Window failed: System.InvalidCastException: Specified cast is not valid.
    at MapMagic.Nodes.GUI.CTSEditor.DrawCTS (MapMagic.Nodes.MatrixGenerators.CTSOutput200 gen) [0x00001] in D:\crso\Assets\MapMagic\Compatibility\Editor\CTSEditor.cs:35
    at Den.Tools.GUI.Draw.Invoke[T] (System.Delegate action, T obj, System.Object[] args) [0x0001e] in D:\crso\Assets\MapMagic\Tools\GUI\Editor\Draw.cs:1312
    at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,System.Delegate,object,object[])
    at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3] (System.Runtime.CompilerServices.CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) [0x00035] in <351e49e2a5bf4fd6beabb458ce2255f3>:0
    at (wrapper delegate-invoke) System.Action`5[System.Runtime.CompilerServices.CallSite,System.Type,System.Delegate,System.Object,System.Object[]].invoke_void_T1_T2_T3_T4_T5(System.Runtime.CompilerServices.CallSite,System.Type,System.Delegate,object,object[])
    at (wrapper dynamic-method) System.Object.CallSite.Target(System.Runtime.CompilerServices.Closure,System.Runtime.CompilerServices.CallSite,System.Type,System.Delegate,object,object[])
    at Den.Tools.GUI.Draw.Editor (System.Object obj, System.Object[] args, System.String cat) [0x000bf] in D:\crso\Assets\MapMagic\Tools\GUI\Editor\Draw.cs:1301
    at MapMagic.Nodes.GUI.GeneratorDraw.DrawGenerator (MapMagic.Nodes.Generator gen, MapMagic.Nodes.Graph graph, System.Boolean selected) [0x00195] in D:\crso\Assets\MapMagic\Nodes\Editor\GeneratorDraw.cs:85
    at MapMagic.Nodes.GUI.GraphWindow.DrawGraph () [0x00367] in D:\crso\Assets\MapMagic\Nodes\Editor\GraphWindow.cs:276 "

    I have applied added CTS to Terrain and applied a CTS profile.
     
  36. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    42
    How can I avoid intersections between objects in MM2? I realized that the Subtract node and the Blob node aren't there anymore. For instance if I don't want a rock to intersect with a tree.
     
  37. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,402
    Ate there any general tips for optimizing mapmagic 1? Sometimes I'm getting crashes onnearlier mobile devices during new terrain generation. Does turning off multi threading help? What does that do exactly?

    8C3C044E-DBE4-4EB5-8A73-417F36BD79E4.jpeg
     
  38. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    27
    Hi @Wright, first of all, thanks for the new release!! I was a fan of MM1, and I can't wait to try MM2. I just bought the objects, splines and biomes modules, I've been waiting for this release for months.
     
  39. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,402
    I added a button in my game (now in the debug hidden screen) that turns the MapMagoc multithreading on and off, which yo can do at runtime, which is cool. It was really apparent how it works when I saw it in action. When its off, the game freezes up completely as it generates terrain, with multithreading on it is more or less smooth with some hiccups, so I buried the toggle for my own testing and will leave multithreading on.

    Now I'm thinking what do the number of thread mean? I have it set on auto but how many threads doe a phone or iPad or android device have? Is it basically one thread per cpu?

    So maybe I should try setting the max number of threads to 2 to put less pressure on the system, im guessing at the price of a lower generation speed?

    And Max Apply time is 15 - if I raise this might that put less pressure on the generation too? What is the trade off?
     
  40. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,402
    Ive ended up making sliders to set max apply time from 1 to 45 and max threads from 1 - 12 (I have no idea how many threads iOS can have but I read somewhere 64?). Im going to test it all out and see if I can figure out what affects what how.
     
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    This looks like the one I had already fixed. What is your MM version number?

    Have a look at the Rarefy Node. Seems to be exactly what you are looking for.

    Thanks, glad to hear that!

    When multithreading is off MM generates terrain in main thread, stopping the gameplay and waiting for generate to finish. When it's on it generates terrain in a background thread, and then just applies the generated result in main.

    And even applying in main thread, MM tries not to stop the gameplay - it splits apply in several frames. Kind of coroutine. The more the frames - the longer apply takes, but the overall framerate is smoother. Max Apply Time determines how long MM will apply in current frame, in milliseconds. When this timer is reached MM will yield and proceed applying in next frame.

    When number of threads is set to Auto, MM thread pool relies on SystemInfo.processorCount, and won't start the thread if active threads count is more or equal to SystemInfo.processorCount-1 (one is reserved to give a green light to main thread). This is made to maintain the chunks queue as close as possible and generate closest chunks first (and in MM2 - closest drafts first, then other drafts, closest main tiles, other tiles). Setting the threads count to 100 will start all of the threads at once. It might be a bit faster (since the main thread will be used), but can create some lag (for the same reason), and will hardly maintain the chunk generate order (even with thread priorities). All chunks might be generated faster, but the chunks you need might be generated even slower - after one or several distant ones.
     
    bok and protopop like this.
  42. shi946

    shi946

    Joined:
    Jun 3, 2019
    Posts:
    11
    Is the original MapMagic compatible with Vegetation Studio 1.2+ on 2018.2.21? When I try to create grass following this video (
    ), nothing appears. I have splatmaps instead of terrain "textures" since I'm using 2018.2.21.

    Edit: On 2018.3.11, following the steps exactly, even using the same prefabs, grass shows but not the trees. Am confused :(

    Edit 2: Nevermind, figured out a workaround.
     
    Last edited: Jun 3, 2020
  43. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    shi946, glad you could sort that out! It would be great if you could share what caused the problem and how you solved it just in case someone else will run into this issue. And it might be that I've got to do something on my side.
     
  44. iserb1

    iserb1

    Joined:
    Jun 3, 2018
    Posts:
    2
    Dear Wright,
    Can you tell me if it is possible to generate objects using MM1 "outside" Terrain object? So that generated objects will be in some other object, or outside any objects?
     
  45. shi946

    shi946

    Joined:
    Jun 3, 2019
    Posts:
    11
    @Wright I actually coded my own runtime terrain grass/tree removal and shaders (which was the reason I was trying to use Vegetation Studio). So still not sure on how to use Vegetation Studio with MapMagic. Thanks for the reply.
     
  46. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    Unfortunately there is no way to do it. While generating the tile, MapMagic cannot place the object on the other tile. You might try using the custom generator, but I'm absolutely sure you'll get out of range exception when trying to process the generated result in other node.
     
  47. iserb1

    iserb1

    Joined:
    Jun 3, 2018
    Posts:
    2
    I think you did not understand me. I do not need to place objects on other tiles, i just need to instanciate them outside any hierarhy, so they will appear not nested in terrain object.
    As i checked code, i need to set parent of new object to null
     
  48. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,402
    I added a slider to control the amount of threads used in my game for map magic just on a hidden debug screen. I ran a test and put it up to 8 threads on an iPhone XS and I can see how it works. Basically the more thread the less it jumps at all, and with 8 threads it pretty much only pauses for a split second to create a terrain. Ill leave it at 3 to be safe but its neat to see how it works so now I understand it.
     
  49. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,402
    MapMagic 1 generates my terrains marked static batching, occlusion static etc all checked. Can I make it generate terrains that have nixing static checked?

    And im wondering if I am pooling terrains in an infinite world should I not mark the terrains static since they are reused and moved? Im thinking it puts more stress on the system to move a static marked object but I don't know for sure.

    EZFItAsWkAA5D3o.jpg
     
  50. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,822
    That's right, this way they won't have any parent at all and will be instantiated on a top level. However objects locks will not work this way, and possibly something else can go wrong, so be sure you've tested it carefully.

    It should not really matter whether the static flag is set or not in infinite terrain, because setting any flag in build is ignored:
    Manual.
    However I have not checked it myself, so it might really play a huge role in the performance if you have lots of objects.
     
unityunity