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

    Hellhound_01

    Joined:
    Mar 5, 2016
    Posts:
    102
    Hormic likes this.
  2. Jacob-Williams

    Jacob-Williams

    Joined:
    Jan 30, 2009
    Posts:
    267
    @Hellhound_01 - Fantastic news, I will take it for a spin today and see how it works.
     
  3. frankcefalu

    frankcefalu

    Joined:
    Jun 28, 2013
    Posts:
    60

    Great, we are trying to get this in for PAX
     
  4. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Hey HellHound, seems to be working now for me. I keep wanting smaller scale stuff out of it, but it seems a little hard with this for some reason. I think we also pretty badly want a separate node for scaling any input map on x and/or y (for MM in general!).

    I've been tearing my hair out trying to get Unity's terrain to somehow fade off into the distance but it's nothing but huge trade offs. Just for the lols in ShaderForge, I made a simple shader that fades out geometry into the distance, then using MM, created a large surrounding terrain underneath the autogenned one with a similar shader. Screen below. Nothing special, just demonstrating the blend, which is pretty nice I reckon. If the surrounding distant terrain is 'tall enough', generally you don't see much in the way of close terrain blending into the sky for example...

    Main reason I've been messing with this so much is that I feel that a generation distance over 1500-2000 starts killing FPS a bit, and since in my game I'm transitioning from ground level to plane height often, it makes it even harder.

    Anyway, seems ShaderForge can't really do proper terrains with normal maps, and I can't find anything else out there that'll do it so *shrug* I'm out of ideas how I'd actually do this with more than one texture + normals.

    I liked the look of HorizonON too but the author never got back to me, don't know whether that system would work.

    Feel like Unity desperately needs nicer terrain texturing.

    blend.JPG
     
  5. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    I have a small suggestion:

    Could you possibly add optional x and z rotation to objects? For rock placement, x and z rotation adds a great amount of variation.

    ;-)
     
    Exbleative likes this.
  6. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Then it's better use quaternions because euler angles are not always stable. But they are not so intuitive. And it will add a lot more parameters to the Adjust and Split generators, actually, I'm afraid they will become a mess: height, scale, rotation x, rotation y, rotation z, rotation w. It will be really hard to use the Split.

    Maybe it's better to add "Random X and Z rotation" feature to the Objects Output? It will not be controllable, but it will increase the amount of the stones variation.
     
  7. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    There's definitely no way you can read in the prefab's rotation to begin with? That'd solve half the problem. I've just been whacking scripts on the prefabs as well to give them some random rotation if its not on Y.
     
  8. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Well i don't think quaternions make much sense here - who would know what to set w to anyways?
    I don't see why Euler should not work just fine.

    But well, you could put it directly on the object - as a range slider or simple checkbox. But then again it kind of breaks your logic with the adjust node. It would not make much sense to just have x and z rotation on the object, and everything else on the adjust node - but if there's no other way, i think x and z rotation are very important.
     
    Exbleative likes this.
  9. Hans

    Hans

    Joined:
    Feb 20, 2007
    Posts:
    422
    Hi Wright how are you going with the rest of the Tutorials?
     
  10. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    I'm working on a long, in-depth and comprehensive tutorial, similar to EB one (but this time I will be dubbing it myself). It is the whole lecture devoted to all of the main MM aspects. I will start from a scratch and end up with an accomplished and playable scene, talking about all the generators I use and demonstrating their use case. So, if you will be patient enough to watch it entirely, you can issue yourself a certificate of the confident MM user.

    By the way, working on a tutorial I'm making some fixes and improvements here and there (and it takes a large part of the time), so along with the tutorial publish a new MM version will be released. And I've got a work for a couple of days left.

    Here is what you'll get in the end:
     
    blacksun666, sarum, lazygunn and 2 others like this.
  11. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Great! If you haven't finished it yet, here's a couple things I'd like to see:

    If its long, in the youtube description, add links to each part, ie "5:12 - Erosion. 10:19 - Flooring" etc.
    Some discussion on which nodes take up the most processing power, or how to optimize MM graphs (if needed)
    Suggested or recommended settings (and why) for stuff like heightmap resolution, tile size, height, terrain generation distance, etc.
    The difference between outputting noise into another noise input vs Blend Add/Mixing.
    A final minor point, your pronunciation of height sounds like "heat", but should be more like "hight" ;)
    *also, I find RAW inputs quite tricky - they often look really nice as a height map, but then actually seeing any of that detail in the terrain itself, and getting it the correct scale etc, is hard.

    Looking forward to it!
     
    Last edited: Apr 9, 2016
  12. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    hey Wright.

    Once again, regarding x and z rotation for Objects: I'm wondering what the reason it to have an Adjust node in general? Wouldn't it make more sense to have all the "Adjust" range parameters directly in the Objects/Trees Node and remove the Adjust Node?

    After all, you don't have an Adjust Node to change width/height or other properties of Grass for instance.

    In that respect I'm also thinking of the Floor Node - why not just auto floor the objects? (detect which node is connected to the height output).

    Are there scenarios that i am not thinking of where the use of adjust and floor nodes have an advantage?

    Thanks
     
  13. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Exbleative,
    Yep, I will surely do so.

    You can see it yourself by enabling a debug mode in settings - under the each generator will be displayed how many milliseconds it takes to generate.

    No difference, except using the blend generator takes a bit more time, but it's more advanced - gives the ability to use mask and the blend modes other than add (as in noise/voronoi input) and multiply (as in noise/voronoi mask). I'll try to insert this remark somewhere in the tutorial.

    If anybody told me about such a mistakes any time I make them I could be a professional announcer now :) Pity the tutorial is almost recordered, but I've said "hight" right for two times in it today :) Thanks!

    iddqd, imagine the situation when we need to lower the trees growing on the slopes - to avoid them partly float above the ground. We flooring them first - and then using adjust generator with a slope mask, and then apply with objects output generator.
    Or it could be the stones plunged into the earth depending from the soil toughness.
     
    iddqd and Exbleative like this.
  14. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Ok thanks for the explanation.

    How can i propagate to place grass? The Propagate has an object output, grass needs a height/blue one. Is there a way to convert?

    Thanks.
     
  15. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    @Wright is there some way to have terrains active based off of multiple cameras (multiple players) ?
     
  16. one_one

    one_one

    Joined:
    May 20, 2013
    Posts:
    621
    Do you have any examples with relatively flat terrain and other climates, a desert for example?
     
  17. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    You can fill some areas on the map around the objects using the stamp generator.

    2All: to fix the stamp GUI you can use the quick fix.

    Stanchion, I've already answered this in the other thread but I'll mention it here:
    MM generates terrain using a main camera position only. Generating terrains for 10 (for instance) players will be ten times longer, and it will display ten times more terrains, which is surely will not improve a performance. What is the reason of one client to generate the terrains that are used by the other client only?

    christoph_r, speaking about desert I've made some experiments with badlands. They were generally flat except some big dunes and mesas. I think I gonna shape them up to make some screens.
     
    iddqd and one_one like this.
  18. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    @Wright - If it's like our situation, we need to generate terrain around all players for multiplayer reasons on a server. I'm guessing that's what he would need the terrains loaded around all players.
     
  19. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Correct me if I'm wrong but why wouldn't each player create their own terrain on their own computer? It'd be identical to other player's terrains, as the seed will be identical? Unless you're multiplayer modifying the terrain?
     
  20. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    When you have server authoritative multiplayer, you need to simulate all client players on the server. Clients would still only generate the terrain around their player.
     
    Wright and Exbleative like this.
  21. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    That's a point. This feature is already in my to-do list, but I have not started it yet.
     
  22. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    Great. It also comes to mind that this is necessary for pretty much any multiplayer game with NPCs or anything that moves on the terrain, because those will be owned by the server/host. Ideally the server/host would just disable those things when no player is nearby and the terrain there isn't active due to no players around there, which should be easy for anyone to do.
     
  23. frankcefalu

    frankcefalu

    Joined:
    Jun 28, 2013
    Posts:
    60
    Can someone take a screenshot of the node screen for the demo scene. Ours doesn't show up and we are trying to reference to understand how certain things are done. Thanks again.
     
  24. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    @frankcefalu Demo scene graph screen: here. Sorry for debug mode. But this ain't right that your graph does not show up. Could yo please send me some more detail: are there any errors in the console, does the editor window opens empty or nothing happens at all, etc. I would be really happy to see the steps to reproduce this bug.


    @all: I've finished the comprehensive tutorial showing the creation of this island from scratch:
    32.jpg 25.jpg 28.jpg 31.jpg 27.jpg
    I hope you will find it useful since it's showing the most typical generator use cases and guides through all of the creation process from the beginning to the end. And I believe it worth watching a hour and a half.

    Note that since I was making an edits and enhancements to MM during the creation of the tutorial it describes a bit more advanced version than the currently available v.1.1. I plan to submit the new version today, and it will be available after Unity review.

    Tutorial link
     
    montyfi, sarum, Hellhound_01 and 5 others like this.
  25. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    @Wright I got this error

    MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.
    UnityEngine.Transform+Enumerator.MoveNext () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineTransformBindings.gen.cs:491)
    MapMagicDemo.LodDisable+<ProcessLods>c__Iterator3.MoveNext () (at Assets/MapMagic/Demo/Scripts/LodDisable.cs:28)
     
  26. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Since it is an error in a demo script I guess it happens in a demo scene. This script disables lod components to prevent exceed of 64k lod groups, which is currently the Unity limit. Happily it's not a MM core error, but I'm going to fix it anyways.
    To find out why it occurs I need to know the conditions when it has happened. Could you please give a guidance on how to reproduce it?
     
  27. Stanchion

    Stanchion

    Joined:
    Sep 30, 2014
    Posts:
    269
    @Wright I can send you the project. All I did was change a couple settings on the map magic prefab
     
  28. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    @Wright I watched your long tutorial. It made me want to download your trial version. In the starter diagram the right button menus are behaving oddly for me. For example when you mouse over Create -> Objects and goto child menu the parent disappears.
     
  29. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    @Wright My preview options seem to be greyed out?
     
  30. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    What are your OS and Unity versions?
    Are you clicking on a generator or on an output (the blue circle at the right of the generator) when try to enable preview?
     
  31. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    @Wright Hmm I seem to have broken something. I had bumped the resolution from 512 to 2048. When I try to put it back to 512 Unity crashes on me.

    EDIT: It crashed twice, third time I was able to reset the resolution's to 512 without a crash and reset the graph to start over. When i got to adding the height object it crashed again.

    Let me know if you want any logs from my machine.

    Tried again seems to not be crashing now

    EDIT:2 Changing resolution while it's generating is a definite no-no
     
    Last edited: Apr 17, 2016
  32. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Windows 7 and Unity 5.3.4p3

    My bad was clicking on height output not blue circle :)
     
    Last edited: Apr 17, 2016
  33. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    @Wright, can raw input offset and hopefully rotation be handled with Standard Unity handles?
     
  34. stevenson

    stevenson

    Joined:
    Mar 16, 2014
    Posts:
    8
    Two questions before (maybe) buying:
    1. I saw that your system can place prefabs on the terrain. Are these all unity terrain trees or is it possible to place my own prefabs without using unity terrain datas?
    2. Is it possible to generate different types of islands (with different textures/gras etc) in the same scene? Maybe with multiple MapMagic "managers"´? But is there an option to create a transition to the borders and to let there start a new island world?
     
  35. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    ibyte, the resolution issue is a known bug that is fixed in v.1.2 which is currently pending review.

    I've never expected that someone would need to set up the Raw Input offset with a handle, but I like the idea. I'll add this one in my possible features list.

    stevenson, you can place any kind of prefab with a Object Output. It could not be related with a terrain at all, it can be an animal or npc, or some sound or particle effect, or a reflection probe, or some non-rendered object with a script, etc.
    To output terrain trees there is a separate generator - Tree Output.

    The feature you are talking about is called "biomes". Since there a lots of requests for it I've planned biomes as my next epic.
     
    stevenson, Stanchion and ibyte like this.
  36. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    Hi,

    This asset looks very cool ! Congrats !

    I'm wondering something, with the "Generate Infinite Terrain" option, is it possible to give to the generator multiple graph ?

    My goal, if it's possible ,would be to have multiple "biome" depending on the region the Player is

    Thanks
     
  37. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    @Wright - Is there a way to make any land below a certain height a specific texture? We're trying to paint different textures and plants for under water.
     
  38. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Ziboo, thanks!
    So I see there are definitely many requests for the biomes feature )

    HolyFireGames, you can take a heightmap, invert it and make it more contrast with a curve. Then you can use it as a probability map for plants or as a texture layer for underwater ground.
     
    ibyte likes this.
  39. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    another vote for the biomes feature !

    getting bolder with the graphs :)

    7a.jpg

    7b.jpg

    7c.jpg

    7d.jpg
     
  40. rpgw

    rpgw

    Joined:
    Jul 3, 2012
    Posts:
    47
    Another nod for Biomes here.
    I have done a similar thing using masks to transition between wildly different terrain types. Can get quite messy on the graph. Anyway of doing the same thing via an official feature that I can use to define many different types of terrain would be great.
     
    ibyte likes this.
  41. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    Another thing.
    Will you make a lod feature ?

    Imagine a game where you freefall from the sky, and need to see a lot of terrains around you without killing you're PC.
    Maybe change the resolution of the terrain according to the distance
     
    ibyte likes this.
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    sarum, this is awesome! I really like how the colors of the trees, and grass, and land textures fit each other! Great job! What fog and image processing effect you are using?

    Ziboo, I'm really thinking about this feature. I find it very useful but rather hard to implement - some generators like voronoi behave differently on different resolutions, so I need to make all of them resolution independent first.

    Ok, I have got it - I've started to prototype the biomes feature to find the best way of how they should be implemented. Not an easy task: on the one hand biomes should share some of the resource-intensive generators like erosion; on the other, different biomes should give an ability to create absolutely different scenes.
     
    ibyte, nxrighthere and stevenson like this.
  43. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    Great !
    Agreed about the biome.

    Do you have any advice or maybe a future tutorial for the infinite terrain feature, to make each terrain really unique ?
    (Maybe it's already the case, but I ask anyway, my guess is that you would have to tile one time or another )
     
  44. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Another option is you implement some combination of other features, which I've kinda been working at, ie:
    - just somewhat simple 'distance' terrains which don't have to match 'close terrains' perfectly. I'm tiling a heightmap that doesn't look heaps like my MM height map but has the same kinda texture map.
    - distance terrains flatten as you get closer to them (flatten underneath the close terrains). I used a shaderforge setup to achieve this myself + a really simple endless tiling mesh script that does something quite similar to MM.
    - close terrains fade/blend into distance terrains with a shader or some other method. I haven't been able to do this yet, terrain shaders are annoying!

    Other thoughts - if MM could generate enough heightmap data, you could use that heightmap for a vertex displacement shader to apply to a distance mesh (not a terrain). Not sure how much processing power goes into creating each terrain segment vs each heightmap segment, so this might not be an option. I'd bet though that even a 'dodgy' auto tiled far terrain could be enough especially with distance fog/atmospherics etc.

    Perhaps you could also assign with node or checkbox "use this node for distance terrain", so if you use a large noise input for general height, it might be pretty quick to use that instead of an entire node graph.
     
  45. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    the fog and sky are shuriken particles that i spawn using Map Magic :)
    as for processing image effects, i use the great new Unity Cinematic suite and SE Natural Bloom & Dirty Lens to add a nice finish
     
  46. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    Here's a few screenshots of our game using MM. It's definitely an awesome tool for procedural worlds :)



     
    Wavinator likes this.
  47. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Ziboo, what do you mean under unique? None of the terrains will not repeat in the world no matter how long you will travel anyways. And the further uniqueness will be brought with the biomes.

    Exbleative, I think that lower resolution terrain lods is the best approach to make far terrains (plus all of the object generators should be ignored for lods).
    This does make a sense, but I think that I'll start with lods and then, if this approach is still too slow, will enable switchable generators for lods.

    HolyFireGames, I like that a bit cartoony stylistic. Looks lovely )


    @all: Version 1.2 is now available in Asset Store. It has has the following fixes, improvements and features:
    - Shore Generator
    - Grass Output mask and Obscure Layers feature
    - new Cavity algorithm (the old one preserved as legacy generator)
    - noise Bias and Noise Generator clamp values in range 0-1
    - pinned terrains could be locked to prevent re-generating of the changed terrains
    - tags, layers and scripts are now could be copied from MM object to terrains automatically
    - preview mode does not change the number of splatmaps for RTP compatibility
    - object pool can be switched off to spawn changeable objects (mob or npc)
    - GUI fixes (preview, stamp generator)
    - solved Unity crash on changing resolution with a big step

    Thanks Unity for the fast review!
     
  48. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    @Wright Not sure if this applies or you are aware but if you use raw input file as a mask, that mask will repeat if infinite terrains is selected.

    Edit: Never mind I realize now when I was seeing that I had tiled selected on the raw input node.
     
    Last edited: Apr 20, 2016
  49. Ziboo

    Ziboo

    Joined:
    Aug 30, 2011
    Posts:
    356
    Awesome, just wasn't sure 100%.
    Can't wait for biomes !

    An option I would like to see in the Outputs Nodes Grass,Trees and Objects is the possibility to toggle on/off or solo any layers you want.
    Possible ?
     
    Last edited: Apr 20, 2016
  50. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    @Wright i have a suggestion for future releases: Some way to make comments in the graph since things can get messy, This seems like a good implementation at 1:29
    - there are nodes in the background that have a comment purpose.