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

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    Good evening, and thanks for the quick reply.

    I tried removing the Normalize node as you suggested. You are correct that is isn't needed, but removing it actually made the problem with previews worse. Now the Noise node's direct output is the only thing I can preview. Even the output of the Raw Input, which was working before, has stopped working.

    There are zero messages at any severity level in the console.

    Closing and restarting Unity didn't help; I tried that just for "due diligence" after making the node change.

    For reference, this is in Unity Pro 2018.3.12.
     
  2. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
    This is probably obvious but can the lighting be tied to the biome of the terrain so that say, you walk from the bright and cheerful Easter area into the Halloween area so the lights go dark and spooky.
     
    syscrusher likes this.
  3. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Could you please email me your scene/graph and raw file so I could look into it?

    There is no direct way to know what biome you are currently in, but you can get terrain textures using the standard Unity ways. If each biome has it's own textures set you can get the most used texture at the player coordinate and thus get the biome.
    Alternatively, you can scatter and output empty objects specific for each biome, and determine the biome type by the closest one.
     
  4. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
    Yeah I'll do it that way. If the biomes are too similar I can simply add invisible biome marker objects unique to each biome, get the nearest one and alter lighting accordingly.There might be another unity plugin that works with Map magic that can handle this for me though and if that's the case then yay.
     
  5. SammmZ

    SammmZ

    Joined:
    Aug 13, 2014
    Posts:
    174
    Is it possible (maybe in future versions) to get a map similar to a flow map from the erosion node? I saw many terrain generation videos utilizing this node and I believe it adds a lot of possibilities to terrain texturing. For now we have only sediment output and it looks quite different...

     
    secondsight_ likes this.
  6. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    I stripped out anything proprietary from my project except your own assets and one free asset (a simple fly camera controller), and I've ZIP archived the resulting project and uploaded it to my Dropbox. You have a private email containing the link to download. Please let me know when you have it so I can delete the archive from the cloud.
     
  7. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
    I only now realize that this isn't compatible with Dungeon Architect. I guess I just can't use them both in that project like I had intended.
     
  8. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    That's relevant to my project also, but I hadn't yet tried the integration. If you wouldn't mind, could you please elaborate a bit on what you found? Thanks.
     
  9. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
    I technically haven't tested it. I'm still yet to actually buy any unity plugins. I just realized that Dungeon Architect having it's own terrain manipulating feature to create a foundation for the dungeon, well rule of thumb is if two plugins by different people edit the same thing you can use one at a time but not both at once.
    My project specifically is actually going to go through Archimatics > Playmaker > Dungeon Architect > and then to Map Magic. So there's plenty of time to test this and find a way to make it work.
     
    syscrusher likes this.
  10. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    In MapMagic you could pin and lock the chunks that Dungeon Architect will edit, that way there won't be a conflict. Just make sure your chunks are not too big and you select 'Hide Out-of-Range Terrains'.
     
  11. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    That terrain manipulation feature is off by default, so as long as you let MapMagic make sufficiently flat terrain zones for your DA procedural structure you'll be fine. Or you can use the suggestion for locking chunks, per @camta005.
     
  12. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Hi @Wright

    It would be great if you could convert the rotation to Quaternion in one of the updates so we can use full rotation without OnApplyCompleted.

    Thanks
     
  13. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    There is an issue in Unity 2018.3+ where terrains do not align properly when viewed from a distance with a Pixel Error value of 1 or greater (0 aligns properly). The issue is more noticeable with higher Pixel Error values. This is because the neighbouring terrains do not exactly mirror the vertices along the seam at different LODs, unless Auto Connect is true or Pixel Error is 0. Unity 2018.2 and before do not have this issue.

    The problem can be fixed in Chunk.cs, add the following line to this section of code
    Code (CSharp):
    1.     #if UNITY_2018_3_OR_NEWER
    2.     terrain.drawInstanced = magic.drawInstanced;
    3.  
    4.     //Allows terrains to properly align in 2018.3+
    5.     terrain.allowAutoConnect = true;
    6.     #endif
     
    Last edited: Apr 16, 2019
  14. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    114
    I have an error during the build :
    Isn't it supposed to be editor only ? :confused:
     
  15. DiscoFever

    DiscoFever

    Joined:
    Nov 16, 2014
    Posts:
    286
    Unit 2019.1 latest MapMagic + Latest VSPro = :(

    upload_2019-4-16_22-19-0.png
     
  16. Nevercallmebyname

    Nevercallmebyname

    Joined:
    Nov 18, 2013
    Posts:
    120
    That sounds like a strategy
     
  17. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I'm having a heck of a time finding these assets. Is there a special keyword I should use maybe? Do you know of any specific ones?
     
  18. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
  19. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    114
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Hi, long time no chat - sorry for that.

    Yes, this is the map erosion node generates internally each iteration. And each iteration it's different, so I think it's better make a special node, like "Streams" that will work after erosion.
    BTW, mm2 use the native erosion algorithms that are about 5 times faster. Since it's hard to say when it will be released for now, I plan to add these algorithms to 1.10. Unfortunately, they are yet for PC users only, other platforms will follow later.

    Not sure if it's possible in a current version. MM2 is using quats from the start, but to make this in current version too many things should be changed. However, will see what I can do about it.

    Thanks for your reports, fixing the VSPro issue right now!
     
    Djayp likes this.
  21. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Not sure if this has been asked on this thread - as there are 79 pages - too much to go through one by one.
    But how would I go about making areas for ponds and lakes? I mean sure I could go in and manually add all this - but that means I'd have to go in and remove the grass and trees from them areas by hand - and then if I make any changes to terrain in mapmagic I'll have to go do it all again by hand, so certainly there's gotta be a way to do this.
     
  22. rasto61

    rasto61

    Joined:
    Nov 1, 2015
    Posts:
    352
    I think this is what you are looking for:?
    Lakes
    and then just clear the area around through the graph.
     
  23. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    With reference to my previous post, here is a screenshot of the issue at pixel error 5 to make it more visible.

    align.jpg

    The issue only occurs in Unity 2018.3+ with the introduction of the Auto Connect terrain feature. In the editor Force Generate All temporarily corrects the problem but it is always visible in Play Mode.

    @Wright can you consider exposing the Auto Connect feature in the terrain settings, which solves the issue, thanks.
     
    syscrusher likes this.
  24. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Ok, well if it's in v2, then that's fine for me.
    I'm using a post script now to apply random rotation.
     
  25. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Yes, there was a post a couple of pages back: here
    View attachment 395965
    You can find the scene attached in the post, and the prefab used in objects output is attached here.
    And since this question is asked not the first time I'll add it to the FAQ page, you can find some more useful information here.

    Done!

    Just submitted the new version that brings VSPro fixes, preferred binary serialization for RAW input, and possibility to scatter < 1 objects per tile (single object will appear at random in this case). And yes, auto-connect exposed.
     
    camta005 and Djayp like this.
  26. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    @Wright were you able to retrieve the project ZIP I posted for you, and if so, does the new version you just submitted address my missing previews? :)
     
  27. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Could you please send me the scene/graph and the raw file I've asked for so I could easily download them and copy to my work folder? It's not convenient to fix the bugs in other projects and then merge changes with the project I submit.
     
  28. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    @Wright - thanks for the help mate!

    Now there's just one last thing - I see on the FAQ how to make islands.
    But - that is for a single terrain chunk.

    Any time I've attempted to make an island with multiple chunks it simply only does the first chunk and/or creates the same island over and over for all the chunks.
     
  29. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    Okay, I just thought that would be easier since it gave you the whole project. I'll email the specific files.
     
  30. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    I'm new to terrain in Unity so I'll be asking simple questions for a while. What benefit is there to using Vegetation Studio Pro output nodes instead of the standard output nodes?

    EDIT: My only use will be seed-generated infinite terrains for mobile platforms. No manual adjustments will be made. Maybe just a bit of scripting.
     
    Last edited: Apr 19, 2019
  31. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    You will benefit only if you are using Vegetation Studio Pro. It works faster, looks cooler than the standard Unity grass and trees.You can apply VSPro to each terrain manually in editor, and it will generate it's own data from the standard vegetation data (using the standard outputs). But if you are making the infinite terrain this won't work, since new chunks are created dynamically and obviously could not be modified in editor.

    Setting the Simple Form tile mode to single will create only one island on a single chunk. Increasing the size value will stretch it to the several chunks.
    BTW he island should not be the same. It should be a different variations of the starting island since noise pattern is different from tile to tile. Isn't it working?
     
  32. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    Here is a modified version of the graph from the FAQ:
    Islands.jpg
     
    Last edited: Apr 19, 2019
    secondsight_ likes this.
  33. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    Sent earlier today.
     
  34. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Is there a way to prevent the stuttering when generating? I figured perhaps it was all my speedtree assets, etc I was using. So I made a new scene and generated a simple noise + curve map and left it alone - went to the range to generate next chunk and boom - massive stutter.

    So I increase the thread timer to 150 - stutter.
    Disabled Terrain pooling - stutter.
    Disabled Hide Out-of-Range Terrains - stutter.
     
  35. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    114
    Hello ! Just tried the update with VSPro. There's no build error now.

    Does it means I can't have a random seed either ? Does it means the map should be pinned ?
     
  36. SoloHonk75

    SoloHonk75

    Joined:
    Mar 27, 2016
    Posts:
    31
    A small suggestion from me. In the section "Mass Pin / Unlock" we have three buttons: pin, lock all and unpin all. What about an "Unlock all" - button? Or is there another way to do that?
     
  37. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    114
    I need some help... How would you generate your heights such as the A areas are symmetrical about the X-axis (red) ?

    upload_2019-4-21_17-12-2.png
     
    Last edited: Apr 22, 2019
  38. JohnnyFactor

    JohnnyFactor

    Joined:
    May 18, 2018
    Posts:
    343
    VS Pro supports infinite terrains just fine. See this link for setup instructions.
    https://www.awesometech.no/index.php/set-up-with-map-magic-infinite-terrain/


    EDIT: Corrected by Wright, below.

    In other news, I bought the VS bundle and upgraded to VS Pro but I'm really doubting whether this is going to work for me. My target platform is mobile so all the fancy rendering tricks are unusable. Without that, I can't see any benefit except for maybe the burst compiler. I'm still testing though so maybe too early to tell.
     
    Last edited: Apr 23, 2019
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Got it, will look into it tomorrow, thanks!

    What is the stutter lag time? Does it happen in the demo scene? Just checked the island map, and could not get peak higher than 26ms in a single frame on several chunks apply. Could this be considered as a stutter? What thread timer do you mean?

    With the standard grass and trees output - no. With VSPro node - yes. It supports generating in runtime and infinite terrains, actually that's why it was made.

    I see. No, there's no other way to do it, so thanks for suggestion. Will try to make it in the next version.

    If you need a circular area you can use the Cone Simple Form adjusted by curve. If you need something more complicated than it depends on the result you are trying to achieve, there's no universal solution.

    Unfortunately this link isn't related to VSPro, it's about the standard VS. If you need to setup VSPro use this video tutorial instead, it's quite different from the non-pro version.
     
  40. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    @Wright : I went to the demo and saw it was fast as can be like you said.
    So i changed my settings to the same thing - dropped from 2048 to 512 size, etc and now it's very smooth... Does 2048 make that big a difference? And changed my map from 1000 meters to 2000 for the terrain, same height, etc.

    I just don't get how 2048 can be that much slower if that's the case, not enough to be hundreds of milliseconds off.

    Also not sure if this is a bug - but if I change it to 4096 - only the base texture works - no other textures work such as slopes and cavity maps.
     
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    The thing is the map is square. Increasing the side just 4 times makes it bigger 16 times. This way 26ms turn into 416ms, these should be the hundreds of milliseconds you are talking about. As for me all of the graph optimizations should begin with using as low resolution as possible, and keeping the chunk small to prevent loosing detail. It's better split chunks until Safe Borders become too visible.

    EDit: Unity does not support 4096 heightmaps. However they could be used with Voxeland, so that's why this resolution is here.
     
  42. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    114
    I'm looking for x-axis symmetrical noises. I think it will be ok with the rest if it is rule-based rather than randomized.
     
  43. Buka

    Buka

    Joined:
    Feb 22, 2013
    Posts:
    48
    Hi, thanks for this great project, by far the best map generator but i am annoyed by these warnigns and i don't know how to fix them since Unity deprecated things. Updated to latest version of MapMagic but still not fixed:
    Line 490 in CustomSerialization script

    if (lineMembers.Length >= 7)
    k.tangentMode = (int)lineMembers[6].Parse(typeof(int));
    else
    k.tangentMode = 0;

    What should i put instead of tangentMode? LIne says use AnimationUtility.SetKeyLeftTangent or right or wtf?
    Don't know much about this so can someone post a line that erases these warnings?
    Can i disable those two lines, what will happen if i do so?
    Thanks!
     
    Last edited: Apr 24, 2019
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    There's no built-in way of doing this, but you can write a custom generator based on the standard noise, and just use abs X value. It shouldn't be very difficult, I think I'm going to write it a bit later today.

    Ah, here is an ambiguous case! Usually I use define constants like #if UNITY_2018_2_OR_NEWER and leave obsolete stuff like k.tangentMode in #else section, but here I can't do this way. The reason is that this block reads previously saved graphs that could contain k.tangentMode data, and I have to use it to convert to newly introduced in/out weights. It caused no trouble in 2019.1 Beta and in older Unity versions, but I suppose it's an issue with the released 2019.1 - so I'm downloading it now to have a look. Yes, you can comment out all of the lines 488-494 block as a quick workaround.
     
    Djayp likes this.
  45. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,277
    Djayp, so here is the mirrored noise node:
    MirroredNoise.jpg
    Code (CSharp):
    1.     [System.Serializable]
    2.     [GeneratorMenu (menu="Map", name ="Mirrored Noise", disengageable = true, helpLink ="https://gitlab.com/denispahunov/mapmagic/wikis/map_generators/noise")]
    3.     public class MirroredNoise : Generator
    4.     {
    5.         public int seed = 12345;
    6.         public float high = 1f;
    7.         public float low = 0f;
    8.         public float size = 200f;
    9.         public float detail = 0.5f;
    10.         public float turbulence = 0f;
    11.         public Coord offset = new Coord(0,0);
    12.      
    13.         public enum Type { Unity=0, Linear=1, Perlin=2, Simplex=3 };
    14.         public Type type = Type.Unity;
    15.  
    16.         public Input input = new Input(InoutType.Map);
    17.         public Input maskIn = new Input(InoutType.Map);
    18.         public Output output = new Output(InoutType.Map);
    19.         public override IEnumerable<Input> Inputs() { yield return input; yield return maskIn; }
    20.         public override IEnumerable<Output> Outputs() { yield return output; }
    21.  
    22.         public override void Generate (CoordRect rect, Chunk.Results results, Chunk.Size terrainSize, int seed, Func<float,bool> stop = null)
    23.         {
    24.             Matrix matrix = (Matrix)input.GetObject(results); if (matrix != null) matrix = matrix.Copy(null);
    25.             if (matrix == null) matrix = new Matrix(rect);
    26.             Matrix mask = (Matrix)maskIn.GetObject(results);
    27.             if (!enabled) { output.SetObject(results, matrix); return; }
    28.             if (stop!=null && stop(0)) return;
    29.  
    30.             Noise noise = new Noise(seed^this.seed, permutationCount:16384);
    31.  
    32.             //range
    33.             float range = high - low;
    34.  
    35.             //octaves count
    36.             int iterations = (int)Mathf.Log(size,2) + 1; //+1 max size iteration
    37.  
    38.             Coord min = matrix.rect.Min; Coord max = matrix.rect.Max;
    39.             for (int x=min.x; x<max.x; x++)
    40.                 for (int z=min.z; z<max.z; z++)
    41.                 {
    42.                     int absx = x+offset.x;
    43.                     if (absx < 0) absx = -absx;
    44.  
    45.                     float val = noise.LegacyFractal(absx, z+offset.z, size/512f*terrainSize.resolution,iterations,detail,turbulence,(int)type);
    46.                  
    47.                     val = val*range + low;
    48.  
    49.                     if (val < 0) val = 0; //before mask?
    50.                     if (val > 1) val = 1;
    51.  
    52.                     if (mask!=null) val *= mask[x,z];
    53.  
    54.                     matrix[x,z] += val;
    55.                 }
    56.  
    57.             if (stop!=null && stop(0)) return; //do not write object is generating is stopped
    58.             output.SetObject(results, matrix);
    59.         }
    60.  
    61.  
    62.         public override void OnGUI (GeneratorsAsset gens)
    63.         {
    64.             //inouts
    65.             layout.Par(20); input.DrawIcon(layout, "Input"); output.DrawIcon(layout, "Output");
    66.             layout.Par(20); maskIn.DrawIcon(layout, "Mask");
    67.             layout.Par(5);
    68.          
    69.             //params
    70.             layout.fieldSize = 0.6f;
    71.             layout.Field(ref type, "Type");
    72.             layout.Field(ref seed, "Seed");
    73.             layout.Field(ref high, "High (Intensity)");
    74.             layout.Field(ref low, "Low");
    75.             layout.Field(ref size, "Size", min:1);
    76.             layout.Field(ref detail, "Detail", min:0,max:0.8f);
    77.             layout.Field(ref turbulence, "Turbulence");
    78.             layout.Field(ref offset, "Offset");
    79.         }
    80.     }
    Download

    Buka, it's still doesn't affect anything in 2019.1, so you can just disregard it.
     
    Djayp likes this.
  46. OJDee

    OJDee

    Joined:
    Feb 11, 2014
    Posts:
    64
    Been having some success combining several biomes across infinite terrain, including trees, rocks and grass.

    However, when I build an executable both on Mac and PC, the grass only appears on the initial terrain, even though all the other objects spawn infinitely as expected. Any ideas what may be happening here?

    Thanks

    Screenshot 2019-04-24 at 22.19.35.png
     
    Last edited: Apr 25, 2019
  47. N1warhead

    N1warhead

    Joined:
    Mar 12, 2014
    Posts:
    3,884
    Ahh okay thanks for the helpful information! This is makes me understand better now. - I do love Voxeland too by the way. :)
     
  48. Djayp

    Djayp

    Joined:
    Feb 16, 2015
    Posts:
    114
    Thank you so much ! I understand the workflow much better now, but I don't know your math classes for the moment. You're my (every)time saviour :)
     
  49. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    I'm having an issue with Microsplat/MapMagic. It seems that it's broken for infinite/runtime Terrain generation when creating a Build (tried with Mono) - playing in the Editor works fine.

    I get this error and as a result the new Terrain is not textured properly and also Objects weren't created for the new terrain. I also tried with the MicroSplatDemo Scene and it's the same issue. Could you please take a look at this, many thanks.

    Unity 2018.3.8f1 and the latest Microsplat + Map Magic.

    upload_2019-4-25_22-40-27.png
     
  50. akuptsov

    akuptsov

    Joined:
    Jul 12, 2015
    Posts:
    6
    upload_2019-4-26_1-10-14.png
    Hi all!

    @Wright , faced with an issue when Map Magic root object is not in 0,0,0 coordinates - spawning VSPro trees is not working properly. I am guessing Persistant Storage stores object position relatevly on 0,0,0 coord