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

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Hi All, a couple of questions. Can someone explain what the Texture Input node is used for. Can it be used as a height map or mask? There is no mention of it in either the manual or on the wiki and I can't make it work as either of those. Perhaps its not the intended purpose or I'm missing something obvious. Or does the data need to be in a particular channel - alpha?

    Also no mention of Biomes in either the manual or on the wiki. I'm assuming from the lack of Input port that these have to be totally self contained when it comes to height maps? Would a height map input port be useful? For example I'm trying to apply the Badlands graph (without height map) to existing terrain which I mask out of a much larger raw input.

    Does having to repeat the same raw input nodes in the Biome add to project or scene size, or are they only referenced?

    Cheers

    Chris
     
    Last edited: Aug 14, 2018
  2. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Hi all,

    I'm trying to place buildings for a village but they are on uneven terrain so are above or below terrain in places. I looked at flatten nodes which I thought would work but the explanation on the wiki does not show how to setup with buildings.

    The nodes do not connect with objects (which I thought you would use for building prefabs) and flatten does not appear to work.

    Any advice welcome, been struggling to place for a day now.
     
  3. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    Have you had a look at the village tutorial, it uses the flatten node:
    https://gitlab.com/denispahunov/mapmagic/wikis/Creating Villages with MapMagic
     
    AndyNeoman likes this.
  4. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938

    Thanks for that. I really only want to place specific items and it seems a bit convoluted. Is this really the best way to place a building and flatten the area around it?

    Got some results so its worth me continuing to play around it. Thanks for the tip. I always seem to struggle with this asset even though I know it is really good. :)

    If anyone knows how to just do it once rather than multiple villages Id really appreciate it.
     
    Last edited: Aug 14, 2018
  5. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    The problem is the placement. If you don't use MapMagic to place them it doesn't know where to flatten. I actually have a custom generator that just calls a separate script to ask for placement locations. It doesn't actually have to be separate it could just be in the generator, but that way you can specify locations, for example just 1 or 2 buildings right where you want them, instead of going procedural. Once you have a map position (a green node) you can feed it into a flatten node, which then you can blend back into your height output. I attached a simplified version of such an object generator.
     

    Attached Files:

    blacksun666 likes this.
  6. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    With Relative Height turned off it will spawn objects at the zero level. To raise it to the desired height you can store this object elevated inside a prefab.

    Are you using CTS/RTP/MegaSplat?

    Yes, it could be used for the mask - however I don't recommend using it for the heightmap to avoid "stairs" effect - textures have only 8 bits per pixel (thus only 256 possible height levels).
    You can choose what channel to use in the node, it doesn't have to be alpha channel only.

    Actually you need only one node - Flatten - for that:
    FlattenHouses.png
     
    AndyNeoman, secondsight_ and camta005 like this.
  7. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Sorry, I must be missing something. Where do I choose the channel in the node?

    Node.png

    Cheers Chris
     
  8. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Oops, I was looking on the MM2 Texture Input node, sorry. This one use the average value of all 4 channels.
     
  9. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I have a problem where I am placing and controlling my own objects on terrain, saving and loading player built buildings, dropped items, things like this that MapMagic is not aware of. I can't use the callbacks because MapMagic doesn't send a callback for disabling of a terrain. I was just using OnEnable OnDisable with 98% success, but upgrading to Unity 2018.2.2 and having to change some of my scripts up it's causing problems again.

    Right now I'm using the foreach loop in MapMagic.Update()
    1. Just before chunk.worker.Start() is called I make sure all the data for the chunk is generated.
    2. Then before the disabling after that, if the terrain is currently active, I save and clear it before MM disables it.
    3. And enabling after that I LoadTerrain before MM enables it, only if currently inactive.
    4. I also have to save and clear on Chunk.OnRemove() because it uses DestroyImmediate

    But I still seem to be missing a possible scenario somewhere. Sometimes a terrain loads with MM generated textures and height properly, but it doesn't have any MM generated items on it, suggesting I'm improperly calling save/clear sometimes. Sometimes a terrain loads encounter (big towers and things) but the previous terrain (prior to MM recycling it) have not been manually cleared and there are floating towers and resources all over.

    Can you think of what I'm missing @Wright or a better/surefire way to go about this? Thank you
     
  10. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
  11. AndyNeoman

    AndyNeoman

    Joined:
    Sep 28, 2014
    Posts:
    938
    Thanks Denis, This works great for multiple buildings but what if I just want to place one? I want to place my main buildings, I.E Castle, and just have one of those.

    I'm also getting a strange error with RTP node. I have setup to have textures on slope for cliffs but unity is throwing an error

    Graphics.CopyTexture can only copy between same texture format groups (d3d11 base formats: src=27 dst=1)

    And terrain is not changing textures just have on texture covering whole terrain. See pic below. I would expect to see grass and sand with rock/dirt on slopes with this node setup.

    EDIT
    Also getting this error

    dynamic_array: assign data may not be data from the dynamic_array itself.
    UnityEngine.Material:CopyPropertiesFromMaterial(Material)
    MapMagic.CustomShaderOutput:UpdateCustomShaderMaterials() (at Assets/MapMagic/Generators/CustomShaderOutput.cs:955)
    MapMagic.MapMagicEditor:OnDeselectedSceneGUI(Transform, GizmoType) (at Assets/MapMagic/Editor/MapMagicEditor.cs:43)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    EDIT
    @Wright An extra note to these issues. I have started a clean project and imported RTP and Map magic and in this the terrain textures are working as expected. Something must have happened in the shader compile or nodes, Is there a way to refresh everything to hopefully remove this bug/error? Maybe the generators asset is corrupted somehow.

    EDIT
    I've reset lots of times and the issue seems to be to do with the shore node. If I change the sea height all goes back correct. However enabling the auto update on RTP corrupts to single texture again.

    I can at least progress like this to we get to the problem but on another note, is there a way to play wall around the terrain using map magic? I've creating a walled city and would like this to be automated if possible. Sorry for the long post and edits.....
     

    Attached Files:

    Last edited: Aug 16, 2018
  12. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    I have some bugs in 2018.1.6:
    • Preview on terrains don't work.
    • Textures don't seem to layer properly. My 2nd layer has to be a very high opacity to show, and 3 or more textures don't layer together and seem to affect the colour of the others.
     
  13. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    191
    Is there anything new about Horizont Preview Terrains? unfortunately MapMagic is not very advantageous for a game that allows you to fly into the air without Horizont Meshes.
    Would be nice to generate low resolution terrain at a high distance so that the horizon doesn't end so abruptly
     
  14. Nunez-Torrijos

    Nunez-Torrijos

    Joined:
    Mar 3, 2016
    Posts:
    33
    I'm having some alerts in the CustomSerialization.cs file.
    Apparently in 2018.2.4 Keyframes of Animation Curves are treated differently. The tangent mode changed. Apparently it is not absolute, it's relative to their left or right side and for each side it has getters and setters. MapMagic is currently treating it in a way that got deprecated.
    I'm using the latest version of MapMagic (v.1.9.2).
    The problem is in the line 261 and 446.
     
  15. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Theoretically OnDisable should work fine and it is exactly what you need - it's called when the object is disabled, any object in all cases. Just wonder what are 2% cases when it fails. If you could be more specific on those cases I could try helping you to find why it doesn't work as expected. Anyways using OnDisable seems to be much more convenient and reliable than changing MM code.

    If you are using one object per game than maybe it's better to lock the terrain where it's placed and edit it manually?

    Seems to be some RTP stuff, but guess it's worth trying to check if all of the textures have the same format. Try using uncompressed textures for the test purpose and enabling read/write (just in case, for test purpose too).

    Haven't seen this before, and couldn't google it at first glance. Might be something related with previous one. Let's try to fix the error above and see if all of the other issues vanish.

    I have not made MM compatible with MicroSplat yet. Although some users claim it works fine, I cannot guarantee it working with no issues.

    Are you clicking the blue circle, not the generator itself? What happens after the click?

    Could you make a screenshot of your graph with the terrain result generated?

    They are still planned for MM2 and work fine in beta.
    BTW you can use increased generate range with higher pixel error value. Unity will optimize the far terrains nicely, and except generate time this effect will be about the same.
     
  16. magicbananna

    magicbananna

    Joined:
    May 9, 2013
    Posts:
    22
    I need help ok so im looking for a way to add navmesh to the terrains and also occlusion to each terrain without having to do each on via pinning
     
  17. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,913
    Edit: I will post a screenshot tomorrow.
     
    Last edited: Aug 20, 2018
  18. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I think the problem arises when I teleport which is something that happens a lot in my game. The player is moved to say 50km North, and the game then waits for MapMagic to shift, and spawn the new terrains. In these cases depending on where the player was/is, sometimes terrains are removed with DestroyImmedite(). This then doesn't call the OnDisable() and any inventory/building changes the player may have made are lost. The way I moved things around does seem to be working. I haven't received any reports of lost data since I changed it. Mostly just Unity 2018 problems =[
     
  19. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Dialog.png
    Hi, I need some help with getting Texture Inputs as a mask to work. It's been a frustrating day reading this thread to try and find answers, trying a lot of combinations (DX1, DX5), and there is no documentation.

    The current attempt is a PSD file in my project, 4096, no alpha RGB (does it need to be sRGB or RGBa or RGB - does it need an alpha?). Shows up fine in my project as a max 2048 texture which I change in the Inspector to max 4096 to match my raw input. No other changes.

    As you can see I load it into the Texture Input node and it shows a preview. The settings are the same as the Raw Input node, which works fine. But it does not seem to show on the terrain. Preview on terrain just covers the whole area in red, no mask. View preview just shows a black screen (and a texture size of 1024).

    Any help would be appreciated. Looking forward to MM2 and a mask per channel Texture Input.

    Cheers

    Chris
     
  20. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    I know this is an old post (still reading through the thread in its entirety) but this is an issue I'm facing. I have a large raw input that covers the area of my world, I have masks for a number of Biomes in that area. In the Biomes, I can add the textures, add noise and voronoi onto the external terrain but I can't manipulate the terrain with terraces or shore without doing it externally or bringing the height map into the Biome.
    If this is a conscious design choice, fine, I can live with it, although in terms of keeping the graph clean it makes things a little complicated. But if this is an edge case that hasn't been considered, would it be possible to add an optional height input port into the Biome, or have a portal in the Biome that you could connect to an external height source portal.
    Cheers
    Chris
     
  21. Poxican

    Poxican

    Joined:
    Oct 17, 2012
    Posts:
    37
    This is an issue I'm wondering about at the moment too. I am generating the overall environment with a combination of RAW and procedural elements, and then I wish to layer biomes on top. For instance the lowest sections will be sand dunes, some areas will be greener, others rockier etc, but the heights as generated in this map are very important.


    I'm also wondering if anyone can recommend a water shader that works with MapMagic and Unity 2018? I looked at AQUAS but it looks like it may have some issues with the latest versions of Unity, and the developer seems to be unavailable for support at the moment (temporarily apparently, I think they said they're travelling).
     

    Attached Files:

  22. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    My current favorite is Lux water. It's very straightforward, responds well to light, has foam, edge blending, and optional Gerstner vertex displacement. It's a little finicky - you'll be fine if you read the manual, which I was slow to do.

    #2 in my evaluation queue is WeatherMaker - super-detailed sky, weather, and ocean shader. The only one I know that, for example, suppress specular lights under a cloudy sky. It's quite complex / powerful and I still haven't gotten to the bottom of it but gets the best frame rates so far for sky + ocean together.

    Another promising one is hydroform - it does inifinite oceans very nicely and has most of the standard featueres, but lacks edge blending and lighting.
     
  23. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Ok, finally figured out the Texture Input issue. They seem to need to be set to Read/Write enabled. That was somewhere in the middle of this thread. A note in the documentation would have saved me an amount of frustration. Does this double the memory usage as I've read?
     
  24. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    It will create a very noticeable lag. Try searching for the pathfinding system that does not use novmesh or other baked data. Apex Path boasts with dynamic navigation. Have not tried it myself, but some users say it works fine:
    OnDisable is always called on DestroyImmediate. It's 100% so in Unity 2017 and older, and I'm pretty sure they have not changed this in Unity 2018.
    Try disabling allowMove in MapMagic.cs line 234:
    Code (CSharp):
    1. if (chunksChange) chunks.Deploy(deployRects, removeRects, parent:this, allowMove:false);
    It disallows using terrain chunks pool, preventing moving terrains and forcing them to be destroyed and created in new place. If it helps I will expose this parameter in settings.

    The feature you're requesting is called "Function" in MM2. At first glance it looks like a biome node with a separate graph - but this graph has a special portal nodes: "Function Inputs" and "Function Output" that correspond to the inlets and outlets of the node. When generated function will get the main graph maps or other objects through Function Inputs, and output generated result via Function Output.
    You can expose internal function node values in the main graph function node, so you can setup the without opening function graph. You can treat them as encapsulated black boxes.
    Changing the function graph is like changing the function code - it will affect the graphs it's used in (unless otherwise is not enabled in settings). So you can tweak all of your scenes by tuning your function graph.

    As far as I know the texture's memory usage is doubled because one instance is used for rendering and stored in video card memory, and the other one is used by scrips and stored in main RAM. It's just my vision of how it all works and why the size of readable texture is doubled. This texture might not be used by the GPU, but it's only a profiler who could say if it's size will be doubled too.
     
    malkere likes this.
  25. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Cool, thanks for the reply. That, along with masks per channel Texture Input are going to be really useful for me. Looking forward to MM2.
    Cheers
    Chris
     
  26. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I use the runtime NavMesh generation stuff that Unity has not yet officially incorporated in. They have a GitHub where you can download it and there are a fair number of posts including me posting raw code in the Navigation forums. You can bake asynchronously using that stuff. It still has other problems like setting up links. But still works a lot better than AStar which runs on the main thread, in my very limited experience. I've never used ApexPath.
    https://forum.unity.com/threads/navmesh-baking-at-runtime-example.507446/#post-3401247
    https://github.com/Unity-Technologies/NavMeshComponents
     
  27. vegashacker

    vegashacker

    Joined:
    Sep 4, 2010
    Posts:
    18
    Is it possible to construct the generator graph programmatically for a MM terrain? I see that it's possible to write custom generators in code, but I'm more interested in being able to have code that constructs the graph--ie, being able to programmatically specify parameter values, to create nodes, and to connect inputs and outputs.

    Also, is it possible to change the graph (parameters, inputs, outputs) while the game is running?
     
  28. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Yes and yes. I use a custom node to feed the graph data about where to spawn points of interest. I could change that code in runtime all I want and anytime MapMagic goes looking for the data you can feed it whatever you want. You'd need strict control of that timing though because most of that happens off the main thread. In other words, "In runtime" will only work prior to generation. You can't change the data being generated by an output node and have MM change the current terrain. You'll need to regenerate which means turning it off, waiting, and turning it on again.

    I'm making an upgrade pass at my terraforming any day here and I think I'm going to setup a 4-deep dictionary for terrainX, Z, and localX, Z, and have MapMagic use that value if it exists otherwise generate it's own. That way I can save changes and not have to reapply them after MapMagic generates, but within it's own generation after saving/loading again.
     
  29. vegashacker

    vegashacker

    Joined:
    Sep 4, 2010
    Posts:
    18
    Thanks @malkere. I certainly may be misunderstanding, but this to me doesn't sound like code that constructs the MM graph. As a simple example, say I want a Noise node connected to an Erosion node connected to a Height node. I'm looking to do something like:

    Code (CSharp):
    1. n = new NoiseNode(); n.size=25; n.highIntensity = 10; e = new ErosionNode(); e.heightsInput = n; h = new HeightNode(); h.input = e;
     
  30. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    So you want to use the nodes but not the visual editor? All it really does is grab everything on the graph whenever it generates a terrain and goes through it. You could intersect that data afterwards, or plug in a custom node in the middle to do as you've posted, create node instances and pass the data through them... Interesting idea... The visual representations are just class instances holding the input data so you should be able to do it just fine.

    I think adding a custom node and actually putting it somewhere on the graph would still be the easiest way to go unless you want to get into worker thread code and try to find where to plug it in manually, maybe not so hard... But it looks for and treats object generators, height generators, splat generators etc differently, so you'd probably run into a number of problems if you tried to do it pure code or with only a single node. Probably want at least 1 node with enough outputs to connect to all of the outputs you need.
     
  31. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Here is the way default initial graph (the one that appear when you create MapMagic) is created programmatically (GeneratorsAsset.cs, 995):
    Code (CSharp):
    1. GeneratorsAsset graph = MapMagic.instance.gens; //originally it creates the new graph, but this should work too
    2.  
    3. NoiseGenerator182 noiseGen = (NoiseGenerator182)graph.CreateGenerator(typeof(NoiseGenerator182), new Vector2(50,50));
    4. //creating noise generator. Vector2 is it's gui position on graph
    5. noiseGen.high = 0.9f; //setting noise values
    6.  
    7. CurveGenerator curveGen = (CurveGenerator)graph.CreateGenerator(typeof(CurveGenerator), new Vector2(250,50));
    8. curveGen.curve = new AnimationCurve( new Keyframe[] { new Keyframe(0,0,0,0), new Keyframe(1,1,2.5f,1) } );
    9. //setting curve values. Curve node uses Unity's AnimationCurve
    10.  
    11. HeightOutput heightOut = (HeightOutput)graph.CreateGenerator(typeof(HeightOutput), new Vector2(450,50));
    12.  
    13. //creating node connections
    14. curveGen.input.Link(noiseGen.output, noiseGen);
    15. heightOut.input.Link(curveGen.output, curveGen);
    16. //Link takes two arguments - one for target generator's output and one for target generator itself
     
    Last edited: Aug 24, 2018
    malkere and vegashacker like this.
  32. Bodyclock

    Bodyclock

    Joined:
    May 8, 2018
    Posts:
    172
    Sorry to drag up old posts again but did this ever get implemented. It would be useful to have a Layer for excluded objects.

    Cheers

    Chris
     
  33. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    If you buy the A* Pro then it can use multiple threads. I've been using it successfully with infinite worlds in MapMagic. It's a beautifully designed library; I've been very impressed.
     
  34. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Yes, you can find Exclude Layers popup in Floating Point Origin menu in MM's General Settings in the latest versions.
     
  35. zeux-n00b

    zeux-n00b

    Joined:
    Nov 4, 2017
    Posts:
    73
    Hello Denis!
    Is it optional to plugout Wire Terrain asset with MM ? It would be super awesome for some new ground Space Hacking Adventure 3d fantasies series
     
    Last edited: Aug 26, 2018
  36. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    When trying to make a biome with CSO in it (CTS mode) I get this errors:

    No such type in process cache: MapMagic.CustomShaderOutput
    UnityEngine.Debug:LogError(Object)
    MapMagic.GeneratorsAsset:process(CoordRect, Results, GeneratorsAsset, Size, HashSet`1, Func`2) (at Assets/MapMagic/Main/GeneratorsAsset.cs:482)
    MapMagic.GeneratorsAsset:Calculate(CoordRect, Results, Size, Int32, Func`2) (at Assets/MapMagic/Main/GeneratorsAsset.cs:234)
    MapMagic.Chunk:ThreadFn() (at Assets/MapMagic/Main/Chunk.cs:224)
    MapMagic.ThreadWorker:ThreadFn() (at Assets/MapMagic/Main/ThreadWorker.cs:533)


    Error generating chunk: MapMagic.Coord x:1 z:1: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
    at System.Collections.Generic.Dictionary`2[System.Type,MapMagic.Action`5[MapMagic.CoordRect,MapMagic.Chunk+Results,MapMagic.GeneratorsAsset,MapMagic.Chunk+Size,System.Func`2[System.Single,System.Boolean]]].get_Item (System.Type key) [0x000a2] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150
    at MapMagic.GeneratorsAsset.Process (CoordRect rect, MapMagic.Results results, MapMagic.GeneratorsAsset gens, Size terrainSize, System.Collections.Generic.HashSet`1 changedTypes, System.Func`2 stop) [0x0036c] in C:\Unity Projects\The Six Dragons - 2018.2.1f1 PC\Assets\MapMagic\Main\GeneratorsAsset.cs:483
    at MapMagic.GeneratorsAsset.Calculate (CoordRect rect, MapMagic.Results results, Size terrainSize, Int32 seed, System.Func`2 stop) [0x0001e] in C:\Unity Projects\The Six Dragons - 2018.2.1f1 PC\Assets\MapMagic\Main\GeneratorsAsset.cs:234
    at MapMagic.Chunk.ThreadFn () [0x0005b] in C:\Unity Projects\The Six Dragons - 2018.2.1f1 PC\Assets\MapMagic\Main\Chunk.cs:224
    UnityEngine.Debug:LogError(Object)
    MapMagic.Chunk:ThreadFn() (at Assets/MapMagic/Main/Chunk.cs:227)
    MapMagic.ThreadWorker:ThreadFn() (at Assets/MapMagic/Main/ThreadWorker.cs:533)

    No such type in apply cache: MapMagic.HeightOutput
    UnityEngine.Debug:LogError(Object)
    MapMagic.<Apply>c__Iterator1:MoveNext() (at Assets/MapMagic/Main/GeneratorsAsset.cs:551)
    MapMagic.<ApplyRoutine>c__Iterator0:MoveNext() (at Assets/MapMagic/Main/Chunk.cs:239)
    MapMagic.ThreadWorker:CoroutineFn() (at Assets/MapMagic/Main/ThreadWorker.cs:604)
    MapMagic.ThreadWorker:UpdateApply() (at Assets/MapMagic/Main/ThreadWorker.cs:224)
    MapMagic.ThreadWorker:Refresh() (at Assets/MapMagic/Main/ThreadWorker.cs:143)
    MapMagic.MapMagic:Update() (at Assets/MapMagic/Main/MapMagic.cs:272)
    UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

    KeyNotFoundException: The given key was not present in the dictionary.
    System.Collections.Generic.Dictionary`2[System.Type,System.Func`5[MapMagic.CoordRect,UnityEngine.Terrain,System.Object,System.Func`2[System.Single,System.Boolean],System.Collections.IEnumerator]].get_Item (System.Type key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
    MapMagic.GeneratorsAsset+<Apply>c__Iterator1.MoveNext () (at Assets/MapMagic/Main/GeneratorsAsset.cs:553)
    MapMagic.Chunk+<ApplyRoutine>c__Iterator0.MoveNext () (at Assets/MapMagic/Main/Chunk.cs:239)
    MapMagic.ThreadWorker.CoroutineFn () (at Assets/MapMagic/Main/ThreadWorker.cs:604)
    MapMagic.ThreadWorker.UpdateApply () (at Assets/MapMagic/Main/ThreadWorker.cs:224)
    MapMagic.ThreadWorker.Refresh () (at Assets/MapMagic/Main/ThreadWorker.cs:143)
    MapMagic.MapMagic.Update () (at Assets/MapMagic/Main/MapMagic.cs:272)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at C:/buildslave/unity/build/Editor/Mono/EditorApplication.cs:191)

    latest MapMagic 1.9.2, unity 2018.2.1f1.

    without biomes my graph works fine.


    EDIT: Seems fixed, checking what was wrong to report
     
    Last edited: Aug 26, 2018
  37. DougieJones

    DougieJones

    Joined:
    Aug 15, 2018
    Posts:
    10
    Hello, I just started working on Mapmagic. I have a few issues with it so far.
    1) One is a rift created between tiles I think it can be cleared by force generate all
    2) Sometimes I get a MissingReferenceException about accessing a terrain that has been destroyed. that I should check that it is null etc.
    3) Super blocky rock parts (the erosion geometry for lack of a better word) they look super "triangle" I have tried increasing terrain resolution to no avail.
    4) Right now my terrain doesnt show up in Playmode, my Char just goes splash into the water. I haven't done anything to change it. I had just reached the point in the tutorial when we are adding grass.. I have tried many options but I havent managed to make it come back in Playmode...
    Thanks for your help.
    mapmagic.jpg
     
    Last edited: Aug 26, 2018
  38. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    After I used Biomes, this code doesn't work (scatter remains 186 in list) and returns an error:

    IndexOutOfRangeException: Array index is out of range.
    NewSeedMM.OnEnable () (at Assets/Scripts/NewSeedMM.cs:15)
    UnityEngine.GameObject:SetActive(Boolean)
    ORKFramework.Events.Steps.ActivateObjectStep:Continue(BaseEvent)
    ORKFramework.Events.Steps.ActivateObjectStep:Execute(BaseEvent)
    ORKFramework.Events.GameEvent:ExecuteNextStep()
    ORKFramework.Events.BaseEvent:StartEvent()
    ORKFramework.Events.GameEvent:StartEvent(IEventStarter, Object)
    ORKFramework.Events.BaseEvent:CallGlobalEvent(ORKGameEvent, Int32, Boolean, Boolean, Boolean)
    ORKFramework.Events.Steps.CallGlobalEventStep:Execute(BaseEvent)
    ORKFramework.Events.GameEvent:ExecuteNextStep()
    ORKFramework.Events.BaseEvent:StepFinished(Int32)
    ORKFramework.DialogueChoice:Closed(GUIBox)
    ORKFramework.DialogueContent:Closed()
    ORKFramework.GUIBox:Tick(Single)
    ORKFramework.GUIHandler:Tick(Single)
    ORKFramework.GUIHandler:Tick()
    ORKFramework.ORKCore:FireTick()
    ORKFramework.ORKHandler:Update()


    I guess it only read the first graph and not inside the Biome? any way to make it work inside of it?
     
  39. Firestar56565

    Firestar56565

    Joined:
    Aug 24, 2018
    Posts:
    2
    Hello everyone, I'd like to start out by saying what an absolute GODSEND this tool is.

    I was wondering if anybody could help me with exporting the terrains I've made in mapmagic, without accidentally including the plugin itself.

    Or in other words, I want to transfer the terrains between computers, so that they may be reused in different projects. However, I can not simply export the actual terrains as .raw files, as I don't believe the trees and grass would be included. Am I wrong? If not, then how could I accomplish this.

    Thank you!
     
  40. Dorian-Dowse

    Dorian-Dowse

    Joined:
    Jun 2, 2016
    Posts:
    95
    Wright likes this.
  41. Firestar56565

    Firestar56565

    Joined:
    Aug 24, 2018
    Posts:
    2
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    I don't remember exactly what it all was about since it was a while ago, but I guess you need to know your generator's number instead of 186. You can see the number in graph by enabling Debug mode in settings.
    Yes, this script will work on the main graph only. If you'd like to use the other graph you should use it instead of MapMagic.instance.gens.

    Might be a welding artifact if it disappears after rebuild. Could occur on intensive terrain height change with a graph in editor. Will not happen in playmode when graph does not change.

    Have you noticed when you get this error? Could you paste it's text?

    Do you mean visible terrain polygons on the left screenshot? Try setting Height Output scale value to 2, this will tessalate and smooth the terrain.

    It will not appear immediately, it takes some time to generate chunk. Check if the terrain appeared above the character in a scene view.

    Have you looked at the AssetStore? If you find the one that works with the standard terrains then it should work with MM's pinned terrains too (however working with infinite terrains isn't guaranteed).
     
  43. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    Thank you! so for a biome that the graph has the name SnowGraph, how the MapMagic.MapMagic.instance.gens.list[186] changes to work with that biome?
     
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    You have to get graph reference somehow. For instance, you can select it in inspector and use
    (GeneratorsAsset)(Selection.activeObject).list[num]
     
  45. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    Sorry but I really cant get into it. I just have a biome and I need to select that scatter inside it, I cant understand how I can do that in the inspector :)

    If you could explain it with more detail I would be thankful, my biome's name is GreenGraph and the generator I m trying to randomize is a scatter generator with debug no. 186. The code I posted in my previous post worked fine when the scatter was not inside a biome generator.

    this is the code I use, could you show me the altered please?

    ((MapMagic.MapMagic.instance.gens.list[186]) as ScatterGenerator184).seed = 12311;
     
    Last edited: Aug 29, 2018
  46. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Here I've made a short tutorial:


    The code I'm using:
    Code (CSharp):
    1. using UnityEngine;
    2. using MapMagic;
    3.  
    4. public class ChangeMM : MonoBehaviour
    5. {
    6.     public GeneratorsAsset graph;
    7.     public float intensity = 1;
    8.     public float oldIntensity = 1;
    9.  
    10.     void Update ()
    11.     {
    12.         if (intensity != oldIntensity)
    13.         {
    14.             VoronoiGenerator1 voronoi = graph.list[0] as VoronoiGenerator1;
    15.             voronoi.intensity = intensity;
    16.             oldIntensity = intensity;
    17.  
    18.             MapMagic.MapMagic.instance.Generate(force:true);
    19.         }
    20.     }
    21. }
     
  47. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    349
    Thank you for making this tutorial Denis! Will test and get back to you :)

    edit: yeap works awesome!
     
    Last edited: Aug 31, 2018
  48. kblood

    kblood

    Joined:
    Jun 20, 2012
    Posts:
    92
    I have had an idea for a game for a long time, and it sure seems MapMagic might be almost perfect for it. My hope is to procedurally generate a world and procedurally place villages, cities and such in this world.

    This node system and instance system sure seems like it could make it possible. So MapMagic and its nodes to help create the world, some custom random function to place instances with cities, villages, dungeons and so on, which I would try to create with Dungeon Architect. I would have to find a way to ensure that the seeds are synced somehow. If they are too different I guess I could make a third type of seed that could be used to make a mix of these other seeds.

    But I wonder what the limits of MapMagic might be? I read earlier in this thread that something like an area of 400 square miles or maybe it was square kilometers from the starting point it could be a problem making these instances... so should it not be possible to fix that with the node system, making more MapMagic... areas? Not sure what to call each map, when its above the level of instances, nodes and such? Well, could more of them be created?
     
  49. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    @kblood I use map magic well beyond the 2000km range. Haven't tried further just because no one has gotten that far in my game. I've never heard of a 400 limitation of any kind. There are floating point precision errors you have to be aware of when you travel past 10km. You can certainly place villages etc because the noise is deterministic.
     
  50. GamePyro-com

    GamePyro-com

    Joined:
    Jul 28, 2018
    Posts:
    197
    Hello

    Work it now on existing terrains created with RWT Real World Terrain from infinity
    are unity terrains

    as at your website stands:

    Roadmap:
    MapMagic as an editor tool: teach the plugin to work with already existing terrains. To scatter objects, to paint splatmaps according to terrain incline or cavity, to apply erosion, to plant terrains with grass, etc.

    and auto paint texture an existing terrain like at your screenshots looking like real .

    terrain 6600x6600 height : 3300 or so .



    regards
     
    kblood likes this.