Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    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:
    515
    or world streamer
     
  2. Devon11

    Devon11

    Joined:
    Mar 17, 2019
    Posts:
    1
    Is there any way for your player character to press a button inside the game to Spohn your AI, I am working on a game and I when my character comes in to the scene I do not want the enemies to Spohn right away, I want the player to choose when he wants the enemies to Spohn by hitting a button, is there any way for this to happen in this asset
     
  3. pranshuprgk

    pranshuprgk

    Joined:
    Sep 21, 2020
    Posts:
    1
    I am using Gaia-2 for terrain generator and Crux Spawner for spawning the animals on the terrain.

    Also I using Emrald AI with Crux.

    I followed this tutorial on Youtube for spawning the animals on the terrain.

    Now When I hit play there are no any animals spawn on the terrain.

    After wondering for hours, I found that when I go deep below the terrain the Crux Objects(animals) were spawned!

    Why they are not spawning on the terrain? Please help any help is highly appreciated!!!
     
  4. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515

    I recommend using the demo scene that comes with crux to test ur animals out. Because you know that level is set up right. Right now we aren't sure if its the level or animal that's set up wrong.
     
  5. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Anyone has any idea if it possible to make crux spawn directly on mesh tagged with certain layer, i tried the settings in Crux, but it does not spawn anything at al..

    I know it is working, because i can spawn wildlife on grass (different scene),
    but here i want to spawn npc's on "mesh" sidewalk..
    upload_2021-2-19_18-19-3.png

    upload_2021-2-19_18-19-45.png

    If it is not possible, does anyone know of a different AI spawner, that allows Mesh spawns and pooling/culling/range limitation..
     
  6. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Before trying a whole new scene. I would duplicate an example provided and start to add your stuff to it. The world being the last part. Set the demo scene up with your layers. Doing each thing one by one and then testing. Theres a lot of things that can cause the issue like the height could be set wrong for example. So doing this will help you find what needs fixed. Its a little bit of a pain but I found that is the best way to get it working. My issue is normally I have the height off somewhere. And try 1 crux ai at a time too till you get it right
     
  7. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    I think you are misunderstanding what i am writing.
    I was using crux in not only another project, but also in a different scene than shown here.
    In those i know it works spawning on terrains.

    But now i want to spawn on Mesh (the sidewalk, NOT A TERRAIN), at the moment it seems impossible. not a single spawn no matter the settings.
     
  8. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    I know exactly what you are doing cidy2, sts, the free pedestrian from github, uma, and crux to spawn the uma for the free pedestrian. How far am I off ;)
     
  9. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    I believe theres a mesh example scene. Start out with that and start to work your stuff into it. First get your ai to work in that scene. Then you can adjust the crux system one by one to match your scene and alter the world to match the world you are bringing it to. Don't try and rush this or you will just waste your time. Trust me. Go back and look at the history in this forum. Ive been here for awhile
     
  10. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    Only Cidy2 and STS, then i use Synty Polygon characters, with Emerald AI as npc's. These are the ones i want to spawn in with Crux ;) Not a fan of UMA.. and the pedestrian thing, tried it, not much joy.. :D

    I like Crux, because it "kinda" pools npc's with a spawn and despawn on player gameobject, and i am allready both using gaia streaming and mesh combiner to limit what is loaded in at the same time. :D
    Else i could just drop in all the NPC's and let them wander around.
     
    Michael_Berna likes this.
  11. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,151
    Hey! @BHS the spawner don't work at all, even if it's set up straight from the video...using latest unity lts. And I use emerald
     
  12. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
  13. Aaron2348

    Aaron2348

    Joined:
    Dec 12, 2016
    Posts:
    328
    Hi im interested in this asset i just want to know can u spawn on meshes? And can u spawn waves of emerald Ais?
     
  14. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    Why Crux spawned more than one instance when population cap is set to 1?

     
  15. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    Do u have it added multiple times? Like maybe each biome?
     
  16. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
  17. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    455
    I've figure it out. I needed to hit regenerate spawn ID button here https://i.gyazo.com/5a752123225fceb4c3c0a1a138e04604.png

    It's not the first time I encounter this problem, but I always forget about it. Cause it is designed poorly that I can make a copy of *.asset file for new object, configure it differently, but if I don't hit that button, it will use settings for different object.
     
  18. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    you could probably write a code to copy asset and regenerate it for you. an editor window option
     
  19. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    but any time you copy it. you do have to regenerate the id as it is a different object. the copy feature is a unity feature. crux has you generate a new object. unless there was a copy feature added. but you could do that with what i listed above
     
  20. TheGhost0

    TheGhost0

    Joined:
    Sep 11, 2017
    Posts:
    29
    iam using :
    unity 2020

    my question

    why crux cannot spawn creature unhide ?

    its always spawn my creature and npc/other like hide

    i try with my friend to unhide the creature on unity 2020

    please help here
     
  21. Michael_Berna

    Michael_Berna

    Joined:
    Jul 5, 2019
    Posts:
    39
    Hello, I am trying to use crux along with emerald AI and am getting the following errors when my emerald character is spawned. I'm using the newest version of both and ran the 3.0 upgrade asset file. Also, the emerald character works fine with the navmesh on its own if it is placed in the scene, just not when being spawned with crux.

    "CalculatePolygonPath" can only be called on an active agent that has been placed on a NavMesh.
    UnityEngine.AI.NavMeshAgent:CalculatePath (UnityEngine.Vector3,UnityEngine.AI.NavMeshPath)

    Code (CSharp):
    1. "CalculatePolygonPath" can only be called on an active agent that has been placed on a NavMesh.
    2. UnityEngine.AI.NavMeshAgent:CalculatePath (UnityEngine.Vector3,UnityEngine.AI.NavMeshPath)
    3. EmeraldAI.Utility.EmeraldAIInitializer:SetupNavMeshAgent () (at Assets/Emerald AI/Scripts/Components/EmeraldAIInitializer.cs:296)
    4. EmeraldAI.Utility.EmeraldAIInitializer:Initialize () (at Assets/Emerald AI/Scripts/Components/EmeraldAIInitializer.cs:18)
    5. EmeraldAI.EmeraldAISystem:Awake () (at Assets/Emerald AI/Scripts/System/EmeraldAISystem.cs:899)
    6. UnityEngine.Object:Instantiate<UnityEngine.GameObject> (UnityEngine.GameObject,UnityEngine.Vector3,UnityEngine.Quaternion)
    7. Crux.Utility.CruxPool/PoolOther:Spawn (UnityEngine.Vector3,UnityEngine.Quaternion) (at Assets/Crux - Procedural AI Spawner/Scripts/Pool Manager/CruxPool.cs:36)
    8. Crux.Utility.CruxPool:Spawn (UnityEngine.GameObject,UnityEngine.Vector3,UnityEngine.Quaternion) (at Assets/Crux - Procedural AI Spawner/Scripts/Pool Manager/CruxPool.cs:131)
    9. Crux.Utility.CreatureSpawning:AttemptCreatureSpawn (int) (at Assets/Crux - Procedural AI Spawner/Scripts/Spawning Logic/CreatureSpawning.cs:165)
    10. Crux.CruxSystem:Create () (at Assets/Crux - Procedural AI Spawner/Scripts/System/CruxSystem.cs:545)
    11. Crux.CruxSystem/<SpawnCheck>d__67:MoveNext () (at Assets/Crux - Procedural AI Spawner/Scripts/System/CruxSystem.cs:257)
    12. UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)


    "SetDestination" can only be called on an active agent that has been placed on a NavMesh.

    Code (CSharp):
    1. Failed to create agent because it is not close enough to the NavMesh
    2. UnityEngine.Object:Instantiate<UnityEngine.GameObject> (UnityEngine.GameObject,UnityEngine.Vector3,UnityEngine.Quaternion)
    3. Crux.Utility.CruxPool/PoolOther:Spawn (UnityEngine.Vector3,UnityEngine.Quaternion) (at Assets/Crux - Procedural AI Spawner/Scripts/Pool Manager/CruxPool.cs:36)
    4. Crux.Utility.CruxPool:Spawn (UnityEngine.GameObject,UnityEngine.Vector3,UnityEngine.Quaternion) (at Assets/Crux - Procedural AI Spawner/Scripts/Pool Manager/CruxPool.cs:131)
    5. Crux.Utility.CreatureSpawning:AttemptCreatureSpawn (int) (at Assets/Crux - Procedural AI Spawner/Scripts/Spawning Logic/CreatureSpawning.cs:165)
    6. Crux.CruxSystem:Create () (at Assets/Crux - Procedural AI Spawner/Scripts/System/CruxSystem.cs:545)
    7. Crux.CruxSystem/<SpawnCheck>d__67:MoveNext () (at Assets/Crux - Procedural AI Spawner/Scripts/System/CruxSystem.cs:257)
    8. UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)


    Failed to create agent because it is not close enough to the NavMesh
    Code (CSharp):
    1. Failed to create agent because it is not close enough to the NavMesh
    2. UnityEngine.Object:Instantiate<UnityEngine.GameObject> (UnityEngine.GameObject,UnityEngine.Vector3,UnityEngine.Quaternion)
    3. Crux.Utility.CruxPool/PoolOther:Spawn (UnityEngine.Vector3,UnityEngine.Quaternion) (at Assets/Crux - Procedural AI Spawner/Scripts/Pool Manager/CruxPool.cs:36)
    4. Crux.Utility.CruxPool:Spawn (UnityEngine.GameObject,UnityEngine.Vector3,UnityEngine.Quaternion) (at Assets/Crux - Procedural AI Spawner/Scripts/Pool Manager/CruxPool.cs:131)
    5. Crux.Utility.CreatureSpawning:AttemptCreatureSpawn (int) (at Assets/Crux - Procedural AI Spawner/Scripts/Spawning Logic/CreatureSpawning.cs:165)
    6. Crux.CruxSystem:Create () (at Assets/Crux - Procedural AI Spawner/Scripts/System/CruxSystem.cs:545)
    7. Crux.CruxSystem/<SpawnCheck>d__67:MoveNext () (at Assets/Crux - Procedural AI Spawner/Scripts/System/CruxSystem.cs:257)
    8. UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
    Also, spawned with crux is set to yes as described in the wiki tutorial.
     
  22. Michael_Berna

    Michael_Berna

    Joined:
    Jul 5, 2019
    Posts:
    39
    @BHS Sorry to bug you, but any recommendations on fixing the navmesh errors when using crux with emerald? I'm trying to figure out the problem, but haven't had any luck yet. I think this one is above my skill level.


     
  23. Michael_Berna

    Michael_Berna

    Joined:
    Jul 5, 2019
    Posts:
    39
    @BHS I think I finally found a solution for this after stumbling on a random 10 year old forum thread for a similar issue.
    I made the following changes to CruxPool.cs around line 35 and it seems to have fixed the issue for now although I do not have time to test it super thoroughly at the moment. I think this may be a valuable check to add to Crux to prevent errors, but it will likely need some better logic to detect if a navmesh is being used or needs to be used before it tries this.

    Here's the diff visual

    upload_2021-10-18_9-34-4.png



     
    Last edited: Oct 18, 2021
  24. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    Does Crux work with Megasplat textured terrain?
     
  25. Michael_Berna

    Michael_Berna

    Joined:
    Jul 5, 2019
    Posts:
    39
    I don't know much about megasplat, but Crux works with unity terrains and mesh based terrains. Because of the way the texturing is done with a single material/layer in mesh based terrains however, it can't detect multiple biomes. So, if megasplat generates a mesh for its terrains, yes it will work, but in a limited manner. If it is based on the unity terrain system, it will have full support for detecting multiple biomes (this is how Gaia works for example).
     
    wood333 likes this.
  26. Michael_Berna

    Michael_Berna

    Joined:
    Jul 5, 2019
    Posts:
    39
    Has anyone created a script to save/load serialize and deserialize crux data in a scene that they would mind sharing?
     
  27. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    851
    I would test it myself except the current version of Crux throws an error in 2018.4.36.
    "Emerald System (CruxSystem.cs) does not contain a definition for UseMagicEffectsPack"
     
    Michael_Berna likes this.
  28. Michael_Berna

    Michael_Berna

    Joined:
    Jul 5, 2019
    Posts:
    39
    Run the emerald 3.0 upgrade asset, that fixed it for me.
     
    wood333 likes this.
  29. unity_dev3194

    unity_dev3194

    Joined:
    Apr 17, 2017
    Posts:
    79
    Anyone set up a FOV for spawning? I don't want AI spawning in player/camera view.
     
    Michael_Berna likes this.
  30. tredpro

    tredpro

    Joined:
    Nov 18, 2013
    Posts:
    515
    who has gotten this working with multiplayer ( mirror )?
     
  31. krolb

    krolb

    Joined:
    Oct 12, 2021
    Posts:
    1

    can you make enemie ai with it?
     
  32. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    Crux only spawns your AI, sorry.
    You have to have the AI created with something else, then use Crux to spawn when you near.
     
  33. ian260011

    ian260011

    Joined:
    Oct 13, 2021
    Posts:
    4
    I need to reduce the diameter size of spawn radius and max radius, send a discord message please reply
     
  34. ian260011

    ian260011

    Joined:
    Oct 13, 2021
    Posts:
    4
    .............
     

    Attached Files:

  35. Vaupell

    Vaupell

    Joined:
    Dec 2, 2013
    Posts:
    302
    As amazing i find this asset, be aware it's not working with the new input system.
    Aparently in CruxSystem.cs line 245 it "emulates" pressing a key to spawn something,
    so if you're the new input system it fails.
     
  36. valentinwinkelmann

    valentinwinkelmann

    Joined:
    Nov 3, 2014
    Posts:
    187
    @BHS Is it possible to use Crux on a MicroSplat terrain + biomes? According to Jason Booth, it is possible to see on a MicroSplat terrain which terrain texture is under a raycast (e.g. to dynamically generate footsteep sounds).
     
    tredpro likes this.
  37. Artini

    Artini

    Joined:
    Jan 29, 2016
    Posts:
    181
    Has exactly the same error in Unity 2021.3.0.
    One need to run Emerald AI 3.0 Support script to fix UseMagicEffectsPack error.
     
    valentinwinkelmann likes this.
  38. iconiciK_

    iconiciK_

    Joined:
    Apr 20, 2022
    Posts:
    1
    is it not possible to use this without using terrain?
     
  39. Michael_Berna

    Michael_Berna

    Joined:
    Jul 5, 2019
    Posts:
    39
    Is it possible to set this up to spawn creatures based on a volumetric area rather than a biome. For example, I want to have livestock animals such as cows and chickens that are spawned only in a certain fenced area in a farm. I would like to have them dynamically spawned in this area since the player has the ability to kill them to get leather and such.
     
  40. Michael_Berna

    Michael_Berna

    Joined:
    Jul 5, 2019
    Posts:
    39
    Great idea. Would make a good feature request.
     
  41. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,267
    This asset hasn't received as much attention over the past few years. I'd look at other spawning solutions that are in active development
     
    Michael_Berna likes this.
  42. gtox

    gtox

    Joined:
    Apr 23, 2013
    Posts:
    25
    Thanks, your code seems to work. I've been having problems with Crux spawning prefabs off the edge of the map, producing the same errors that you were getting.
     
  43. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    176
    @BHS feeling like i am ignored at emerald ai forum or maybe i was out of place but crux need addressables support, it is ok for small game but if you have many enemies & npcs passed in crux inspector even if we spawn a few at a time all of them are loaded into ram which slow down the game with addressables only those objects will be loaded to ram which you want to spawn on despawn you can unload them to free the memory.
     
    valentinwinkelmann likes this.
  44. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    176
  45. johny256

    johny256

    Joined:
    Mar 3, 2015
    Posts:
    258
    Suport emerald ai 3.0 and survival template pro?
     
  46. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    176
    #BadSupport
     
  47. khushalkhan

    khushalkhan

    Joined:
    Aug 6, 2016
    Posts:
    176
    or #NoSupport
     
  48. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,267
    If I were all of you, I'd check out Soul Link by Magique
     
    khushalkhan likes this.
  49. Destystar

    Destystar

    Joined:
    Jul 4, 2021
    Posts:
    4
    Don't know if this is just an issue with my project but if using Crux to spawn objects that utilise Emerald AI 3.0 they spawn deactivated. This only happens when they are spawned as creatures it works when spawning them as wildlife
     
    Last edited: Aug 15, 2023
  50. dsilverthorn

    dsilverthorn

    Joined:
    May 14, 2017
    Posts:
    835
    Can spawning be done in other ways other than textures?
    Such as a radius from an object or inside a collider?
    This would be very helpful.