Search Unity

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. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    209
    It is worth mentioning that Aquas water will have infinite water using world space UV mapping soon which will work nicely with MapMagic. The details of the update can be found on the Aquas forum thread.
     
    syscrusher likes this.
  2. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    MicroSplat support out of the box:
     
  3. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    201
    Wow. When do we get this version? :D
     
  4. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    396
    @Wright

    Great news! Thank you for the MicroSplat integration.
     
  5. Dwight_Everhart

    Dwight_Everhart

    Joined:
    May 11, 2014
    Posts:
    123
    Interesting. No, I haven't encountered any problems with grass flickering. Perhaps I just got lucky with the script execution order. Or maybe it's a Unity version thing. I'm using 2018.3.9. Thanks for letting me know!
     
  6. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    I plan to submit it on Monday.
    Edit: done
     
    Last edited: Mar 31, 2019
    mmaclaurin, malkere, Djayp and 2 others like this.
  7. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    68
    First, AWESOME asset :).

    In the Wiki you talk about using flatten to adjust terrain for placing villages (or other objects I suppose). I was wondering if you could add a node that would contain a list of points (x/y) that could be used to locate the villages, instead of the location being generated by the map? Then I could examine the generated terrain, and choose the locations manually but still be able to regenerate and tweak until I get ready to do all of the manual placements.
     
    Wright likes this.
  8. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    68
    One more question, can you provide an example of how you would include rivers in the procedural generated terrain?
     
  9. walter_sung

    walter_sung

    Joined:
    Jun 13, 2016
    Posts:
    7
    I think this is an excellent idea!

    In fact a node that could input a list of coordinates could even be used as points on a path.
    That path could be used to create a mountain ridge or a river if used to adjust terrain height, a track or trail if painting textures, or a fence if used to place objects.
     
  10. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    78
    Hello,Can I create random magic-map at editor/runtime mode by your plugin?Is there a demo for it?Thank you!
     
  11. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    68
    You could maybe even do a line, with an optional curve for the river/mountains/paths too...and then if there were a tolerance type of function you could adjust the path along the line to try to keep it more level, or not.
     
  12. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    78
    I need a native function ^_^.
     
  13. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    209
    lightwaterjohn, walter_sung and Mnlk like this.
  14. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    63
    Sooo hyped I'm flooding the reload button ! Does the VS Pro node works with a Voxeland output ?

    Has anyone tried the Spline tool with the Voxeland output ?
     
  15. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    I like this idea too. Will think of a special Positions Input node.

    Sure. That's what MM is about :) You can try the evaluation version (BTW I will update it to 1.10 once it will be available at the AS).

    No, I have not implemented VS Pro support to Voxeland. Keep in mind that Voxeland is a separate terrain engine, that just uses MM's graph to generate the terrain - and no more than that. So in order to use 3rd party assets (like MegaSplat, MicroSplat, VS Pro and others) they should be integrated with Voxeland, not MapMagic.
     
    Djayp likes this.
  16. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,067
    @RadioactiveXP I use the attached generator to request object positions and use them to place objects in the world. In this though I'm pre-generating the data in a different script, so it's not quite as easy as adding a Vector2 to a list as you're suggesting which would be nice.

    Basically my WorldEncounters are pre-generated to have local positions on the terrain, so if you say GetChunk(5, 5) and there is a tower on x5z5 then it will have a WorldEncounter in the chunk data with a localX and localZ that MapMagic uses to spawn the object.

    This isn't the actual object output, just an object generator, so you then feed it into an object output with say the tower prefab. The EncounterTypes public enum is there so it knows which type of WorldEncounter to be looking for, so the correct type goes to the correct object output.
     

    Attached Files:

  17. Lumos

    Lumos

    Joined:
    Feb 11, 2013
    Posts:
    45
    You might be interested in the plugin I'm working on at the moment. One of the main focus points for me is the ability to specify unique points of interest in the world, which will be ideal for stuff such as settlements (if you've got a fixed amount of them, or if you want to spawn one in some specific part of the map).
     
    RadioactiveXP likes this.
  18. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    287
    updated to 1.10. I had some errors for microsplat but I just commented the code (not usign microsplat) now I have this error:
    Assets\MapMagic\Generators\VegetationStudio\VegetationStudioTile.cs(96,18): error CS1061: 'UnityTerrain' does not contain a definition for 'Terrain' and no accessible extension method 'Terrain' accepting a first argument of type 'UnityTerrain' could be found (are you missing a using directive or an assembly reference?)


    I use VS Pro.

    edit: also I get this error when I pin/unpin the last terrain. (unity 2018.3.10f1) (minor problem but just mentioning it).

    NullReferenceException: Object reference not set to an instance of an object
    MapMagic.MapMagicEditor.OnInspectorGUI () (at Assets/MapMagic/Editor/MapMagicEditor.cs:437)
    UnityEditor.InspectorWindow.DoOnInspectorGUI (System.Boolean rebuildOptimizedGUIBlock, UnityEditor.Editor editor, System.Boolean wasVisible, UnityEngine.Rect& contentRect) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1625)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    edit: Another think I see is that when I use CSO with CTS, the terrains not having the textures resulting not being able to get them for VS Pro and use them in exclude rules etc. Is this how it works? here is what I see on the pinned terrains: https://imgur.com/ZCFpgQe (empty layer, no textures in the inspector, but all textures showing in the terrain)
     
    Last edited: Apr 2, 2019
  19. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    63
    Same problem here, plus I can't see the VS Pro Objects node and just got a thread/alloc problem.

    upload_2019-4-2_17-48-43.png
     
  20. Aress28

    Aress28

    Joined:
    Dec 12, 2015
    Posts:
    77
    Hi i saw there example of Island one page back :) is there way to make like 4 or 5 Islands in map size like x10x10 terains? and rest out of that size is just like underwater ?or only way is make 5 islands (sculpt them) in normal unity terain and use Raw to get 5 islands in size of 10x10 map?
     
  21. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    MapMagic 1.10.1 is available at the Asset Store. Here is what it brings:
    - Vegetation Studio Pro integration: VSPro Objects output and VSPro Maps output. However, it will not work without the latest VS Pro version which I guess will be released soon. Lennart has made changes on his side to MM compatibility too.
    - Out of the box support for MicroSplat with CSO node
    - Background layer link fix in all layered outputs
    - Clear Preview fix (preview had to be disabled twice)
    - Ensure running in main thread fix on objects output
    - Linux editor fix (values change from keyboard)
    - Curve serialization fix
    - Reflection probes exposed in settings
    - Minor graph visual enhancements
    - Spline input/output icons for the 3rd party spline assets

    We have to wait (yep, me too :) )for the new VS Pro.

    What were these errors?

    It's possible, and there are plenty of ways to do that. For example, setting Simple Form wrap mode to Tile will make 100 terrains - one in each tile. Increasing the Scale will make islands bigger, and each will take more then one terrain tile. This way they could be scaled up to 4 islands instead of 100. But if you don't want to have big islands you can mask Simple Form output with Noise instead of scaling, this will remove as much of your islands as you like.
     
    Bartolomeus755 likes this.
  22. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    287
    edit: Another thing I see is that when I use CSO with CTS, the terrains not having the textures resulting not being able to get them for VS Pro and use them in exclude rules etc. Is this how it works? here is what I see on the pinned terrains: https://imgur.com/ZCFpgQe (empty layer, no textures in the inspector, but all textures showing in the terrain)

    can you also check this? is this normal behavior?
     
  23. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    Yes, CTS is using control textures instead of terrain splat maps. It can create the control textures from the terrain, but I don't know if it could work vice versa. Personally, I'm using mask rules instead of terrain textures when working with VS Pro Output node, so I guess the usual VS rules should be changed a bit when working with MM.
     
  24. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    68
  25. yumianhuli1

    yumianhuli1

    Joined:
    Mar 14, 2015
    Posts:
    78
    Hello!where is the runtime api doc?
     
  26. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    68
    When I try to open the .zip file, I have a bunch of errors under each terrain where there are missing quads. Looking at the chart in your post, it is pretty clear, except for what you are hooking the transform up to that would be the water. What is the missing object / prefabs?
     
  27. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Hi, I'm supporting CTS for Procedural Worlds,and dlevel contacted me as well regarding their issue with the missing terrain layers / texture prototypes. From what I can see from the screenshots it looks like MapMagic creates a control texture for the CTS shader directly and bypasses the terrain, which is why there are no terrain layers present in the final terrain, is that correct?

    While that works for rendering the terrain, it creates issues with other assets such as Vegetation Studio which rely on the terrain layers / texture prototypes to be present on the terrain. Would it be possible to make this optional in MapMagic, e.g. have an option somewhere where the user can decide if they have the terrain layers and the terrain splatmap populated by MapMagic when using the custom shader output?

    If that is not possible or difficult to add, could it be a workaround for dlevel to not use the Custom Shader Output node but instead to apply CTS to the resulting terrain manually? I assume that when there is no Custom Shader in use, MapMagic will add the terrain layers & populate the unity terrain data splatmap for the unity terrain shader, and then dlevel could just apply CTS as they would with a manually built terrain which should leave the layers & splatmap intact which then could be picked up by Vegetation Studio or other tools.
     
    SSL7 likes this.
  28. Lumos

    Lumos

    Joined:
    Feb 11, 2013
    Posts:
    45
    I'm getting a couple of MicroSplat errors too: the two additions at the end of
    CustomShaderOutput
    which require MicroSplatTerrain. For some reason I had
    __MICROSPLAT__
    present in my constant definitions (probably a remnant from when I tried and subsequently wiped it recently). @dlevel, do you have the constant defined as well without actually having MicroSplat installed? The field is in Project Settings -> Player -> Scripting Define Symbols.
    Removing the constant fixes the errors.

    Looks like a regular Quad to me. Managed to more or less replicate it by creating a Quad primitive and converting it into a prefab with a X rotation of 90 and scale set to 180 in all three dimensions, although that's overkill. Check the attached image (the very first Noise generator has been turned on in Preview to make the quads stand out). You might need to properly merge overlapping ones into one mesh to make real water look properly, but I wouldn't know for certain.

    Untitled.png
     
    Last edited: Apr 3, 2019
  29. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    Yes, you will have to assign a prefab. It's a gameobject with a quad rotated 90 degrees and scaled up to 300 units. You can find the prefab in the attachment.

    You can look through these pages in Scripting section, they describe the most useful API to create nodes or to control MM object with script. Unfortunately, the complete API reference with the description of all of the members used is not available.

    That's right, with the custom shader output MM creates control textures directly, with no terrain data involved. MM either outputs control textures with CSO, or writes terrain data with the standard textures output. I'm not sure if they could be used both - at least not automatically because they require different data - and terrain layers for textures output.
    Yes, dlevel could use the standard output, and convert terrain data to control textures automatically with CTS once it assigned. I don't know if CTS supports this feature, though.
    The solution that will work is using the VS mask rule instead of the texture rule. It uses the control textures (masks) too, so there is no need to convert control textures to terrain data with CSO or CTS, and then convert them back with VS.
     

    Attached Files:

    PWPeter likes this.
  30. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    Yes, this is the normal mode of operation: when no other tool is involved, CTS uses the splatmap from the unity terrain data object as input for the shader for texture distribution.
    Ah yes of course, I think that might be the best solution because it does not require to remove the CSO node in MapMagic, and going via the terrain data when it is not needed just creates unnecessary bloat (splatmap & Terrain layers).

    @dlevel I think these would be two good solutions you could try, Instead of trying to get the terrain textures as a rule in Vegetation Studio, you could set up a mask rule and use the control textures of MapMagic for input
    Regular VS Masks
    Masks in VS Pro

    The other solution would be to remove the CTS output in MapMagic and then add CTS to the terrain as you would if MapMagic wasn't involved, then you should have the texture layers and the terrain splatmap to access via other tools, but this should not be necessary if you use the first solution.
     
  31. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    287
    Ok thank you guys both! Will try what you suggested and get back to you!
     
  32. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    287
    @Wright @PWPeter So VSPro only has RGBA masks, so I don't think that would work either. contacted Lennart too about it and he doesn't know about control textures. If I'm missing something let me know.

    My other simple solution would be that when Lennart has the updated VSPro that can work with VS output of the new MM I can just mask the areas I want via MM graph
     
    Last edited: Apr 4, 2019
  33. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    Once Lennart will release compatible VSPro everything will fall into a place. VSPro Output node will create masks for you the way shown in this tutorial, so you won't have to worry about texture format.

    If you can't wait for VSPro release to start using it with MM, you can change it yourself. Open VegetationStudioPro\Runtime\VegetationSystemPro\Terrains\UnityTerrain.cs, scroll to line 568, there should be something like
    private Terrain _terrain;
    . Double click on _terrain word, press F2 if you are using Mono or double tap Ctrl-R if you are in Visual Studio, and rename it to
    Terrain
    . It should change 16 references. Then change the whole line 568 to
    Code (CSharp):
    1. [UnityEngine.Serialization.FormerlySerializedAs("_terrain")] public Terrain Terrain;
    This way _terrain field was made public and renamed, and we can use VSPro with MapMagic now.
     
  34. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    287

    awesome thank you. Also what I did now and I see that it works is I spawned a hidden simple MM texture in the same line as my path and I used this as an exclude terrain texture on VS. I don't see much overhead.

    edit: Yeah that worked until a new terrain generated in runtime and screwed everything up haha. will go for the VS pro output.
     
    Last edited: Apr 4, 2019
  35. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    I can't make MapMagic+CTS+EasyRoads to work together, EasyRoads can't draw splatmap under roads when I use CTS profile inside MapMagic. I asked CTS developers about this and they respond like below.

    Can you please take a look why EasyRoads can't draw its splatmap when I use CTS inside Map Magic?
     
    Last edited: Apr 5, 2019
  36. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    I think this is more or the less the same issue that dlevel had: When you use the CTS Output in MapMagic it will create the control textures for the shader directly, rather than going via the terrain splatmap.
    I did not know about this yet when I replied to you over in the CTS thread about this issue, I only learned about this as well when looking into the issue of dlevel.
    What you could try to do is: Don't use the CTS output in MapMagic but rather use the standard output (as if you would use the default unity shader on the terrain), then apply CTS to the terrain manually as you would if MapMagic was not involved.
    Then you should be able to use Easy Roads to alter the terrain data splatmap & have CTS displaying the changes.
     
    ksam2 likes this.
  37. flow-

    flow-

    Joined:
    Apr 19, 2015
    Posts:
    138
    We are happy to announce that we have finished the Terrain in our game with map magic.

    Here is a trailer of our work ( Low Poly ):
     
  38. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,001
    Yes, it works this way. Thank you. Just isn't that bad for performance to have 25 Complete Terrain Shder Script on all my terrain tiles?
     
  39. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    380
    It should not be a problem, the script does not do much during runtime at all unless you would for example switch out CTS profiles during runtime.
    What can be a problem is that through the CTS component the textures are referenced twice: Once in the CTS texture array, once on the terrain and in the CTS profile as individual textures. Therefore the textures will be included twice in the build and you have some extra memory overhead that is not required.
    To combat this you can click the "Disconnect Profile" button in the CTS component, or for all terrains at once with the
    "Disconnect all profiles" menu entry in the window menu.
    Disconnecting the profile will
    -Create a persistent material in the Profiles\Material folder
    -Create persistent copy of the terrain splatmaps in the Profiles\Splatmaps folder
    -Remove references to the CTS profile, normal, color map and cutout mask texture
    -Remove all splatmap prototypes / terrain layers from the terrain
    -Remove all splatmaps from the terrain data object

    At this point CTS is set up as "minimal as possible" without any additional references to textures that are not needed. You can also revert this procedure by connecting the profile again.

    But once the profile has been disconnected CTS also won't recognize anymore if the splatmap on the terrain changes like when Easy Roads makes its texture changes, so I would wait until you are finished with the terrain before you do this. It also can't hurt to backup your project before in case anything goes wrong in the process.

    If you have any more questions let's continue over in the CTS thread so we don't spam the MapMagic thread with CTS stuff.
     
    Wright and ksam2 like this.
  40. daswichtel

    daswichtel

    Joined:
    Jun 7, 2017
    Posts:
    2
    Hi there,

    when i try to save an ImportedRaw.asset Unity is freezing completly.

    I am using Unity 2018.3.11f1
    Is the raw image size limited in any way or is it possible it is taking that long?

    The raw i am using is 8192^2

    regards
    daswichtel
     
  41. RadioactiveXP

    RadioactiveXP

    Joined:
    Nov 6, 2013
    Posts:
    68
    There is a MapMagic Interview-tutorial with messy coder on YouTube that shows you just how to do that; it is definitely worth a watch - it's a ways into the video.
     
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    I'd like to agree with PWPeter: if you are using EasyRoads then I guess you are using pinned (baked) terrains only. In this case the best solution would be using the standard Splat/Textures output, and convert splats to CTS control textures with CTS standard tools.
    I will think about the way to export both splats and control textures at once, however this approach has some disadvantages like significantly increased apply time (more then 2x I guess) and memory usage. But at least it can solve double referencing PWPeter mentioned - as far as I understand splat/textures prototypes don't require the textures to be actually assigned - all that EasyRoad and VS need is splat maps.

    This can happen if you are using text serialization. It tries to write all of 8K image as text. Try switching to binary or mixed in Edit - Project Settings - Editor - Asset Serialization Mode. It will still be rather time-consuming since the file is quite big, but at least will make it possible.
    If you are going to use mixed mode try using this MatrixAsset file instead of MM built-in one.
     
    Nunez-Torrijos and ksam2 like this.
  43. daswichtel

    daswichtel

    Joined:
    Jun 7, 2017
    Posts:
    2
    that did the trick.

    thx
     
  44. PicturesInDark

    PicturesInDark

    Joined:
    Jun 13, 2013
    Posts:
    89
    Hello
    Firstly I love your asset. But sometimes I have a problem, the terrain that is fixed dissapears and I have the error:

    NullReferenceException
    at (wrapper managed-to-native) UnityEngine.Terrain:get_terrainData ()
    at MapMagic.SplatOutput+<Apply>c__Iterator2.MoveNext () [0x00000] in <filename unknown>:0
    at MapMagic.GeneratorsAsset+<Apply>c__Iterator1.MoveNext () [0x00000] in <filename unknown>:0
    at MapMagic.Chunk+<ApplyRoutine>c__Iterator0.MoveNext () [0x00000] in <filename unknown>:0
    at MapMagic.ThreadWorker.CoroutineFn () [0x00000] in <filename unknown>:0
    at MapMagic.ThreadWorker.UpdateApply () [0x00000] in <filename unknown>:0
    at MapMagic.ThreadWorker.Refresh () [0x00000] in <filename unknown>:0
    at MapMagic.MapMagic.Update () [0x00000] in <filename unknown>:0
     
  45. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,605
    Is there any way I could reproduce this issue? From the error code it seems that the terrain data is null, and it's hard to say why it is so. Maybe it was removed somehow?
     
  46. warezzko

    warezzko

    Joined:
    Feb 17, 2014
    Posts:
    2
    Hello
    I need help.
    with VsPro node. It not working It does not work even in a new and empty project. What could be the problem?
     

    Attached Files:

    • scr1.jpg
      scr1.jpg
      File size:
      41.5 KB
      Views:
      118
    • sc3.jpg
      sc3.jpg
      File size:
      44.8 KB
      Views:
      125
    Last edited: Apr 11, 2019
  47. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    287
    1) https://www.dropbox.com/s/mgole104qf4ot9k/VSProObjectsOut.cs?dl=0

    use this, Wright sent it to me I had the same problem
     
    Djayp likes this.
  48. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,067
    If you open the generator code you can see that the code that deals with drawing the GUI is underneath VEGETATION_STUDIO and may need VEGETATION_STUDIO_PRO instead.
     
  49. warezzko

    warezzko

    Joined:
    Feb 17, 2014
    Posts:
    2
    Oh, its work! Thank you
     
    Last edited: Apr 11, 2019
  50. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    972
    I just started using MapMagic and have it working well so far. I bought this tool because it can support Voxeland and I need to make procedural voxel terrain.

    Thanks for this latest update -- I was having the "main thread" error that others had reported as well as some warnings, but after updating just now, the console is clean when I load my test project. :)

    I've got a greatly-simplified prototype of my voxel terrain doing what it's supposed to do (see the screen shot below), but the Preview in Window function from right-clicking the output connector on most of my nodes does not work and gives just an all-black result in the preview. Directly previewing the outputs of my Raw Input and my Noise nodes works as intended, but none of the others do. I understand that the Voxeland output generator is fundamentally different from other nodes, so I would not expect to be able to preview that node's output, but everything that feeds into that final node is still -- I would assume -- a 2D map.

    MM-NodeGraph.jpg MM-Result.jpg

    Is this a bug, or is there some inherent reason why texture nodes feeding into a Voxeland generator have to behave differently? It's a bit of a problem because my project requires a fairly complex procedural node graph with partially-flattened areas, underhangs/caves, and so forth (I've been reviewing the online material for how to create those but haven't attempted it yet in my test project). I'll almost certainly need to preview intermediate nodes to debug my final design.

    Thanks for listening and for any suggestions if I may be doing something wrong.