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

    antony57

    Joined:
    Sep 9, 2017
    Posts:
    28
    upload_2018-1-14_12-49-16.png


    upload_2018-1-14_12-49-28.png

    upload_2018-1-14_12-49-49.png

    These are the two biomes, and the way they are connected in between each other. It's exactly the same than on the youtube video.

    Thanks for your help
     
  2. kepesh

    kepesh

    Joined:
    Dec 29, 2017
    Posts:
    92
    Just bought Mapmagic and got these errors when importing it to unity:
    upload_2018-1-14_21-25-59.png

    I use 2017.3
     
  3. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Hi there

    Is Microsplat currently supported with Map Magic?

    Thanks!
     
    protopop likes this.
  4. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    @Harekelas VS by default spawns a new VegetationSystem using the OnGenerateCompleted callback, but it does not check for an OnDisable. I run a

    Code (CSharp):
    1. if (terrain.gameObject.GetComponent<AwesomeTechnologies.VegetationSystem>() == null)
    before I add a new Vegetation System, and Destroy(VS) in an OnDisable() method on one of the scripts on the terrain itself.
     
    Harekelas, camta005 and boysenberry like this.
  5. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
  6. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    The first error just "went away", and I was unable to duplicate it (Got to love that about Unity).

    The second error (with the custom material) happens when a chunk is removed. I was able to duplicate it in a minimal project that had only MapMagic and Microsplat in it.

    To duplicate the error, setup a custom material. Then go into play mode, and walk in a straight line (generating terrains) until MapMagic decides to start deleting some of them. It happens when a terrain is deleted.
     
    twobob and boysenberry like this.
  7. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
  8. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    You just use the regular texture output node. You actually need to setup all your textures for microsplat beforehand. Simplest thing to do is to pin a terrain, generate the Microsplat data assets like normal (see the microsplat documentation), and then use those for the script.

    For puddles/lava, I don't have any idea. There's a couple of other Microsplat users on here, maybe they'll chime in.
     
    iddqd likes this.
  9. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    Ok so it's working with the texture output - thank you! If anybody has a solution for puddles and all the other microsplat features, that would be great! :)
     
  10. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I'm trying to write my own output node for vegetation studio and got no idea where to start.
    Anyone got any ideas?
    Or if there already is an output to VS that I don't know of, I will be very grateful to be informed!
     
  11. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    Just let vegetation studio place the vegetation.
     
  12. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    I will need some rules directly from MapMagic, like biomes info. Different biomes may use a same texture like grass to save texture count(even with microsplat I can only use 16 textures for all my biomes and I have 11 of them)
    VS does not have a biomes function and will not be in near future.
    So I think maybe use mapmagic to export data into VS's persistent storage can be a good idea. I took the object output as a reference and found the info I should output is in the Apply function, a dictionary with prefab as key and another dictionary contains transform info as value, but got no idea how to assign VS system onto this node and let it output info into it's database.
     
    iddqd and boysenberry like this.
  13. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    It seems like the easiest solution is to include texture based rules in vegetation studio, then have some unique textures in each biome. Particularly if you are using MicroSplat then it's not going to hurt performance to fill up all 16 texture slots if you need to.
     
  14. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    I want to have a large world map in which players can modify some aspects of it (eg create a small structure) and when they return it is still there in the same place. Possible in Map Magic? Would adding many such structures/save data have a significant impact on load/generation times. P.S I have not yet used Map Magic and I'm looking for the right terrain solution. Thanks
     
  15. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    I am doing something similar. It's possible with MapMagic by pinning/locking a terrain. There are issues with it though. Once it's locked it can no longer get updated by MapMagic. This means if any of the other terrains are altered the locked terrains won't be altered. This can lead to 'ripped' terrain edges with the locked terrain.

    I am still working on a solution to keep the procedural generation and POI intact together. But what you are trying to do is very possible in MapMagic, just with caveats. Also, I am pretty sure any other terrain solutions will run into the same issues. MapMagic is an awesome terrain solution I can recommend 100%.
     
  16. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    My last post brings up a question for me. Is it possible to have POIs in biomes?
    I am trying to have a procedurally generated world using the biomes concept to 'meld' different biomes. So far it's working fine, but as soon as I try to factor POIs into the biome melding process I am at a loss.
    Is there a way to procedurally generate POIs?
    I was thinking maybe I need to use prefabs then place them (the same as trees, rocks, etc), the best I've come up with so far. Is there a better way anyone can suggest?

    Thanks in advance,
    Boysenberry

    PS a way to tighten the seems between locked and unlocked terrains when spawning terrains that are unlocked would be awesome, solving bunches of problems for me. Right now I am looking at trying to that programatically using other assets (Terrain Stitcher and Multiple Terrain Brush), but it would be much better to be able to do it with MapMagic instead. Anyway, just a suggestion.
     
  17. camta005

    camta005

    Joined:
    Dec 16, 2016
    Posts:
    320
    There is this tutorial for generating villages:
    https://gitlab.com/denispahunov/mapmagic/wikis/creating-villages-with-mapmagic

    It's a cool concept that I think could be expanded on. I'm going to be implementing something similar in my project if I can get decent results.
     
    Last edited: Jan 16, 2018
    BackwoodsGaming and boysenberry like this.
  18. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    camta005 likes this.
  19. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Since I have 11 biomes, this method may cost more than 16 textures if I really want the biomes to have unique vegetation.
    For example, I use a common grass texture in shallows, swamp and hills biomes, but in shallows it grows coconut tree on it, in swamp it grows poplar, in hills it grows spruce. I can use mapmagic to achieve this easily but with VS I'll have to use 3 different textures for it.
    And I have rivers in different biomes, they also require unique by-water plants, normally I only use one texture for all rivers and let mapmagic to handle the vegetation, but now I'll need more textures.
     
  20. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    Just a thought. You might be able to create color maps in VS with the details you want then use those to paint the terrain with the correct plants. It might take a bit of work to get all of the color maps setup. I imagine it would be something like adding the texture details you want, create a colormap of them, then switch out the textures for the next colormap. Then once all of the colormaps have been created use them to arrange the plants where you want them, regardless of what textures are on the terrain.

    Of course, I might be wrong with how colormaps work, I am still getting there myself. But the guys over on the VS thread would know for sure.
     
  21. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Thanks for the suggestion.
    I assume the colormap should be created in editor manually?
    If so, it's not suitable in my case, I'll need MM to generate new terrain tiles in runtime.
    If not, then I'll have to see how long will the creating process take and if the lag it causes is tolerable...
    I'll look into this method.
     
    boysenberry likes this.
  22. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    Hey guys, my game just went live for Early Access on Steam, there should be videos popping up over the next few days, and people can post public screenshots now on Steam, etc. I do a lot of what you guys are talking about though. I only use MapMagic to create the terrains. Once the terrain is loaded it starts a script that checks to see if it's ever loaded the terrain before, if not, it generates points of interest and saves them. Then next time the game gets loaded or the players goes far enough away for MapMagic to recycle the terrain then comes back, it will load from the now present saved data.

    2018.01.17-view.jpg

    For VegetationStudio all I save are the masks. It always loads the same vegetation and will keep a "harvested" ore node or whatever out of the game once there is a mask there.

    Still a ton of work to do, there's always a way though.
     
    tequyla, trilobyteme, iddqd and 2 others like this.
  23. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    This happens in a playmode, right? Are the 0 and 1,-1 terrain are always switched each time you start the playmode? Is 1,-1 non-pinned too?

    Not quite. At this picture (the last one) one of the biomes should be connected to Invert node, while the other should be connected directly to Noise.
    The summary value of all biome masks should be 1. For instance, at one location one of the biomes could be applied with 10% opacity (0.1), that means that the other biome should have 90% opacity (0.9). Invert or Normalize nodes can calculate the value for the second biome, but in your case both biomes using the same value, that makes them blend equally at all of the terrain.

    It looks like _MEGASPLAT_ directive is enabled, but you have no MegaSplat installed. That could happen if you have removed MegaSplat files outside of Unity. To fix it go to Edit - Projects Settings - Player, in Scripting Define Symbols remove the _MEGASPLAT_ keyword.

    I'm going to look into Vegetation Studio shortly. But do not expect wonders - if there's something VS does not support it will not support even with MapMagic compatibility enabled. Obviously I will not add any new feature to it :)
    Speaking of biome textures I will try to re-use the same texture from different biomes the way it's done with the standard Texture Output, but cannot promise it - I have not even seen VS yet.

    You need some serialization and streaming system rather than MapMagic. MM can generate the initial world for you, but it will not change the terrain or serialize your changes to be loaded in another game session (I guess you will need that, right?) Your requests are too complex to be carried out with a single tool. Possibly you will need MapMagic to generate terrain, WorldStreamer to stream it, something to change the terrains (guess it could be a custom script), and something to serialize changes.

    I just wonder why it isn't possible to generate POIs with MapMagic. If you could share some details on your POI generator I would consider implementing something similar in MM so there will not be a need to save anything.


    PS sorry if I've missed something, feel free to tag me in a post.
     
    boysenberry likes this.
  24. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    To be honest, I know I am not using MapMagic to it's full potential, I'm not the smartest person here, I know that much XD Ummm, in my case, I control things like, every 2km x 2km patch of world has a "large encounter," I don't know how to do that in MapMagic....? I'd be interested in listening to someone exaplain a way to do that honestly. Every 2km x 2km chunk of land spawns an object somewhere within that space at a random location, checks to make sure it's above water and looks somewhere else if it's not, up to five times. If after five times it still can't find a random spot above water it gives up. More precise stuff like that. I use MM for biomes and things that I don't need to control as strictly.
     
  25. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Okay sounds good. Does this mean I can lock the tiles state during runtime and have it load again in the same state next play? If so, if my player drops a building on each tile in the game (which in turn locks them) does this have any performance hit (as they will no longer be generated at runtime and loaded instead I guess).

    I think really the main thing I'm asking is ; if I visit a generated chunk and then return to it sometime later can I have map magic save its state. Whether that is the basic terrain shape or any modification that the player has done do it. If map magic doesnt do this on its own is there a way to use something like world streamer in conjunction with it...or some other system?
     
    Last edited: Jan 17, 2018
  26. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    Yes, it happens in playmode and the 1,-1 terrain is not pinned, I only pinned 0,-1 for reference.
    And sometimes 0,0 terrain switch with other terrain tiles, in the last time I enter playmode it switched with 2,0.
     
  27. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    VS supports runtime vegetation placement, I can place vegetation with my own script.
    Just provide the location, rotation and scale and pick one of the vegetation in it's database, then just use it's API to add an instance of this vegetation.
    Just leave an API for us to choose which database should we add the vegetation, then it is totally possible to output directly into vegetation studio. :)
     
    iddqd likes this.
  28. IronManhood

    IronManhood

    Joined:
    Jan 10, 2015
    Posts:
    3
    What is the best way to save a .raw heightmap for mapMagic? I've tried GIMP but it is not working properly. Also, I was able to import that same file to a terrain successfully.
     
    Last edited: Jan 18, 2018
  29. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    I've got terrains that are not calling neither OnApplyCompleted nor OnGenerateCompleted.
    mapmagic7.jpg
    There seem to be more terrains in the pool than are necessary, and some of them are not performing their callbacks. All of the terrains without children have no made any callbacks. Any ideas? I believe it's something to do with the pool recycling.

    seems to only happen when I run really fast
     
    Last edited: Jan 18, 2018
  30. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    So you need something that will spawn an object on each 2nd, 3rd, etc. terrain? I guess I should add make it possible to set the scatter density value below 1, but it will spawn objects no matter if they are in the water or not. As for me the easiest solution is using a custom generator rather then post-processing all of terrains.

    You need a serialization (i.e. save game/load game) system for that. MapMagic has nothing to do with it, it's not about of serializing the playmode changes. It will not save a building, each time you start a new game session it will give you an unchanged terrain no matter if it's locked or not.

    Except the terrain names, is there weirdness in chunks behavior? Are they switched in place, not welded correctly or something?

    Don't know if GIMP supports RAW export, have not worked with it. But there's another tool that can do it called Krita.
    To export raw image from Krita:
    - make your image square
    - set image color space to 16 bit integer grayscale in Image -> Properties:
    RawExportKrita1.jpg
    - draw your heightmap. Note that this step should be done only after you switch the color space, otherwise you can have a stairs effect in height.
    - export image as R16 Heightmap (.r16), set your image resolution and PC endiannes in a pop-up window:
    RawExportKrita2.jpg
    - import r16 in MapMagic, and if you are happy with it save it to assets.
    I don't really know why but the imported image is rotated 90 degrees and flipped vertically, so take it into account when drawing your image.

    These terrains are the ones that are out of the Enable Range, but within the Remove Range. They are just disabled, they are not removed (i.e. moved to new chunks), and will be enabled again without generate once the player wants to return.
     
    malkere likes this.
  31. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    chunks are not welded well, the textures have a distinguishable line between terrain tiles. don't know if it is expected or a weirdness.
    And with Ceto's auto shore mask script(it tests the terrain height compare to the sealevel and flaten the wave in shallow water and cut water plane out under the terrain) assigned to terrain tiles in the event OnGenerateComplete, after some streaming newly generated terrain may cut all water plane in the whole terrain tile's area. Don't know if this caused by the same issue.
     
  32. grimmy

    grimmy

    Joined:
    Feb 2, 2009
    Posts:
    409
    Okay thanks for that but the line between generating a random chunk of terrain and loading back a modified pice of terrain seems blurry to me. Would I first let Map Magic generate the initial terrain and then (instantly) load in and make and modifications from save data straight after that point. Presumably my serialization will still have a way of referencing the generated chunk as the same one that was previously saved? Is this all done using identical seed numbers? (eg...if (chunk.seed=="123456789"){//Load data stored for a chunk with that seed id})...Maybe?
     
  33. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,212
    So there are cases where a terrain will go through OnDisable but then be re-enabled without calling OnApplyCompleted? I didn't know that, thanks. I should be able to plan for that and fix it.
     
  34. IronManhood

    IronManhood

    Joined:
    Jan 10, 2015
    Posts:
    3
    Thanks! Didn't know that was a thing.
     
  35. Gandamir

    Gandamir

    Joined:
    Nov 22, 2017
    Posts:
    36
    I am looking at purchasing MapMagic, but have a few questions before I do so.

    The road map shows "Implementing spline support and a spline-to-mesh feature so MapMagic will be able to generate roads and rivers.". Is there an estimate on when this might be added? I ask as Voxelland integration is still listed on the road map, but there are videos out on how to do it.

    On GitLab, there is a milestone for version 2.0 listed. Will this be a free upgrade from the 1.x version?

    Thanks in advance!
     
    fenix6390 likes this.
  36. makerspender

    makerspender

    Joined:
    Aug 20, 2017
    Posts:
    9
    Hello @Wright, just bought this asset today and so far very pleased.

    I do have an issue with biomes however. I tried following the tutorial step by step, and when I select the layer mode instead of sum, it only uses the Badlands biome, the one connected to constant with value 1. If I set the mode back to sum then it blends all layers in all biomes. The issue sounds similar to another post in this thread, however I was not sure as the other poster did not seem to use normalize and layer modes.

    As a side question, how would you easily create the biome 5x5 tiled map you create in your youtube tutorial into an island with surrounding water? If I try your other tutorial you start out with a raw input and I can't seem to connect that properly in the biome node settings.
     
  37. Harekelas

    Harekelas

    Joined:
    Feb 3, 2015
    Posts:
    864
    upload_2018-1-21_10-10-31.png
    Here is the picture, I forgot to attach it last time.
    It indeed seems to be caused by a wrong size of the texture.
    I'm using 1k*1k terrain tiles and the resolution is 513.
    The textures are 1024*1024.
    Any calculations to determine what size should I use in the texture output node?
    upload_2018-1-21_10-13-36.png
    Now I'm using 10.
     
  38. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Could you make a screenshot of your graph? Possibly you are using constant 1 at the top layer, this makes it fill all of the map, just like photoshop layer with no transparency.

    As far as I remember the tile size should be a power of two. Could not check it to be sure now, however. Guess it's worth trying to set the size to 8 or 16.
     
  39. makerspender

    makerspender

    Joined:
    Aug 20, 2017
    Posts:
    9
    Fiddling with the layers worked, looks great now.

    I still don't see how I can generate a slope or shoreline ready for water around a pinned 5x5 grid using the 3 biomes from the video tutorial. Since there are 3 final biome outputs instead of 1 height output, I have trouble following the tutorials, as I couldn't find one that covered the combination of biomes and islands.

    Ideally I would like to use a raw input using an outline of the island, and keep all height calculations up to the individual biomes, but cut away the border and flatten the shoreline all around the 5x5 pinned terrain edge.
     
    camta005 likes this.
  40. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    You a requesting a feature that will be available in v2. It will use "functions" along with biomes. Picture a biome that has an output, inputs and some parameters exposed - you can encapsulate some graph logic in a single node, reuse it, and in your case - adjust biome/function output before apply. It will be far more convenient than adding 3 shore nodes in each biome.
     
  41. Gandamir

    Gandamir

    Joined:
    Nov 22, 2017
    Posts:
    36
    Looking for some tips!

    I am a proud new owner of MapMagic, but now I have to make it do what I want. So now I need help! :)

    My Project:
    I am building a large-scale transportation (rail, trucks, etc.) game. Distances between cities will vary between a few to several hundred km, same as in a real world. Each game will use a randomly generated endless terrain map, so starting from a RAW image file doesn’t work for me.

    Ideas:
    I want to use the biome system to divide the world into multiple territory types (Flat Valleys, Rolling Hills, Foothills, and Jagged Mountains). I hope to set the height with these territory type biomes.

    From there I want to apply additional details by using biomes based upon a few factors, such as temperature and moisture. Moisture is easy with a noise map, but temperature is a bit harder to figure out a system for in endless terrain. These variables would determine which final biome we are in (dessert, lush rainforests, etc.) which can then place textures and trees.

    Questions:
    What would you recommend for terrain size and height based upon the map I am trying to create?

    How do I split a noise map into multiple biomes? I have seen how to do it with predefined maps, but not from just random noise. Is there a way to set “pick this biome if the value is between 0.3-0.5”?

    Are there any pitfalls or issues you can see that I should be aware of for the described project?


    Thanks in advance for any help!
     
  42. Gandamir

    Gandamir

    Joined:
    Nov 22, 2017
    Posts:
    36
    Another question for Wrigth:

    Is there a way to switch the middle mouse drag to be a right click mouse drag? I don't mind changing the code, but want to know that other things won't get messed up.

    P.S. Anyone know how to do the @mention for people? I can't get it to work...
     
  43. Candac59

    Candac59

    Joined:
    Sep 18, 2015
    Posts:
    106
    Hello,

    In the demo scene, I try to make the mountains wider, higher and more realistic but I'm not sure what setting to play for that. Can you help me a little?

    thanks in advance

     
  44. Gandamir

    Gandamir

    Joined:
    Nov 22, 2017
    Posts:
    36
    To adjust the types of heights that it outputs you can modify the curve on the Height panel. There are 3 Voronoi that start the height generation, then a curve that applies to the output from those, followed by some noise for bumps beofre terracing and erosion.

    Changing the curve to different shapes will modify the final terrain sharpness and steepness. Right clicking while editing the curve will add another key where you can adjust the angles at that point.

    Hope that helps. :)
     
  45. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,276
    Are you going to use sub-biomes only to place textures and trees? If so you can adjust each of the sub-biome intensity based on the parent biome height.

    You can select value range with a curve like this:
    HeightSelector.png
    but personally I'd prefer using several noise maps and blend them using Normalize:


    You can drag with an Alt + left mouse in case if you have a two-button mouse or don't want to drag with the wheel for some reason.

    Neither I do. But simply copying the name seems to pop notification.

    I'm afraid there's no slider that will make the mountains more realistic. You'll have to tune all of the nodes in height group, but as Gandamir says, curve is a good choice to start with. Then you can try experiment with voronoi cell count.
     
  46. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    Hey @Jaimi, thanks for posting your script. I'm new to MapMagic and Microsplat so I am unsure about this but is it possible to support different textures for different biomes with Microsplat? When I try to create Microsplat's texture definitions I only seem to be getting the textures from a single terrain tile even though I highlighted them all.
     
    Last edited: Jan 24, 2018
  47. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    I suppose this is because MapMagic only applies the textures that a terrain tile uses but Microsplat will require all tiles use the same texture indexes even if it doesn't have that texture in the tile. Has anyone come up with a proper solution to this yet?
     
  48. JohnTomorrow

    JohnTomorrow

    Joined:
    Apr 19, 2013
    Posts:
    135
    I was able to modify the splat output node so that it outputs all textures for all biomes. This makes things work consistently for Microsplat.
     
    twobob and camta005 like this.
  49. jaised

    jaised

    Joined:
    Jul 5, 2012
    Posts:
    17
    Is there a way to round height map values, as to normalize them so that connecting edges of the poly object that gets created are squares and either flat or 45 degree angled. Making it a low poly map for use with building placement on an RTS kind of game? Hopefully my picture of reference makes it a little more clear what I am asking. Thank you for answering my inquiry.

     
    protopop likes this.
  50. Gandamir

    Gandamir

    Joined:
    Nov 22, 2017
    Posts:
    36
    A start might be to look at the terracing option to create flatter terrain. You can then fiddle with the settings to get the slope at the angles you want.
     
    Wright likes this.