Map Magic World Generator - a node based procedural and infinite game map tool

Thanks Wright. I will look in to it.

Are you using MM 1.9.6?

Good job with MapMagic. I am working on a very ambitious project and MM is helping to make this possible.

I need to know when a chunk is about to be destroyed so I can freeze/hide dynamic objects first. I was hoping there would be an OnBeforeDestroy(terrain) ChangeEvent but I can only find on generate and on apply events.

I could slightly alter the code to fire an event but of course I would need to do this every time I update MM.

Am I missing something that already exists?

You can use terrain’s OnDisable - it might be more handy than changing MM’s code. But if for some reason it will not work (not sure about dynamic objects) then take a look at Chunk.OnMove and Chunk.OnRemove methods, or ChunkGrid.Deploy. I can add an event on some point so you will not need to change the code all the time, just let me know where you need it.

Do you have an updated version of this that works with 2018.3 terrains? Currently exported terrains using this script lose all their textures. (It works fine in 2018.2)

I’ve come across another 2018.3 terrain issue. My grass patches are getting tinted in Map Magic, but not in a 2018.3 generated terrain. (Using 2018.3.6f1). You can see the difference in the screenshots below. Note. I’m using trees as grass to simulate an aerial scene.

This script deals with splats only because of some unity issue. I guess they fixed it all with the layers system, so this script might work (have not tested it though):

       void ExportTerrainData (Terrain terrain)
       {
           if (!export) return;
           export = false;
           string path= UnityEditor.EditorUtility.SaveFilePanel(
               "Save Terrain as Unity Asset",
               "Assets",
               "ExportedTerrain.asset",
               "asset");
           if (path!=null && path.Length!=0)
           {
               path = path.Replace(Application.dataPath, "Assets");
               Terrain terrain = GetComponent<Terrain>();
               UnityEditor.AssetDatabase.CreateAsset(terrain.terrainData, path);
               UnityEditor.AssetDatabase.SaveAssets();
           }
       }

Note that you are using a different grass type in MM rather than in manual placement. On the first screen it’s a standard ā€œgrassā€ type while on the second it’s a ā€œbillboardā€ grass. Try switching grass mode in Grass Output layer.

1 Like

it really shouldn’t be so impossible to just make each chunk a random biome based on probability and seed. that would be the perfect solution for what i’m talking about

The preview on terrain function has been broken for a while. In various new / empty projects I get every time only

ArgumentNullException: Value cannot be null.
Parameter name: shader
UnityEngine.Material..ctor (UnityEngine.Shader shader) (at C:/buildslave/unity/build/Runtime/Export/Shader.bindings.cs:105)
MapMagic.Preview.DrawMatrices () (at Assets/MapMagic/Main/Preview.cs:205)
MapMagic.Preview.DrawGizmos (UnityEngine.Transform objectTransform, UnityEditor.GizmoType gizmoType) (at Assets/MapMagic/Main/Preview.cs:146)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Unity 2018.3.2f1

Yes I do use 1.9.6 and Unity 2018.3.6 also try ti on 2018.3.5.

I follow the tutorials of Using RTP in the menu. It said there should be a message that _RTP_LODmanager object has been created. But I didn’t see it after I click any fix buttons. And there is no ReliefTerrain component on MagicMap gameobject. I have to add it myself.

Not sure if there is anything I am doing wrong, but I cannot figure out myself. Counld you please help me on this one. Thanks! It buzz me for a week.

Hey Wright

I think I got find reason why this is happanning.

                #if RTP
                if (rtp==null) rtp = MapMagic.instance.GetComponent<ReliefTerrain>();
                if (rtp==null) //if still not found
                {
                    layout.Par(42);
                    layout.Label("Could not find Relief Terrain component on MapMagic object.", rect:layout.Inset(0.8f), helpbox:true);
                    if (layout.Button("Fix",rect:layout.Inset(0.2f)))
                    {
                        MeshRenderer renderer = MapMagic.instance.gameObject.GetComponent<MeshRenderer>();
                        if (renderer==null) renderer = MapMagic.instance.gameObject.AddComponent<MeshRenderer>();
                        renderer.enabled = false;

                        rtp = MapMagic.instance.gameObject.AddComponent<ReliefTerrain>();

                        //filling empty splats
                        Texture2D emptyTex = Extensions.ColorTexture(4,4,new Color(0.5f, 0.5f, 0.5f, 1f));
                        emptyTex.name = "Empty";
                        rtp.globalSettingsHolder.splats = new Texture2D[] { emptyTex,emptyTex,emptyTex,emptyTex };
                    }
                }
                #endif

This chunk of code is never running because RTP marco is never defined. And I didn’t find any code in MM or RTP defines it. Is there any step I am missing like define RTP some where?

Hey Ruonan,
I am pretty sure that this is just an optional part of the code for those who use RTP. The defines you are referring to can be made in the Player Settings. (Scripting Define Symbols, just the String like ā€œRTPā€ without " and they are separated by ā€œ;ā€)

1 Like

Thanks, was not aware of this. Is there any way I could reproduce this issue starting from an empty scene?

You can enable this from MM’s compatibility window (Window - MapMagic - Compatibility). Or by manually adding the RTP keyword in scripting define symbols as ElevenGame said.

Anyone experienced with MapMagic looking for paid work?

If so, please PM me some screenshots of your MM generated terrain.

Looking for nothing crazy (various standard biomes, village generation) but would like nice looking scenes that include water. Thanks!

I think so, please try it out in an empty project. my unity version is as I said Unity 2018.3.2f1 . I have noticed this bug for a long time in previous versions. I’m currently helping myself by always having a debug texture in the texture output and then viewing my preview over it, but the preview function is of course smarter and should therefore be fixed. it always helped very well in designing the graph.

Hello there!
Try to import Demo folder too, because TerrainPreview.shader is inside
Hope that helps
BR, Alex

Thanks for that. It still has some issues. The first export creates a blank terrain with height map but no textures. If I export is again, I get this:

But the exported terrain now has the textures on it. However the terrain editor is locked out of the textures. As soon as I save it, the textures are gone again.
4286011--383824--TerrainPaintError.PNG

After restarting Unity the editor is available, but the textures are blank, and it’s thrown a random layer on at the end.
4286011--383830--TerrainAfterRestart.PNG.jpg

At this point I can: Edit Terrain Layers / Replace Layer and it works.

It looks like it’s not creating links to the layers. This new layer system is quite cool, but it creates an aweful mess when you upgrade to 2018.3. It creates a new folder called ā€œ_TerrainAutoUpgradeā€ and every texture on every terrain gets a layer asset that is dropped in this folder. My project created 218 layer files. I’ve had to go through and sort them out. I found I can move them and rename them ok.

For Map Magic to be fully compatable with the new terrain layers, we should be able to drag a terrain layer into the texture node instead of the diffuse/normals.

I’m also getting some other issues.

I get this when I try to use the Preview on Terrain:

And I get the when I select the terrain in the Hierachy:

Might be so, but it will loose all the compatibility with the previous Unity versions then. I think it’s better make a new output (Layers Output or something) that will work only in 2018.3

That’s right, that really might cause this preview issue. Dorian-Dowse, Diego_Graphics, do you have a demo folder in a project?

Just tried empty project with full MM install in Unity 2018.3.3, but it seems to be working fine. Not sure if this is because of a slight Unity version difference.

1 Like

That’d work.

Yes, no demo folder. We have a lot of assets in our project and we routinely delete demo folders to save space (currently sitting on 44gig). It’d be a good idea not to put critical functionality in a demo folder.

Sure thing. But at least now I know what causes that issue, and will move the shader out of the demo folder in next update.