Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

Discussion in 'Assets and Asset Store' started by Wright, Mar 10, 2016.

  1. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Hi, just checking out the new version. Mostly going swimmingly, here's some issues I've noted as I go:

    I think the bug where terrain textures aren't generated after previewing still exists. Cleared preview and they returned.

    I recall wanting to mention this before - sometimes just clicking in a number entry box is frustrating. Often I want to click to the right of a number but it seems impossible. Instead, the numbers are always "select all'd".

    Still seeing seams between terrains at pixel error 10, but lemme confirm, as I'm using HellHound's FractalNoise thing.

    Regarding debug where it shows you how many ms each thing takes up, I notice it changes during generation and afterward. In particular, FractalNoise (hellhounds) is around 180ms during generation then 10ms after, while Noise and Voronoi seem to stay the same. Have also noticed some oddities, ie some nodes are randomly 0ms after generation, and sometimes FractalNoise generates at 180 then is 180 afterward. Just keen to know some details on this as I rely so heavily on generating lots of terrain quite quickly.

    What's the test node under map?

    Great stuff, love the update!
     
  2. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Shader Forge and Allegorithmic's Substance designer (node editors) both have quite a few little interface things that I imagine could keep Wright going for some time :)
     
  3. Hellhound_01

    Hellhound_01

    Joined:
    Mar 5, 2016
    Posts:
    102
    @Exbleative I will check out the new version at the weekend when I'm back from JAX developer conference and also test my generator. If the issue is reproducable please add an error report at bitbucket and add some screenshots.
     
    Last edited: Apr 20, 2016
    Exbleative likes this.
  4. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    In the 1.2 release notes there's some brief mention of RTP compatibility. I also notice there's the ability for components/scripts to be 'copied' to all terrains. I started trying to mess with RTP just now, but I'm kinda lost on step one. You can't really place an RTP script on base MM object, because there's no terrain on that, and then it seems to deactivate itself, and during play it doesn't exist on any other sub terrain objects. What's the workflow for using RTP with MM?

    I just tried putting the RTP script on one pinned terrain and it seems to be carrying over to all other terrain segments, but how do I get it to use MM's splat/base map? It's just using some default splat map right now.

    I'm guessing MM creates the splats on the fly as it generates each segment?

    I also thought briefly maybe I could use RTP's splat generation based on slope etc, but that looks limited again to static, pinned/locked terrains.
     
  5. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    I think it's better use "Enabled" parameter in each layer - this way you can make not only a single layer solo, but set any layer visibility configuration.
    I'm not sure if it's possible with a grass, so I'll start with objects/trees and see what I can do with other output generators.

    Yeah, the node groups. I admit that they should be in any advanced node editor, and more important, I see a way to biomes through implementing this feature. For instance, I'd like to experiment with a group masking - some map will set up the factor that will multiply the output of the group.

    Personally I find the current way to input numbers a bit more convenient - when you click a number it is already selected, so you can just write a new one without pressing delete or backspace (or use a right arrow to deselect it). But i guess it's not liked by everyone, so I gonna make it switchable or something.

    The generator debug timer displays the time used to generate for each of the terrains. Once the new terrain is ready it will re-write the number. And since the terrains are generated in several threads causes changes during the generation (or "after" generation - if the terrain generating is the last one). However, I cannot say why Hellhound's noise generate time differs on each terrains.

    Currently RTP works with pinned terrains only.


    @all: I want to share my plans for the next version:

    - node groups (which will be a base for further boimes support)
    - a desert demo scene
    - switching the MM data to scriptable asset to improve editor window performance when MM is selected
    - texture input gen
    - multiple cameras support
    - maybe: a low-resolution lod terrains to display in a distance
    - further fixes and minor changes (hide test generator:), input fields, switchable object/trees layers, textures on preview cancel, improve blur performance, etc.)
     
    Last edited: Apr 21, 2016
  6. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    @Wright please add "bypass node" your future feature list.
     
  7. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I think the 'standard' selection method goes like this, usually: one click (selects all), second click (places cursor between/after numbers/letters), 3rd click as 2nd, double click for whole words, triple click for select all again (or ctrl a).

    Next version plans sound good. On the desert scene, I know you don't mean a new generator, but I'd be awfully keen to see a sand dune generator :) I think they're quite complex though to get these sort of shapes:


    I suppose I'd like to see further integration with RTP, but at the same time I haven't used it a lot, so I'm not sure. From what I've seen from playing with it, the following are pretty amazing features for terrain textures, so I think tied in support somehow would be great:
    - Triplanar for cliffs
    - Detail textures
    - POM/heightmapping
    - Fading to lower tiled textures in the distance to reduce tiling artifacts
    - Snow cover/glitter etc
    - Tessellation and heaps of other stuff. Pretty nice!

    I'm going to play around a bit more as I think there's a chance that RTPs triplanar shader will work without any RTP scripts installed anywhere. Otherwise I'd imagine that if RTP could dynamically read in MM's splat maps it'd work as intended?
     
  8. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Do you mean where you click the eyeball on a node and it bypasses it, or are you talking about something else?
     
  9. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    @Wright - Do you have any sort of an ETA for the next version? Multi camera support is very important to us right now. Could this be provided as a hot fix without having to wait for another full release if it can be worked in separately?

    Thanks
     
  10. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    Ah Thanks did not see that in the manual.
     
  11. CplMulder

    CplMulder

    Joined:
    May 12, 2014
    Posts:
    52
    Hi, thanks for a truly amazing and powerful terrain tool!

    I am loving the "Shore" generator and find it great for creating islands etc... however it would be brilliant to have a parameter to make the shore slope from the land towards the see to create a more realistic type of beach.

    Perhaps I am missing something but my sores end up very flat and fall off steeply into the "sea"
     
  12. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Exbleative, thanks for the dune shapes diagram! However I thought about a distortion generator, that will offset the map in some direction with the mask-adjusted intensity. I suspect that combining this with an organic voronoi can make an interesting dune-like effect. However, I have not made any tests yet.

    HolyFireGames, I think implementing all of these features will take two weeks or so. I can provide you with a beta version once the mult-cameras support is implemented.

    CplMulder, thanks!
    You can incline a beach by adjusting the intensity value, the way I did in the tutorial.
     
    CplMulder and Exbleative like this.
  13. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    Thanks that would be great, I appreciate it.
     
  14. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    a quick demo of a world in progress
    trying to map the ground/rock texture to the littles lumps on the ground .. tricky :)

    b4b.jpg

    b7.jpg

    b7b.jpg
     
    pixelsteam, CplMulder, ZJP and 3 others like this.
  15. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Sounds great, I imagine this could be useful for a lot of things. I guess would just have to try it out to see if it'd replicate these shapes. Otherwise, another decent option could be simply grabbing a series of varied dune heightmaps and 'scattering' them around on a terrain. This would also help with the whole idea of scattering craters/whatever other feature you want in your terrain.

    If this worked like a photoshop brush (without any hand painting) where you could control the randomness of direction of the brush, size, opacity and so on, would be quite a good addition
     
  16. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Hmm, a scatter generator... That sounds interesting. It will not deal with object input like the Stamp Generator, but will generate stamps in random position to cover all the area. Or maybe to unify somehow it with a Stamp... I should think about it, I really like the idea of such a generator. First of all I've got to come up with it's name, because Scatter Generator already exists to scatter objects.

    sarum, looks fantastic! I'm downloading the demo!
    Edit: And the demo had met the expectations! In dynamic it all looks really awesome. Just a piece of advice though: use the Adjust Generator to rotate the stones, right now they look a bit cloned.
     
    Last edited: Apr 23, 2016
  17. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    i will :)

    could you make a quick video tutorial about the stamp node ?
    i need to use it but i am not sure how to
     
  18. ibyte

    ibyte

    Joined:
    Aug 14, 2009
    Posts:
    1,047
    What map input do i use to have a raw input start at a particular elevation? I am trying to merge a plain with a volcano. I created the plain with a noise generator and using a raw input file for a mask. I added a another raw input file as the height map for the volcano but i seem to be struggling on how to blend the two together at the correct elevation
     
  19. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    The idea of a stamp generator/scatter sounds pretty useful.

    I also created a Curve to Height generator - i think it's very useful to create masks.



    It's not perfect, since i have to set the size manually (multiply where 1=one Terrain size) to fit the whole terrain. I bet Denis could make a better implementation.
     
  20. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I think the idea of unifying it sounds good. One generator to both create bases for objects and also to create pre-drawn features (craters etc). You may just need an input to it that accepts images. If you don't input an image, its flat as it is now.

    Also I imagine there might be situations where you want it to both flatten the area under an object and then accept a height map. One example - you have a jetty object + water plane in a prefab, and you want to first flatten the terrain for both, and then stamp a small pond depression into the flattened part. With the current setup, you could only flatten the area under the jetty. Another example (slightly dumb), you may want to have a meteor object at the bottom of a crater, or a pick/shovel at the bottom of a hole :) Unsure just how often people might need this kind of thing but the randomized scattering heightmap placing thing I'm certain would be very useful.

    I suppose the tricky part is whether it exists in the objects section or the maps section. Also it may get 'overloaded' with inputs etc if it does both things.

    Re the names, I actually reckon stamp generator is slightly off name-wise. I think stuff like "Base" or "Flatten Under" are better.

    For scatter generator for the height stamps, does it matter if its also called scatter generator? It will be in the maps section, not objects. Alternatively you'd could name them "Object Scatter" and "Map Scatter" or "Brush Scatter" or whatever you wanna name that.

    For the actual generator that takes input maps (ie craters, sand dunes), would that just be the raw input generator (or perhaps eventual non raw input for speed!)? Could possibly be useful (now maybe I'm just dreaming?) to also somehow utilize sprite sheet type functionality too. Say I want to have a dozen different types of sand dune to match the image I attached and reduce 'tiling', it'd be nice to be able to import all 12 in from one map and cut that up and choose from each dune or crater randomly (or weighted).
     
  21. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Is it possible to subtract objects 'from themselves' using Subtract and the minuend/subtrahend nodes? I've got some large objects I've scattered>propagated, which then overlap/intersect. I guess they just randomly propagate with no knowledge of where the others are or what size they are? Anyway I tried subtracting the propagated objects but it didn't work. Not sure if this is my mistake or just not supported?
     
  22. DuckyDev

    DuckyDev

    Joined:
    Apr 18, 2016
    Posts:
    7
    Ok. I sucked it up and bought it after playing with the awesome demo and reading through this super-packed forum.

    So far, I'm super impressed and loving it. Hope I can help you all make this thing even better, looks to be quite the project, with quite the helpful community here already.

    A few thoughts, questions, and/or suggestions while trying to make some terrains and digging through things initially:

    1. Maybe add an option for using the dark background grid in General Settings rather than only if the user is using the unity pro skin. IMO it is MUCH easier on my eyes with the dark BG, and is the first code changes I made in my project once I saw the code there for it.

    ---

    2. A 'Group' node you mentioned for grouping and moving multiple nodes would be SUPER handy, and if added REALLY needs a field for notes about the group contained within. Would serve as both grouping and code-commenting as it were.

    ----

    3. A 'Duplicate Node' function in the right-click menu would be also a well-used tool.

    ----

    4. Either an 'invert map' node or a 'invert' curve preset is another one.

    ----

    5. I might have a possible fix for the trees. As mentioned before here, random rotation on terrain trees is broken. In fact, on the provided island scene, Trees are chosen via a split node that feeds into the trees node, and the split node has a random rotation (0-360) set, which does not get applied by unity. Looking over the scene, I noticed that the stones are randomly rotated, so I fiddled with some things. If you feed the layered split node (that has the big, medium, and small tree layers on it) outputs into the OBJECT output that the stones are using (adding an additional layer with the tree prefab assigned), it appears to work, but if the split node has ANY rotation other than 0 on the left parameter, the trees vanish completely, ANY rotation on the right rotation parameter is still ignored. The INTERESTING part is that if you then add an adjust node between the split and the object output (the same method used to give the stones their rotation if you follow back the heirarchy), random rotation works fine on the tree, just like it did on the stones. Since I've dug into a bunch of unity forums and looked around, the random rotation issue isn't being worked on (it traces all the way back to version 5.1 with no fix in sight), my thought is this:

    Maybe the trees node could be re-worked to add trees like the object outputs rather than as terrain trees, and possibly duplicating the adjust node's random rotation and scale fields within the re-worked trees node so we can randomly rotate the new trees from the one node without having to add an adjust node for each tree layer. Does this make sense or am I missing something?

    -----

    6. Grass BUG?- Can't get grass node to plant any grass when terrain resolution is 1024 or up (512 and down all tested to work fine). Something broken here or just me? I did try jumping over into the Unity terrain tools and it had the grass textures there, as well as let me paint using it's tools just fine, so I'm thinking it's an issue within MapMagic here.

    -----

    Also, @iddqd: (P.S. Love the nickname, and I miss doom...)
    Love your idea, have been toying with the idead of a radial gradient option myself, but had the same manual scaling to fit terrain issue. My work-around was I discovered that if you play with single-cell voronoi and fiddle with the values, you can actually make a pretty good radial gradient. Mine was a little different than your idea, but it seems several people could benefit from a way (or ways) to generate some initial height data to work from without requiring a raw input map.

    My thoughts would include a linear gradient (achievable with your 'curve to height'), radial gradient, and even more fun, a radial version of your 'curve to height' instead of linear. (Picture using your curve to have a mountain in the middle, flat spot surrounding it, then raised terrain edges, all with a single curve.)



    Thanks for reading if you bothered, and keep it up everybody! Cool stuff here!
     
    Exbleative likes this.
  23. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    Suggestion for next update re scattering objects - please make the default Count something like 10 instead of 1000. If you accidentally make a scatter generator then plug it into the wrong thing without looking at the Count + with a heap of pinned terrains, it's all over :)
     
  24. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Yeah, first of all I'd like to thank a community: so much ideas and improvements suggestions - and all of them are really helpful - in just a one day! You guys even make your generators and share them! You guys doing a great job!

    sure, just want to make some changes to it - and make a tutorial illustrating these changes and the Stamp use cases.

    Looks great, but it's unclear what will be the neighbor terrains from right and left. Will they be just a flat terrains at the same levels, or they will inherit the incline, or they will be the same terrains as this one? How they will be welded together then?

    I'm not really sure. Right now I'm thinking about two generators: a Stamp Generator and a Flatten Generator. Although they have much in common internally they are producing a different result.
    And the Flatten Generator will be more like the current Stamp, this name fits it better as you already noticed.

    A worthwhile idea. I'll try to make a sprite support in a Texture Input generator.

    Nope. It will create a vicious circle. How the generator can determine which of two intersecting objects should be removed? The smallest one?

    How do you see a connections here? They almost merge with a background! Anyways, I got the idea: to give the user an ability to customize colors.

    Ok, added to the to-do list.

    Since the curve uses a standard Animation Curve interface you can make your own presets.

    That's what an Object Output for. You can add a tree prefab layers to the stones and use an object trees, but then the trees will not have a billboard lod, and the apply time will be increased.
    Could you please make a screen of the graph where the trees disappear with a rotation of 0 in Split? Do they have an Adjust generator before that sets the random rotation?

    Hm, really. I'll take a look why, thanks for the bug report!

    I like the idea of the radial gradient, it is better for tiling than a linear one. Btw I didn't expect that a voronoi and a curve could be used that way, what a nifty approach!

    Got it.
     
  25. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Hello.
    Speaking of the API, is there a function that lets you know the elevation (y) of the point (XZ) any of a not yet rendered terrain.
    I mean, the courses are built around the camera (the main player). What to know an altitude at a location that is not "draw".
     
  26. frankcefalu

    frankcefalu

    Joined:
    Jun 28, 2013
    Posts:
    60
    We've been waiting for the shoreline generator. Any chance of that please?
     
  27. DuckyDev

    DuckyDev

    Joined:
    Apr 18, 2016
    Posts:
    7
    So using an Object Output you have standard LODs, but never billboard? Why is that?

    Will do a screenshot when I get back to the house. But to clarify, that happened when feeding the split node into an object node instead of the tree node, and it was making trees disappear with any value that was NOT 0, so I set the split to 0, then added an adjust node for 0-360 random rotation, then fed that into the object node.

    The only issue with the radial gradient that I've had is it's finnicky to get the sizing and fade out the way you want with the voronoi and also you can move it so it's always centered, but it did work, so something 'official' would be cool at some point.
     
  28. CplMulder

    CplMulder

    Joined:
    May 12, 2014
    Posts:
    52
    Yep I used the intensity to change the inclination of the beach... problem is that it also adjusts the intensity of the "flatness" of the shoreline so the beach becomes much more bumpy (specilly when applied to a rocky/bumpy terrain)... it would be great to have a inclined beach and still have the full flattening effet of the shoreline - hope this makes sense.
     
  29. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    The only way to know a height of the non-generated terrain is to generate it. You cannot generate only one coordinate of the terrain, it is generated as a whole: most of the generators require neighbor pixels information, they cannot get height for one pixel only.

    The Shore Generator is already available in Asset Store since v.1.2

    I mean the standard tree billboard, which is used by terrain. It takes a model, renders it and places the plane instead of a tree in a distance. And it all is done automatically. Or do you know the way to make it using the standard objects with transforms (maybe I've just missed something)?

    Ok, I've got your point. I'll see what I can do.
     
    CplMulder likes this.
  30. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    Thanks for the reply.
     
  31. DuckyDev

    DuckyDev

    Joined:
    Apr 18, 2016
    Posts:
    7
    Well, I assumed incorrectly about Unity, I thought unity used billboarding on standard objects at a distance as well, but it seems it just uses distance to cull them completely once they are far enough away. There ARE solutions for standard object billboarding if you're interested (could make scenes render WAY more efficiently on typical scenes using mapmagic, as there are typically TONS of standard objects present).

    https://www.assetstore.unity3d.com/en/#!/content/40188 - A unity extension that does this now.

    http://www.gamasutra.com/view/feature/130911/dynamic_2d_imposters_a_simple_.php - Explanation of imposter billboard implementation.

    Anyway, that does seem like a bit of a project, even though it would be performance-wise a big deal, might take some serious thought and time to actually implement, so yeah...

    (Now I think of another solution, though not as elegant.. If I were to purchase that other imposter asset, then use the standard object node for the trees, it would then re-gain the billboarding nature of terrain trees, plus be applied to any other standard objects for a performance increase anyway. So we might get away with just testing compatibility, then you can just say mapmagic is compatible with that other plugin. Anyway, I'm done rambling for now.)

    Thanks again.
     
    Wright likes this.
  32. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    501
    By the way: Random rotation works fine with speedtree models
     
    Wright likes this.
  33. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    I really like the idea of imposters, I find them very useful - at least for the trees. Pity Unity came up just short. So I see these workarounds:
    - use several tree models with different rotations (or different tree models at all);
    - use the SpeedTree instead of meshes (thanks iddqd for confirming this);
    - use the object output and a custom imposter plugin (thanks DuckyDev for plugin advice).

    For my own game project I've chosen the first variant, just because I've got trees generating with MaxScript, so I can make any number of tree models I like :)
     
  34. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    hey denis :)

    i think there is a problem on the store .. i updated MM to v1.2 and imported it , but there is no shore generator .. looks like it is still v1.1
     
  35. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    @All: a quick fix if you do not have a grass generated when the terrain resolution is higher than the terrain size: OutputGenerators.cs

    sarum, just checked by downloading 1.2 from the Asset Store - and I can see the Shore generator in the end of the Maps list, right after the Erosion:
    upload_2016-4-28_19-41-28.png
    And there were users on forum who already checked out shore generator.
    Try clean install by removing MapMagic folder and downloading it from AS again.
     
  36. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Hi I am the author of Distingo. Handling multiple terrains under one script is on the road map, I just need to find the time to put it in.

    Someone has already moded the script for biomes? And (I think) posted their source to the Distingo forum. Unity forums are not great for searches so cant point you at it.
     
  37. sarum

    sarum

    Joined:
    Mar 2, 2014
    Posts:
    212
    got it working .. i redownloaded it from the assestore 2 times before importing, and this time it was the good 1.2 version.
    sorry for the bother :)

    infinites terrains with distingo ... such a great combination !
     
  38. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    NemoKrad, what do you think about the voucher exchange to make both of our products compatible with each other? Destingo's description on AssetStore seems really promising, so I'd be gladly experiment to implement it's support to MM. You can contact me via mail (mail@denispahunov.ru) or skype (akawraith).
    Wanted to send you this offer as PM, but seems that your account does not support conversations.

    sarum, glad you've worked that out! AS can glitch on an update sometimes, so personally I always try to remove the previous versions before installing the new ones.
     
  39. NemoKrad

    NemoKrad

    Joined:
    Jan 16, 2014
    Posts:
    632
    Hi,

    Sure, about to go to bed, but will hook up with you tomorrow :)

    Be cool to see your asset in action, one of my users told me about this thread, so only just found out about it :)
     
  40. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    @Wright - Hey there, do you think you're still on track for the next release? We're super excited to see the multi position support :)
     
  41. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Sure! Multi-camera support is already implemented, but the version is not stable yet. I can give you a try if you want, but prefer to get rid of at least of a known bugs first.
     
  42. HolyFireGames

    HolyFireGames

    Joined:
    Apr 23, 2014
    Posts:
    134
    Hi there, we can wait until you get rid of the known bugs, this will be huge for us though, allowing our players to explore endless terrain now. Thanks again for taking care of this feature :)
     
  43. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I think there might still be a slight bug with clamping for curves or terracing. I was trying to use a curve>mask to only terrace high altitudes but if my curve wen't under zero it acted as if 'red areas' (on the terrain) were green, and therefore were getting terraced when they shouldn't have been. To fix it I just had to make sure my curve was not under 0.
     
  44. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    @Wright

    Just purchased, MM is a really great asset, good job. I'd like to make a few suggestions after looking at main class code.

    1. Don't use foreach, especially in Update() (noticed 3 different ones) as it allocates memory that then triggers extra GC
    2. Wrap any debug/Editor only stuff in Update() inside #if UNITY_EDITOR so it is compiled out of builds (bit of performance boost)
    3. Don't include demo code that is just comment out in full version. Suggest that be done via code version system.
    4. Add two terrain settings options for MM that via TerrainGrid.OnCreate() sets the tag and layer for new terrain objects. (Good for use of raycast/etc)
    5. Add an option to delete terrain chunks that are greater than X distance beyond "hide" distance. Disable is fine for closer chunks but during long transversal collecting large groups of terrain + objects can lag badly.
    6. Use floating origin for infinite terrains. Once the player is more than 5-8km from Vector3.zero, inside one frame snap and re-center the player, camera and all objects to Vector3.zero. Keep the offset internal to MM for terrain so generators know the true position. This will prevent physiX from losing it's mind due to floating point problems.
    But all in all I'm very impressed with the asset. Looking great and can't wait to see future updates.

    Edit Update:
    *** 7: PLEASE add a more stable method (scriptableobject/xml/etc) to save or backup our map editor node data. I just lost all my nodes while making a few changes due to unity's crappy internal serialization. Ugh. :(
     
    Last edited: May 4, 2016
  45. Exbleative

    Exbleative

    Joined:
    Jan 26, 2014
    Posts:
    216
    I've never lost anything myself, but I've often thought I'd really like something saved outside of the scene file as a lot of work can go into the node graphs, and losing it would be horrendous. It'd have the side benefit of letting users share graphs if they wanted to.

    I suppose for this to work you'd need to do extra work in terms of hand placed items, sky/cloud systems, etc so that half your world doesn't reset to zero and the other half does?
     
  46. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    Or just make sure you parent them to the terrain chunk so it gets moved with it. :) But yeah, when I made one of these systems for a space game, I just added an event delegate that notified anything that cared to of the recenter action. Some things like particle systems and speed calculates/etc don't behave well doing that. It wasn't too hard to setup... but the alternative is you can't travel more than 10km in any direction without physiX starting to jitter and cause problems.
     
  47. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    terravires, thanks for all of your suggestions! I'm a bit missing why you have to publish them to the community, but not to me in person, but anyways - thanks!

    I guess you are talking about this
    Code (CSharp):
    1. foreach (Chunk tw in terrains.ObjectsFromCoord(camCoord))
    and similar cases. Is there the other way to iterate IEnumerable? :)
    Take a note that in all cases where "for" loop is possible it is used. The only case of using "foreach" I found in ThreradFn at a glance. If you have encountered something else - please send me a email or personal message. And I'll have a look myself if there are any "foreaches" left where they could be replaced with "for".

    Yeah, I admit that this option is useful. And it's already made for an upcoming version 1.3

    Most of "if (guiDebug)" conditions are called from an editor window, so they will not be included in build anyways. In main MM script they are mainly used to log the performance. What if we want to log a performance in a build?

    Isn't it what you mean:
    Code (CSharp):
    1.                 //copy layer, tag, scripts from mm to terrains
    2.                 if (MapMagic.instance.copyLayersTags)
    3.                 {
    4.                     GameObject go = terrain.gameObject;
    5.                     go.layer = MapMagic.instance.gameObject.layer;
    6.                     go.isStatic = MapMagic.instance.gameObject.isStatic;
    7.                     go.tag = MapMagic.instance.gameObject.tag;
    8.                     //#if UNITY_EDITOR
    9.                     //UnityEditor.GameObjectUtility.SetStaticEditorFlags(go, UnityEditor.GameObjectUtility.GetStaticEditorFlags(MapMagic.instance.gameObject));
    10.                     //#endif
    11.                 }
    12.                 if (MapMagic.instance.copyComponents)
    13.                 {
    14.                     GameObject go = terrain.gameObject;
    15.                     MonoBehaviour[] components = MapMagic.instance.GetComponents<MonoBehaviour>();
    16.                     for (int i=0; i<components.Length; i++)
    17.                     {
    18.                         if (components[i] is MapMagic) continue;
    19.                         Extensions.CopyComponent(components[i], go);
    20.                     }
    21.                 }
    It's done via Apply function, not OnCreate. The reason is the terrain pool: once the terrain is created it could be re-used as a new chunk after it was removed at the old one. If the MM layer, tag or component will change during this time they will not be applied to the new chunk.

    As Exbleative noted, this can create bugs for drawing skies and particles. I'm not really sure that fixing particle bugs is in scope of this tool, and there are really plenty of templates and code examples that can do what you've described. MapMagic object could be moved like any other object (and it does not matter if the terrains are generating or not - they all will be created in a right place).

    Could you please email me what were the changes you making when you've lost your nodes? Were they a changes to the MapMagic code or you were just changing the graph?
     
    Last edited: May 5, 2016
  48. terravires

    terravires

    Joined:
    Mar 27, 2013
    Posts:
    103
    Because everyone else was leaving suggestions here as well and you said this above:
    Sorry, I thought this was the correct place to add them. o_O

    As for the layer/tags, you are correct I missed that copy part and that works fine.

    Don't know how you got to fixing particle bugs out of that. Obviously that would be something we'd need to provide, just suggesting that you add support for floating centre. Yeah, you either get a few graphic glitches to deal with a few frames or a broken physics system. :p

    And this just happened again, and lost a bit more work. Thankfully, this time I had a backup scene saved. I'm using unity 5.3.4f1 and Map Magic 1.2. The nodes all disappeared at once when I hit editor save scene shortcut (Ctrl-S) twice as the first one doesn't save current scene anymore. I had the Map Magic Editor window open and everything vanished at once! :eek:

    Edit: Bugger, the backup scene data is also completely empty too. Only other thing I can add is I had the map editor window docked with my scene window at the of save.

    Update2: I'm using Forced Text mode serialization so git works, so I checked my scene file and I see all the Map Magic data inside the .scene file. The nodes and values (seed/etc) are all there. So appears to be a bug with Map Window not loading it somehow? I even deleted all of MM and restarted unity, reimported from Asset Store and still get an empty node when clicking on MM show editor window. One final node is the terrain and all objects is still in scene.
     
    Last edited: May 5, 2016
  49. Wright

    Wright

    Joined:
    Feb 26, 2013
    Posts:
    2,267
    Sure, np, I just decided that I'm the only man who can follow your suggestions since nobody else will change the MM code - at least, officially :)

    Experience has shown that the feature made even with a small glitch will be perceived as bug that shot be fixed. I simply cannot say: "Well, it was designed to be buggy, so that's okay" :D I don't really know: on the one hand it is really a useful feature, especially when speaking about infinite terrains, on the other - making it right is a subject for a whole new plugin, and making it not right is... actually not right. I'll make some tests and will find out what I can do with it.

    Are there any errors in the console?
    Could you please send me a scene that is not loading (mail@denispahunov.ru)? Since all the data is in it than there is something with a load (OnBeforeDeserialize) function, so I've got to take a look.
     
  50. Redlotus99

    Redlotus99

    Joined:
    Apr 19, 2016
    Posts:
    7
    Are there still plans to combine Voxeland and Map Magic?