Search Unity

[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:
    515
    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:
    788
    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:
    124
    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:
    788
    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:
    788
    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:
    124
    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:
    788
    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:
    124
    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:
    788
    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:
    515
    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:
    851
    Does Crux work with MicroSplat and MegaSplat?
     
    Hawk0077 likes this.
  12. Hawk0077

    Hawk0077

    Joined:
    Nov 6, 2017
    Posts:
    788
    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:
    48
    Hi~ I already bought Emerald AI~ Is Emerald Ai work seamless with Crux?
     
  14. SickaGames1

    SickaGames1

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

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    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:
    75
    Does this perform well on mobile?
     
  17. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    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:
    4,294
    May I ask about the Vegetation Studio support status? Thank you.
     
    BriBill likes this.
  19. tredpro

    tredpro

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

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    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:
    515
    Why cant you move your water up?
     
  22. chrisk

    chrisk

    Joined:
    Jan 23, 2009
    Posts:
    704
    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:
    455
    @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:
    455
    I've noticed that Crux ignores my population cap. Why does this happening?



     
  25. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    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:
    455
    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:
    199
    @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:
    48
    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:
    48
    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:
    414
    You need to change the shader from standard to urp...
     
  31. sky_dragon

    sky_dragon

    Joined:
    May 27, 2016
    Posts:
    32
    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:
    32
    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:
    42
    Hello, is there any news regarding the update for Crux ?
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    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,764
    If an object is destroyed or despawned, Crux should automatically adjust the populations accordingly.
     
  36. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    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,764
    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:
    239
    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:
    62
    Hello.Is Crux suitable for URP projects? Does it work ?
     
  42. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    186
    I brought this spawner into my scene in 2019.4.13 and just can't get it to spawn a single AI--- I swapped the demo scene (demos seem to work fine) monsters and player with my own --- and it works in the demo scene with the included terrain and textures with my player and AI. But when I literally drag it in my scene and set to my textures no AI appear.
     
  43. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    I remember having similar issue. If I'm not mistaken my problem was cause by the fact that I did have different later for terrain object.
     
  44. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    186
    Nope... default layer same between demo scene and my scenes terrain object... any more ideas ?
     
  45. DeidreReay

    DeidreReay

    Joined:
    Oct 28, 2019
    Posts:
    50
    Have reached out in DMs, and the discord and not getting any guidance so here goes. We have the crux spawner spawning Emerald ai Deer. They are set to Root motion as they need that. They spawn in as they should but all of them just stand there acting if they are not able to move. Moving a player to one of them then is acting as if we can not hurt them. Anyone else ran into this? Any ideas what to check? Thanks in advance hopefully.
     
  46. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515

    Is there a way (maybe script) for spawning a certain object at a certain point? Like you pick the assign Crux object on the gameobject and place the gameobject where you want in your world and it uses the same check system. But spawns the object there. I was working on making one using Crux but this seems like an obvious feature imo
     
  47. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Do you only have this issue with your deer?
     
  48. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
    We just completed final editing to our latest video, "Apollo's Dream", and it will be coming soon to our YouTube channel.
    Using Emerald AI and Crux.
     
  49. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    839
  50. johny256

    johny256

    Joined:
    Mar 3, 2015
    Posts:
    259
    Please Integration other asset? etc UnitZ survival asset integrated helping?