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

[RELEASED] Crux 2.0 - Procedural AI Spawner for Terrains (Biomes, Population Caps, and more)

Discussion in 'Assets and Asset Store' started by BHS, Dec 13, 2016.

  1. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    440
    i do it all the time with crux also. lol once i get it working i just dont mess with anything again lol. what mistake did you make? so if others come here they know to check that
     
  2. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    First time it was the detection layer and second time I forget but it was something really dumb. lol
     
  3. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    121
    Hi Team - Had Crux for a while because BHS assets are the best. I started to work it into a project - It looks as if the Spawning is performed according to "Textures" ? I have an "Large" Infinite Terrain area with same Texture (Different Vegetation). Is there anyway to break this up for different AI or will it be same AI over this Large Terrain Spawn. FYI- Doing beta testing with Gaia Pro.
     
  4. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    I am running crux and basically you setup one or several profiles of AIs, then create a biome of the grass you have and add the AI profiles to the biome.

    Whether you have one AI or 10 they will all spawn based on the rarity and % you choose. I believe thats set in the profile. Im doing a build at present so cant check.
     
  5. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    My bad, theyre called objects not profiles but essentially the same. Heres several AIs/Objects added to a biome (on the right). The biome can have one texture or 10. and so on. Those AIs spawn all over the texture.

    Capture.PNG
     
  6. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    121
    Hi Hawk0077 - I really do appreciate the help. :) I've successfully created Crux Object Wildlife with no problem but they spawn to texture reference.
    What if I have an infinite terrain with the same Global texture across the board. How do I break up where different AI(Animals) spawn with same Global Texture. Thanks!
     
    Last edited: Nov 16, 2019
    Hawk0077 likes this.
  7. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    Hi, I am no expert but based on my experience when you add AI to a biome with one texture they automatically spawn all over the terrain. Based on the rules in the Object/profile. As well as the Odds of a partiicular animal spawning.

    I have bears that spawn and they are rare, deer are common, stags are less so and so on.

    I have mountain goats spawning at higher levels than deer for example. Birds spawning approx 10 points above the terrain (sparrows)
    Like the examples I gave above you have to think your way through your terrain when adding them and then set rules and rarity etc for each as you build the animal kingdom specific to your own choices.

    I think only having one texture does limit you a little but not so if you spawn them all on the same texture and set the rules for spawning and rarity etc.
     
  8. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    121
    Ah - I see. I honestly did a quick run, create and spawn which worked perfect. I just didn't dig deeper into breaking up AI (animals) spawing areas locked to texture. I'll give it a run. I really do appreciate it Halk0077. Thanks, Matt
     
    Hawk0077 likes this.
  9. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    OK so I opened my project and took a look at the settings and so, in your case the first level of control is at the biome level when you choose either ODDS or RANDOM generation for your OBJECTS.

    So if youve got 6 objects/animals/AIs you can either spawn them randomly across the texture or using odds. I dont really get the odds thing to be honest. If it was PER object then it would make sense but its odds per biome?

    Second level (or first depending on how you look at it) is within the OBJECT/Profile.

    For each you have:

    Minimum spawning level
    Maximum spawning level

    So goats would be higher than bears.
    Bears could be higher than deers.
    Rabbits could be within the bear and deer range but not in the mountain goat range

    Of course they can either be LAND or SEA (negative offset) or AIR (positive offset)
    Individual animals such as bears or groups such as deers.

    Then you have rarity.
    Male deers could be rarer than female deers
    Bears rare and lions ultra rare.

    So the settings in the individual profiles/objects is where you really control what spawns and on a global view you are really controlling the rarity of the AIs. Then height they are spawned at and then the amount.
    It then depends on your modles.

    If you have brown bears, black bears and red bears you of course set the rarity of each in as logical way as possible.

    Apart from that, thats about as much control as you can get with only one texture but I believe its really enough to get a good setupo going with a little bit of thought.

    Hope that helps.
     
  10. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    440
    Could also try changing the values at runtime. I havent tried but how I would try is:

    Set up colliders (zones) and make a script for each one

    Within the script reference the crux object and create a list of crux objects for that zone

    On player enter/exit add or remove the objects

    Again I havent tried so idk if runtime changing of objects is possible but I believe it should be
     
  11. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    707
    Does Crux work with MicroSplat and MegaSplat?
     
    Hawk0077 likes this.
  12. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    691
    Yes. You just add the textures into the crux biomes.

    Its been a while since I used megasplat but if I recall you reference the ONE unity texture Grass for instance. Which spawns the AI on the same megasplat instances.

    I dont think you can choose individual megasplat instances of ONE texture but I might be wrong.

    IM using CTS but the unity textures and CTS versions are the same.

    If I recall you select the unity texture for grass as an example and add it to a crux biome then the AI spawn on that texture. Whether you have one or 10 megasplat textures to represent the one.

    Hope that makes sense.
     
    wood333 likes this.
  13. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    46
    Hi~ I already bought Emerald AI~ Is Emerald Ai work seamless with Crux?
     
  14. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,009
    It plays really nice with it if that is what you are asking. I use both.
     
  15. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    46
    It
    Sound like npc controller? So, I just let them do what I want, and when my player go away , it will gc what I want?
     
  16. noobynobody

    noobynobody

    Joined:
    May 9, 2019
    Posts:
    76
    Does this perform well on mobile?
     
  17. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,404
    Hello, can I spawn npc without assigning a texture? I dont use unity terrain and use meshes instead with base color.
     
  18. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    1,552
    May I ask about the Vegetation Studio support status? Thank you.
     
  19. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    440
  20. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    691
    Hi, Crux uses SampleHeight() to get the terrain height but it gives you wrong terrain height, instead, it should use GetHeight() to get the world-position height. The difference is explained here.
    https://answers.unity.com/questions/752538/sampleheight-vs-getheight.html

    Basically, SampleHeight gives you HeightMap height but often terrain object world-position is set at some negative position to cover underwater.
    The reason is that HeightMap cannot be a negative value and if you set your terrain at Zero world position, terrain cannot cover underwater.

    This is why you shouldn't assume the terrain object is at Zero.
    To fix it, you just have to swap the function above.
    Thanks for the help.
     
    Last edited: Dec 15, 2019
  21. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    440
    Why cant you move your water up?
     
  22. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    691
    Besides the water, if you place your terrain other than y=0, you will have this problem. This is a simple bug. @BHS I hope you take a look. Thanks.
     
  23. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    @BHS, can we have an option to ignore terrain textures all together. I really want to have an option to use it with CTS strip textures option enabled.

    Update: Looks like switching to mesh terrain spawn removes texture check. Is this a good solution for my problem?
     
    Last edited: Jan 17, 2020
  24. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    I've noticed that Crux ignores my population cap. Why does this happening?



     
  25. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    I've been able to fix it. Because I copied crux asset object for different enemies, they had same Spawn ID, when I hit Regenerate Spawn ID button on every Crux asset, it fixed the problem.
     
  26. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    After having some more problems with population cap I've discovered that I need to have all object in one group (for example "wild life") in order for system to work properly.
     
  27. JDrem1

    JDrem1

    Joined:
    Jun 24, 2017
    Posts:
    195
    @BHS

    Hey. I own both this and Emerald.
    I know you update Emerald quite often.

    But have you any plans for an update of Crux please?

    Thanks.
     
  28. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    46
    Hey~ It seems when i upgrade Emerald AI to LWRP, those demo scene not look so well~ Is there have better way to fix it quickly?
     

    Attached Files:

  29. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    46
    By the way, where can I find the Tutorial about LoveHate\Quest Machine\Dialogue System?Thanks
     
  30. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    389
    You need to change the shader from standard to urp...
     
  31. sky_dragon

    sky_dragon

    Joined:
    May 27, 2016
    Posts:
    27
    Hi!
    I would like to ask if I destroyed the object produced by spawning. How will spawning work? Will it automatically remove and adjust the population of an AI. Or need other methods of destruction?
     
  32. sky_dragon

    sky_dragon

    Joined:
    May 27, 2016
    Posts:
    27
    Hello there
    How can I integrate Unistorm and Crux? I want to spawn at a certain time
     
  33. AdminArdagor

    AdminArdagor

    Joined:
    Feb 6, 2018
    Posts:
    40
    Hello, is there any news regarding the update for Crux ?
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    My apologies for the delay. Yes, I have updates planned for Crux. I'm nearly finished with my Emerald AI and UniStorm updates and then I will provide more information on my plans for Crux's updates.
     
    Last edited: Jun 8, 2020
  35. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    If an object is destroyed or despawned, Crux should automatically adjust the populations accordingly.
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    Crux should automatically detect if UniStorm present in your project. If it is, it will open up additional options within Crux Objects that will allow you to spawn according to the time of day, season, and weather type.
     
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,284
    Hey everyone,

    Crux 2.1.1 has been accepted and is now live! This update's main focus is fixing the reported bugs and fixed UniStorm support that allows for spawning based on UniStorm's weather, time, and season.

    Release Notes
    • Improved UniStorm support to allow AI to spawn according to UniStorm's time of day, season, and weather.
    • Decreased Min Spawning Elevation to -500 (from 0) to better support deep water spawning.
    • Increased Max Spawning Elevation to 2000 (from 1000) to better support higher elevation spawning and terrains.
    • Fixed an issue that spawned objects incorrectly if the terrain wasn't positioned near a y position of 0.
    • Fixed an error that happened when using spawning nodes with Mesh terrains.
    • Fixed an issue with UniStorm support that didn't allow it to work with newer versions of UniStorm.
    • Fixed a script conflict issue with UniStorm and Crux.
     
    Akshara and westryder907 like this.
  38. westryder907

    westryder907

    Joined:
    Dec 28, 2016
    Posts:
    61
    Is it possible to use a GKC NPC with Crux? Everytime I've tried to achieve this it doesn't work.
     
  39. AngelBeatsZzz

    AngelBeatsZzz

    Joined:
    Nov 24, 2017
    Posts:
    224
    Hi, I tried to use SpawnByID (string SpawnID) to generate an animal and then use RemoveObject (GameObject ObjectToRemove) to recycle it, but I got a prompt: "The object Animal(Clone) wasn't created with Crux-Ignoring Object", it looks like SpawnByID (string SpawnID) is not the Crux generation function but just an ordinary Instantiate()? How can I use Crux to generate a single animal that can be recycled?
     
  40. Syllvia

    Syllvia

    Joined:
    Mar 26, 2013
    Posts:
    16
    Howdy!

    Like some others have posted, i'd love to use this in a multiplayer setting where multiple systems follow multiple players (infact my boss has pretty much told me to use this), however it turns out that having multiple systems doesn't actually seem to work as only the first one will spawn stuff. Has there been any updates on restoring that v1 multiple players support? This is pretty important so if i need to go redo some code myself that's fine, but I'd love to know where to look to ensure that works.
     
    Willbkool_FPCS likes this.
  41. Jairusx

    Jairusx

    Joined:
    Jun 25, 2020
    Posts:
    22
    Hello.Is Crux suitable for URP projects? Does it work ?
     
unityunity