Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    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. monoRAIL

    monoRAIL

    Joined:
    May 22, 2010
    Posts:
    7
    I recently released Mars Flight VR, which uses Map Magic to recreate 35 square kilometers of Jezero Crater, the landing site for the next NASA mars rover.

     
    taylank and camta005 like this.
  2. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    214
    MapMagic is contributing to a a significant slowdown in the editor, even for scenes that do not use MapMagic

    upload_2020-6-8_7-27-56.png
     
  3. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    Is there any way I can reproduce this slowdown? Does it happens after opening some specific scene or starts right after loading Unity, no matter what scene is initially opened? Is it MM1 or MM2?
     
  4. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    214
    After disabling that function

    upload_2020-6-8_7-32-50.png
     
  5. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    214
    "Is there any way I can reproduce this slowdown?"

    Load a scene with 41K objects will probably do it.

    It doesn't matter what scene is opened or when, so long as the scene has a lot of objects

    I think the problem is Unity is just slow generally, and [DrawGizmo(GizmoType.NonSelected | GizmoType.Active)] in a large scene will never work

    Map magic 1
     
  6. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    Hello, I'd like to make a few suggestions:

    Currently Detail Resolution Per Patch is hard coded to a value of 8. Please allow us to set this value in the Map Magic Object inspector.

    BaseMapResolution seems to default to 512. Is there a way to control this value besides manually setting it before generation begins?

    One other issue. The Control Texture Resolution on generated terrain appears blank in the inspector. Do you know why this is?
     
  7. annacpear

    annacpear

    Joined:
    Apr 29, 2020
    Posts:
    7
    Hey all - I’m seeing a strange issue with MapMagic and VSPro in my HDRP project - I’m using the VSProObjects node to generate trees/vegetation, but they disappear in the editor when game is set to “Maximize in Play”, and they don’t appear in the .exe when exported. However, using the VSProMaps node has grass showing up correctly in all situations. Do you have any ideas why this could be happening?
     
  8. annacpear

    annacpear

    Joined:
    Apr 29, 2020
    Posts:
    7
    Hi, were you able to figure out this issue?
     
    Nunez-Torrijos likes this.
  9. annacpear

    annacpear

    Joined:
    Apr 29, 2020
    Posts:
    7
    Hi @Wright, I'm getting the same issue that someone else appears to have had in the forums, but I didn't see any resolve being mentioned. The error occurs using VSPro in MM1 when automatic calculation is turned on - in code the amount of vegetation cells grows as the maps grows, and then I get this error. Re-initializing persistent storage doesn't do anything unfortunately.

    Exception: Vegetation System cells number has a different count rather than Persistent Storage./nPlease re-initialize Persistent Storage.
    MapMagic.VegetationStudio.VegetationStudioTile.FlushObjects (UnityEngine.Rect terrainRect, System.Boolean clearCache) (at Assets/MapMagic/Generators/VegetationStudio/VegetationStudioTile.cs:232)
    MapMagic.VegetationStudio.VegetationStudioTile.OnDisable () (at Assets/MapMagic/Generators/VegetationStudio/VegetationStudioTile.cs:81)

    Any ideas on how to fix this? Thanks in advance.
     
    Nunez-Torrijos likes this.
  10. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    I have tracked a performance issue to "Dirty heightmap" which is basically just a call to TerrainData.DirtyHeightmapRegion. No matter what I set the split frame value to (tried as low as 5), this operation takes up the same amount of time each frame (~54ms). My terrains have a heightmap of 2049 x 2049, very large I know but I thought reducing split frame would alleviate this problem . . .

    Any idea what's going on?
     
  11. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    Thanks, will try to reproduce it for the next MM1 bugfix!

    Got it, will expose this setting in Grass Output.

    Currently there is no way to do this, but I'll try to expose it too.

    It's equal to the heightmap resolution (npot + 1), and thus does not correspond to any of the resolutions from list.

    This error just says that Vegetation System cells number has a different count rather than Persistent Storage. You've got to re-initialize Persistent Storage :) In VegetationStudioPro object -> VegetationSystemPro sub-object -> Persistent Vegetation Storage component -> press Initialize persistent storrage.

    Split frame just tries to split operations in several frames, but it does not guarantee that if you set the value of 5 ms it will take no more than that - it depends on what operation is currently running - some could be yielded for the other frame, but some could not.
     
  12. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    Interesting! I would have thought this would cause issues with texture alignment, but as that doesn't seem to be an issue, obviously I was wrong. Still, I wonder if there is a specific reason for using that value and not the heightmap value - 1, to keep the alphamap texture as a power of two value? I guess it doesn't matter either way?

    Hmmm, this sounds different than what the manual says, and my own understanding looking at the code. From the manual:
    "Split Frame: number of pixels in stripe that are processed per frame in Set Heights Delay LOD (or send to texture in Texture To Heightmap). If resolution is 513, Split Frame of 129 means that terrain will be applied in 4 frames (four 129*513 stripes). Decreasing this value will make terrain apply smoother, but will increase the total apply time."

    Is there a minimum value for this? I would think you'd be able to set it as low as you want at the cost of increased apply time.

    Edit1: I think there must be some overhead for using these methods which is based on the underlying resolution of the terrain's heightmap. I have found a heightmap resolution of 513 is the maximum acceptable value beyond which the performance impact becomes too much, even when using a low split frame value.

    Edit2: I thought of two suggestions. I hope you don't mind!
    1. Add support or an approved workflow for manually controlling which tiles are loaded at runtime. Currently, the MapMagicObject calls the Tile Manager's Update method each frame, which I understand is meant to make the process of loading the tiles easier for the user. However, in my situation (and I imagine others could find this useful as well), I want to make use of your procedural generation system, without relying on the Tile Manager to decide which tiles should be loaded.

      Really, all that is need is a way to disable the Map Magic Object's default behavior of calling TileManager.Update. I know it's as simple as commenting out that line of code to get what I want, however I am hoping to make my own Asset Store product completely compatible with yours, and I obviously don't want to have to tell my users they need to change your code in order to get things working nicely. I hope that makes sense!

    2. When using the Apply Type "Texture To Heightmap", it would be great to have an option for what data should be synced via TerrainHeightmapSyncControl. I know it's an advanced topic and would be hard to explain the use of such an option to most users, but for advanced users some way to control this would be nice, as it's not always necessary to have terrain changes reflected on the CPU side (I'm thinking distant terrain which don't need grass or physics).

    Edit3: I found a small bug. In some instances the corners of terrains do not align properly. I noticed there is a WeldCorners method that is called when the terrains LOD switches, however there are some instances where Draft terrain are not used at all; in these situations WeldCorners is not called. As a result, sometimes the corner x value and corner z value stored in a terrains Edges container do not match, even though they should represent the same value. When the Edges are written to the terrain, the z values are written last so corner z value becomes the final value of the corner; as such, terrains align properly with their left/right neighbors but not their top/bottom neighbors at the corners.

    upload_2020-6-12_19-9-53.png

    This was tested in the tutorial scene with Drafts disabled.
     
    Last edited: Jun 13, 2020
  13. othercrow

    othercrow

    Joined:
    Oct 19, 2013
    Posts:
    16
    Hey @Wright I'm using MM2 and am getting floating objects on draft tiles.
    The floating objects align to the ground correctly when I get closer and the tile becomes a "Main" tile instead of a "Draft" tile.

    Is there any way to fix this or just not spawn objects on draft tiles?
    Either would be fine, just need to not have floating trees on the horizon.
    OculusScreenshot1592058332.jpeg
     
  14. SilverTiger24

    SilverTiger24

    Joined:
    Apr 14, 2018
    Posts:
    2
    Hey all, looking at investing into some of these tools for a project I am going to be starting soon. Couple questions if anyone would be so kind to answer.

    1. Any particular benefit or drawbacks of getting MapMagic vs all the modulus for MapMagic 2?
    2. Want to be able to draw roads and allow the placement of buildings / towns / cities by players. So is this flexible enough to allow minor in-game terrain changes? Like flattening areas and such.
    3. Would like to be able to implement randomly generated cave systems or dungeons (using other assets), so Voxeland seems like it would help with this. Does it work with maps generated by both MapMagic and MapMagic2?

    Bonus Q: any discord server for this?

    Thanks in advance for any input.
     
  15. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    I'm having two issues with Vegetation Studio that I have been unable to solve. Both are not issues in the editor or when using your product as you designed it, allowing Map Magic Object to determine which tiles should be loaded. It is only when loading tiles manually via my own Asset Store product that I run into issues. The two issues are:
    1. I purchased Map Magic Objects and am using the VS Pro Objects node. In VSProScene, everything works fine, however in my own scene where I am manually loading tiles, I cannot get the trees to load. I see instances of the trees in the storage package, but for some reason they are just not being applied in the scene.The issue was due to custom origin option with my tool. Basically, Map Magic expects coord 0,0 to always be at scene position 0, 0 as far as I can tell, and calculates object positions and other stuff based on that fact. It would be nice to be able to set an alternate origin, or when a tile is created, set its position manually, however I have managed to work around the issue so it's no big deal if it's solved any time soon.
    2. The grass drawn by Vegetation Studio Pro disappears and reappears causing a flickering effect when new terrain are added to the scene.-Issue was caused by deactivating terrain at wrong time - fixed
    In my use case, I have to have the terrain deactivated until they are finished generating, so I place them as children of a deactivated game object until generation completes, call SetActive(false) once they are done generating, and then set their parent to null so they are root objects in the scene. This causes the terrain to only be added to Vegetation Studio after generation has been complete. Could that be causing a problem?

    Here is the basics for how I am constructing/loading tiles manually:

    Code (CSharp):
    1. var tile = TerrainTile.Construct(mapMagicObj);
    2. tile.Pin(false);
    3. var terrain = tile.ActiveTerrain;
    4. var go = terrain.gameObject;
    5. go.transform.parent = deactivatedTempParent;
    6. tile.coord = new Den.Tools.Coord(cellOnWorldGrid.Column-1, cellOnWorldGrid.Row-1);
    7. mapMagicObj.tiles.grid.Add(tile.coord, tile);
    8. tile.StopGenerate();
    9. tile.main.data.Clear();
    10. tile.StartGenerate(mapMagicObj.graph, true, false);
    I then wait on the tile to finish in a coroutine, and once it does, I deactivate it and change its parent to null as described above.

    I know the tile coords are correct. I'm not sure if I'm doing something in the wrong order or missing another method call. I hope you don't mind me posting this code, as it's all just public API calls and not anything from your actual classes. There is a lot of other stuff going on with my code, but I hope that is enough to give a clue on what might be going on.
     
    Last edited: Jun 15, 2020
  16. Justice0Juic3

    Justice0Juic3

    Joined:
    Apr 29, 2013
    Posts:
    185
    Just wrote my review 3 days ago :) and thought showing my work a little bit.
    I think I've used for MapMagic (evaluation version) for a little less than 2 hours but I'm loving it! :p



    ^ The screenshot that I shared at UnityConnect
     
    Bartolomeus755 likes this.
  17. uberwiggett

    uberwiggett

    Joined:
    Jun 26, 2015
    Posts:
    103
    A little confused about MM2 on the store, it says out of the box compatibility with VSPro, but to follow the video from a few pages back where you can setup object nodes with VSPro, do I need to purchase the objects module as well?

    edit: nevermind, just re-read splines and realised you need the objects module for it to work so have to purchase it now.
     
    Last edited: Jun 15, 2020
  18. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    As I recall, DirtyHeightmapRegion works per-chunk - I mean internal Unity terrain chunk. So no matter how narrow the stripe is - it updates the full chunk anyways. Have not looked into it for quite a long, so might be missing something.

    I already have a feature request "Disable terrain generation in playmode". As I see it now it will make MM not call tile manager in any way unless you manually pin a tile. Is that what you mean?

    I'll think it over - for now I've got more questions than answers (where to expose that? MM object or node? What to do with the not synced chunks?). I'll promise to consider this idea next time I will be looking into height apply, but yet can't promise it will be implemented.

    Thanks! Adding to bugs list, will try to reproduce soon.

    I've made some changes in v.2.0.5 (already available at the Asset Store) that might affect this. Could you please check if this issue is still relevant?

    May be the most important one in your case - MM2 does not support Voxeland. However MM1 does not support splines out of the box. There are third-party spline nodes sets at AS, but I haven't looked into them.

    Flattening - sure: MM2 doc! You can create simple towns/villages in MM as well: MM1 village tutorial.

    Discord link. However it's just a server where users share their own knowledge, screenshot, advises, etc. I'm not a frequent guest here, so don't use it as a support channel.

    Sounds like a difficult task :) Will try to think about it, but doubt it could be made.

    MM2 Core has a map output for VSPro, and can create the map rules for VS. However, you are right that it cannot output objects since there are actually no objects without Objects module.
    Please note that Unity 2019.2 or later required to make this compatibility work.
     
    gilley033 likes this.
  19. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    That makes a lot of sense so I am guessing you are right. That's too bad, hopefully Unity will expose some control over that in the future.

    Yes, that is exactly what I mean. Really, it's not a big deal since you can disable the Map Magic Object and everything works okay, so long as you run the Coroutine Update from another script. The Pin method also calculates the remoteness of the pinned tile, which is unecessary when not using your loading logic.

    I understand. For my purposes having the option on MM object would be sufficient.

    Cool, thanks for taking the time to consider it!
     
  20. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    Hi again. Is VS Pro Object node intended to be used in a production project? Currently I see a huge performance hit when using it when there are a large number of trees or objects to add to Vegetation Studio storage. The reason is clear, MapMagic adds all instances created by the node to Vegetation Studio storage in a single fame.

    Are there plans to change that? Are there any issues with changing this operation to be performed across multiple frames? Or should vegetation be baked to the storage container after being generated (either in play mode or the editor), and then the VS Pro Object node disconnected from the graph?
     
  21. SilverTiger24

    SilverTiger24

    Joined:
    Apr 14, 2018
    Posts:
    2
    Thanks for the reply, though still a bit on the fence of which one to go with. Voxeland definitely looks cool, so would love to be able to implement that easily down the line if needed. And I could live with trying to implement my own road system or get a third party one to work with it. So MM1 seems the way to go, just want to make sure I am not missing out on anything cool MM2 has (or will have) that the other does not.

    If there is a readme somewhere that show what one has over the other I could look at that. Just couldn't find one anywhere. Also, are you still adding stuff to MM1 or will you be focusing on MM2 from now on?

    Played around with MM2 last weekend and it is really a great tool. Your videos have been awesome as well. Really looking forward to diving into this.

    EDIT: Found the description you posted on the MapMagic 2 forum *facepalm*
     
    Last edited: Jun 16, 2020
  22. michaelfritz

    michaelfritz

    Joined:
    May 11, 2020
    Posts:
    2
    @Wright Hello,
    I'm using MapMagic along with Vegetation Studio Pro. I've followed the tutorial to set up VSP, replicated each step done in the video, and I'm getting an issue where trees in VSP aren't spawning unless the editor scene view is active and visible. If the scene view is active - trees spawn as expected. If the editor scene view is not active or visible (if the game window is maximized or the game is built into an .exe) trees won't spawn.

    I've noticed that when the game is run and the scene view is NOT active, only the first terrain chunk spawned receives a VSP "Unity Terrain" component. All other terrain does not have that component. I've tried resizing the VSP terrain extents (auto-recalculate is turned off) and that doesn't help. Even with that first chunk having a Unity Terrain, trees won't spawn on it.

    Once I un-maximize the game and the editor scene view is shown, all terrain chunks immediately receive a Unity Terrain component and trees spawn just fine.

    Do you have any idea why this would be happening?

    My Unity version is 2019.3.7f1 using HDRP 7.3.1
     
  23. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    I'd rather recommend using the VS map output to create woodlands. VS objects is more for the individual trees, where the placement of each tree matters. You can also combine maps and objects outputs of the same tree, and use maps to create forests, while use objects to create trees at the key locations.

    Is it MM2 or MM1?
     
  24. annacpear

    annacpear

    Joined:
    Apr 29, 2020
    Posts:
    7
    Hi @Wright - I'm working on this project as well. We are using MM1.
     
    michaelfritz likes this.
  25. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    I could reproduce this issue - but it seems to be happening with VSPro only, even if there is no MM object in scene.
     
  26. annacpear

    annacpear

    Joined:
    Apr 29, 2020
    Posts:
    7
    Hi @Wright, I took your suggestion and tried to isolate the problem further. I am able to see trees in the maximized editor/.exe if I use VSPro without MM1, instead using a Unity terrain and enabling ‘runtime spawn’ on my tree asset. However, when I’m going through the MM1 terrain (& un-enabling runtime spawn, spawning through a scatter node in the MM1 editor) the issue still seems to occur where the trees don’t show up in the maximized editor/.exe, but will still appear in the minimized editor. Do you have any other suggestions for what I could investigate?
     
  27. annacpear

    annacpear

    Joined:
    Apr 29, 2020
    Posts:
    7
    @Wright Also one more issue we have is that when we are set to generate infinite terrain, automatic calculation is turned on & when persistent storage has been reinitialized, as the terrain grows we get stuck at this issue in the FlushObjects() function - "system.VegetationCellQuadTree.Count != storagePackage.PersistentVegetationCellList.Count". The error message advises a reinitialize but doing so will still have it get stuck at the same spot. It appears the VegetationCellQuadTree grows as more terrains are added but the PersistentVegetationCellList always is staying the same size from one there was just one terrain. Is there a setting somewhere that should be telling the persistent vegetation to grow its cells as more terrains are added on? Thank you for your help :)
     
  28. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    When you say, "automatic calculation is turned on", do you mean on Vegetation Studio Pro? For runtime added terrain you have to disable automatic calculation and set the total size of your "world" (the space where all procedurally created terrain will lie in) in the editor so that VSP can calculate the number of cells correctly.
     
    Nunez-Torrijos likes this.
  29. annacpear

    annacpear

    Joined:
    Apr 29, 2020
    Posts:
    7
    @gilley033 That makes sense, thanks for explaining. On this same topic, are there any other steps needed to be taken to have vegetation appear on the new terrains? It seems that they will only appear on the first terrain I am spawned in but won't extend to the new terrains as the map grows.
     
  30. gilley033

    gilley033

    Joined:
    Jul 10, 2012
    Posts:
    911
    I was having some issues with vegetation not appearing on my terrain as well, however in my case it was because I was spawning tiles manually at locations Map Magic was not expecting, and so the world space area it sent to vegetation studio was not accurate. But if you are using Map Magic's automatic loading I don't think that's your issue . . .
     
  31. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    Let me clarify it to make sure we are talking about the same issue. Here is the bug I've got:
    - I open the MM's VSPro demo scene
    - Then close the scene view, leaving the game view the only render window.
    - Then start the playmode. The trees and the grass appear as they should.
    - Stop the playmode - and see that nor trees appeared, neither grass.

    The same issue happens if I disable MM, create the terrain manually, add it to VS terrains list, and paint some trees on it (with the persistent storage), and close Scene window. Trees do appear in Game view in playmode, but do not appear when I exit the playmode. My guess is that VSPro uses the scene camera position to calculate tree visibility level (full/billboard/off), and if there is no camera - no trees are rendered.

    Note that for me the trees are still appearing in the playmode, even when the scene view is closed. If they do not appear for you - I recommend:
    1. turn off automatic area calculation (in Vegetation System pro - Terrains);
    2. set the area size manually (to the size that significantly exceeds terrain size)
    3. initialize the persistent storage after that (Persistent Storage component - Settings - Initialize persistent storrage). It should be done every time area size changes.

    If you've done all that and still have an issue that the trees do not appear in the playmode - please send me the scene so I could look into it.

    Might be related with the area change in playmode. Cross-check that you have automatic area generation disabled.
     
  32. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    136
    I just got MM2 and went through the first tutorial. My frame rate dropped by 70-80. This is just the tutorial and a play prefab from another scene. No other models in the scene. Is MM2 really that heavy?
     
  33. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    MM uses the standard Unity terrains internally, and it should not create a significant overhead while generating chunks in separate thread. It's hard to say why you've got an FPS drop - I guess the first step in looking into it should be removing MM component (not object with terrains) and checking whether FPS changed.

    PS: if you've got only MM object - then are you comparing MM performance with absolutely empty scene?
     
  34. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    136
    I only have the MM object. All terrains are place inside that object. I am comparing it to a scene that is relatively empty. Basically a plane, and a couple of rooms, player and two AI characters. It runs at about 120fps. MM2 with the same character and no AI drops to about 45-55. I would expect a frame drop by adding MM just not that much. I am using the MM2 demo scene.
     
  35. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    136
    I was able to get the frame rate up to around 60 - 65 by removing all of the grass and stones. Is there anything else I can to to bring up the frame rate? I'm afraid that when I bring villages and AI into the scene it will dip below acceptable frame rates. I have Vegetation Studio (not pro). Would incorporating that to handle trees and grass be more performant? Is there a performance difference between the normal and pro version? What about MegaSpat? Anyone have any thoughts?
     
  36. Artaani

    Artaani

    Joined:
    Aug 5, 2012
    Posts:
    418
    Hello, Wright

    Unity crashes when I try to import Map Magic into a project.
    Unity version 2017.4.40f1 (that is latest 2017 LTS version)

    I tried that in clean project, so to reproduce it just create a new project on this Unity version and try to import Map Magic.

    ==== UPDATE ====
    Found a workaround.
    In import window I should disable a few folders:

    works now.jpg

    Now sure which exactly folder cause a crash but now it works.
     
    Last edited: Jun 29, 2020
  37. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,550
    There should be no performance difference between MM and a regular hand-painted Unity terrain.

    Your terrains must be different, such as you have more grass/etc on the MM settings.

    You have to optimise as usual, such as LOD objects, and use GPU Instancer for all objects, including grass.
     
    Wright likes this.
  38. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    747
    Hi. I'm trying out MM2. Few bugs. On 1K resolution it generates fine.

    On 2K resolution it breaks the MM setup and throws null reference.
    NullReferenceException: Object reference not set to an instance of an object
    MapMagic.Core.GUI.MapMagicInspector.DrawGUI () (at Assets/Packages/MapMagic/Core/Editor/MapMagicInspector.cs:176)


    Can't fix it, have to create a new MM object every time.


    When 2x or 4x interpolation is enabled it throws exeptions:

    Exception: Routine error: System.ArgumentException: X or Y base out of bounds. Setting up to 130x130 while map size is 129x129
    at UnityEngine.TerrainData.SetHeights (System.Int32 xBase, System.Int32 yBase, System.Single[,] heights) [0x0009f] in <2c805c0606c24d7cae94a6cadb8e9d4a>:0




    Also can't find a way to set the material.. Only in generated terrains manually.
     
  39. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    136
    I am getting the following error when I stop runtime:

    NullReferenceException
    MapMagic.Nodes.ObjectsGenerators.TreesOutput+ApplyTreesData.Apply (UnityEngine.Terrain terrain) (at Assets/MapMagic/Generators/Objects/Runtime/ObjectsOut.cs:405)
    MapMagic.Terrains.TerrainTile+<ApplyRoutine>d__41.MoveNext () (at Assets/MapMagic/Terrains/TerrainTile.cs:787)
    Den.Tools.Tasks.CoroutineManager.Update () (at Assets/MapMagic/Tools/ThreadManager/CoroutineManager.cs:147)
    MapMagic.Core.MapMagicObject.Update () (at Assets/MapMagic/Core/MapMagicObject.cs:144)
    MapMagic.Core.MapMagicObject.EditorUpdate () (at Assets/MapMagic/Core/MapMagicObject.cs:136)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Delegate.DynamicInvoke (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <c10752821eec4acbb89ccd53fbbc5e27>:0)
     
  40. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    Take a look at Stardog's post. He is saying exactly what I was going to write.

    Glad you could sort that out! I will check if the compatible assets demo scenes make Unity 2017 crash, as well as VS compatibility scripts.
    2All: It's about MM1, not MM2. MM2 is not compatible with 2017 at all.

    If you save the scene with an error - will it remain after loading it? If so, could you please send me this scene and the graph used with it (and their meta files)?

    You can assign custom material in MM object - Terrain Properties - Material Template.

    Could you please send me your graph with the scene where it's used (and their meta files), and the description of steps to reproduce this error?
     
    Artaani likes this.
  41. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    136
    I was able to take care of the error. I had a tree node hiding that was not connected to anything. I removed it and the error went away.
     
  42. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    136
    I was was able to get the frame rate up by using Vegetation Studio Pro. Now I have another problem with them. Does anyone that uses VSP know why after added the VSP component the amount of time it take to go into play mode goes up be 7 seconds. After adding grass and trees that amount of time goes up to 20 seconds. I'm in contact with Lennart for some answers but if anyone has any thoughts I'd appreciate it
     
  43. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    Using VS Pro can really increase the playmode starting time since it's doing some initialization routines on startup, however I've never experienced starting it that slow. 20 seconds is really a lot. Have tried VS Pro demo scene that comes with MM? Is it slow as well? And BTW, what are your machine specs?
     
  44. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    136
    I just tried the VSPro demo scene and all I get are a ton of reoccurring argument out of range errors and nullreferenceexceptio errors relating to VSPro. The startup time is around 5 seconds however, none of the vegetation shows. My system specs are Intel i7, 2.24, 16 gigs ram, nvidia gtx1050. Window 10, Unity 2019.3.1f1.

    Lennart from AWESOME just got back to me and he seems to think that it is because new terrains are being added at runtime.

    His quote is, "I think the issue is that you add new terrains run-time without having a pre defined world area. Then things reload every time you add/remove a terrain size the world size changes".

    I thought having a predefined world happens when my graph is generated.
     
    Last edited: Jul 3, 2020
  45. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    136
    Why is my terrain still still producing trees? I removed the tree generators. I am also getting these errors.

    NullReferenceException
    MapMagic.Core.GUI.FrameDraw.CreateLinePoints (UnityEngine.Terrain terrain) (at Assets/MapMagic/Terrains/Editor/FrameDraw.cs:181)
    MapMagic.Core.GUI.FrameDraw.CreateTerrainLine (UnityEngine.Terrain terrain) (at Assets/MapMagic/Terrains/Editor/FrameDraw.cs:171)
    MapMagic.Core.GUI.FrameDraw.UpdateTile_OnTileApplied (MapMagic.Terrains.TerrainTile tile, MapMagic.Products.TileData tileData, MapMagic.Products.StopToken stop) (at Assets/MapMagic/Terrains/Editor/FrameDraw.cs:51)
    MapMagic.Terrains.TerrainTile+<ApplyRoutine>d__41.MoveNext () (at Assets/MapMagic/Terrains/TerrainTile.cs:799)
    Den.Tools.Tasks.CoroutineManager.Update () (at Assets/MapMagic/Tools/ThreadManager/CoroutineManager.cs:147)
    MapMagic.Core.MapMagicObject.Update () (at Assets/MapMagic/Core/MapMagicObject.cs:144)
    MapMagic.Core.MapMagicObject.EditorUpdate () (at Assets/MapMagic/Core/MapMagicObject.cs:136)
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Delegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Delegate.DynamicInvoke (System.Object[] args) (at <437ba245d8404784b9fbab9b439ac908>:0)
    UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <c10752821eec4acbb89ccd53fbbc5e27>:0)

    NullReferenceException: Object reference not set to an instance of an object
    MapMagic.Core.GUI.MapMagicInspector.DrawGUI () (at Assets/MapMagic/Core/Editor/MapMagicInspector.cs:176)
    Den.Tools.GUI.UI.Draw (System.Action drawAction, Den.Tools.GUI.UI+RectSelector rectSelector, System.Boolean offsetAfterDraw) (at Assets/MapMagic/Tools/GUI/Editor/UI.cs:218)
    MapMagic.Core.GUI.MapMagicInspector.OnInspectorGUI () (at Assets/MapMagic/Core/Editor/MapMagicInspector.cs:98)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass55_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <c10752821eec4acbb89ccd53fbbc5e27>:0)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  46. illinar

    illinar

    Joined:
    Apr 6, 2011
    Posts:
    747
    New bug. When MM object is made into a prefab, it stops working. MM2. No addons. Reloading never helps with any of these. 2019.3.15


    ArgumentNullException: Value cannot be null.
    Parameter name: objectToUndo
    MapMagic.Core.GUI.MapMagicInspector.DrawGUI () (at Assets/Packages/MapMagic/Core/Editor/MapMagicInspector.cs:176)
    Den.Tools.GUI.UI.Draw (System.Action drawAction, Den.Tools.GUI.UI+RectSelector rectSelector, System.Boolean offsetAfterDraw) (at Assets/Packages/MapMagic/Tools/GUI/Editor/UI.cs:218)
    MapMagic.Core.GUI.MapMagicInspector.OnInspectorGUI () (at Assets/Packages/MapMagic/Core/Editor/MapMagicInspector.cs:98)
    UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <a20a50bbfaff4193bf6ba6b262f9a71f>:0)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
     
    Last edited: Jul 3, 2020
  47. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    MM 2.0.4 had a demo scene with an area not assigned. Could you please check if you are using MM 2.0.5 or newer?

    Is there any way I could reproduce this issue?

    You can't put a terrain tile in a prefab. If you unpin all of the tiles before making a prefab it should work fine.
     
  48. RakNet

    RakNet

    Joined:
    Oct 9, 2013
    Posts:
    214
    Currently we are using entirely randomly generated terrains using Map Magic for randomized battle maps.

    The problem with this is the maps are boring to play on. They lack the interesting gameplay elements you can only get with a designed map. This is not a fault of Map Magic, but I am trying to find a better approach.

    I looked at Mechwarriors 5 Mercenaries, which also has random maps. The difference is they use a tile based approach using hand crafted terrain squares. In Mechwarrior 5 Mercenaries for example, you have a flat plane, rocky outcroppings with intentionally designed cover, valley, high hills, trees, river valley, alleyway through mountains, and so on. I believe there are also rules for what squares can connect to what other squares and on which edge. The squares connect together seamlessly somehow, most likely with custom code to blend the edges.

    Can Map Magic or Map Magic 2 help with this? Any general suggestions?
     
    Last edited: Jul 10, 2020
  49. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    1,800
    Sounds like an absolutely different approach. However, it's still not clear how exactly they are doing it, or at least what's the size of that square cell. But seems that I've got the general idea - they are using pre-made stamps, and combining them in random order.

    I was thinking about a way to stamp biomes on with nodes. As I see it, you design your POI manually, save it as an asset (the one that combines heightmap, splatmap, objects, etc), and stamp it on terrain using scatter node objects or more complex object graphs.
     
  50. IsntCo

    IsntCo

    Joined:
    Apr 12, 2014
    Posts:
    143
    Any plans to bring MapMagic to Unreal Engine 4?
     
unityunity