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. RAZD112

    RAZD112

    Joined:
    Aug 30, 2017
    Posts:
    70
    It's somehow fixed lol..
     
  2. RAZD112

    RAZD112

    Joined:
    Aug 30, 2017
    Posts:
    70
    hey , crux not spawning enough ai...
    i tried to duplicate it tried to make it spawn between 30-50
    and i dont get enough animals life as i want
     
  3. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    @BHS, So I just place a huge trigger over my terrain. Crux simply stopped spawning AI. How can I setup Crux to ignore triggers?

    Reproduction of the issue
     
    Last edited: Sep 21, 2017
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Hey there!

    Thanks for the video I wasn't aware this was an issue.

    You can fix this by making sure your collider is well above the terrain and that the collider is not touching the terrain like the screenshot below. This will still allow you to trigger your sound events but not have it obstruct Crux.

    If you don't need your layer to be a specific layer, an easier solution would be to set your colliders' Layers to Ignore Raycast. This will make Curx's raycast ignore all objects that have this layer.

    Crux_Solution.png
     
    Gua likes this.
  5. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    Thanks. It did solved Crux problem. Tt did caused some issues for third Environment audio system, but I did managed to find a workaround for it.

    p.s. Any news on the solution for navmesh spawn problem?
     
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    I'm currently looking into a solution. I can get back to tomorrow with it.
     
  7. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    Any news on the solution for navmesh spawn problem?
     
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Yes, I was able to find somewhat of a solution. It allows AI that are spawned through Crux to be disabled and put back into the object pool, if no NavMesh is found where they are spawned. this is checked on Start and should be able to be added to any AI system that uses NavMesh.

    The only draw back to this solution is that it gives a warning message (not an error message) when an AI's position is invalid. I'm looking to see if there are any better solutions. Unity has added more NavMesh API as of Unity 5.6. So, I will see I can better it with the newer versions of Unity.
     
  9. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    This is quite a serious problem, because those warning messages can eat up a lot of memory. Maybe a better solution would be to raycast using Nav Mesh Raycast and if it doesn't hit navmesh, then raycast again in a different positions until it does. Or something like that.
     
  10. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
  11. KIR99

    KIR99

    Joined:
    Feb 21, 2017
    Posts:
    19
    Hey there,

    any word on when Crux version 1.2 will be out? :)
     
    Gua and recon0303 like this.
  12. antony57

    antony57

    Joined:
    Sep 9, 2017
    Posts:
    28
    Hello Quick question.

    Can you edit how AI behave between each others with crux ? Should they bump into each others?

    a.
     
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Thanks! As soon as Emerald 2.0 is finished, I will get right on getting this figured out.


    As soon as Emerald 2.0 is finished. :)


    Hey there!

    Yes, there's an option called "Use AI Detection". What this feature does is search for object of the appropriate layer and respawns AI if there is already an AI in the next spawning location. The radius of this can also be controlled to be as little or as high as needed.
     
    KIR99 likes this.
  14. antony57

    antony57

    Joined:
    Sep 9, 2017
    Posts:
    28
    Okay but let say a pack of wolf bump into a pack of deers. Is it possible to modify to way they react to each other.

    E.g : The wolf hunting, the deers running away?

    Also, is there a option for free roaming on the map for the AI spawned or are they restricted to an area? Let say I want to spawn zombies and let them roam around the map freely. Is that something I can do with crux?
     
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Crux is a spawning system, not an AI system. It does not handle the logic or actions of models. It places them according to certain conditions and biomes based on the user's settings. An AI system, such as Emerald AI, handles actions such as hunting, fleeing, and roaming.
     
  16. antony57

    antony57

    Joined:
    Sep 9, 2017
    Posts:
    28
    Thank for your answer!

    Is Emerald AI compatible with Crux?
    And with Map Magic streaming of terrain system?

    a.
     
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    You're welcome!

    Yes, Emerald AI is compatible with Crux and Crux is compatible with Map Magic. However, if you'd like to use procedurally generated terrains with Emerald AI, you would need to use Unity's Runtime NavMesh, which can be implemented using this tutorial: https://www.youtube.com/playlist?list=PLX2vGYjWbI0Rf0im34I2lBF4eufM-cgzQ I plan on having it officially supported soon. Once Emerald 2.0 is release, there will be a tutorial on how to do this as well.
     
  18. crimsonmortis

    crimsonmortis

    Joined:
    Feb 21, 2016
    Posts:
    63
    Looking for news on the voxel support.
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Mesh and voxel terrain support are planned for version 1.2.
     
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Last edited: Dec 8, 2017
  22. claudiorodriguescampos

    claudiorodriguescampos

    Joined:
    Jun 23, 2017
    Posts:
    98
    Hi @BHS

    Is it possible to setup Crux to spawn enemies in waves?

    Example:
    I want to setup 3 enemies( each of them in an different x,y,z coordinate ), after 3 minutes spawn more 5 different enemies ( each of them in an differentx,y,z coordinate )

    Is this possible?
     
  23. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    Can`t get this to work. Always getting this error:

    IndexOutOfRangeException: Array index is out of range.
    Crux.Create () (at Assets/Crux - Procedural AI Spawner/Scripts/System/Crux.cs:460)
    Crux+<SpawnCheck>c__Iterator0.MoveNext () (at Assets/Crux - Procedural AI Spawner/Scripts/System/Crux.cs:251)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

    I have two biomes, one is grass and the other is sand. The textures should be set right.
     
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Spawning in waves is not possible. AI are spawned if population caps are not met and if certain conditions are met. Crux doesn't spawn based on time.


    Hey there!

    This is happening because you are using the Instantiated Player Transform Type. This method will look for your player by name. If you don't have a proper name in the Player Name section, you will receive this error. To fix this, simply type your player name in the Player Name section. If your player is not instantiated, you can manually assign the player transform using the Standard Player Transform Type.

    CruxPlayerName.png
     
  25. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    I have tried both methods, standart and instantiated. Always the same error. I am trying it with another player controller.

    Edit:
    Tried it again and added another texture from my terrain. Error comes again but seems to work now. Must have something to do with my terrain textures.
     
    Last edited: Jan 1, 2018
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Strange, that error seems to be associated with the player transform. If possible, can I see a screenshot of the editor for the Biome Options and the Spawning Options? This would help me better understand what's happening.
     
  27. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    Last edited: Jan 2, 2018
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Thanks for providing the screenshots.

    Are you using a Unity Terrain?

    Also, is your player's transform created or altered on start? If so, you will need to use the Instantiated Player Transform Method. You can try this option just to eliminate it as a possible cause of the issue. Ensure that you have properly typed your player's name in the Player Name slot of the Crux Editor.
     
  29. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    The terrain is done with World Creator Pro. Should be a normal Unity terrain.
     
  30. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
     
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Strange, I haven’t yet encountered this issue with Crux. However, I’m confident I will find out what’s causing it.

    I double checked the World Creator Pro asset and it says it uses a Unity Terrain.

    To help pinpoint the issue, test the demo scene Crux comes with to ensure everything is working correctly. If this works, try using the demo Crux player as your player to confirm the issue lies with the terrain and not the character controllers you have previously tested.

    Can you post a screenshot of your Unity Terrain that World Creator Pro created?
     
  32. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    Crux demo scene works. Crux Player from the demo scene doesn`t work in my scene.

    Here two pics from my Terrain:



    https://picload.org/view/ddawwgda/pic1.jpg.html
    https://picload.org/view/ddawwgdl/pic2.jpg.html
    https://picload.org/view/ddogiaoi/pic3.jpg.html
     
    Last edited: Jan 4, 2018
  33. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Alright, so it has something to do with your terrain. Thanks for posting the screenshots.

    Can you post some screenshots of the Unity Terrain within the Unity Editor? Crux has been tested with all sorts of terrains even ones generated with Gaia and Map Magic. I’m very curious as to what’s causing the issue.
     
  34. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    That pictures are from within the Unity Editor. I have added another one.
     
  35. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Thanks for the additional screenshot. I see that you are using CTS. The last time I checked, CTS worked perfectly fine with Crux. Are your textures also on the texture portion of the Unity terrain?

    Are you using any other assets that alter or enhance the terrain? Also, what version of Unity and Crux are you using? If I can recreate the issue, I’ll be able to find a solution a lot quicker.
     
  36. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    328
    Hey i buy yesterday crux i have the same error i use CTS too

    Unity 2017.3.0.p1
    Crux Version: 1.1 (Aug 18, 2017)

    CTS, Vegetation Studio, Enviro, Aquas, Advanced Foliage Pack

    Looks like CTS is the problem when i trun my CTS Profile to Unity Standard then works CTS Basic dont work give me the error same with advance and tess
    Screenshot_106.png

    IndexOutOfRangeException: Array index is out of range.
    Crux.Create () (at Assets/Crux - Procedural AI Spawner/Scripts/System/Crux.cs:460)
    Crux+<InitializeCrux>c__Iterator1.MoveNext () (at Assets/Crux - Procedural AI Spawner/Scripts/System/Crux.cs:316)
    UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
    UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
    Crux:Start() (at Assets/Crux - Procedural AI Spawner/Scripts/System/Crux.cs:257)
     
    Last edited: Jan 4, 2018
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Thanks for the bug report. Now that I know where the issue lies, I will working on finding a solution. I’ll also talk with the developer of CTS to see if he can help find a solution.
     
  38. AdamGoodrich

    AdamGoodrich

    Joined:
    Feb 12, 2013
    Posts:
    3,689
    Thanks for the heads up.

    CTS strips textures from the terrain at run time as a default optimization. To change this, go into Optimization Settings on your profile and uncheck the strip textures option.

    As soon as you do this everything should work as you expect.
     
  39. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    416
    Yep, it`s working now. Thank You Adam.
     
    AdamGoodrich likes this.
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Thanks for the solution Adam.
     
    AdamGoodrich likes this.
  41. Ramulos

    Ramulos

    Joined:
    Feb 19, 2017
    Posts:
    57
    Hello,
    Any ETA on version 1.2?
     
    RoyalDust likes this.
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Hey there!

    I can't currently provide an ETA on version 1.2. However, it is currently being worked on.
     
    recon0303 likes this.
  43. RoyaleJoons

    RoyaleJoons

    Joined:
    Jul 28, 2016
    Posts:
    13
    My hope is to use Crux to spawn Emerald zombie AI's in a urban area (no terrain used), would that be possible once 1.2 is released?
     
  44. RoyalDust

    RoyalDust

    Joined:
    Mar 4, 2015
    Posts:
    8
    Would it be possible to have news? It's been several months since I waited for version 1.2 which took place after Emerald AI's maj
     
  45. DarkArts-Studios

    DarkArts-Studios

    Joined:
    May 2, 2013
    Posts:
    386
    Hi,

    How do you get crux to really actually despawn creatures? I have disabled spawn on startup (in which case I get no creatures ever) so I enabled it and then what happens is I get some creatures at the start, but then never again. It appears they're just disabled spawn nodes but no actual creatures, they don't even re-enable if I return to the position.

    Here is a screenshot showing my player far away from crux spawns:


    I have also tried disabling object pooling, nothing seems to help. I am only ever able to get creatures near where I start.
     
  46. recon0303

    recon0303

    Joined:
    Apr 20, 2014
    Posts:
    1,634
    ya hoping we see one soon, I bought this week 1. and waiting for some, features that are suppose to be added, already made one game, and on to the next for Steam, would of like to use...but may not happen either, kinda wish I waited now... been a long time since we seen an update 7 months.. or so.. UGH..
     
    RoyalDust likes this.
  47. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    @BHS, I have a question regarding pooling. I know character can get back to the pool if I it will get despawned by distance, but will it get to the pool if a just deactivate it when it dies instead of destroying it?

    p.s. Just deactivated it, it seem that it is not used by pooling sistem. How can I despawn AI properly so it could be used by pooling system?
     
    Last edited: Mar 20, 2018
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Hey everyone!

    My apologies for the delay in responding. For some reason my notifications weren't enabled for the Crux thread.

    Yes, Crux 1.2 will support mesh spawning. The mesh feature will also use tags.


    Yes, my apologies for the delay with the 2.1 update. I am trying to find the time to get the updated finished and released.


    Instead of disabling it, you would need to deactivate is with the CruxObject pool script when your AI is killed. You can use the code below to deactivate an object pool object.

    Code (CSharp):
    1. CruxPool.Despawn(gameObject);
     
    RoyaleJoons likes this.
  49. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    382
    When I use that code, it does disable ai gameobject, but Crux doesn't try to use those objects to spawn/enable them again, those objects just remain disabled.

    Maybe you can spot what I did wrong in this video?
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,264
    Are you disabling during death or on start? My guess is that if it's on start, it's not giving the spawned AI a chance to properly initialize. However, I will look into this to see if I can figure out what's going on.
     
unityunity