Search Unity

[UPDATED] ICECreatureControl v1.4.0 - creature AI for enemies, animals, monsters, zombies ...

Discussion in 'Assets and Asset Store' started by icetec, Aug 11, 2015.

  1. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Do you have a way for the player to target, or detect what it is attacking?
    If not, then you might want to add this in.
    If you already have this, then you simply check if the animal dies after applying damage, and if so, give the player EXP.
     
    icetec and arnesso like this.
  2. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi Arnesso, you could handle this within the update function of an additional script, by checking the layer/tag of the ActiveTarget if your creature is dead.

    Code (CSharp):
    1.  
    2. void Update()
    3. {
    4.     // get the control ...
    5.     ICECreatureControl _control = GetComponent<ICECreatureControl>();
    6.  
    7.     // evaluate if the creature is dead
    8.     if( control != null && control.Creature.Status.IsDead )
    9.     {
    10.         // compare the tag of the active target
    11.         if( control.Creature.ActiveTarget.TargetGameObject != null && control.Creature.ActiveTarget.TargetGameObject.CompareTag( "Player" ) )
    12.         {
    13.             // insert your XP copde
    14.         }
    15.     }
    16. }
    Please note, that this works well if your creature is fighting with your player but if there are multiple attackers or if your player starts a sneak attack, the player don't need to be the ActiveTarget while killing your creature ... but you are right, it's an important topic and I'll implement the required functionality to identify and note the cause of dead and the involved GameObjects.

    Have a great day!

    Pit
     
    arnesso likes this.
  3. PhoenixDevs

    PhoenixDevs

    Joined:
    May 4, 2016
    Posts:
    8
    Hi,
    How do you make a predatory animal inflict damage on prey, The predator enters the attack interaction and plays animation but no damage is inflicted, am I missing something obvious?
     
  4. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi PhoenixDevs,
    basically each ICE creature handles its own damage by itself, for this you can use the Influence Settings of a target or its associated behaviour. Simple open the DEFEND or GETHIT behaviour of your prey creature, activate the Influence section and define the desired damage value.

    The fundamental idea behind this is, that a creature notice an impact and evaluates the influence individual according to its own state, so it could react to each GameObject in your scene without any other scripts.

    I hope my answer was helpful to you but please feel free to contact me whenever you have further questions or if you run into a problem with ICE and in urgent cases you can contact me also via skype.

    Have a nice day!

    Pit
     
  5. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    Hello !

    I got error after unistormadapter importing :The type or namespace name `WeatherType' could not be found. Are you missing a using directive or an assembly reference?
    Unistorm 2.1 !
    What should I change? Does anybody have similiar ?



    Code (CSharp):
    1. ...
    2.             UniStormTime = m_Weather.hourCounter.ToString () + ":" + m_Weather.minuteCounter.ToString () + " " + m_Weather.dayCounter.ToString () + "/" + m_Weather.monthCounter.ToString () + "/" + m_Weather.yearCounter.ToString();
    3.                 UniStormTemperature = m_Weather.temperature;
    4.  
    5.  
    6.                 WeatherType _weather_type = WeatherType.UNDEFINED; /// here unknown
    7.  
    8.                 switch( UniStormWeatherType )
    9.                 {
    10.                 case 1:
    11.                     UniStormWeather = "Foggy";
    12.                     _weather_type = WeatherType.FOGGY;
    13.                     break;
    14. ....
     
  6. Jacky_Boy

    Jacky_Boy

    Joined:
    Dec 8, 2013
    Posts:
    95
    Thanks @icetec Pit, you gave me a lot to think about and play with. I look forward to testing it out, and even though some things may not be perfect now I know it will get better. I will share my results when I can
     
  7. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi Arnesso, the mentioned `WeatherType' is defined in ICE\ICESharedAssets\Scripts\Utilities\ice_types.cs which is part of the current version 1.1.18. It could be that you get this issue after updating an older version of ICE by importing the current version, so I would like to recommend you to remove the ICE folder before importing the latest version of ICE from the asset store to avoid conflicts with older versions.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. namespace ICE.Utilities.EnumTypes
    5. {
    6.     public enum GroundCheckType
    7.     {
    8.         NONE,
    9.         RAYCAST,
    10.         SAMPLEHEIGHT
    11.     }
    12.  
    13.     public enum TemperatureScaleType
    14.     {
    15.         CELSIUS,
    16.         FAHRENHEIT
    17.     }
    18.    
    19.     public enum WeatherType
    20.     {
    21.         UNDEFINED = 0,
    22.         FOGGY,
    23.         RAIN,
    24.         HEAVY_RAIN,
    25.         WINDY,
    26.         STORMY,
    27.         CLEAR,
    28.         PARTLY_CLOUDY,
    29.         MOSTLY_CLOUDY,
    30.         CLOUDY
    31.     }
    32. }
    If you are sure that you are already working with a clean version of ICE, please remove the ICE\ICECreatureControl\Scripts\Adapter\UniStorm folder and install the ICECreatureUniStormAdapter again. One of the both mentioned solutions should fix your issue, but please feel free to contact me again if they are not working for you.

    Have a great day!

    Pit
     
    arnesso likes this.
  8. PeuBraw

    PeuBraw

    Joined:
    Jul 22, 2014
    Posts:
    2
    Any luck with that integration ?
     
  9. Tracomi

    Tracomi

    Joined:
    May 3, 2016
    Posts:
    12
    Hey, I have some questions before I buy this asset.First of all in this video
    I saw that the asset automatically detected the available animations but if I have like a separated model and the animations for that model are not like in a FBX file with the model I need to make a prefab that the asset detects the animations or I can assign any animations?
     
  10. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi Tracomi, the wizard automatically detect the available animations to simplify the setup, but you are free to choose the desired animations also by hand. ICECreatureControl supports Legacy animations and the Mecanim Animation System as well and you can drag and drop each suitable animation to your Animator Controller. While using the assign animations in ICE with the DIRECT mode, ICE provides you a list with all available animations and will handle the transitions automatically but you can also use the advanced mode to steering a complex Animator Controller (incl. BlendTrees etc.) by using dynamic values such as velocity or direction etc.

    I hope this will be helpful for you so far but please feel free whenever you have further questions.

    Have a great day!

    Pit
     
  11. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi PeuBraw, Invectors Third Person Controller Template is already listed on the wishlist but unfortunately you have to wait a while, because there are some other tasks and adapters which I have to finish before starting with the above-mentioned integration. I'm sorry for that!

    Pit
     
    PeuBraw likes this.
  12. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44

    Hi Tracomi,

    I think you can drop your character into the scene, then create an Animator and an Animation Controller. Then simply drop each required animation from the project into the Animator, the first will be automatically setup from Entry the rest you can transition from the Any State 'state' which means you will get transitions too. To connect it all up use the ICE Creature Control Script - which is where the automatic animation selection happens. But add this last as it takes information at the point you add it. I have found - although I could be wrong - that if you add additional animations later, the ICE Creature Controller doesn't recognise them - there may be a way around this, Im only on my second day with the system.

    Hope that's useful.

    IPete2
     
    icetec likes this.
  13. DigitalIPete2

    DigitalIPete2

    Joined:
    Aug 28, 2013
    Posts:
    44
    Hi Pit,

    I was just going to ask, is there a way to adjust the height of my creature off the ground during travel?

    I have a dragon I want to do two things. I want to make it jump then fly at a pre-fixed height then land.

    (1) Can I use a jump up animation in a single play (not looped) followed by a flying animation which loops until it reaches a target location when it will play a single land animation?

    (2) Is it also possible, during this initial animation to alter the Dragon's height off the ground transition to a flying height and remain until it needs to land (at a waypoint or target)?

    thanks for any help.

    IPete2
     
  14. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    Hi
    Thank you @icetec , Unistorm adapter tips worked well.
    I would have a returning question about the setting up the given NPC/Animal would spawn only between the give time e.g : between 10pm- 6am
    Do you have tips for this issue ? :)
    cheers :)
     
  15. Artificialized

    Artificialized

    Joined:
    Oct 5, 2014
    Posts:
    69
    Hey pit,

    Does your asset ice creature control work with third person controller ive had both the third person controller asset by opsive and your ice creature control asset for a while now been waiting for that integration im having very poor luck setting it up with third person controller i keep getting this error
    No camera exist within the camera monitor component.Has this compenent been added to a camera? Also when i click play to test my scene out it says this Display 1 no cameras rendering.

    Can you please make a tutorial on how to set it up with opsive third person controller im currently working with the networked demo
     
    Last edited: Aug 26, 2016
  16. Alex3333

    Alex3333

    Joined:
    Dec 29, 2014
    Posts:
    342
    When the update is released? I wrote that this month, and the month is already ending ))
     
  17. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Hi Pit! Hope you are doing ok? I have an issue, and hope you can help! I've added a Collision Rule, based on a Tag name which is in a Child gameObject from the parent creature. I put in a 100% damage influence after ticking the Influences checkbox, and a Death behavior on checking the Behavior checkbox. Either the child collision is not working or the influence is not giving 100% damage to my creature on attacking it with several bullets when it should only be on hit to the collider. Im using the ICECreatureTCPAdapter also.
     
    Last edited: Aug 29, 2016
  18. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Yes it does. But you need to add the integrations from both Opsive and ICE website.
     
  19. Jacky_Boy

    Jacky_Boy

    Joined:
    Dec 8, 2013
    Posts:
    95
  20. michael_c85

    michael_c85

    Joined:
    Jul 26, 2015
    Posts:
    6
    Hi Pit,

    your asset store listing mentions soldiers, is ICE currently suitable for ranged attack or only melee?

    thanks,

    Michael
     
  21. Jacky_Boy

    Jacky_Boy

    Joined:
    Dec 8, 2013
    Posts:
    95
    @icetec The handheld torch avoid fire settings from the example isn't working for me. My enemy does sense the torch while chasing my player, and leaves me alone but they actually run toward the torch and stays at the stopping distance range.

    I set the escape distance to 20m but they don't turn away and run
     
  22. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Hi Pit - are you on holiday, not well or on a contract as we've not heard from you lately, since around 18th of August. Hope all is ok?
     
  23. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    It might be that they are set to chase the player.
    Thus, when not escaping the torch, they are seeking out and chasing the player.
    You might try looking for the interactor for the player chasing, and set the selection range under "Target Selection Criteria" to a value higher than zero. This will limit the interactor to only become active when the player is within that distance from the enemy.
    Hope this helps. :)


    Yes, ICE is suitable for ranged attacks.
    There are multiple ways of setting this up, but I will describe the easy, no hassle way for now.
    If your bullets/arrows ammo have colliders, you can set up a collision behavior for the ICE creatures, so that when a projectile hits them, they take damage.

    If you would like me to go through the steps for doing this, just let me know and I would be glad to help. :)

    Otherwise, you can script your own ranged combat/damage based on your needs, and easily apply damage to the hit creature.

    Yes, he is quite alright, I talked to him on Saturday, and he is trying hard to focus on the next major update and does not want any distractions. He told me that the Update should be pushed to the Asset Store soon.

    If you guys have any questions about using ICE, I will do my best to answer them. :)
     
    Last edited: Sep 6, 2016
    BackwoodsGaming and julianr like this.
  24. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Is there a download for the Deathmatch demo source?
     
  25. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Has anyone noticed if you have two creatures fighting each other, the Death animation kicks in on (creature A) after applying Damage, before (creature B) has run the Attack animation. I believe its the damage that needs to be played after the animation, not before, especially on the first attack.
     
    Last edited: Sep 7, 2016
  26. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    How are you applying damage to the creatures?
     
  27. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Through the influences based on the other creature using the ATTACK behavior. I think I did mention this a while back, that the first attack was always out of sync. So the attack animation of the attacker would play after the damage was given. Is there a workaround ?

    I could increase the animation speed, for now that will do it.
     
    Last edited: Sep 7, 2016
  28. robymv

    robymv

    Joined:
    Oct 28, 2013
    Posts:
    74
    Goodmorning everyone. I'm making a game 2d platforms and wanted to know if it is possible to use ICE for enemies, is there any tutorial for 2d?
     
  29. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    You could try linking the ATTACK behavior with a DEALDAMAGE behavior, then have the creature look for the DEALDAMAGE behavior instead of the ATTACK. With linking, the DEALDAMAGE behavior should start when the ATTACK ends, and thus after the attack animation plays.
     
  30. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Thanks. I'll give that a go. Also while I'm here, after the creature (A) attacks creature (B) and creature (B) dies, creature (A) still plays the attack animation and doesn't go off to seek another creature to attack. Any ideas?
     
  31. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    In the interactor for creature (A), make sure that you have a condition that checks if the target creature is dead or not.
     
    julianr likes this.
  32. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I did that, but maybe I'm placing that condition in the wrong place. I will try again :) Before I only had Player vs Creature.. so Creature to Creature is a bit new to me :) Thanks for your help though, appreciate it!
     
  33. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    If you want, I could post a How To to for various ways of setting up combat, including any scripts I make. :)
     
    wood333 and Tethys like this.
  34. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Thanks! That would be awesome. I don't know if the Death match type demo is available as once I saw that I could easily understand it. My logic is flawed today!! :)
     
  35. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I've tried various; but my latest one is under Attack behavior - where it checks to see if the creature is under a Target Distance of < = 2 AND Creature is Dead IS FALSE. Which works to a point and stops the attack animation, drops it down to the RUN animation/behavior, but doesn't change the target. Its odd :)
     
    Last edited: Sep 7, 2016
  36. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Ideally you want all interactors to check if a creature is dead before trying to interact with it.
    This includes the Sense, and Chase interactors as well as the Attack.
     
    Tethys and julianr like this.
  37. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    Thanks, I think this may help a lot!
     
  38. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I managed to get it working now! Thanks for the pointers. :)
     
    Tethys and TonanBora like this.
  39. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    One thing I am stuck on though. Is Creature A kills Creature B, but Creature A doesn't move onto another target until Creature B game object has been destroyed. Unless there is another way to move onto the next target without removing the gameObject after death straight away, I'm guessing that adding a corpse might solve this.
     
  40. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    Don't know about this one, as I replace my dead creature with an actual corpse object which breaks the target connection.
    However, I would expect that Creature A should move onto its next target, since it can no longer pick the dead creature as a target.
    Maybe you are not giving Creature A another valid target?

    What other targets do you have setup?

    Or maybe you have another interactor on Creature A for Creature B that does not have the IsDead check?
     
  41. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I basically send out Creature A to kill multiple Creature B types, all setup correctly. Like you say. I think if I replace it with a corpse, or change the code so it goes onto the next target quicker. As I'm assuming without looking that the next target is not selected until the gameObject is removed. Unless there is a setting somewhere. Looking at the death match demo, it seems much quicker.. so there must be a way (replace with a corpse, seems more likely!).
     
    Last edited: Sep 7, 2016
  42. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    96
    My game will be kind of open world, for the optimization, could you give me some hints, or tips
    How should I setup for the given NPC they will able to spawn if Player reaches the trigger ?
    Until they do not spawn
    Thank you
     
  43. TonanBora

    TonanBora

    Joined:
    Feb 4, 2013
    Posts:
    493
    With the Creature Register, you can call SpawnObject(creaturePFB, spawnPoint, rotation) to spawn in an ICE creature when the player walks into the trigger.

    Here is a simple script:

    Code (CSharp):
    1. using UnityEngine;
    2. using ICE.Creatures;
    3.  
    4. public class SpawnerTrigger : MonoBehaviour {
    5.  
    6.     [SerializeField] private ICECreatureRegister _creatureRegister;
    7.     [SerializeField] private Transform _spawnPoint;
    8.     [SerializeField] private GameObject _creatureReference;
    9.  
    10.     void OnTriggerEnter(Collider other) {
    11.         if (other.tag == "Player") {
    12.             // Spawns the creature reference at the position of _spawnPoint, with the rotation of _spawnPoint.
    13.             _creatureRegister.SpawnObject(_creatureReference, _spawnPoint.position, _spawnPoint.rotation);
    14.         }
    15.     }
    16. }
     
    Last edited: Sep 9, 2016
    antoripa, Tethys, julianr and 2 others like this.
  44. Hakazaba

    Hakazaba

    Joined:
    Jul 1, 2015
    Posts:
    119
    Is this asset compatible with apex path, steer and utility ai?
     
  45. robymv

    robymv

    Joined:
    Oct 28, 2013
    Posts:
    74
    Goodmorning everyone. I'm making a game 2d platforms and wanted to know if it is possible to use ICE for enemies, is there any tutorial for 2d?
     
  46. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I don't think it is, not yet. Maybe once Pit has released v1.2, then more integration options will be available.
     
    TonanBora likes this.
  47. Jacky_Boy

    Jacky_Boy

    Joined:
    Dec 8, 2013
    Posts:
    95
    I'm really hoping Apex Path is, coz I have this $95 asset just sitting on my asset store shelf
     
  48. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    Simple examples like this and just passing some damage between a few different setups are what this asset sorely needs. Thanks!
     
    TonanBora and BackwoodsGaming like this.
  49. robymv

    robymv

    Joined:
    Oct 28, 2013
    Posts:
    74
    Goodmorning everyone. I'm making a game 2d platforms and wanted to know if it is possible to use ICE for enemies, is there any tutorial for 2d?
     
  50. julianr

    julianr

    Joined:
    Jun 5, 2014
    Posts:
    1,212
    I don't think 2D is supported, but having said that I've not tried it. Best wait for Pit to clarify this, but I spoke to him today and he is really busy with the next major update and once its ready he'll be back to answer your questions that are outside the scope of what we know it can do. Shouldn't be too long now :)