Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

GeNa - Sophisticated procedural content spawner

Discussion in 'Assets and Asset Store' started by AdamGoodrich, Oct 22, 2016.

  1. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    284
    Hi StevanJay, thanks to your detailed description how to reproduce the issue I was able to reproduce it myself immediately and found the culprit: This seems to be a bug where the min-max y-offset is applied twice when spawning on meshes. When the value is the same for min-y & max-y, this results in the duplication of the y-value that you are seeing. This will be corrected in the next GeNa update, you can do two things to fix it for now:

    1. Adjust the min-y and max-y to compensate value when spawning on meshes.
    2. Open the file Assets\GeNa\Scripts\Spawner.cs and add to forward slashes // to the line 1222 in there. The line should now read:
    Code (CSharp):
    1. //newLocation.y += m_randomGenerator.Next(res.m_minOffset.y, res.m_maxOffset.y);
    Then save the file. This should fix the issue until the update arrives.
     
    StevanJay likes this.
  2. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    73
    Great, thx for the fix... :)
     
  3. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,608
    Hey everyone,

    Wanted to give you all a bit of a heads up on the next version of GeNa. It's has been in solid development since around mid - late October and I am super happy with how it is shaping up. We still have probably 2-3 weeks before it is polished enough to release, but I thought I would share some play time from the other day.

    This scene is a test scene where I was doing some integration testing on the latest internal Gaia, CTS, PathPainter and GeNa releases.

    It is Unity 2018.3, built in pipeline, some SpeedTree 8, and Nature Manufacture Meadow pack assets. I did terrain creation and texturing with Gaia, the path with Path Painter, and everything else was done with GeNa.

    One of the things we have been working on in latest GeNa is improved structure spawning. Check out the cliff faces... we made some high level groups of rocks, and then applied them into the scene with just a couple of clicks in GeNa!

    Grab 20190223062507 w1924h1041 x358y85z122r224.jpg

    Grab 20190223062054 w1924h1041 x358y86z125r207.jpg

    Grab 20190223061317 w1924h1041 x357y88z129r188.jpg

    Given some of the comments and reviews that have come our way over the past few months, in 20/20 hindsight we would have reduced scope and launched the next update sooner, but we didn't expect it to take this long and made way more awesomeness than we anticipated.

    We will show more of the many enhancements coming your way over the next few weeks.
     
    Last edited: Feb 24, 2019
  4. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    73
    There's one thing that I would find super useful - the abilty to toggle having the y-coordinate automatically snap to surface. Often it's very useful to have that snap, but there are times when I'd rather keep a group of objects spawning together relative to each other, with them all taking the y distance adjusted from the initial spawn location. Any chance we'll see that in the future? (Actually, maybe that`s even possible now and I just haven't discovered it yet...??). :)
     
  5. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,608
    Not really understanding what you mean - GeNa already inherently snaps things to the surface of whatever you are spawning on.
     
  6. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    631
    Is Gaia 2 coming out after 2019.1?
     
  7. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    73
    Yep, but I'd like to be able to turn that snap off. Here's an example...

    I use Gena to spawn buildings that have modular interiors. In the screen shot below, I'm spawning the building, along with a sarcophagus and two floor tiles. Because everything snaps to the terrain, it's impossible for me to get all those objects to align correctly unless the terrain is perfectly flat - even a very slight angle and you can see the step between the floor tiles, and the sarcophagus floats or passes into the floor. What I really want is an option for all the prefabs to spawn relative to the initial spawn point (which would necessarily be on the terrain), regardless of terrain height. Does that make any more sense...?

    GeNaExample.png
     
    Last edited: Feb 24, 2019
    SickaGamer likes this.
  8. DavidBVal

    DavidBVal

    Joined:
    Mar 13, 2017
    Posts:
    76
    I am just trying GeNa for the first time but sadly didn't get very far...

    I created a spawner, added a tree (automatically one was selected, I couldn't choose) but then when I do shift+left click on terrain, nothing happens... no green dots.

    Also, a question. In your vids you already have all the spawners ready and configured. I own the Village Exteriors Kit, is there a way to automatically get the spawners configured, or do I need to create them myself?
     
  9. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    284
    If you can't see any visualizer spheres that usually means you have some restriction active that prevents the spawn in this area. Can you try to open the "Spawn Criteria" settings and set them up as minimal as possible with no restricting criteria being active? Should look like this: Unbenannt (1).JPG
    When that brings the spheres back you can start adding restrictions back one by one to see which one of the restrictions was set up to be the limiting factor.

    You would need to create them yourself according to how you need them to spawn for your project.
     
    AdamGoodrich likes this.
  10. StevanJay

    StevanJay

    Joined:
    Feb 5, 2014
    Posts:
    73
    Hey GeNa peeps!

    I have a small problem with seeding the random generator for GeNa. I have a bunch of stuff gets spawned at run time, and I want the random number generator to have a random seed for each run. The way I'm doing this at the moment, I have a GameManager script, and in the Start function of that script I generate a random integer value and then use that to seed GeNa with the line "genaSpawner.m_randomGenerator = new XorshiftPlus(randomSeed);" where genaSpawner is my Spawner, and I then call genaSpawner.Spawn after that.

    This kinda, almost works... The problem is that the first spawn generated by GeNa is always the same. After that first spawn has been generated, everything else appears to change with each different seed as expected.

    Any suggestions what's happening with that first value, and why it might stay the same whatever value is used as a seed? Or is there a better way to seed GeNa randomly at run time...?

    Thx!
    Stevan :)
     
  11. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    284
    Hi StevanJay,

    it is a bit difficult to tell what is going on without having your project in front of me and being able to debug. I have two ideas for you though:

    1.) Have you checked if the random seed that you randomly generate for the random generator is actually random? If you are using Unity's own UnityEngine.Random I think it needs to be initialized with a seed as well, usually with the system clock milliseconds, please see here:
    https://answers.unity.com/questions/1072318/randomrange-always-generates-the-exact-same-number.html
    https://docs.unity3d.com/ScriptReference/Random.InitState.html
    If that is the case, you could cut out the middle man and just put the number of milliseconds directly into the XorshiftPlus class constructor.

    2.)If that does not help, I would try to debug the GeNa.XorshiftPlus class, you could for example set a breakpoint in the constructor or the Reset function to see if something messes with your random seed in between you set it up and when its random values are used by the spawn itself (the first usage of the XorshiftPlus class in the Spawn function should be when determining the number of instances in line 727 of Spawner.cs)
     
  12. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    170
    Sorry for my ignorant question in the matter.

    I have GENA 1 and I passed GENA 2. It is a tool that I like very much and I have used it on many occasions.

    However, I do not see what difference there is between Vegetation Studio Pro and Gena in a particular aspect. With VS I can generate vegetation, rocks, etc. and the rendering is very fast.

    In what aspects can GENA 2 and VS be compatible?

    Thank you.
     
  13. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    284
    I would say they are two tools that have some intersection in functionality. VS is mainly a vegetation rendering system. Since you need to be able to determine somehow where the vegetation items need to be displayed, it has functionality regarding placement and generation for the vegetation items, trees, etc. as well.
    GeNa is mainly a general spawning and placement tool for all kinds of objects to either place objects locally where you paint / click with your mouse cursor or globally across the entire terrain. Since it is more a general placement tool, it has some additional features for spawning that are not present in Vegetation Studio.

    We had a very rudimentary beta integration that allowed you to spawn GameObjects into the persistent storage of Vegetation Studio with GeNa, however this is not working properly due to changes in VS. We plan to fully support VS to be able to spawn all types of Vegetation items with an upcoming update.
     
    Barritico likes this.
  14. Barritico

    Barritico

    Joined:
    Jun 9, 2017
    Posts:
    170

    Thank you for your answer.
     
    PWPeter likes this.
  15. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,608
    I just had to share this - we have been hard at work on the next release of GeNa for the past 5 months... and it's starting to get pretty close.

    There are many many new features - and one that I love in particular is the new 'Iterate' feature.

    Here it is in action : https://gyazo.com/66aae3e7beed24dd31d6caaa6a2ca5c6

    What it allows you to do is iterate on a spawn until you are happy with it. It makes use of the new stepped undo feature... which allows you to go back step by step on a spawning session.
     
    Hitch42 and StevenPicard like this.
  16. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    631
    Holy cow! Nice stuff! Would like it now please!
     
  17. jakes-du-preez

    jakes-du-preez

    Joined:
    Aug 14, 2013
    Posts:
    27
    Hi. I have 2 questions

    1. When we do a global spawn. what settings gets used and what gets ignored. ie. normal spawning takes into considiration depending on where you click. what if i click no where and just do a global spawn?

    2. What is the difference by using the child/parent relationship with multipke spawners or adding spawners and objects within current spawners.
     
  18. PWPeter

    PWPeter

    Joined:
    Dec 16, 2018
    Posts:
    284
    The key combination for the global spawn is Ctrl + Shift + Left Click, and the position you do the left click on acts like the click of the normal spawn, if you click "nowhere" no spawn will be executed.

    You can use the child spawners to keep GameObjects organized more easily that "belong" together, like a group of rock assets for example. Another advantage of using child spawners is that each child spawner has its own settings for spawn criteria, etc. again - if you would just add those objects to a single parent spawner they all would share the same settings while you can create new setting for each child spawner you add.
     
  19. jakes-du-preez

    jakes-du-preez

    Joined:
    Aug 14, 2013
    Posts:
    27
    awesome. thank you. now building super spawners in a hierarchy and painting biomes. this is so powerfull. thank you..
     
    PWPeter likes this.