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

    bezo0

    Joined:
    Sep 5, 2018
    Posts:
    17
    Hi, everybody. Before you buy, I decided to find out here:
    How are things with objects that can be thrown away, i.e. those objects with which you can interact?
    How to implement this?

    Is it possible to do so:
    Generate a world, pin, and leave it to be always, but everything else generated (grass, trees, bushes, stones)? Ie will load the surface itself with a texture, and the surrounding objects on the first terrain?
     
    Last edited: Jan 3, 2019
  2. truefx001

    truefx001

    Joined:
    Jan 30, 2013
    Posts:
    100
    @Wright I emailed you about CTS and MM its not working properly like the guy mentioned,
    I think you assume it does work because when setting it up the first time it does display the textures (sometimes) but as soon as you try changing any values in CTS the stuff goes crazy as well I mentioned your Youtube video that you linked too on how to set it up in your own video the entire terrain gets the background texture (which is grass) so there you have it already that something is not right, on top of that I get that the node connections getting lost (disappear) or the textures in the custom generator disappear aswell painting manual with the textures on terrain tiles (via unity) is not possible as well. I tested it with the CTS team and its not CTS its something in MM. And you should give someone Moderator access to your discord they are people there posting inappropriate ads on your discord, I vote for @malkere he is the most helpful person on your discord and deserves to get MM2 for free.
     
    malkere likes this.
  3. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    Latest rts doesnt work with mm. Is there a workaround. the rts gameobject wont get created when following your tutorial.
     
  4. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,619
    The best way to keep changes in objects is to create a <Vector3, GameObject> dictionary of changed objects positions and the objects that replace the original ones. Since MM always generate the same objects at the same position, you can look up for the changed object in OnApplyCompleted event (or just use terrain's OnEnable) and replace the generated object with the one from the dictionary.

    It would help a lot if you could describe the way to reproduce this issue step-by-step, like:
    1. start the new scene
    2. create an empty MM object
    3. add CSO node to the graph
    4. switch it to CTS mode
    ....
    X. see the black terrain where the grass supposed to be
    I don't assume that CTS works flawlessly since at least one person is reporting a bug, but to fix the problem I have to find out what happens and why. I've tried testing it myself, but the reproduce instruction could lead me right into the issue.

    Oh yeah that's really so! @malkere you are the man!

    Sorry to hear that. It'd be good to know what rts is and what tutorial do you have in mind. Is it RTP? (then what tutorial do you mean anyways?)
     
    malkere likes this.
  5. MangeyD

    MangeyD

    Joined:
    Mar 11, 2014
    Posts:
    73
    what controllers are people using with Map Magic? I am trying to use Invector, I have a few of his templates, Basic Lite, Basci Pro and Melee and none of these seem to work with Map Magic. I just fall through the terrain when I run the scene.

    I really love the results you get with Map Magic but I am not sure what controller options to use with it.

    Thx for any feedback or advice you can give
     
  6. bezo0

    bezo0

    Joined:
    Sep 5, 2018
    Posts:
    17
    We already have the preservation of items and their positions. Was such a thought:
    Just when throwing the object knows what terrain it fell on and the next time it is loaded it is not loaded until the terrain is activated.
    There is still question, we have made 3 terrain and have blocked their, terrain are located from each other in two cells (0.1, 0.3 and 0.5), under start the scene booted all three terrain with habitats?
     
  7. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,619
    MapMagic uses the standard terrains with the standard terrain colliders. So if the asset work with the standard terrain it should work with MapMagic. Please check if the controller you're using supports terrain colliders. Or maybe it just require a special layers or tags setup?

    Yes, if you have 3 terrains pinned they are all saved to scene and loaded when the scene runs.
     
  8. bezo0

    bezo0

    Joined:
    Sep 5, 2018
    Posts:
    17
    I see. If I'm on some terrain, add my objects, I in any case have to block or pinned?
    Is it possible to configure the terrain separately? That is, If I need to plant one site with other trees, only one site, is it done through biomes?
    B question-request:
    Could you check how ММ behaves and how fast the scene loads with a 20x20 km map?
     
    Last edited: Jan 5, 2019
  9. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,076
    Whenever you change your graph MM regenerates all unlocked terrains in the editor. If you want to add things manually you can use a simple form, image maps, or even custom generators to place things specifically. The biome feature is to split up graphs beneath an overlying layer of separation such as a noise generator or a raw image. You can also define your own "biomes" just based on noise or height or direction or whatever. If you add things via the graph this way instead of manually they will always regenerate the same whether things are locked, pinned, generated in runtime, or whatever.

    Generating a 20x20km map can be super easy or super hard depending on what the resolution is at, the number of objects and trees being generated, etc. The speed would also be highly dependent on the CPU used and be different on different machines.
     
  10. bezo0

    bezo0

    Joined:
    Sep 5, 2018
    Posts:
    17
    It is clear that loading the same scene depends on the settings of the computer. I just need to know the time and parameters and then I can calculate how much it will take to download on the simplest computer. I believe that booting the scene on the usual computer should not exceed 40 seconds.
     
  11. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    Sorry, I meant RTP. I typed that in with my phone. I tried with multiple versions of unity.
     
  12. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,076
    Time to download and time for MM to generate and time for unity to setup the terrains are all very different things, but again all heavily dependent on resolution. If each 1x1km terrain is using 1024 resolution you would need to send 1024x1024x20x20 x 1xfloats for resolution, 4xTexturesInUse floats for splatmap data, alone, so 128 resolution would be immensely smaller than 1024. The general approach is to allow the client to generate its own data by simply passing it the seed. MM uses deterministic math so that the results of the same graph will always be the same, so long as the main seed is the same. Then you only need to pass an int and let them generate and draw on their own.

    For something 20x20km and static though... you really should have them downloading the whole scene pre-generated IMHO. Unless you need seed based generation. I use runtime seed based generation, 128 resolution, 1024m terrains, and 2-3k objects per terrain and it takes around 8-10 seconds to generate and enable the first 4 terrains around the player on my not so hot machine.
     
    Wright likes this.
  13. MangeyD

    MangeyD

    Joined:
    Mar 11, 2014
    Posts:
    73
    The controller just uses standard terrain colliders as far as I am aware, no special tags or layers, so I will check with the dev and users to see if they have any thoughts on why it is not working with your terrains.

    I was hoping a user may have commented in here as the Invector third person controller has a free version that is very good for simple purposes and I was trying to use it just to test walking around my terrain so I could tweak the design.

    I was also hoping others could talk about what controllers they are using with Map Magic as a good controller is crucial to having a good gaming experience.

    I have switched to Gaia for now and have built up a suitable terrain for my project and the Invector controller is working fine when I drop it into the scene... I do prefer Map Magic, however I need to work out why the controller doesn't work before I can go back to it as this is the third person cotroller I have invested in and I do like the way it works on other terrains.

    if you or one of your users could grab the free controller and drop it into a scene and let me know if it works for you I would appreciate that as it may be something I am doing wrong.

    https://assetstore.unity.com/packag...person-controller-basic-locomotion-free-82048

    Thanks
     
  14. bezo0

    bezo0

    Joined:
    Sep 5, 2018
    Posts:
    17
    We do not need to load absolutely everything, we need a surface only, because the world is active, it changes, there are phenomena and so on, it's easier when the surface of the terrain is active. You can make it all work and without an active terrain, but it's harder.

    I know it sounds crazy, but we have reconciled.
    I know that I can load my RAW, it will also be loaded later, as if it was generated?
     
  15. ANUBISKONG

    ANUBISKONG

    Joined:
    Nov 16, 2016
    Posts:
    16
    hi, @Wright
    When I use preview, show this.

    Then I clean preview, show this.

    All node's preview show same result.
    Windows 10. Unity 2018.3. MapMagic 1.9.4
     

    Attached Files:

  16. Prod212

    Prod212

    Joined:
    Dec 13, 2017
    Posts:
    12
    I have been recently getting this error where my character isnt spawning. Here is the error im getting:

    No Main Camera to deployUnityEngine.Debug:LogError(Object)MapMagic.Extensions:GetCamPoses(Boolean, String, Vector3[]) (at Assets/MapMagic/Main/Extensions.cs:846)MapMagic.MapMagic:Update() (at Assets/MapMagic/Main/MapMagic.cs:214)


    I have checked my scene and i only have one main camera.
     
  17. malkere

    malkere

    Joined:
    Dec 6, 2013
    Posts:
    1,076
    is your main camera tied to your character? In other words, are you starting up MM at any point where the main camera isn't in scene yet? That would throw the error. Otherwise make sure you have "Around main camera:" checked on in your MM instance.
     
  18. taylank

    taylank

    Joined:
    Nov 3, 2012
    Posts:
    111
    It would also happen if you have set MM to use objects with a certain tag instead of your camera, and there are no actual objects in the scene with that tag.
     
  19. Prod212

    Prod212

    Joined:
    Dec 13, 2017
    Posts:
    12
    Thank you for the response guys but it just randomly fixed itself; i didn't even have to check "Around main camera"
     
    malkere likes this.
  20. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,619
    This error also occurs when the camera is disabled. It literally says that MM can't find the camera object to deploy terrain.

    ANUBISKONG, are you using custom terrain material?

    It's not the size of the terrain that takes time to generate, but it's resolution. Using the same resolution you can generate the terrain of 200 meters, 2 km or 200 km in the same time. So the main question is how detailed your 20*20 km map, and how many quads per meter are you using. But I suppose that if you are not making the flight simulator or something you will be using 1024 pixels per km or more, so generating all of your 400 chunks at once will take hell lot of time (and I'm not sure if it's even possible because of the memory limit).
    MapMagic generates new chunks in a background while the game is running, and removes the chunks that are not used to free memory. As far as I know there's no way to load such a vast land at once, even if not using MM you will have to stream it somehow.

    Just to make sure: that tutorial you were talking about - is it the instructions from the manual?

    I will look into it - however I can't promise it soon. Theoretically there should be nothing that prevents it from working except an obvious case of placing the controller on the areas that were not generated yet.
     
  21. ANUBISKONG

    ANUBISKONG

    Joined:
    Nov 16, 2016
    Posts:
    16
    I found the reason. My MapMagic gameobject.transform.position is not at Zero point. If you set it at (1,0,1), preview is still work, but at (3000, 0 , 2000), the bug will show.
    I want generate a world map, and the center of it is Zero point, so I set MapMagic gameobject at (-3000, 0, -2000). I will use Offset instead.
    I still don't know why terrain turn pink when I clear preview.
     
    Last edited: Jan 8, 2019
  22. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    Hey Wright,

    No that is not the tutorial I used. I used this one:


    The video does not show that first step that is in the manual. "Enable RTP compatibility mode". I did that and everything looks to be working fine. Thank you.



    Hey one more thing.....is there another build of the beta coming soon? I cannot seem to get the current build to work at all.
     
  23. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    397
  24. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,619
    Any error in the console?

    Thanks for reporting that, will check it in a clear project.

    MicroSplat should work fine on pinned terrains only. Unfortunately I have not made MM compatible to work with MicroSplat in infinite mode via Custom Shader node - at least yet, so I can't give any advise on how to make all of the channels work.
     
  25. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    397
    Ok thanks, I'll look into it.
     
  26. bezo0

    bezo0

    Joined:
    Sep 5, 2018
    Posts:
    17
    By the way, can I write in Russian right here? =)
    I understood correctly that if I need to add 1 grid cell, for example, a house (i.e. my object), then this cell should be blocked and it will be loaded together with the first/initial cell?
     
  27. Prod212

    Prod212

    Joined:
    Dec 13, 2017
    Posts:
    12
    upload_2019-1-10_21-5-28.png
    How do i fix this texture issue on the cliff; im assuming it has something to do with the steepness but i've played around with all my terrain nodes and I can't seem to pinpoint what's causing it.
     
  28. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    I cannot get the flatten generator to work properly. It does affect the terrain, and I can see the circle of it's influence, but it will not flatten all the way. Any ideas on how to fix this?

    2.GIF 3.GIF
     
  29. ANUBISKONG

    ANUBISKONG

    Joined:
    Nov 16, 2016
    Posts:
    16
    Nothing in console.
    The pink will turn normal after I clear preview again.
    BTW, I use
    Code (CSharp):
    1. mm.chunks.Create(new Coord(x + tileStartX, z + tileStartZ), mm, pin: true);
    to pin tiles, I don't know if it is related with the bug.
     
  30. jalapen0

    jalapen0

    Joined:
    Feb 20, 2013
    Posts:
    136
    No idea if it's the same thing, but I've had my terrains turn pink. Restarting Unity was the only way I found to fix it.
     
  31. sfoust

    sfoust

    Joined:
    May 18, 2011
    Posts:
    25
    I want to use MM to prototype a location based game. I'm hoping to use the GPS position as a starting offset for the initial MM tile. Is there a simple way to tell map magic to, for example, start with tile [23,145] at the scene origin position?
    BTW, thanks for an awesome product.
     
  32. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    203
    The animals from "Malbers Animation" have amazingly well-thought-out controllers. (I used to write character controllers for commercial games so have some knowledge) They're not free but when you're ready to splurge one of the Malbers animals is a great way to go - great animation, feet track the terrain, flying controllers are fun and can transition from flying to walking to swimming (in the case of Unka the Dragon.)
     
    Wright and malkere like this.
  33. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,619
    Feel free to email me in Russian if you'd like to. The point of the forum is that other users with the similar problem can find the ways to solve it by just reading through the thread, not asking me or someone else directly. This is pointless if the problem solution or description is written in a language the majority of users don't understand. I'm not sure that you'd like to have your problem solution written in Chinese, for instance.

    Once the cell (or better call it Tile) is pinned and locked it is saved with the scene like the standard terrain, and is not affected by MM. When the scene is loaded this tile is loaded too, but no first or initial tile is generated.

    Could you please clarify what the issue exactly is? A screenshot of your graph might also come in handy.

    Is there any chance that you are using the second height output (for example, in a biome)?

    I doubt this code is related since MM uses the same internally to pin chunks.
    Does this happen in all scenes or in some particular one?

    Thanks!
    MapMagic generates the terrain around 'Marker Objects': it could be a main camera or any other object or objects with the tag you'd like (could be set in General Settings). It does not matter if the camera or the other marker object is located at 0,0 or 23,145 - it will create the first tile(s) around it.
     
  34. sfoust

    sfoust

    Joined:
    May 18, 2011
    Posts:
    25
    Thanks for the replay however I seemed to have stated my question poorly. Since I'm hoping to prototype a location based game, where the tiles may be many miles away from the origin of the scene (where I'm told floating point precision would be extremely poor) I'm hoping there is a simple way for MM to allow me to specify a tile offset value. This way tiles that would normally be drawn far away would now be drawn at the origin (rather than tile [0,0] at the origin it could now be [23, 145], for example). Hopefully the following images will help illustrate my need.

    upload_2019-1-12_21-39-5.png
     
  35. ANUBISKONG

    ANUBISKONG

    Joined:
    Nov 16, 2016
    Posts:
    16
    All projects and all scenes.
    I update Unity to 2018.3.1. The bug still there
     
  36. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,094
    I wrote a script that procedurally places a pool of rocks in front of you as you cross a terrain.

    Im thinking to have mapmagic generate the terrain and i can handle the kind of close up stuff using my script in conjunction with it.

    Im wondering if this will save some cpu because it is re-using the same pool of rocks, and just placing them nearby as you walk, compared to MapMagic which i presume generates all the procedural items in one go when it generates the terrain? Is that correct? Like does mapmagic generate all of the terrain rocks at one time for a single terrain?
     
  37. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,094
    Does anyone know the best solution for using navmesh agents on mapmagic terrain?

    Does the navmesh component work, and fast enough?

    Or are people using some kind of navmesh alternative (do those exist?) for npcs to navigate freshly generated terrain?
     
  38. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    203
    I've had good results using the A* pathfinding package, which is a real tour-de-force of software architecture - huge power, easily accessible, and deep grounding in (IMHO) state of the art. Highly threaded implementation for good perf. Used successfully on mobile with MM in infinite terrain mode - there are different "flavors" for procedural terrains (and a great demo of the author's own procedural demo. Super-recommended.
     
    Wright and protopop like this.
  39. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    203
    Hello @Wright I'm wondering what this code does in Generate()

    if (chunk.terrain.materialTemplate != null) GameObject.DestroyImmediate(chunk.terrain.materialTemplate); //removes custom shader textures as well. Unity does not remove them!

    I suspect I have something set up wrong, because these keeps trying to delete my material and throwing an error. I'm using Microsplat together with infinite terrain. Considering just commenting this line out but would love to understand the reason it's there first.
     
  40. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    203
    By the way: I'm mainly seeing this errors from the editor rather than at runtime.
     
  41. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,094
    Thank you! Just the kind of mini review i was hoping to get. Im going to check it out:)
     
    mmaclaurin likes this.
  42. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,619
    Unfortunately there's no way to offset tile indexing. It's core MM code and was not supposed to be changed. But you can try offsetting MM object itself, that might solve some floating point issues like z-fighting or shadows, but still will have problems like object placement precision. However to make these problems really visible the offset should be extremely high (hundreds of thousands or even millions units).

    Well then it should be easy to reproduce, but I can's find out what exactly to do. Could you please describe the steps like:
    - start the new scene, add MapMagic object
    - move it to 3000,0,2000
    - enable any node preview
    - disable the preview and see the pink terrain
    What am I missing?

    Just like to mention that MapMagic uses objects and terrains pool too. Once the camera is moved to the new position, previous chunks are not deleted, but disabled, moved to the new location and forced to wait until the data is generated. Once it's done they have all of the objects re-located too, not deleted and created again.

    If by 'one time' you mean one frame - then no, objects are placed in a co-routine manner to avoid hiccups. This co-routine takes 30 ms per frame (could be changed in settings). Note that I'm talking just about placing objects (changing transforms positions/rotations/scale), of course generating (processing the objects node in the graph) is done in a background thread and is not bound to frames at all.

    It's hard to say exactly why it's needed since I don't even know what generator you are talking about, and I've got no v1.9.4 close at hand to perform a search now. As far as I can see it destroys the terrain material (possibly on chunk remove? on preview disable?), since it's a game object and not removed by Unity (commenting a code could be handy:)). Removing this like can result in creating the unused materials and thus memory leak.
     
    protopop likes this.
  43. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,094
    Thank you:) i THINK i get it. I was thinking we could add more detail close up using a seperate script and seperate pool. But it sounds like MM does a great job already of being efficient.

    By pooling, does it mean lets say we add a ton of rocks, and MM generates 300 rocks on a terrain. And when we goto the next terrain lets say there are again 300 rocks, do you mean it moves the previously initially generated rocks over anmd positions them so it doesnt have to make new instances? And if theres more then it generates more and adds that to the rock pool. And if there is less it just leaves a few in the pool invisible?

    Just writing this, i can see what i meant clearer by my previous question. If MM generates lets say all the rocks on a terrain and places them, and what i am thinking is instead use my own script to procedurally place from a pool of about 30 rocks as i walk across the MM terrain, so MM wont have to generate all those rocks, just the terrain and trees and grass, and i can just stream in objects from a smaller pool in addition to the MM big terrain stuff.

    Sorry if i dont make sense, i have a hard time describing some of whats in my head:)
     
  44. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,619
    Yes, that's right. Except maybe MM removes objects too - if they are not used. Imagine the only chunk in the world that has 1000 rocks, while others have 300. Once this chunk is disabled there's no need to keep all of the 700 objects, so MM frees memory.

    I'm not that persuading you to use MM here, but are you sure this script wouldn't be a premature optimization? You don't know if those objects would really be a bottleneck, or could this bottleneck be solved with LOD.
     
    protopop likes this.
  45. ANUBISKONG

    ANUBISKONG

    Joined:
    Nov 16, 2016
    Posts:
    16
    New project and new scene, all default settings.

     
    Last edited: Jan 16, 2019
  46. Prod212

    Prod212

    Joined:
    Dec 13, 2017
    Posts:
    12
    [UPDATE] I fixed it, i didn't realise my gizmo was disabled on my scene.


    Hi, i have never been able to make preview on terrain work. Every time i get an error and as you can see on the image below, i am just using a simple gradient node setup for the base of blending the biomes together. Also keep in mind that this doesn't only happen on this terrain; the preview on terrain function doesn't work on any of my other map data. upload_2019-1-16_10-59-34.png
     
    Last edited: Jan 16, 2019
  47. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,094
    Id rather use mapmagic completely - it gives great results - and you're probably right about it being a premature optimization. I understand a bit more how map magic works now:)
     
  48. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,619
    Thanks! I could reproduce it, and will look for the way to fix it tomorrow.
     
  49. mmaclaurin

    mmaclaurin

    Joined:
    Dec 18, 2016
    Posts:
    203
    Hi Wright, sorry I was unclear on my previous post about this code:

    Code (CSharp):
    1. if (chunk.terrain.materialTemplate != null) GameObject.DestroyImmediate(chunk.terrain.materialTemplate); //removes custom shader textures as well. Unity does not remove them!
    This is actually your code in the base implementation for Generate(). Sorry I don't have the file name in front of me but can dig it up later if it doesn't ring a bell.

    tl;dr This code fails trying to delete my custom material and I'm trying to figure out why it's trying to do that.
     
  50. Gaidzin

    Gaidzin

    Joined:
    Nov 14, 2012
    Posts:
    11
    Update to Unity 2018.3.1f1 MapMagic 1.9.4 + CTS 1.8.0 don't work.

    Terrain don't render. "Draw Instanced" is unchecked.

    Have some errors on console:
    Missing splat textures - add some textures to your terrain