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

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592

    Hi Arnesso, you can handle this with the register and deregister function of the CreatureRegister.

    All creatures using the CreatureRegister to find their nearest targets, therefore all potential targets must be registered and listed in the register – also your UFPS player, who is using the ICECreatureUFPSPlayer adapter script to handle the registration/deregistration process. As long as your player is registered, your creatures can find him according to the given selection criteria, but if you deregister your player during the runtime, your creatures will ignore him. You can use this factor to realize your requested feature.

    Create a new MonoBehaviour script with OnTriggerEnter and OnTriggerExit and assign it to your trigger object. If your player enter the trigger zone call CreatureRegister.Deregister( [YourPlayerGameObject] ); and if your player leave the trigger call CreatureRegister.Register( [YourPlayerGameObject] ); - that’s all!

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using ICE.Creatures;
    4. using ICE.Creatures.Objects;
    5. using ICE.Creatures.Adapter;
    6.  
    7. public class ICESafeZone : MonoBehaviour {
    8.  
    9.     void OnTriggerEnter( Collider other )
    10.     {
    11.         if( other.gameObject.GetComponent<ICECreatureUFPSPlayer>() != null )
    12.         {
    13.             CreatureRegister.Deregister( other.gameObject );
    14.             Debug.Log ( "Deregister Player" );
    15.         }
    16.  
    17.     }
    18.  
    19.     void OnTriggerExit( Collider other )
    20.     {
    21.         if( other.gameObject.GetComponent<ICECreatureUFPSPlayer>() != null )
    22.         {
    23.             CreatureRegister.Register( other.gameObject );
    24.             Debug.Log ( "Register Player" );
    25.         }
    26.     }
    27. }
    If your player enter now the trigger zone he will be 'invisible' for your creatures and if he leave the zone your creatures will attack him again.

    http://www.icecreaturecontrol.com/files/webplayer/TutorialSafeZone.html
    ... enter the red platform to be safe!

    Here a complete demo project (UFPS required)
    http://icecreaturecontrol.com/files/examples/UFPSTutorialSafeZone.unitypackage
    btw. you can use this script also for other player or NPCs, just change or remove other.gameObject.GetComponent<ICECreatureUFPSPlayer>()

    I hope this will be helpful to you.

    Have a nice day!

    Pit
     
    Last edited: Dec 1, 2015
    arnesso likes this.
  2. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93
    Wow
    I would not have thought you can write a whole script for us. I cannot be grateful enough.
    Thank You so much , Master ! :)

    (If the NPC is enough close to the SafeZone, then Register activate again with Ontriggerstay, because it is too easy if this zone you cannot be attacked by NPC.
    How is it possible? I cannot refer to Visual range or similiar

    Obviously , the best would be if NPC is looking for Player at his last position, and if He is in the safezone too close to player attack again)
    Cheers :)
     
    Last edited: Dec 2, 2015
    icetec and Al- like this.
  3. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93
    Hello again ! :)

    Just another issue or suggestion I am thinking about expereince 1;point stuff and 2; interactor disabling.
    SO if NPC animal is dead then it SendMessage to . ( other script which collect this like, xp points)
    Can I refer to dead NPC somewhere in the script ? I could not find it

    On the other hand, for example Fire protection. Is that possible to disable this interactor after a given time and thereafter It starts again.
    This would be helpful for the animal will be able learn a little bit. The bear would afraid from fire unitl couple of minutes but after he /it was not be disturbed by fire.
    ( If it is not possible ,Other soultion what I will do it, the animal will be afraid from fire only its health is low enough ,
     
    icetec likes this.
  4. Al-

    Al-

    Joined:
    Jun 5, 2015
    Posts:
    20
    Thank you very much. I tried it with another navigator and I can download them.
     
    icetec likes this.
  5. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    424

    You sold me by saying you are going to support Apex.. Remember Apex has Steer as well. So hopefully you support both. I SEE you have you do support PUN, for your asset, any plans for Photon Bolt??? I do have PUN, but I perfer Bolt.

    I will buy this asset now since you seem to support other assets..
     
    icetec likes this.
  6. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    199
    I really like the lego-style component-based approach for your AI. I like the way you've implemented Interactors, but I have a question about them that I wasn't able to answer for myself from my skim through the docs. Is there a way to have an interactor apply to an entire class of creatures/objects rather than a single instance? For example, make a creature afraid of all torches, rather than one torch? Or want to eat all players, rather than one player? If this is possible, ICE would become my go-to for all AI objects I don't write from scratch.

    Thanks for creating a really cool looking asset!
     
    icetec likes this.
  7. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi Arnesso, I’m sorry for the late response …

    Basically you can handle the desired behaviour by define additional rules for an interactor, but in v1.0 the selection criteria are limited and therefore not suitable for all situations. This issue is already fixed in v1.1 in which the selection criteria are much more powerful and can be extreme complex and flexible adaptable to nearly each potential situation. But if you want you can handle the desired behaviour also in v1.0 completely without the trigger, just by override the ReactComplete() method of the ICECreatureControl script. The ICECreatureControl based on ICECreatureController and contains a couple of abstract and virtual methods which you can use to implement your own custom code in addition to the default routines.

    ReactComplete() is an abstract method, which will be called as soon as your creature has prepared all potential targets and selected the ActiveTarget for the next move. Here I have prepared small snippet with examples how you could use the ReactComplete() to control your creature by evaluate the situation, setting custom behaviours and/or to manipulate a target.

    Code (CSharp):
    1.  
    2. public override void ReactComplete()
    3. {
    4.   // Make sure that your player will be the active target - highest priority, selection range adjusted to zero or suitable to the situation.
    5.   if(
    6.   ( gameObject.name == "YOUR_PREDATOR_NAME" || gameObject.tag == "YOUR_PREDATOR_TAG" ) && // optional filter for a specific creature
    7.   Creature.ActiveTarget != null && // Make sure that the ActiveTarget isn't null
    8.   Creature.ActiveTarget.IsValid && // Make sure that the ActiveTarget is valid
    9.   Creature.ActiveTarget.TargetGameObject.name == "Player" // Make sure that the ActiveTarget is your player
    10.   )
    11.   {
    12.    if( Creature.ActiveTarget.TargetInFieldOfView( transform, 120, 30 ) ) // the target must be within the defined sighting field of your creature
    13.    {
    14.     if( Creature.ActiveTarget.TargetDistanceTo( transform.position ) <= 2 ) // the target distance must be smaller than 10
    15.     {
    16.      Creature.Behaviour.SetBehaviourModeByKey( "NAME_OF_THE_DESIRED_BEHAVIOUR" );
    17.     }
    18.     else if(
    19.       Creature.ActiveTarget.TargetDistanceTo( transform.position ) > 2 &&
    20.       Creature.ActiveTarget.TargetDistanceTo( transform.position ) <= 10
    21.       )
    22.     {
    23.      Creature.Behaviour.SetBehaviourModeByKey( "NAME_OF_THE_DESIRED_BEHAVIOUR" );
    24.     }
    25.     else if(
    26.      Creature.ActiveTarget.TargetDistanceTo( transform.position ) > 10 &&
    27.      Creature.ActiveTarget.TargetDistanceTo( transform.position ) <= 30
    28.      )
    29.     {
    30.      Creature.Behaviour.SetBehaviourModeByKey( "NAME_OF_THE_DESIRED_BEHAVIOUR" );
    31.     }
    32.    }
    33.    else
    34.    {
    35.     // the player isn't in the defined sighting field and therefore your creature can do other task ...
    36.  
    37.     // e.g. back to the home location
    38.     Creature.SetActiveTarget( Creature.Essentials.Target );
    39.  
    40.     // e.g. back to the patrol mission
    41.     Creature.SetActiveTarget( Creature.Missions.Patrol.Target );
    42.  
    43.     // e.g. hold the position and wait for next contact
    44.     Creature.Behaviour.SetBehaviourModeByKey( "IDLE_WAIT_FOR_PLAYER_CONTACT" );
    45.  
    46.     // e.g. replace the home position, set the home as active target and run some idle activities while waiting for player contact again
    47.     Creature.Essentials.Target.TargetGameObject.transform.position = transform.position;
    48.     Creature.SetActiveTarget( Creature.Essentials.Target );
    49.     Creature.Behaviour.SetBehaviourModeByKey( "IDLE_ACTIVITIES_WHILE_WAITING_FOR_PLAYER" );
    50.    }
    51.   }
    52.  
    53.   // EXAMPLE TO HANDLE DEAD CREATURES ...
    54.   else if(
    55.   ( gameObject.name == "YOUR_PREDATOR_NAME" || gameObject.tag == "YOUR_PREDATOR_TAG" ) && // optional filter for a specific creature
    56.   Creature.ActiveTarget != null && // Make sure that the ActiveTarget isn't null
    57.   Creature.ActiveTarget.IsValid && // Make sure that the ActiveTarget is valid
    58.   Creature.ActiveTarget.TargetGameObject.name == "PREY" // Make sure that the ActiveTarget is your desired prey creature
    59.   )
    60.   {
    61.    if( Creature.ActiveTarget.TargetIsDead ) // NPC creature is dead (NPC must be a ICECC creature )
    62.     Creature.Behaviour.SetBehaviourModeByKey( "EAT_THE_TARGET" );
    63.    else
    64.     Creature.Behaviour.SetBehaviourModeByKey( "ATTACK_THE_TARGET" );
    65.   }
    66. }
    67.  

    Please consider that this is just an example how you could handle the desired solution by your own custom code. ICECreatureControl provides a complex API to support custom code but the API is currently not well documented, because there will be several changes within the next versions and therefor it’s inadvisable to invest too much time in individual changes. If it’s possible to you, please wait for the v1.1, which contains all your described issues out of the box without custom code.


    That's already included in v1.1 also the new version provides a basic memory so the creatures can learn at runtime …

    btw. by using Creature.Status you will have access to all the status values and for futher informatuíon please visit also http://www.icecreaturecontrol.com/docs/html/index.html

    I hope my answer is helpful to you, please feel free to contact me again if you have further questions ...

    Have a nice day!

    Pit
     
    Last edited: Dec 6, 2015
    arnesso likes this.
  8. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi Recon, of course I’ll provide an adapter for Apex but first I have to finish v1.1 and some other adapters. Also I’m not sure about APEX Steer, because I don’t know this component and have also no experience with it and therefore I’m not sure how to combine it with ICE and have to test this component first. Photon Bolt is also listed as an adapter candidate but I know that some users already using ICE with Bolt without adapter. Please check the forum entries ...
    http://forum.unity3d.com/threads/re...s-monsters-zombies.347147/page-2#post-2308885

    Have a nice day!

    Pit
     
  9. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi CodeBison, basically the targets which you assign directly as home or mission object are single instances but an interactor don’t need to be a single object. All the objects which are listed in the CreatureRegister are just references for a group of potential targets with the same name.

    In the given version (v1.0) an interactor target will be handled by its name, so if you have different kinds of torches but all with the same name your creature can interact with all of them independent of the used reference object. The crucial factor is the name of your objects.

    In v1.1 this principle will be valid for all targets (also for home and missions) and in addition to the name a target can be optional detected also by its tag. But your described examples are already realizable with the given version, just use the same object name to group your desired targets.

    I hope my answer is helpful to you and please feel free to contact me if you have further questions.

    Pit
     
  10. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    321
  11. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93

    Thanks Pit ! :)

    I am going to check it ,I guess I will be able to figure out.
    Right now I am looking the scripts to create a headshot function to NPC , and add to the NPC HEARING.

    If it is possible to make Shark(fish) AI with ICE how could you do that? maybe a short tutorial about that.
    We like the tutorials, I hope they are going to be more.
    Have a nice day ! ;)
     
    icetec likes this.
  12. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Fishes and birds will be supported in one of the next versions, I have already done some tests with a branch but I'm not happy with the swarm behaviour, also i would like to integrate hearing, but up to now I'm missing a smart way to realize it. The headshot you could handle with a head collider and a small script which will trigger the impacts and applies the damages to your creature (e.g. GetComponentInParent<ICECreatureControl>().Creature.Status.AddDamage( 10 ); )

    Currently I'm little sickly and in addition also busy with a contract work but as soon as v1.1 is online I'll prepare more tutorials and also videos ...

    Best regrads, Pit
     
    Teila and arnesso like this.
  13. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    199
    Thanks for your answer. Sounds good. Do you have an ETA on version 1.1?
     
    icetec likes this.
  14. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93
    Hi @icetec Pit ,

    First of all I made a little raw modification UFPS Adapter script which is responsible for BLOCK NPC ATTACK .(Only paste these lines into ICECreatureUFPSAdapter.cs like this :


    Code (CSharp):
    1. public void Update ()
    2.         {
    3.             if (Input.GetKeyDown(KeyCode.Y))
    4.             {
    5.                 UsePlayerDamage = !UsePlayerDamage ;
    6.  
    7.             }
    8.             if (Input.GetKeyUp(KeyCode.Y))
    9.             {
    10.                 UsePlayerDamage = !UsePlayerDamage ;            
    11.             }
    I hope this is useful for somebody else ,too . ( It would be better if only NPC attack damage would be zero, because until we hold Y we cannot damage NPC)

    I noticed if I modify on UFPSADAPTER in inspector the Damage amount or anything when I press play it alwasy resets itself, Why ?)


    I am sorry for maybe stupid question, but i could not figure out this headshot function (I tried to add UFPSadapter ,but is did not work :\
    If it is possible ,could you write to where should I paste this code line and what is the correct form this trigger stuff,?

    Because RaycastHit hit; hit.collider.tag("Head") does not option. I do not know howd does the NPC sense the bullet impact.
    I would be really grateful !
    Thanks
    Best wishes!
     
    Last edited: Dec 12, 2015
    icetec likes this.
  15. Recon03

    Recon03

    Joined:
    Aug 5, 2013
    Posts:
    424

    Apex Steer was added from the same company to extend Apex Path for Flocking. and many other things.. So they just extended it.. actually no real need to add Apex Steer, once Apex Path, is we can as Devs actually do it..
     
    icetec likes this.
  16. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,596
    Take care of yourself, Pit! Get some rest. Hope you feel better soon!
     
    icetec likes this.
  17. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    Minor Architectural question
    Hi. I was wondering if it is possible to cache the ground collision layer ID chosen at runtime and not pipe the detection via the Layer to Name helper so as to ditch all the Runtime Allocations associated with that.

    Seems like a one-time "Change it now" approach would be better than a runtime scan of the value since this is really only applicable to editor space and the likelihood of needing to fish around to find your ground layer is minimal.

    Few possible Gaffs upon importing the demos
    On that note I saw that Layer 8 is un-named by default (no existent layer/tag name mangling on your part) and it is this layer that is referenced by default by the little cubey things. So without giving the layer a name..
    Code (csharp):
    1. _layers[i] = LayerMask.LayerToName( EditorGUILayout.LayerField( "Ground Layer", LayerMask.NameToLayer(_layers[i]) ));
    would fail. Causing null reference errors when highlighted in the Hierarchy. This is obviously easily fixed by adding a name in the LAYERS pane. but thought I should mention it.

    So, to precis, change that line to only reference the dropdown when you are updating it.
    Which doubtless you have considered but it seems like it would be a nice design change.

    Also we noted that it ultimately boiled down to a ref of "return m_GroundLayers;" in ice_CreatureMove.cs so, whilst I am reticent to tell your your business, these might be better store/referenced as integers. Only ever translated to their string equivalents by a one-time list population method thereafter used by the editor for display purposes, reverse engineering the string thru id back to string in LayerMask.LayerToName(... LayerMask.NameToLayer(_layers)) is sub-optimal. however it is a small thing. The package is really nice.

    Thanks for your consideration, perhaps there is some other architectural decision that I am missing that precludes this other storage type, if so I apologise.

    In the simple demo the main player is missing an AudioSource component and the audioclips are not assigned, also move values are all set to 0. Amending these makes the simple demo work. :) Many thanks, this may well be a unity thing, it is easily fixed.

    We also noted
    Code (csharp):
    1. UnityException: GameObject has undefined tag!
    2. UnityEngine.Component.get_tag () (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineComponentBindings.gen.cs:160)
    3. ICE.Shared.ICEDemoProjectile.OnCollisionEnter (UnityEngine.Collision collision) (at Assets/ICE/Shared/Scripts/Public/ICEDemoProjectile.cs:68)
    but we didnt investigate yet we didn't manage to replicate this after we fixed all the layers, may have been a false report.

    When does the animator component show?
    Here are some ICEy pigs.
    IceyPigs.JPG
    It was non-obvious to us how the animator section decides if it should be shown or not in the editor, we did start delving into the editorDrawer code and finally figured out the model needing the animation attaching at the root level. it was non-obvious from the manual also. perhaps just elude to it a bit more, in a few more places if you ever update the docs :)

    Request for more generalised target selection
    Finally, it would be nice to determine a target via a layer/tag selection and a distance, rather than on actual object, solving the prefab problem. This would be a nice addition. :)

    Many thanks, sorry for the long post.
     
    Last edited: Dec 8, 2015
    icetec and Nateply like this.
  18. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    Additionally the intermittent error
    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. ICE.Creatures.EditorHandler.EditorEssentials.HandleSystemSettings (ICE.Creatures.ICECreatureControl _control) (at Assets/ICE/ICECreatureControl/Scripts/Editor/Handler/ice_CreatureEditorEssentials.cs:87)
    4. ICE.Creatures.EditorHandler.EditorEssentials.Print (ICE.Creatures.ICECreatureControl _creature_control) (at Assets/ICE/ICECreatureControl/Scripts/Editor/Handler/ice_CreatureEditorEssentials.cs:34)
    5. ICE.Creatures.ICECreatureControlEditor.OnInspectorGUI () (at Assets/ICE/ICECreatureControl/Scripts/Editor/ICECreatureControlEditor.cs:74)
    6. UnityEditor.InspectorWindow.DrawEditor (UnityEditor.Editor editor, Int32 editorIndex, Boolean forceDirty, System.Boolean& showImportedObjectBarNext, UnityEngine.Rect& importedObjectBarRect, Boolean eyeDropperDirty) (at C:/buildslave/unity/build/Editor/Mono/Inspector/InspectorWindow.cs:1211)
    7. UnityEditor.DockArea:OnGUI()
    8.  
    seems to be caused by
    Code (csharp):
    1. _control.Creature.Move.Width = ICEEditorLayout.DefaultSlider( "Width", "", _control.Creature.Move.Width, 0.01f, 0, 45, ( _control.GetComponentInChildren<Renderer>().bounds.size.x / _control.transform.lossyScale.x ) );
    This look like a race condition where the GetComponentInChildren<Renderer>().bounds.size.n simply isn't returning "in time" for the first pass, we will try fencing it in a null check and additionally caching the reference to improve performance, at least until respawn. It's editor script though so, meh. Just the null check would be fine.

    This seemingly would only affect a highlighted gameobject in the Hierarchy, so I suppose it is low priority but thought I should report.

    EDIT:
    Code (csharp):
    1.  
    2. if( _control.Creature.Move.GroundOrientationPlus )
    3. { Renderer test = _control.GetComponentInChildren<Renderer>();
    4.  
    5. if (test != null)
    6. {
    7.  
    8. _control.Creature.Move.Width = ICEEditorLayout.DefaultSlider("Width", "", _control.Creature.Move.Width, 0.01f, 0, 45, (_control.GetComponentInChildren<Renderer>().bounds.size.x / _control.transform.lossyScale.x));
    9. /// SNIP...
    10. _control.Creature.Move.DepthOffset = ICEEditorLayout.DefaultSlider("z-Offset", "", _control.Creature.Move.DepthOffset, 0.01f, -10, 10, 0);
    11. EditorGUI.indentLevel--;
    12. })}
    Seems to fix it, with limited impact on functionality. Obviously one could take advantage of the cached reference if preferred...
    Kind regards.
     
    Last edited: Dec 8, 2015
    icetec and Tethys like this.
  19. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    I would like an objects location to respect a simple Stream of Y values on a per frame basis.

    I have a "Water Level @ X,Z" function that I would very much like to pass into a roaming animal, so as to facilitate sticking to surface... this would be a "lerp toward" value ideally and would allow for "floating" above a percieved lower ground layer i.e. effectively "fly".
    Any tips from anyone on the best place to start with that?

    Many thanks
     
    Last edited: Jan 9, 2016
  20. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,596
    Like a swimming swan? ;)
     
  21. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    well. I cheated so far and simply added an invisible Y plane for the hippos to "swim" (walk) on until we get it sorted.
    upload_2015-12-9_23-14-40.png

    upload_2015-12-9_23-15-57.png

    upload_2015-12-9_23-16-49.png

    Works okayish for now. :)
     
  22. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,596
    Hey, that is a very good idea, Twobob!
     
    icetec and twobob like this.
  23. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    528
    Are they the hippos from 4toon? I'm using the same ones, I got around the problem by making the water bed a certain height so they were just walking on the terrain, but looked as though they were swimming. I think you could perhaps do it by adding a collider, and then increasing their Y position when they enter it, but I think this would need to be done via code or visual scripting package like GameFlow.

    Have you managed to get them to walk into the water and start swimming? This should be possible now as there is an option change the behaviour based on the splatmap, just haven't had chance to test it yet.
     
  24. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93
    Any idea for flying enemy ? Between random range ( 0, 20) on y axis and when touch the terrain then walk .
     
  25. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    Protofactor african animals, with a toony shader we are working on (just mangling the unity examples).

    As far as we could see there was no way to change /behaviour/ based on splat map. Just effects, sound...
    So we didn't try that, as we could see no way to do it.

    We tried collision tag/layer stuff but it didn't seem to work in the way we expected.
    Perhaps we should revisit, the manual was a bit non-clear on it, perhaps the examples need revisiting too by us...

    Ideally, as you say, we should be able to pass a 3rd party value range into it to provide a "MaxY" and a "MinY" for the roaming, This would effectively provide swimming, ghostly floating and even avian possibilites. (With a few roll, yaw, pitch rules strapped on for the various styles).

    Most certainly. I would simply affect the BASE OFFSET value programatically. I intend to do this, in a moment, to effectively provide "Floor track hovering", a bit of lerping will hopefully provide a smoother "flight" experience. It is never going to be proper "flight" though without quite a bit more love :)
    "When we touch the terrain then walk", I would hope to be able to switch behaviours when my BASE OFFSET became "not offset" (or, more simply, "on the ground"). Fingers crossed ey ;)
     
    Last edited: Dec 11, 2015
    icetec and arnesso like this.
  26. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    528
    Ah ok, to be honest I haven't tried out the splat texture effect yet. I was waiting for the next release, as it will be huge since the developer has vastly improved the selection criteria, so I imagine the splatmap actions will be expanded as well.
     
    icetec and twobob like this.
  27. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    540
    @icetec
    All you examples shows open environment. Will your system work if I want a creature to guard a narrow bridge for example, where it should move only on surface and can be kicked out from it by player but not by itself. Bridge is rectangular if it is matter, with fall-able abyss on both sides.
     
    icetec likes this.
  28. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    648
    @twobob - We experienced some of the same things, I expected the movement with regards to layers to work a bit different, and personally I found the manual difficult to get through and the included examples to be a bit lacking. Lastly, we also have to wait for 1.1 as the selection criteria for certain methods (such as finding an enemy or running from a predator) has to be based on tags. Looking forward to the 1.1 update and trying to get this working in our game. Right now, regarding deciding on an AI asset to use for our game, it's a toss between the 1.1 update here and the big Emerald AI update that includes path finding support. We really like the potential that both packages have but obviously will need to settle on one of them, which for us is going to be the least costly/time efficient package to get working. :p
     
    Last edited: Dec 12, 2015
    icetec, Nateply and twobob like this.
  29. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    I dont think really I can say much more than this:

    BadElephant.JPG

    Any clues?
    upload_2015-12-12_2-34-29.png

    upload_2015-12-12_3-25-38.png

    Here is the gizmos on that
    ElephantGizmos.JPG

    Many many thanks
    EDIT: we thought the capsule colliders need to be marked as ignoring the terrain layer.
    But that didnt help..

    In additon please could somone tell us how to set a maximum slope for walking?
     
    Last edited: Dec 12, 2015
    icetec likes this.
  30. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Dear customers, I'm really sorry for my late response. I'm currently busy with a contract job outside of my office and there is unfortunately no way to answer the incoming requests as I would like to prefer to support you as accustomed and appropriated. I’m really sorry for that!

    I'm back at home now and will answer all requests asap within the next hours.

    Best regards,
    Pit
     
    twobob and jonfinlay like this.
  31. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi twobob, I'm really sorry for my late response. Thanks a lot for your detailed information and error description, I’ll answer all your posts step-by-step but here directly a solution for the latest issue. Please check the axes orientation of your creature - the positive z axis have to be in line with the forward direction. v1.1 provides already more flexibility, but the current version requires an exact orientation, therefore it's problematical to handle a quadruped animal with a capsule collider, because you can't rotate this type of collider as required and have to adapt the complete creature object, which provokes the effect you see. The easiest way is to use a simple box collider and the best results you will get with a multiple box and sphere colliders for different body-parts.


    Best wishes, Pit
     
    Tethys and twobob like this.
  32. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    Thanks man.

    I thought I did have him/her facing forwards but I guess not?

    I will break up his colliders a bit then. But elephant = 1 big fat tummy ;) perhaps I can use a sphere ;)

    glad you are back

    :)
     
    icetec likes this.
  33. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi Montyfi, yes of course … in v1.0 you could handle the descripted situation in different ways, here two ways as example …

    1. Navigation Mesh – use the Navigation Mesh to define the walkable areas and create the desired OffMesh Links, where your creature can be kicked out by your player. Add a location target (e.g. HOME, OUTPOST etc.) near or on your bridge and adapt a suitable Random Positioning Range for idle activities (make sure that all potential positions within the range will be reachable for your creature, but without using the OffMesh Links). Adapt now the desired Interactor settings for your player, so that your creature will attack and fight with the player if he try to cross the bridge. Adjust the fighting behaviour and move positions, so that your creature have to use the OffMesh Links e.g. play with multiple behaviour rules and negative velocity values, so your creature will avoid hits by walking backwards etc.). As soon as a given MovePosition will be outside your bridge structure, the NavMeshAgent will use one of the OffMesh Links and your creature will tumble into the abyss. The only problem you will have now is, that your creature will not receive any fall damages and will stay alive but this issue you could handle by adapt the Environment Settings, so that your creature receives damages while comes in contact with a specific surface or an collision object.

    2. Patrol – if you would like to handle the described situation without the Navigation Mesh, you could define several waypoints, your creature have to visit while doing idle activities. As long as the Random Positioning Range of a waypoint is adjusted to zero, your creature will following the given path without randomized influences, so you can make sure that your creature will stay on the bridge and will not fall into the abyss. Define now your player as interactor, so that your creature will attack and fight with him if he try to cross the bridge. Adjust the fighting behaviour and move positions, so that the MovePosition can be outside your bridge structure e.g. play with multiple behaviour rules and negative velocity values, so your creature will avoid hits by walking backwards etc.). As soon as a given MovePosition will be outside your bridge structure your creature will tumble into the abyss. Handle the damage as above mentioned to kill your creature after falling into the abyss.

    Btw. In both cases you could use invisible colliders on both sides of your bridge to force the desired falling behaviours or to trigger an effect etc.

    I hope this will be helpful to you.

    Have a nice day!

    Pit
     
    Tethys likes this.
  34. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi unicat,
    as already mentioned above, within a short time there will be a bridge script to handle the damage between ICECreatureControl and your RFPS Player. The RFPSP Adapter works similar to the UFPS Adapter and provides to integrate ICE controlled creatures into your RFPSP project just by drop the adapter to your creature and adapt the required values. The adapter will be part of the next update!




    Have a nice day!
    Pit
     
  35. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi twobob,
    thanks a lot for your bug-report and your described solution. I have directly fixed this issue in v1.1 and will provide also an update for v1.0 if required, but I hope, I’ll have the time to finish v1.1 and publish it before Christmas.

    One of the next versions will support fishes and avian creatures out-of-the-box but your current solution is really smart and provides me brilliant aspects and inspirations how to implement vertical movements in keeping with the given horizontal ones. Many thanks for that!

    The current version don’t provide a slope angle, but it is already implemented in v1.1. Here you will have two values, one for the maximum slope limit and one for the walkable slope limit. The maximum slope limit defines inaccessible areas by the angle of its surface while the walkable slope limit defines the maximum slope angle your creature will use to crest a hill, so your creature will not use the shortest route to the mount peak but the most passable one, according to the given walkable slope limit (e.g. similar to serpentines or twisting roads in the mountains).




    In this example 45 degrees will be the maximum surface limit, but the creature will try to found a way with a smaller angle by walking diagonal to the given surface slope.

    Have a nice day!

    Pit

     
    arnesso and twobob like this.
  36. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    540
    Is it possible to stop creature when it hits a collider on its way?
    Or check if there is a collider between creature and target and then count it as target is not reachable?
     
    icetec likes this.
  37. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761

    A) Yes, There is a collisions section that with some imagination could achieve that.

    B) I would go for "No", from what I have seen. That would imply path finding.

    However a better definition of what you mean by "between" would not hurt :)
     
    icetec likes this.
  38. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    Hi Montify, in the given version you can use the environment -> collision to change the behaviour (as twobob already mentioned) ... and in addition you could use the advanced selection criteria to ignore a target while a specific behaviour is active ...


    It's a small indirection and not exactly what you want but you could use this way to count the target as not reachable.

    Tip: flag the IGNORE_WHILE_COLLISION as favoured and define a small delay (2-3secs.), so that your creature will waiting for a while if its lose the 'simulated' visual contact and before run another behaviour (e.g. TRAVEL_HOME etc)
    Btw. In v1.1 it's more easier because in addition the field of view (FOV button) there is a VC button to check the visual contact, so that your creature will ignore it while it isn't visible.

    I hope that's helpful to you!

    Have a nice day!

    Pit
     
    twobob likes this.
  39. montyfi

    montyfi

    Joined:
    Aug 3, 2012
    Posts:
    540
    Um, perhaps I described the problem in a wrong way. If a creature doing a leisure activity, is it possible to check for colliders on its way? At the moment it looks like colliders are completely ignored.
     
    Tethys likes this.
  40. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    Perhap it is the bit about "Favoured.", I am kind of thinking it just triggers for 1 frame then goes off and does a HOME or LEISURE before we, the developer, notice it.

    An option to output a simple, single, string - per "animal", per change would obviously clear this up. Will go dig.

    EDIT, looks like simply modifiying the public static class EditorInfo class Print method to spit out the changes respecting _control.Creature.Behaviour.BehaviourModeKey should do the job, I'll have a play

    ... Okay, so it turns out we have already got an event monitored for us, therefore adding:

    upload_2015-12-14_15-29-53.png

    at the end of the Print method in \Assets\ICE\ICECreatureControl\Scripts\Editor\Handler\ice_CreatureEditorInfo.cs gives us an additional debug output, per change, ensuring we don't miss single frame changes during the testing phase.

    Like so:

    upload_2015-12-14_14-56-29.png

    There, now we can be sure when testing that changes are or are not occuring.

    EDIT: On further inspection this is already possible in the virtual UpdateComplete Method ;)
    Simply use the code there if you wish this output from ALL creature instances.. However the above method limits the output to just the "Tested" creature, so... both are helpful. :D
     
    Last edited: Dec 14, 2015
  41. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93
    Hello everyone,

    How could I refer to NPC death, so if its health is zero?
    I would need NPC to send Message(if it is dead) to other script with public float(which is how many points send to my Levellup system)
    Other thing, If NPC is dead it disappear too soon, I would need NPC to stay longer time I will be able to loot it.?
    Thank You :)
     
    icetec likes this.
  42. jonfinlay

    jonfinlay

    Joined:
    Aug 25, 2015
    Posts:
    528
    Hey Arnesso, I had this problem as well. You have to increase the RespawnTime within the Status settings, to a maximum of 5 minutes. If you want it longer, you have to edit it in the script. I'm hoping in the next version it will spawn a new prefab "dead animal carcass" in its place after 5 minutes.
     
    icetec and arnesso like this.
  43. icetec

    icetec

    Joined:
    Mar 11, 2015
    Posts:
    592
    ... it's already inculed - v1.1 can spawn a corpse object, which you can use for a ragdoll or something like this ...
     
    twobob, arnesso and jonfinlay like this.
  44. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    Would kill to be a beta tester.
    Just saying
     
  45. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    Honestly, I was just working on fixing it, and listening to some tunes and.. well...
    Screenie or it never happened right?


    He's got the moves, you gotta give him that.
    You know, Really dancing...
     
    Teila, jonfinlay and Tethys like this.
  46. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93
    Where shoul I insert my XP line in ICE Creature Control script ?
    If NPC is dead or its damaged 100 % , where is that line, part exactly ?
    I would add this : getcomponent<levelup>().xp += 10;
    (if NPC is dead)
    thank you for any Help :)
     
  47. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,761
    seems like it should hook into an "OnDeath" event or something...

    Havent got that project open right now
     
  48. arnesso

    arnesso

    Joined:
    Mar 3, 2015
    Posts:
    93
    I have found finally after long searching
    I insert here , I share it , If somebody else would need for this ,too :
    ice_Creature.cs
    public Levelup level;

    Code (CSharp):
    1.             if( Status.IsDead )
    2.             {
    3.                 Behaviour.SetBehaviourModeByKey( Essentials.BehaviourModeDead );
    4.                 Status.RespawnRequest();
    5.                 level.xp += 10;
    6.             }
    7.  
     
    twobob likes this.
  49. CodeBison

    CodeBison

    Joined:
    Feb 1, 2014
    Posts:
    199
    Do you have an eta on v1.1? I don't mean this in a "hurry up and get it done" sense - I know from what you've said that it's going to be a huge update. I'd just like to have some sort of idea on the timeframe so I can plan my development timeline.

    Thanks!
     
  50. delmol

    delmol

    Joined:
    Dec 21, 2015
    Posts:
    1
    Having some issue with UFPS integration.

    I've pretty much just picked up this asset and loaded the latest UFPS demo scene, so it may be my inexperience here.

    When playing the demo scene, the attack when close event doesn't work at all.
    When the player shoots at the orge, it will run at the player and not stop, running around in circles when it reaches the player (forcing the player up in the air).
    The attack state never seems to get called?

    Also the ogre seems to temporarily respawn where it died, before teleporting back to the original start position

    EDIT: I managed to fix the issue, seem it was caused by some of the state having a selection range of 0. I Changed this and now he runs and attacks me.

    However the respawn glitch is still happening.

    And how can i get multiple attacking enemys to attack the player from different angles, rather than all converging on the same point (and walking through eachother)?
     
    Last edited: Dec 21, 2015