Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    got this

    Terrain Layers cannot be populated at the same time as the splats UnityEngine.TerrainData:set_splatPrototypes(SplatPrototype[]) MapMagic.<Apply>c__Iterator2:MoveNext() (at Assets/MapMagic/Generators/OutputGenerators.cs:584) MapMagic.<Apply>c__Iterator1:MoveNext() (at Assets/MapMagic/Main/GeneratorsAsset.cs:565) 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:176) MapMagic.ThreadWorker:Refresh() (at Assets/MapMagic/Main/ThreadWorker.cs:143) MapMagic.MapMagic:Update() (at Assets/MapMagic/Main/MapMagic.cs:272) UnityEditor.EditorApplication:Internal_CallUpdateFunctions()
     
  2. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Try using the Normalize node instead of Invert. This way you can use any number of biomes (and more likely to the first tutorial).

    If you are going to use CTS manually (without MapMagic) then you have to create a standard terrain with the standard splat data CTS can read on assign, you don't have to use the control map. Assign textures with the standard Textures output (not Custom Shader), generate, save terrain, add it to (probably new) scene and assign CTS the way you assign it on non-MM terrain. It should automatically convert splat information to control maps, preserving terrain painting.

    I'm going to submit a new version with these recent bugfixes tomorrow:
    Will look into Unity beta bug too, but don't promise it will be fixed now.
     
  3. viveleroi

    viveleroi

    Joined:
    Jan 2, 2017
    Posts:
    91
    Thanks. I played with a lot yesterday and I think I finally got normalize working the way I wanted. I believe the key was using "layers" mode instead of "sum" - you mention "layers" mode in one of the videos and I hadn't realized it was there.

    Just so you're aware, the "Biomes" link on your wiki doesn't seem to work.

    I think this will do exactly what I want for my game, so I think you'll have a new customer in the next few weeks.

    Is there a better place for paying customers to get support? I'm not sure how often you check the forums.
     
  4. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Feel free to email me. I try to answer within 24 hours, but it's not always possible - especially on weekends. The same with the forums, though - I don't prioritize emails above the forum or vice versa.
     
  5. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I check the forums most days too =D and am usually in Discord for most of the day. I'm not affiliated with MM in anyway, it's just made my game more possible than anything else and I've received a lot of help in here over the years, I try to help out when I can. It was a 3-day weekend where I live or I would have chimed in =D
     
  6. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,204
    I currently have an event that fires off to enable objects when a terrain chunk is created - but is there an event when the terrain chunk is disabled or deleted? That would simplify the disabling and cleanup of items a lot.
     
  7. scourgey

    scourgey

    Joined:
    Jan 5, 2014
    Posts:
    20
    @Wright Thanks for the great asset!

    I am however confused with how I am meant to make roads with Map Magic, how abouts would I go with structuring it within the node editor?
     
  8. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    I've submitted the new version that brings these fixes:
    - Unity 2018.3b compatibility;
    - fixed "Destroy asset" issue when using custom material;
    - fixed RTP texture names.
    It will be available in AS in a couple of days.

    You can use OnDisable on the terrain for that. While there's no way to call OnEnable before terrain is created (actually nothing to call OnEnable on) that event is the only way to to perform some action on creation, but to perform an action on disable/destroy OnDisable is the most straightforward way.

    Unfortunately MM does not support roads - at least yet. They are planned for v2, but there's no ETA for this feature.
     
  9. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
  10. MakeGames2

    MakeGames2

    Joined:
    May 23, 2016
    Posts:
    82
    Getting this on compile after updating to 1.9.3:

    Assets/MapMagic/Main/Chunk.cs(131,22): error CS0103: The name `UnityEditor' does not exist in the current context
     
  11. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
  12. MakeGames2

    MakeGames2

    Joined:
    May 23, 2016
    Posts:
    82
    2017.4.12.f1 Personal. I found that if I wrapped the null check there in an If UNITY_EDITOR statement the error went away.

    I also couldn't figure out the biomes thing before similar to viveleroi above but kind of got something working replacing the first node with a noise and experimenting but it still wasn't quite right. I kind of gave up on it for now.
     
  13. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    146
  14. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    MakeGames2, sorry for the redundant question, but it seemed to be okay at glance. The fixed version should be available at AS soon.

    I haven't made MM compatible with DunGen. Can it randomize a village in some anchor object's OnEnable, i.e. you place some marker with DunGen script in scene and it creates a village/dungeon around it in playmode?
     
  15. MakeGames2

    MakeGames2

    Joined:
    May 23, 2016
    Posts:
    82
    Awesome, thank you for all your hard work =)

    I've been testing out various vegetation assets to go with MM. I've tested uNature but had weird issues with the grass and next I'm going to test Vegetation Studio but I'm not sure what to expect with that since it doesn't seem as automatic so I guess I'll see.

    I've actually thought about using some sort of thing like DunGen as well. I don't know how it works since I don't have it yet though. I was just thinking that I wanted to have a way where such a dungeon can have an opening in the terrain somewhere that might look just like a normal pile of rocks but when players explore they can find a little opening and it can go underground into this vast dungeon area with monsters and treasures or whatever. Players can just go down into it as if it were part of the world rather than going into a separate instance or something. But I'm not sure how that might be possible. It's going to be a lot of work to get all this stuff to work together I think.
     
  16. viveleroi

    viveleroi

    Joined:
    Jan 2, 2017
    Posts:
    91
    Can anyone recommend ways to add in oceans and lakes? Should I start with my actual land terrain, and have ocean "biomes" that "carve" out large areas for water?

    Also, it sure would be cool if there was a place to share data. If someone creates a good design for something, it sure would be helpful for new users to start there. I've been learning from scratch which is best, but I don't always know the best path to what I want.
     
  17. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I have a base grass height noise: 0.2 - 0.3
    and an ocean height noise 0.0 - 0.2
    I then use an "area blender" noise (I'd say biome but I'm not talking about MM biomes) noise to determine where grass is an where ocean is. That way the areas blend together. If you just subtract, you will end up with sheer cliffs of grass suddenly changing to deep ocean. I then also have tundra 0.3 - 0.4 and mountains 0.4 - 1.0 determined by a second "area blender" noise, though ocean overpowers it.
     
  18. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    This sounds very interesting! If you could provide a screenshot for better understanding would be wonderful :)
     
  19. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Untitled-9.jpg
    There's the jist of it. Each "biome" (again not MM biomes, I don't use MM biomes) is mostly just a noise and a curve, but then they are subtracted from one another first so the grass biome is only grass, the mountain biome is only mountain, etc. The moutain has a minimum height, where the grass has a minimum and maximum height. That way they 50% grass and 50% mountain can never end up being less than the minimum of the two.

    The desert/grass curve only goes from 0.2-0.25 or so (I use 4000 height). The mountains get added onto that, but only for the mountain biome areas. The ocean then gets subtracted from both meaning the ocean takes priority.
    2018.09.04-mountain.jpg
     
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Everything should be fine with VS, I've made MM compatible with it, and so did Lennart (VS author).

    Sure, there is the Community Graphs page. Feel free to use these graphs, and edit (you must be a registered GitLab user) and add your own graphs too.
     
  21. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi!!! A Suggestion @Wright ...

    There is a possibility that you put this link in the main post of MM to be able to find it always quickly ???

    If it's already done, I apologize, but I did not see it.

    regards
     
  22. hworld

    hworld

    Joined:
    Mar 18, 2018
    Posts:
    6
    How to let terrain to be fixed ?

    I have done like this, but it has problems.
    upload_2018-10-3_15-40-19.png

    upload_2018-10-3_15-40-51.png
     
  23. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Done :)

    This error says you have no object to be used as a "center" for the infinite terrain. If you don't want to use the infinite terrain - turn the Generate Infinite Terrain toggle off. Otherwise you have to use either your main camera (and have at least one camera in scene) or object with a specified tag (or both).
     
    hworld and ftejada like this.
  24. viveleroi

    viveleroi

    Joined:
    Jan 2, 2017
    Posts:
    91
    Does anyone have a good way to include texture assets in a build?

    Since I use infinite terrain, any textures that aren't used by an object already in the scene are left out of the build.

    I figure I have no choice but to put them into the Resources folder, but figured I'd check to see if anyone any alternatives for MM.
     
  25. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    You can pin a single terrain, so all of the textures will be set to the scene.
     
  26. viveleroi

    viveleroi

    Joined:
    Jan 2, 2017
    Posts:
    91
    I tried but this didn't work. I can try again, but only the texture for the biome for that chunk was used.
     
  27. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    yeah you need a pinned terrain from each biome
     
  28. viveleroi

    viveleroi

    Joined:
    Jan 2, 2017
    Posts:
    91
    Ah, I didn't think of that. Thanks!
     
  29. viveleroi

    viveleroi

    Joined:
    Jan 2, 2017
    Posts:
    91
    Although now I realize that I can't have multiple map magic 3d objects. I was planning to just have several constant->biome setups for each biome and disable them. But since I can only have one, the only real way is pin random chunks across my map that happen to be in each biome.

    Not sure I like that, feels to disorganized.
     
  30. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    We need splines :D (Just a post while waiting for MapMagic 2.0 :)
     
    camta005 likes this.
  31. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    84
    When is 2.0 avalible?
     
  32. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    @viveleroi I use multiple instances of MM, you just have to disable the few lines of code where it throws a Debug and turns off the interloper, and make sure they aren't generating at the same time. They use thread pools so if you have more than one active they will mix their data up and break everything.
     
  33. Southroner

    Southroner

    Joined:
    May 29, 2017
    Posts:
    5
    Hello! I've got a situation where I'm generating textures at runtime outside of Map Magic then using them as texture inputs in Map Magic. It works great the first time I load the scene and generate the texture inputs. However, when I generate new textures and assign them to the texture inputs after the first time, Map Magic keeps using the first textures (not the new, updated textures) until I pause and click 'Reload' on the texture input nodes. Checking the 'Reload on every generate' option does not fix this. I can't figure out how to reload the texture input gens from code at runtime which I suspect would fix this problem. Does anyone know what I would use to do this?

    EDIT: Nevermind, I just found the answer myself looking through the generator code. All I had to do was call CheckLoadTexture(true) on the TextureInput generator after I changed the texture. Thanks Wright for your very well structured and readable code!
     
    Last edited: Oct 9, 2018
  34. shedworksdigital

    shedworksdigital

    Joined:
    Nov 7, 2016
    Posts:
    40
    The preview on terrain feature of MapMagic recently stopped working for me in the editor - it might have something to do with being on the 2018.3 beta but I'm not totally sure. Anyway, I did some digging and found that the problem was the DrawGizmos function inside the Preview class was not being fired. I tried changing the type of the first argument of that method from Transform to MapMagic and that fixed the problem for me. Not totally sure what's going on here but I just thought I'd let you know in case other people have been having this problem.
     
  35. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    I need them too, but for now I'm stuck making new faster and reliable GUI. Thing like this are boring, but they have to be done. Once I'll deal with them I'll add so awaited spline support in beta.

    Oh, you're walking on a razor's edge. It can ruin everything in any moment no matter how hard you will test it. This debug error is for a reason here. Consider disabling all MM objects, and enabling only one of them at a time. At least, this way you will not have to change MM code.

    Glad you could find it out, and it's pleasant to know you like the code. I've got to check why reload every generate fails, but the way you are using now is better. It reloads the texture when it's changing, but not every generate.

    Check if you have gizmos enabled in your scene view. Yes, MM's preview is a gizmo, and it will not show up if gizmos are disabled.
     
  36. 7Ye

    7Ye

    Joined:
    Dec 5, 2014
    Posts:
    18
    First of all, congratulations for one of the best terrain generators out here.

    Then, after some hours of google it and find no good answer, I'm struggling with speedtree grass. Seems wonderfull but,it can (well) used as Tress inside Map Magic generation, don't?.

    I'm struggling since generation to performance. Anyone has solved this? or better use it only for shrubs and let the billboard grass be grass?
     
  37. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    I don't usually talk about other assets in other assets forums, but I would start with Vegetation Studio about all grass/trees related staff, MapMagic doing a great job for the terrain and combined with VS you go to the next level.
     
  38. Nihilus0

    Nihilus0

    Joined:
    Jan 25, 2017
    Posts:
    52
    Have you solved the overhead for 'VS(Vegetation Studio) Prepare' that appears every time MapMagic create a chunk?
    Could you tell me solutions?
    MM과VS연동시문제0_8.png MM과VS연동시문제0_7.png
    MM과VS연동시문제0_5.png MM과VS연동시문제0_6.png
     
    Last edited: Oct 11, 2018
  39. SSL7

    SSL7

    Joined:
    Mar 23, 2016
    Posts:
    347
    I don't use the VS output of MM, I worked with @LennartJohansen on improving his simple integration which works pretty good, it has some downsides (like biomes are a bit hard cut) but it's fine for me and biomes will come in the new Pro version of VS anyway.
     
  40. shedworksdigital

    shedworksdigital

    Joined:
    Nov 7, 2016
    Posts:
    40
    camta005 and malkere like this.
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Yes. The main thing that's changed is the Layers system instead of splatmaps. I've recently updated MM, so current version works fine with 2018.3 terrain layers. Other stuff like brush performance or per-pixel normals is great, and happily it will work with no effort on my side :)

    I aim to integrate VS Pro in MM2. It's faster and should not have the lag Cosmoraph mentioned.

    Thanks!
    How do you use the speed tree grass with the standard, non-MapMagic terrain?
     
  42. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    @Wright Since you mention it with the VS Pro, for when Map Magic 2 and what features do you think?

    regards
     
  43. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    So I Raycast trees generated by MM and they are detected as the terrain itself.

    Code (CSharp):
    1. hit.collider.name // returns Terrain 0,0
    Is that normal?
     
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    I can't say the exact ETA - it's done when I'm happy with all of the aspects and like what I've made. But here is the feature list I've planned:
    - Interface enhancements: major interface performance improvements, convenient way to apply curve or other node adjustments, per-node map preview;
    - All nodes will be resolution-independent: you can switch the resolution and get the same result, but more (or less) detailed.
    - Terrain LOD preview: terrain placeholders that will be generated way faster to be displayed at far distance and for editor preview;
    - Margins: the way to create borderless terrains with no visible seam without using "Safe Borders";
    - Functions: "biomes" with inputs, outputs and parameters exposed. Using them will make the graph more readable and allow to re-use the graph parts in other graphs. 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.
    - Height, splats, objects inputs: MapMagic as an editor tool - you can sculpt the terrain manually and then let MM texture it or place objects. Or place objects and automatically create grass around them. Just to mention it's not the way Vegetation Studio works - grass and objects will be processed by MM per chunk and "baked" the usual way MM does;
    - Native C++ generators in editor (erosion, noise, forest - Mac and Win editors only);
    - If everything goes well - a couple of test spline generators

    It depends on what do you expect Raycast to detect. Note that terrain trees (not MM ones, but trees placed on terrain in general) do not have their own transform and collider component, so there's no way to return a collider of some particular tree.
     
    bok and ftejada like this.
  45. DEV971

    DEV971

    Joined:
    Oct 25, 2017
    Posts:
    26
    Thanks, basically I want to extract resources from the trees.
    So I understand it's not possible with terrain trees?
    Do I have to drop them in the scene?
     
  46. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    You can use Objects Output to place them as usual transforms.
     
    DEV971 likes this.
  47. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    That's an age old problem of Unity. Tree colliders are merged with the terrain collider. You need a script to to look for all trees and spawn separate colliders for them in runtime if you're doing things procedurally. Or as Wright said, place them using an object output or manually.
     
  48. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    44
    Will there be an easier way to access the terrain preview in MM2? It's a feature I use a lot, and having to right click > Preview > On Terrain to activate it and then going through the same procedure to deactivate it can get tedious. Not sure if I'm the first to request this but a simple easy-to-access toggle button to turn Terrain-Preview On/Off would be an amazing time saver.

    Absolutely love the tool, keep up the great work!!

    EDIT: Or maybe clicking on a node's blue Output-Circle while holding Ctrl or Shift or Alt could turn On Terrain Preview On/Off? Just an idea...
     
    Last edited: Oct 15, 2018
    camta005 and malkere like this.
  49. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    244
    Regarding Vegetation Studio Integration:

    1. It looks like VS and MM both do integration with each other. Is it necessary to use both sets of instructions, or just one?

    2. VS integration instructions are a bit out of date. I tried to do step-by-step by some UI had clearly changed.

    3. I wound up using half MM instrutions, half VS instructions. Result was trees work but no groundcover would.

    Has anyone created up-to-date integration instructions? I hear the integration is great but feels very trial-and-error.
     
  50. Sholms

    Sholms

    Joined:
    Nov 15, 2014
    Posts:
    84
    Hello, im trying to do a road system for mapmagic getting points positions from the new navmesh runtime component, but I dont have idea how put those vector 3 positions to a mapmagic node to them use those vector 3 variables with the Blob node to use it like a mask to paint the terrain. Any one here can help me?