Search Unity

  1. Unity 2019.2 is now released.
    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. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,086
    ^^ That's a very good idea
     
  2. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    Hmm, okay. That really sounds like a good idea, so I will make a color selector for groups. Don't sure what "colorized graph" is, though.
     
    boysenberry, camta005 and bok like this.
  3. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    35
    Groups is actually what I meant, awesome :)

    Also, have you considered making the Font Size of Group headlines adjustable? As it is now when I zoom out of a very big complex graph I cannot read the headlines of the groups because they are too small (because I'm zoomed out). It would be super helpful if I could change the font size and make it bigger so that the group headlines can still be read even when zoomed out. That way I can immediately see where the group is that I want to edit and I can zoom in to that group again.

    Again, it's just an idea.
     
  4. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    I can leave the groups font size constant no matter of zoom. Or zoom groups text with the half factor. Or zoom until the minimum readable font size is reached, and then keep it unscaled.
     
    bok and boysenberry like this.
  5. Poxican

    Poxican

    Joined:
    Oct 17, 2012
    Posts:
    37
    OK, so just to be clear:

    - Are you saying it would not be possible to create a version of the Raw Input node that places the mask according to a specified position, rather than according to the Offset as it currently is?
     
  6. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    What is the difference between specified position and specified offset?
     
  7. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    35
    That sounds great! Personally I think the third option sounds best (or maybe the first?) but it's hard to tell.
     
  8. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    74
    Hello, Im trying to create multiple biomes separately on one map where you can come across a desert or forest biome, I watched the blending 3 biomes tutorial but still not sure how to generate them separately without the need of simple form.
     
  9. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    199
  10. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    MegaCo, could you please clarify what are you going to make? Are you going to create 3 biomes the way 2 of them never intersect and always have a third biome between them?
     
  11. Nihilus0

    Nihilus0

    Joined:
    Jan 25, 2017
    Posts:
    52
    Hi, I am looking for a way to hand over HeightMap to the MM inside Biome Node.
    I tried to modify the code, but there is interference in the values.
    Does anyone have a good ideas?
    I want MMv2 should have this kind of functionality.

    @Wright I'm glad to hear that you're building Spline functionality into MM. Because I do similar things.(For the River/Road) However, my methods are never procedural. Could you give a brief introduction to MM's Spline feature?

    and I propose the "Change the Color of the Node Window" function. This could make it easier to see than just change the only group's Color. Even if it doesn't change the color of the line...
    Don't you like this colored graph?

    @MaximilianPs You can use Gizmo and custom nodes. You add several Gizmo layers by creating a new custom node in the MM. Then, you can mark the Gizmo at that location on the Apply function.

    Could you tell me how you did this part of the blue circle in your work? Not considered to be noise generated. It turned the mountains upside down and described the valley very well.
    20180320_112342_1 - 복사본.png

    ps. I'm a non-English speaking Buyer. used Translator.
     
    Last edited: Mar 20, 2018
  12. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    74
    Yes i want three or more different biomes to spawn randomly through out the generation.
     
  13. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    199
    It's an issue caused by the max-height, I guess the mountain reached the maximum height available, must be some parameter that limit the altitude. I'm still be a noob on MM so I didn't know to solve it. :rolleyes:
     
    Last edited: Mar 20, 2018
  14. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    You can use Raw or Texture Inputs for that.
    (Suddenly realized there's no TI page in wiki. Try to fix it soon).

    I'm afraid I can't since I don't have a fully clear vision of splines in MM. I plan to start with 2 nodes only - one to connect objects and the other to flatten the land to the spline level. Then I'm going to see where do users want me to move from that point.

    Yep, personally I don't like the colored interface, it distracts form feeling color in scene or game view. But I'm not making this plugin for my own so I'll start with colored groups - don't know about colored nodes though - at least yet.

    MegaCo, if so use blend 2 biomes first and apply the third one with a "spike" curve in-between them (scene attached):
    Bake3NonIntersectingBiomes.jpg

    It's called "Terrain Height" in general settings. Note that changing it will stretch your terrain up or down so you will have to lower all of your generator height values.
     

    Attached Files:

    malkere likes this.
  15. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    74
    @Wright

    Thank you so much. Also if possible I would like to know if you can blend terrains together because I have locked a terrain and changed the height values.
     
    Last edited: Mar 20, 2018
  16. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Biome too. Thx
     
  17. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    It will conform to the terrain?
     
  18. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    Biome too, yep.

    Only with it's key points (objects). It will make the terrain conform to spline - at least in first release. We'll see what do users require next.

    You can make the nearby non-locked terrains blend to the locked one by increasing height margins value, but not vice versa.
     
    blitzvb and MegaCo like this.
  19. Nihilus0

    Nihilus0

    Joined:
    Jan 25, 2017
    Posts:
    52
    Thank you for your reply.
    Is this what you means? (Screenshot showing the same raw input per each biome)
    20180321_051856_1.png
    isn't this method allow to read one raw file in duplicate?

    All I wanted to do was read one raw file from the top(A Graph), not from each biome(B Graph).
    20180321_050334_2.png
    Anyway if there is no other way, I will use your method.
    Oh, and thanks for the brief introduction.
    ps. I'm a non-English speaking Buyer. used Translator.
     
    Last edited: Mar 21, 2018
  20. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    74
    Thank you, I've tried increasing height wield margins in general settings but nothing seems to be happening is there a specific node i should use?
     
  21. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    Cosmoraph, biomes are independent graphs, that can work both with other graphs and in standalone mode. That's why they do not receive any data from the parent graph. But if you will be using a height output both in biome and parent graph their results will be combined additively. So if you are going to use additive mode in blend node that might be a solution.

    MegaCo, it should change not the locked terrain, but the chunks around it. The affect is applied after forcing re-generate (from the editor window).
     
  22. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    74
    Yes, none of the chunks generating around the locked terrain are blending, I'v started new project to see if it works there it doesn't I am attaching some screen shots maybe im doing something wrong.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      952.8 KB
      Views:
      363
    • 2.png
      2.png
      File size:
      908.5 KB
      Views:
      419
    • 3.png
      3.png
      File size:
      910.7 KB
      Views:
      356
  23. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,086
    Been very busy in here lately =D
    I've run into a problem I can recreate repeatedly.
    When I "quit and return to main menu" I call:
    Code (CSharp):
    1. foreach (MapMagic.Chunk chunk in MapMagic.MapMagic.instance.chunks.All()) {
    2.     chunk.worker.Stop();
    3. }
    But if I then try to reload the level I get:
    Code (CSharp):
    1. MissingReferenceException: The object of type 'Terrain' has been destroyed but you are still trying to access it.
    2. Your script should either check if it is null or you should not destroy the object.
    3. UnityEngine.Component.GetComponent[MicroSplatTerrain] () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/ComponentBindings.gen.cs:48)
    4. EternalLife.MicroSplatMapMagicSync.MapMagic_OnGenerateCompleted (UnityEngine.Terrain terrain) (at Assets/Scripts/Terrains/MicroSplatMapMagicSync.cs:24)
    5. MapMagic.MapMagic.CallOnGenerateCompleted (UnityEngine.Terrain terrain) (at Assets/MapMagic/Main/MapMagic.cs:47)
    6. MapMagic.GeneratorsAsset+<Apply>c__Iterator1.MoveNext () (at Assets/MapMagic/Main/GeneratorsAsset.cs:519)
    7. MapMagic.Chunk+<ApplyRoutine>c__Iterator0.MoveNext () (at Assets/MapMagic/Main/Chunk.cs:255)
    8. MapMagic.ThreadWorker.CoroutineFn () (at Assets/MapMagic/Main/ThreadWorker.cs:604)
    9. MapMagic.ThreadWorker.UpdateApply () (at Assets/MapMagic/Main/ThreadWorker.cs:224)
    10. MapMagic.ThreadWorker.Refresh () (at Assets/MapMagic/Main/ThreadWorker.cs:143)
    11. MapMagic.MapMagic.Update () (at Assets/MapMagic/Main/MapMagic.cs:264)
    I think the threads are still initialized somehow in the memory. There is no persistance on my end between the two scene, the main level is being fully unloaded, but it errors on re-entry.
     
  24. azdak

    azdak

    Joined:
    Oct 15, 2014
    Posts:
    3
    Hey folks-
    I found out about MM after spending a few days sketching out some probably overly ambitious code aiming to accomplish almost the very same things MM does (with varying degrees of success), so it's really cool to find a tool that looks to be so well supported and mature out-of-box- it looks fantastic.

    One prepurchase concern I have is with handling horizons without pop-in, though- my game needs a relatively far field of view, with some relatively flat sections (albeit at a pretty slow camera movement rate). Is this something I should be worried about, and does anybody here have recommendations or experience they'd be willing to share about how they're handling horizons in MM?
     
  25. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,086
    That's a whole topic in itself and outside the scope of any single tool including MM. There are tools specifically built for that purpose such as HorizonOn. If you need it static, if you need it dynamic, if you need to actually be able to get there, there are a lot of different ways to go about it. The best is of course some custom skyboxes as far as performance goes, with low res meshes in the distance being the next step in most cases. You can certainly generate terrains at any size and detail using MM then use a 3rd party tool or some not too hard code to shift it to a mesh, remove MM from it completely and use it as a horizon object.

    I use a second layer of MM (not supported out of the box) at extremely low res on a separate camera rendered behind the foreground because my worlds are procedural and need to be traveled to. It's ugly and costs performance, but it works.
     
    blacksun666 and azdak like this.
  26. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    MegaCo, Looks like MM really skipping the locked terrains because they are not ready. Because they are not generating at all. Try this (save to Generators folder) to see if it helps.

    What is MicroSplatMapMagicSync? Is it something from Jason? I've been busy with v2 so I might have missed something.

    As far as I know you're not the only one who does so. That's why I'm working on a lower-detail chunks feature on the horizon for v2. If everything goes well you will see it in a week or so in action.
     
    malkere and camta005 like this.
  27. MegaCo

    MegaCo

    Joined:
    Jan 24, 2018
    Posts:
    74
    It works thank you very much :)
     
  28. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,086
    That was written by Jason I believe yes, it just adds the microsplat components to each generated terrain. The error shows up before any terrains have generated, as soon as I get in the scene, starting with MM thread workers, so I assume the workers are still carrying some sort of reference data even though I stopped them all and went to a different scene?

    That would be awesome! My biggest problem since day one is the resolution difference layering. I have a 512m chunk at 128res at full noise scale and a 1024m chunk at 128 res with noise scaled down 16 times on a lower depth camera, though in the same world space. Because the main camera clears using depth, every once in a while there are spots from the low res terrain that stick up and can be seen. I tried doing runtime flattening of the low res terrain following the player, but never got it looking good enough to use it.

    Because of such an extreme difference I can't turn a "chunk" from low res to high res because that would be 16km x 16km of land.
    2018.03.23-distance.jpg
    Under the crosshair is 512m, while the snow capped mountains in the upper left are around 40km away. I'd be happy to send you my scripts, probably wouldn't be any use, or test/help anyway I can if that means possible improvement for my game!
     
    camta005 likes this.
  29. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    Don't really know why this script is using OnGenerateCompleted. Guess Jason had his own reasons to call it in thread (performance reasons, I guess), but I think it's worth try to subscribe to OnApplyCompleted instead. It's called in main thread only if terrain exists, so it should be more reliable.

    That's the most important feature of v2. It will always generate the same result no matter of resolution. Increasing it's value will just add more detail, but will not change the overall look.
     
    Jaimi likes this.
  30. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    35
    Hey! I have big 1000 x 1000 terrain tiles with a lot of stuff spawning on them. Every time a new tile and its prefabs is generated ingame, the game stutters for 1-2 seconds. Is there a way to reduce performance cost and the frame drop when these tiles generate for infinite terrain?
     
    Last edited: Mar 26, 2018
    blitzvb likes this.
  31. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    265
    @Wright Is it possible to import splatmaps into Map Magic from a terrain made outside of Unity?
     
    Last edited: Mar 26, 2018
  32. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,086
    The biggest problem is bringing in colliders to the physics engine. If you can implement any way to spread that out across multiple frames it will reduce the lag spike. Controlling the terrain collider manually for example. Only enabling colliders near the camera, etc. Turning on a new mesh in the render pipe has a very minimal affect when compared to the impact of colliders, especially mesh colliders. Also monobehaviours with Start and Awake functions will all be called in that frame if they are turned on together, so if you are calling any Find functions or lots of GetComponent functions in those for example that can cause a slow down, again limiting those to things near the camera being a good first step.
     
  33. MaximilianPs

    MaximilianPs

    Joined:
    Nov 7, 2011
    Posts:
    199
    @Wright how far we are from a new release? :rolleyes:
     
  34. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    4,858
    @Wright - a feature request: Can you make it so that the groups can be locked so they can't be dragged around the screen? When I have a very large nodemap open, it gets slow to update (very laggy), and unity will quite often detect the mouse down in the wrong spot. So moving/changing items with the mouse results in me dragging the group rectangles around quite a bit.
     
    bok and secondsight_ like this.
  35. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    341
    @Wright, I was wondering, does MegaSplat still work MapMagic and regular terrains? I was enjoying using it with Voxeland and was wondering if it was still working with regular terrain output as well? Last time I used MicroSplat, which is why I ask.
     
  36. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    bok, 1-2 seconds is a pretty large lag. Even if you are spawning thousands of objects - they should use pool and be split in several frames. Could it be that you are calling something in Start or OnEnable of your prefabs?
    Yep, they are already split. Maximum time allowed for objects creation is controlled with Max Apply Time value. Once it reached - MM yield return apply coroutine until the next frame.

    Yes, you can import any texture (including the splat maps made in other software) to graph using the Texture Import node.

    From the release - far yet. But in a week or two - it depends on the number of bugs I will have to fix - I will get more or less stable version that I plan to make public and available for download (along with the evaluation version). It will have lod terrain, partial lock, some other features and btw will solve Jaimi's problem. But do not expect splines here yet, they will be added later.

    I can make even better. I can get rid of the lag while displaying the graph. To do so I have to re-write the node interface engine. Luckily, I've already made this for the next version.

    Sure, you can use MegaSplat through the Custom Shader Output, as well as CTS and RTP.
     
    bok, boysenberry and Jaimi like this.
  37. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    35
    @malkere and @Wright: Thanks for the response! That makes sense, I will do some investigation and hopefully I'll find out how to do it the right way.

    @Jaimi The group lock is an awesome idea. I have the same issues :)
     
  38. Nihilus0

    Nihilus0

    Joined:
    Jan 25, 2017
    Posts:
    52
    Hi, Unity 2018 said it would put a JS(Job System) for MT(Multi-Thread) support.
    I understood what is job system means that unity classes can be used as MT.
    Your MT walker in MM(MapMagic) is great, but the connection to Unity is similar to the coroutine.
    and I think most of the delay or lack is due to the GC(Garbage Collection). However, JS does not have GC.
    Are you willing to change most of your assets into a job system?

    ps. I'm a non-English speaking Buyer. used Translator.
     
    Last edited: Mar 27, 2018
  39. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    The chance I'll make it is quite high, even though it will not work for older Unity versions. However do not expect it right after Unity 2018 release.
     
    shedworksdigital and blitzvb like this.
  40. bok

    bok

    Joined:
    Feb 24, 2014
    Posts:
    35
    Is there a way to randomly rotate an object in all axes? So XYZ insted of only Y (as it is now with the adjust node)?
     
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,626
    Not in the current version. However it's possible in the upcoming one.
     
  42. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    I've just purchased and imported Map Magic, but got three errors that seem to want fixing, to do with the output nodes I guess:

    Assets/MapMagic/Generators/LegacyOutputs.cs(87,15): error CS0101: The namespace `MapMagic' already contains a definition for `CTSOutput'

    Assets/MapMagic/Generators/MegaSplatOutput.cs(47,15): error CS0101: The namespace `MapMagic' already contains a definition for `MegaSplatOutput'

    Assets/MapMagic/Generators/RTPOutputGenerator.cs(11,15): error CS0101: The namespace `MapMagic' already contains a definition for `RTPOutput'

    I'm running Unity 2017.3.0f3 on Windows 10. I do have MegaSplat installed too in this project, but not the other two.

    I didn't get these errors when I imported the demo package, but I did once I'd bought it and imported the full version.
     
  43. JBT27

    JBT27

    Joined:
    Jul 13, 2016
    Posts:
    197
    I quit the scene I was working on, deleted Map Magic, reimported the full one, and the errors have now gone. Should have thought about that sooner.
     
  44. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    121
    @Wright
    MM is amazing!! I'm excited to try MMv2...especially the terrain LOD.

    A few questions:

    1. Is it possible to apply different raw files to individual terrains? In other words: target specific parts of the graph to specific terrains? I know that MM is really built for infinite terrain, but for my current project, I'd like to create some static island terrains. For performance, I don't want terrain in between them, as my water will cover those areas.

    2. If I have an existing terrain island, with height set, can I use MM to apply only erosion, textures, trees, etc.?

    3. Is there a simple way to set minimum and maximum height for trees, bushes, etc.?

    Thanks!
     
    Last edited: Mar 30, 2018
    blitzvb likes this.
  45. smoluck

    smoluck

    Joined:
    Mar 8, 2016
    Posts:
    25
    Hi Denis. I'm wondering if you got an example that can show a looping terrain setup. I have a project where i want to slide at the terrain, and make it loop infinitely from the World position view. like a walking carpet machine. Do you know how to do that ?
     
  46. Abystral

    Abystral

    Joined:
    Sep 20, 2017
    Posts:
    2
    What would be the best way to go about persisting manual changes to the height/grass/trees/textures through subsequent generation passes?
     
  47. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,086
    @wwg 1. You can specify an offset for raw files within your graph as to exactly where they will show up. If your terrains are 1024 in size, offsetting it by x-1024 will move it onto the x-1 terrain, etc.
    2. If you run MM it will completely regenerate the heightmap. You can export the current heightmap to a raw file and use that as the starting point of your height graph adding on top off that.
    3. Curves are the easiest way to set limitations on object placement. Start with your height noise then apply a curve that turns it down to y0 when below x0.5 then if your terrain is 1000m high, trees or whatever you're using the curve on will only show up above 500.

    @Wright I'm reloading the same scene over and over and getting 1 of 2 height values in certain areas. In other words a player builds a house, logs out then back in and now the house is buried under an extra 3m of land. I'm using LegacyFractal still type 0 (Unity/Mathf.PerlinNoise) with 4000 height. Do you think changing the noise pattern can fix this? Or maybe my height is too extreme causing a floating point error somewhere?
     
  48. KrankyBoyGames

    KrankyBoyGames

    Joined:
    Mar 27, 2009
    Posts:
    733
    completely stumped. I cannot for the life of me get three biomes to blend properly. I copied the exact node graph values and generators you have in your video tutorial, but I only get the biome with a constant input value of 1 to show up.

    See pic.
     

    Attached Files:

  49. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,086
    I'm still getting ThreadWorker errors:
    Code (csharp):
    1.  
    2. MissingReferenceException: The object of type 'Terrain' has been destroyed but you are still trying to access it.
    3. Your script should either check if it is null or you should not destroy the object.
    4. MapMagic.SplatOutput+<Apply>c__Iterator2.MoveNext () (at Assets/MapMagic/Generators/OutputGenerators.cs:553)
    5. MapMagic.GeneratorsAsset+<Apply>c__Iterator1.MoveNext () (at Assets/MapMagic/Main/GeneratorsAsset.cs:553)
    6. MapMagic.Chunk+<ApplyRoutine>c__Iterator0.MoveNext () (at Assets/MapMagic/Main/Chunk.cs:255)
    7. MapMagic.ThreadWorker.CoroutineFn () (at Assets/MapMagic/Main/ThreadWorker.cs:604)
    8. MapMagic.ThreadWorker.UpdateApply () (at Assets/MapMagic/Main/ThreadWorker.cs:224)
    9. MapMagic.ThreadWorker.Refresh () (at Assets/MapMagic/Main/ThreadWorker.cs:143)
    10. MapMagic.MapMagic.Update () (at Assets/MapMagic/Main/MapMagic.cs:264)
    11.  
    This happen when from the main game I return to the front screen like this:
    Code (csharp):
    1.  
    2.             foreach (MapMagic.Chunk chunk in MapMagic.MapMagic.instance.chunks.All()) {
    3.                 chunk.worker.Stop();
    4.             }
    5.             SceneManager.LoadScene(1);
    then try to go back into the main game. In the first frame it throws an error that is never thrown when the game first starts, on this line:
    Code (csharp):
    1. TerrainData data = terrain.terrainData;
    I assume because a thread is still waiting to complete but there is nothing for it to act on anymore and so the terrain throws a null reference. Last time I posted it was null referencing MicroSplats callback but it was the same problem, calling on generate complete in the first frame of re-entering the game. I tried watching
    Code (csharp):
    1. MapMagic.ThreadWorker.IsWorking("MapMagic")
    but it never returned positive. What can I do to ensure these threads are stopped? We're not talking miliseconds, I leave to the main menu, and click a few buttons to start loading the level again. Thanks!
     
  50. Poxican

    Poxican

    Joined:
    Oct 17, 2012
    Posts:
    37
    Really looking forward to getting my hands on the next version, the terrain LOD is super exciting!

    I guess I would want to be able to combine the node with something like the scatter node. ie., a green-type input, rather than having to manually enter an offset value into the node.