Search Unity

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

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

  1. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    49
    Do you know when Mesh spawning support will be released? My terrain is all mesh terrain and the asset is useless without mesh support. I bought it months ago, along with EmeraldAI, cause mesh support was in development but its been months with no update. Is there a beta access to 1.2 that just enables mesh spawning so I can use the asset? I don't care about the rest of the 1.2 update, just this important feature please. I love your work on your other assets and your support on them are much better than on this asset. I understand its not a priority but just this feature would allow usability for alot more people.
     
    RoyalDust likes this.
  2. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    329
    I trigger CruxPool.Despawn(gameObject); after 3 seconds after object is spawned.
     
  3. pickle_rick1

    pickle_rick1

    Joined:
    Jan 7, 2018
    Posts:
    8
    @BHS I getting this error Assets/Crux - Procedural AI Spawner/Scripts/Editor/CruxEditor.cs(538,29): error CS1540: Cannot access protected member `UnityEngine.Texture.Texture()' via a qualifier of type `UnityEngine.Texture'. The qualifier must be of type `CruxEditor' or derived from it

    Assets/Crux - Procedural AI Spawner/Scripts/Editor/CruxEditor.cs(538,29): error CS0122: `UnityEngine.Texture.Texture()' is inaccessible due to its protection level
     
  4. Demonoid74

    Demonoid74

    Joined:
    Jan 20, 2017
    Posts:
    16
    Hello , also a user of Emerald AI...and was thinking about picking this up as well...any hints at the next version release as my game is mostly in a town/city setting and waiting on the new spawning functionality . I know you are busy and just curious as to progress!
     
  5. pickle_rick1

    pickle_rick1

    Joined:
    Jan 7, 2018
    Posts:
    8
    @BHS how to get crux to spawn ai when there is no terrain?
     
  6. westryder907

    westryder907

    Joined:
    Dec 28, 2016
    Posts:
    52
    I am also looking for mesh support in Crux, hopefully version 1.2 comes soon.
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    I'm currently working on UniStorm's 3.0 update. As soon as this is done, Crux 1.2 will continue development. It shouldn't be more than a couple weeks after UniStorm's update is finished, if everything goes according to plan.


    When I get the chance, I will see if I can figure out why the despawning isn't working when being called outside of the Crux system.


    What version of Unity are you using? This sounds like an error from Unity 2018 which is still in beta.


    I'm currently working on finish UniStorm 3.0's update. As soon as this is done, the Crux 1.2 update should be released about 2 weeks after.


    Mesh spawning will come with the 1.2 update.
     
    Gua likes this.
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    Crux 1.1.1 has been submitted and is awaiting approval. This update adds support for Unity 2018.1. Crux 1.2 is still in development.
     
  10. Tech-Byte

    Tech-Byte

    Joined:
    Dec 5, 2014
    Posts:
    26
    Code (CSharp):
    1. Texture2D newTexture = new Texture2D(90, 90);  
    2.  
    3. _MyClass.TerrainTextures.Add(newTexture);
    This is what I did as a temporary fix.
     
  11. AdminArdagor

    AdminArdagor

    Joined:
    Feb 6, 2018
    Posts:
    11
    {HELP} I just bought a Crux, but did not see if it supports the landscape created in Landscape Auto Material ? ((. We use it to create our landscape...
     
  12. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    Does Landscape Auto Material use a Unity terrain? If so, you shouldn’t have any issues as Crux just gets the texture index from the terrain.
     
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
  14. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    441
    Devision4 likes this.
  15. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    115
    @BHS I'm trying to better understand how the node spawning works before I purchase Crux. My initial assumption was that I could place game objects ("nodes") in my scene and AI would be spawned around those nodes once my player was within range. This would allow me to have specific areas/clusters occupied by that AI. Is that possible, or do I have to use terrain textures to define the biomes to contain the AI?

    Also, I'm not totally clear on the spawn limits. I'd like to set it up so that there are X number of monsters on an island and once they destroyed, no more will spawn on that island. Is this possible?

    Thanks!

    [EDIT] - I bought Crux and now have a better understanding of the differences between Node and Standard spawn modes from reading the inline help text:
    • The Standard Spawn Type option will simply spawn AI around the player. They will remain active as long as they don't leave Crux's despawn radius. This option is helpful for those who want AI to continue to be active even though they might not be visible or near the player.
    • The Nodes Spawn Type option will spawn all AI groups to nodes. If the player is out of the customizable range, the AI within the said node will be deactivated until the player is within range. This allows AI to stay inactive when not close enough to help increase performance.
    It would be great if we could define biomes (spawn areas) using something other than terrain textures. Example: a nest or home base of creatures/enemies.
     
    Last edited: Jun 30, 2018
  16. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    115
    @BHS I'm also running into this problem. Other than changing textures, are there any suggestions for a fix/work-around?

    Thanks!
     
    Last edited: Jun 30, 2018
  17. Moonthurst

    Moonthurst

    Joined:
    Feb 10, 2018
    Posts:
    6
    @BHS Just went through you interview with The Messy Coder, and fell in love with Crux. I do have Gena but this AI spawner is more well AI spawning specific.
    Just by curiosity: Any plan on making Crux Unet ready out of the box in the future or maybe a tutorial on how to implement it ?
     
    Last edited: Jul 3, 2018
  18. wwg

    wwg

    Joined:
    Apr 2, 2014
    Posts:
    115
    I get hundreds of Emerald errors when Crux tries to spawn AI - presumably because it's trying to spawn objects off of the NavMesh - for example:
    • "GetRemainingDistance" can only be called on an active agent that has been placed on a NavMesh.
    • "CalculatePolygonPath" can only be called on an active agent that has been placed on a NavMesh.
    • "IsStopped" can only be called on an active agent that has been placed on a NavMesh.
    • etc...
    Anyone have a fix or work-around for this? @BHS?

    [Edit: More Information - I'm using a single terrain with a navmesh surface. There are several places that are not walkable.
    Appears to be related to Emerald AI objects spawning above the NavMesh. This only happens when Spawn Type=Standard. It works fine when Spawn Type = Nodes.]
     
    Last edited: Jul 11, 2018
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    I plan on releasing an update that will add layer masks so Crux will only spawn on the appropriate layers. This would allow you to exclude things like bodies of water.

    This will also be fixed with the version I mentioned above. It may require a Unity version update as I don't think the older version of Unity have the API to detect where Unity's NavMesh is. If I remember correctly, it shouldn't be any higher than Unity 5.6. However, I do think there is a solution. Users will have the option within the Crux Editor whether or not to have NavMesh spawning enabled. This will allow Crux to function as normally, but also need to be on Unity's NavMesh to be a successful spawn.


    I do plan on adding Unet support in the future. This will be after UniStorm's 3.0 update.
     
  20. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    193
    I have the same issue, using newest unity, mapmagic/voxeland. Emerald ai. Aquas. And unistorm and gkc. I have several textures set, even some extra ones for good measure. I have a navmesh and pop caps set. I have objects set. If i place a animal it runs around fine, just wont spawn
     
  21. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    688
    Any idea when the next release will be?
     
  22. Shturmovik

    Shturmovik

    Joined:
    Nov 5, 2014
    Posts:
    22
    Would having multiple Crux systems in a scene cause any issues? The reason I might be interested in this is to have different spawning logic depending on the location of the player gameobject, so Crux systems would be activated and deactivitated by trigger zones. Ideally, only one of the Crux systems should be active at any given time.

    Specific use case: goblins live on the left bank of a river, elves live on the right bank. The same set of terrain textures are used on both sides of the river, but each race should only spawn in their own area.

    Anything immediately wrong with this idea - I haven't tested it yet - or is there perhaps a simpler approach I've not thought of?

    EDIT: Or in fact keep all the systems active at the same time, but with an option to disable spawning of new AI from specific systems. That way any currently active AI objects in the vicinity of the player will stick around until they get culled due to distance.

    EDIT EDIT: Or perhaps add an option so AI can only spawn inside specific volumes.
     
    Last edited: Jul 28, 2018
  23. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    688
  24. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    688
    I am having a hard time getting Crux to spawn my Emerald AI NPCs that I already have created. Can you please provide a tutorial on how to use both in conjunction with each other?
     
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    Strange, I will test Crux with the newest version of Unity and see if I can recreate the issue. If I can, I will find a solution and release a quick update to fix it.


    Now that UniStorm 3.0 has been, I will begin working on the Crux update. This update will also add the ability to spawn base on certain weather types, time, and seasons.


    There are a few customer who use multiple Crux systems without any issues.

    A possible solution could be to have a tag condition. This way if 2 terrains have the same textures, but are different terrains, they could both have different tags. I'm not sure if your terrains are two separate object though. With the new version of Crux, I plan on improving quite a few things as well as add some new spawning conditions.


    I will be working on improving Crux's documentation and tutorials. I will be moving them from the current wiki site and to Google Docs, similar to what is done here with Emerald AI: https://docs.google.com/document/d/...uHce2BVLM3QTq5axg/edit#heading=h.t9lgwfc7t9ts

    All you should have to do is ensure that you have NavMesh baked in your scene, for Emerald AI, and apply Emerald AI objects to Crux. When the conditions are met, an AI should be spawned. What specifically are you needing assistance with?
     
  26. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    688
    Assigning the right object to Crux.
     
  27. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    688
    When do you expect 1.2 to be available?
     
    Ramulos and RoyalDust like this.
  28. RendCycle

    RendCycle

    Joined:
    Apr 24, 2016
    Posts:
    329
    I would like to know how flexible is Crux. Can it also be connected to another Weather System aside from UniStorm so I can use some other functions there to affect spawning? For example, use the other Weather System's temperature values to determine if a creature can spawn in a particular Biome?

    Also will this work without Navmesh?
     
    Last edited: Aug 24, 2018
  29. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    I prefer not to not give an ETA because sometimes an update will take longer than expected. However, Crux 1.2 is currently in development. This update will add quite a bit, but some of the main features are mesh terrain support and spawning based off of UniStorm's weather, time, season, and more.


    Currently, you would have to manually add the conditions to the Crux script to implement a weather system spawning aside from UniStorm's. I'm considering adding some type of custom condition system that will allow Crux to be more flexible with external systems and scripts. However, this most likely won't come until after the 1.2 update.

    Yes, Crux works without NavMesh.
     
    RendCycle likes this.
  30. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    572
    @BHS I'd like to use your AI and Crux but would Crux have to be compatible with Megasplat in my project in order for AI to spawn in correct areas designated via specific textures? I'm using Both Voxeland and Megasplat together and would like to use your tools, thanks.
     
  31. xrenuix

    xrenuix

    Joined:
    Aug 22, 2018
    Posts:
    6

    Do you plan on ever adding this feature? I just bought it and I haven't gotten a chance to play around with it, but I imagine you might be able to simulate waves? Can you adjust spawning parameters during gameplay? So you could build a counter or something that adjust the spawning to, like I said, simulate a wave.

    You should also add parented spawning. So if x creature spawns, it always spawns with 3 of y creature. It doesn't seem like that's something that is straightforward to do.
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    Crux works with Unity terrains so I'm not sure if Voxeland would work as Crux gets the texture index of a Unity terrain at the position of the spawn. I'm assuming the Voxeland uses mesh terrains which isn't yet supported. I do have plans to support mesh terrains soon though. I haven't yet tested Megasplat, but I will look into seeing if Megasplat is or can be supported.


    I'm not sure as Crux isn't a wave based spawning system. It's a procedural spawner that takes various conditions into account to spawn AI around the player. However, I will have to look into this to see if it's possible to be modified to do so.
     
    Ascensi likes this.
  33. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    Hey everyone,

    A lot of users have been asking for more information on Crux 1.2. While I was figuring out the direction to take with Crux 1.2 and which features to add, I decided to rewrite the system with Crux 2.0.

    The reason a rewrite was needed is that I saw a lot of limitations with all of the spawnable objects being stored directly in the Crux Editor. This also meant more limitations to additional features and conditions that could be added. With Crux 2.0, users will be able to use ScriptableObjects for handling their spawning objects. It's essentially a very similar approach to the previous method, except each spawnable object will have its own editor.

    New Crux Editor
    Here's the new Crux 2.0 Editor, which is still a work in progress. It's similar to the previous version, but a lot more organized. Instead of creating a new sub-editor for each created object, there is a list for each category. All users have to do to assign their spawnable objects, is apply a Crux Object. A Crux Object will be explained below.
    CruxBiomeManagement_2.0.png

    Crux Objects
    Crux Objects are similar to how users created spawnable objects previously except, each spawnable object will have its own editor as a scriptable object. With a Crux Object, users will be able to assign a prefab to spawn, adjust the spawning condtions, and spawning settings.
    CruxObjectProjectTab_2.0.png
    CruxObject_2.0.png

    UniStorm Conditions
    UniStorm conditions allow an object to only spawn if the current UniStorm conditions are met. These include weather, time, and season, with more conditions coming. UniStorm conditions are set for each Crux Object. The UniStorm Conditions feature is completely optional and can be globally adjust from with the Crux Editor. Each Crux Object also has the option to not use the UniStorm Condition feature.
    UniStormSpawningWeather.png

    Terrain Info, Mesh Terrain Support, and Elevation Based Spawning
    Crux 2.0 will have mesh terrain support, however, texture spawning will not be possible due to Unity's inability to get mesh terrain's textures. A Terrain Info section has been added to allow users to quickly see the information of the terrain right from within the Unity Editor using the mouse's position. This will help users determine the conditions of their terrains without having to guess their height or slope angle. Crux 2.0 has also added the ability for objects to be spawned with based on height/elevation to allow fish to spawn only in the water and the ability to spawn something like mountain animals in higher elevations.
    TerrainInfo.png

    Improved API and Despawning
    Crux 2.0 will have improved API. This will allow users to access the Crux system by simply calling:
    Code (CSharp):
    1. Crux.Instance
    Despawning has also been improved to allow an object to be properly despawned and reused. So, if you kill an AI, Crux will automatically reuse the object and will remove the object from the current total population as well as the current population of the specific object. All users have to do is call the function below and pass the AI object as the parameter and Crux will do the rest.
    Code (CSharp):
    1. Crux.Instance.RemoveObject(GameObject ObjectToRemove);

    All this will make Crux more efficient and easier to manage spawnable AI. It will also make adding 3rd party support easier. Mesh terrain support still in the works. Please be sure to provide feedback or let me know if you have any questions regarding the 2.0 update.
     
    Last edited: Sep 15, 2018
  34. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    403
    Has anyone else had issues using this with vegetation studio?
     
    Last edited: Sep 3, 2018
  35. Delta5-1

    Delta5-1

    Joined:
    Apr 21, 2015
    Posts:
    9
    Yes, I've tried to implement Crux yesterday but it didn't seem to work for some reason. I'm using Gaia + CTS + Vegetation Studio + Emerald AI + Crux.

    I've figured out that the problem is Vegetation Studio related, without VS crux is running perfectly fine, even with CTS when strip textures is disabled.

    Is there any solution for this issue? Crux is a great system and I hope I can use it as planned.

    I know this has been requested already but are there any news on Emerald integration with Opsive's TPC?
     
  36. Akshara

    Akshara

    Joined:
    Apr 9, 2014
    Posts:
    91
    I have yet to implement Crux with VS/CTS, however it may be that VS splatmap rules are overriding CTS. The following is a quote from Lennart on the Discord VS channel, regarding using CTS with the current version of VS, "Make the package with textures. Select the package with the textures and disable Update Texture on Init - this way CTS still manages the textures, yet with VS splatmap rules." Don't know if that will help, yet may be worth a shot.
     
  37. Delta5-1

    Delta5-1

    Joined:
    Apr 21, 2015
    Posts:
    9
    I tried it but sadly it didn't work for me. Anyways, thank you for your help!

    If I find a solution to this by myself I'll let you know about it.
     
    Akshara likes this.
  38. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    Hi @BHS

    How do I make killed AI Agents get removed from the map and reused by the pooling system?


    I am using Crux with Emerald AI and have set "Recycle AI" to true. In my small demo level terrain (200x200) AI don't ever seem to get reused after being killed. I have set the "Deactivate distance" to 50 and I see AI Agents be disabled in the Hierarchy, but after being killed they dont get reused, instead they remain forever being dead on the ground. I have set "Max Radius" and "Despawn Radius" to the smallest value accepted (100/150), which still is too high for my small demo level, but even outside of the defined radius AI Agents do not despawn. I suppose I am missing something basic here, so any help is much appreciated.
     
    Last edited: Sep 8, 2018
  39. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    I will contact the developer of Vegetation Studio to see if we can point points what's happening. Vegetation Studio support is definitely something I want for Crux.


    With the current version of Crux, there is a little bit of a bug with manually despawning an AI. With Crux 2.0 I have fixed it and added a function to call passing the object to remove as the parameter. This successfully removes the object from Crux, adjust the population levels, and allows the object to be reused. However, I haven't done this with the current version. If it's needed, I can give you a function to add to Crux 1.2 that will do the same thing for the time being.
     
    Akshara and Weblox like this.
  40. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    403
    so i have made progress using cts and vegetation studio with crux and emerald. but now im having another issue.

    it appears crux is adding checkrendererstatuswithoutdelay without delay to my animal even though the component is already there and the one that is added doesn't have the emerald component populated.

    so i have 2 copies of the component. one with emerald component populated and the other not
     
  41. Ascensi

    Ascensi

    Joined:
    Sep 7, 2013
    Posts:
    572
    Just an idea, make a terrain invisible to the camera.
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,811
    Crux doesn't add the checkrendererstatuswithoutdelay component. This is Emerald AI's disable when off screen feature. This is done to boost performance so AI that are off screen aren't wasting performance. I don't believe it would affect Crux spawning as Crux fully supports Emerald AI.

    I now have a copy of Vegetation Studio. I will test everything to see if I can get it working. When I find out how to do so, I will be sure to post it here. If there is something I can do on Crux's end to make things easier, I will add it to the 2.0 update.
     
    Akshara likes this.
  43. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    688
    Can't wait for the new update!
     
  44. Weblox

    Weblox

    Joined:
    Apr 11, 2016
    Posts:
    256
    @BHS - Thnx a lot. A fix for this would be awesome, but I would need some instructions on how to implement the function. Also, for my current demo level I still need to decrease the "Max Radius" and "Despawn Radius" below it's currently accepted minimal values. Can I safely do this in the Source?
     
  45. RockingGameDeveloper

    RockingGameDeveloper

    Joined:
    May 28, 2015
    Posts:
    12
    Hello, I just bought Crux and so far I really like it. I do have some questions though.

    I keep getting messages saying that they can't read the idle state of my animation, is there a way I can have it so I don't have to change the name of the animation?

    How do I have the Ai avoid the player?

    How do I have the Ai incorporate other animations, such as ex) Have the deer move left before running away. Just like how the zebras do in the video when the player is close to them.

    Please contact me back when you get this message, my email is Proudguitarist@yahoo.com.
     
  46. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    279
    Could someone write up a how-to for using Crux with CTS and Vegetation Studio? I'm unclear how to add CTS as textures.

    Any help, much appreciated :)
     
  47. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    70
    I would also like to know how to do this.
     
    Hawk0077 likes this.
  48. RockingGameDeveloper

    RockingGameDeveloper

    Joined:
    May 28, 2015
    Posts:
    12
    I have a question, the animation calls for the animation by the name "idle", any way I can have animations with custom names on there like, "Idle 4" or "Deer Idle 3"? I like to be organized.
     
  49. transat

    transat

    Joined:
    May 5, 2018
    Posts:
    224
    @BHS Can I suggest moving Crux from the "Window" menu to the "Tools" menu, where it makes more sense? Replacing a few lines in CruxMenu.cs achieves this in a breeze...

     
    RendCycle likes this.
  50. MarceloASG

    MarceloASG

    Joined:
    Jun 15, 2017
    Posts:
    21
    Hello, I am using the World Streamer asset and I get the error: "No terrain could be found, Crux was disabled". Is there a solution to this problem? Grateful for the attention (Using Google Translate).