Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

RAIN{indie} Free, Powerful, AI Engine -- Released

Discussion in 'Assets and Asset Store' started by RT_Jester, Jan 25, 2013.

  1. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello KalKyl87,

    First off, welcome to Unity and welcome to RAIN{indie}! My name is Nick (Jester on forums) and I'm in charge of community and communications here at Rival Theory. We're here to help you will all your AI questions.

    In response to your question:
    You'll want to do your scripting inside a custom behavior tree action. Here's a link to our wiki article on Custom Actions: http://support.rivaltheory.com/rainindie/wiki/doku.php?id=behavior:behaviortrees:nodes:customaction

    Let us know if this helps! Check out my signature for more resources, or let me know what you're looking for.

    Best,
    Jester
     
  2. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Can Mecanim Action also be publish the source code in rain indie documentation wiki, just like other Actions do ?
     
  3. spendew

    spendew

    Joined:
    Feb 12, 2012
    Posts:
    104
    Hello, is it possible for RAIN to generate nav grids during runtime?
     
  4. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Yuewahchan,

    Thanks for the suggestion! We will add this action source as well as update the others.

    Thanks again,
    Jester
     
  5. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    SGM3,

    Thank you for the feedback. What parts of the RAIN{indie} system are you having the most trouble with? Unfortunately there isn't a solution that's "one size fits all". Most developers have different skill levels and different goals for their games. Which is why we developed the Wiki, forums, and our awesome community generated tutorials-- it allows users to learn the parts of the system they're less familiar with, without having to go through information they already know (check my signature for the links). We encourage all of our community members to reach their goals and create outstanding games. That's why we're here with full-time support. We do everything in our power to answer questions, provide feedback, optimizations, code samples, tutorial examples etc. If there is something you're having trouble with, let me know. We can get you on track.

    We took the time to consolidate the best tutorials made with RAIN{indie} and put them into one easy-to-use thread.

    http://support.rivaltheory.com/forums#/discussion/390/community-generated-tutorials-and-documents-

    If you're completely new to an AI system, I would suggest starting with Tornado Twins (for movement and animation using FPS Control), CodersExpo (obstacle avoidance, behavior trees, and waypoints), and JakeCasper (for a complete beginner's guide). We also have tutorials on how to set up RAIN{indie} with Mecanim characters if you're looking to go down the animation route.

    https://www.youtube.com/watch?v=Pi4t2IRkEL0

    Within a few hours you will be able to create an AI that paths, animates, and makes decisions.

    Let me know if this helps.

    Best,
    Jester
     
    Last edited: Jun 19, 2013
  6. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello spendew,

    Thanks for posting! In this version of RAIN{indie} it is not possible to generate nav grids at runtime. We are talking about it as a possible feature for future versions.

    How is your project coming along?

    Best,
    Jester
     
  7. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Is it possible to allow setting the default path for folder AI, especially "AI/Actions" and "AI/Resources/BehaviorTrees" ?
     
  8. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Yuewahchan,

    Thanks for posting. It depends on what you're looking to do. Could you give me a few more details?

    Talk to you soon!

    Best,
    Jester
     
  9. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    In the Behavior Tree Mind Component, the Behavior Tree Filename load the file under /Assets/AI/Resources/BehaviorTrees/ , is it possible to change the path , e.g. fullpath ?

    Also, the BT Editor also load the files under /Assets/AI/Resources/BehaviorTrees/ , is it possible to change ?
     
    Last edited: Jun 18, 2013
  10. HenryStrattonFW

    HenryStrattonFW

    Joined:
    Jul 27, 2012
    Posts:
    18
    Hey, after a long time using my own waypoint graphs, I stumbled over RAIN and thought it looked great, far more features and stable than my own implementations and just a generally good time saver.

    But before i move some of my project over to it i'm trying to just test if i can still do certain things in the same way. For example If i have a room filled with a waypoint graph Is there some way (Looking over the documentation I've not found anything yet) for me to "disable" a given waypoint without removing it from the graph?

    See i have an area where users can place and relocate items, obviously it would be great if when that happens i can simply re-enable the waypoints they were covering, and disable the waypoints that they now cover. Fortunately I wont have to worry about path invalidation as when an item is moved the characters current action is restarted from the current position meaning a fresh path calculation.

    Or perhaps a navigation grid is a better approach for this? the only reason I wasn't considering a nav grid was because from what i can tell the obstacle avoidance only uses steering forces, which might not suit some of the odd and potentially cramped positions that might be created.

    Any suggestions or advice is greatly appreciated. Really looking forward to using rain more.
     
  11. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello Yuewachan,

    Thanks for the follow-up. In code it is possible to load trees manually with the BTLoader (there are a few methods to do this, working on updating the API docs to show them, but MonoDevelop or VisualStudio will show it through their autocompletion, look for BTLoader.Load). Unfortunately the behavior tree editor is currently forced into that directory.

    As I said, I'll update the API to show them.

    Let me know if this helps.

    Best,
    Jester
     
  12. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Will you plan to support this in the future release ?
     
  13. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Yuwahchan,

    Absolutely. This feature will be included in our next major release. :)

    Thanks for posting!

    Best,
    Jester
     
  14. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello HenryStrattonFW,

    Thanks for posting! You'd probably need to remove the connections to the disabled waypoint and then re-add them to enable. Not as nice, I know, but you could probably cleanly encapsulate that work by inheriting from our Waypoint class.

    Then, to cause AI to repath, you would just need to call ReInit(Agent agent) on their pathmanagers.

    Let me know if this helps.

    Best,
    Jester
     
  15. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello Unity,

    I wanted to share this video created by community member Ryan Meowers. He gives step-by-step instruction on how to set up a Mecanim character with RAIN{indie}, using RAIN{indie}'s navigation, behavior tree, and sensor/aspect features.

    Check it out and let us know what you think!



    Best,
    Jester
     
    Last edited: Jun 25, 2013
  16. Alex-3D

    Alex-3D

    Joined:
    May 21, 2013
    Posts:
    79
    Hello. {RT}_Jester!

    Impressive product. But one question:

    With what accuracy is necessary to specify MoveTarget.Vector in Move and MecanimMove nodes for SUCCESS result?
    In some cases, if the position is above or below the center of the actor, the actor continues to spin there forever. Empirically found that the difference can be no more than 0.3 units. Is that right?

    Best!
     
    Last edited: Jun 27, 2013
  17. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello Alex 3D,

    Welcome!

    You can set the CloseEnoughDistance of the AI's PathManager higher to make it easier for the AI to reach a target. You can run in to trouble if the AI's transform and/or the target are off the ground.

    Let me know if this helps!

    Best,
    Jester
     
  18. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
  19. XilenceX

    XilenceX

    Joined:
    Jun 16, 2013
    Posts:
    122
    I've just watched the Mecanim AI movement tutorials and they have convinced me to use this plugin. However what happens once the player is "in range" and should be attacked by the AI? Is there a way to detect this in RAIN and play a Mecanim attack animation via the behaviour tree? Or would this be better done with the old animation system? Some video tutorial on that subject would be awesome, as the FPS Control series unfortunately ends right before it gets to this interesting part. ;(
     
    Last edited: Jun 30, 2013
  20. Alex-3D

    Alex-3D

    Joined:
    May 21, 2013
    Posts:
    79

    Hello, {RT}_Jester!
    Thanks!

    Unfortunately, PathManager.CloseEnoughDistance influences on each step of work of PathManager, and its increase leads to a way flattening.

    I found attribute RAIN.Path.MoveLookTarget.closeEnoughDistance. It's very helpfull, but not visible in editor window.

    Is there ability to make it "published" in future versions?

    I make some test. I prevent Move action by Custom action with some like this:

    Code (csharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using System.Collections.Generic;
    4. using RAIN.Core;
    5. using RAIN.Action;
    6. using RAIN.Minds;
    7. using RAIN.Path;
    8.  
    9. public class InitVars : RAIN.Action.Action
    10. {
    11.     public float closeDistance = 1.0F;
    12.     private BehaviorTreeMind _mind = null;
    13.     private GameObject _target = null;
    14.     private MoveLookTarget _moveTarget = new MoveLookTarget();
    15.    
    16.     public InitVars()
    17.     {
    18.         actionName = "InitVars";
    19.     }
    20.  
    21.     public override RAIN.Action.Action.ActionResult Start(RAIN.Core.Agent agent, float deltaTime)
    22.     {
    23.         return RAIN.Action.Action.ActionResult.SUCCESS;
    24.     }
    25.      
    26.     public override RAIN.Action.Action.ActionResult Execute(RAIN.Core.Agent agent, float deltaTime)
    27.     {
    28.         _mind = GameObject.FindWithTag("Player").GetComponentInChildren<BehaviorTreeMind>();
    29.         _target = GameObject.FindWithTag("Actor");
    30.         if (_target != null)
    31.         {
    32.             Debug.Log(string.Format("target found: {0}", _target.name));
    33.             _moveTarget.TransformTarget = _target.transform;
    34.  
    35.               // All this done only for this line:
    36.             _moveTarget.closeEnoughDistance = closeDistance;
    37.  
    38.             _mind.actionContext.AddContextItem<MoveLookTarget>("target", _moveTarget, true);
    39.             return RAIN.Action.Action.ActionResult.SUCCESS;
    40.         }
    41.         else
    42.             return RAIN.Action.Action.ActionResult.FAILURE;
    43.     }
    44.  
    45.     public override RAIN.Action.Action.ActionResult Stop(RAIN.Core.Agent agent, float deltaTime)
    46.     {
    47.         return RAIN.Action.Action.ActionResult.SUCCESS;
    48.     }
    49. }
    If target was previously found by Detect action, it will be more easy. There can be many variations.

    What do you think of similar approach?

    Best,
    Alex
     
    Last edited: Jul 2, 2013
  21. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello XilenceX!

    Thanks for posting! You could use a custom action or a sensor to detect when the player is in range of an attack. You can send data into Mecanim with a Mecanim Parameter node. That would allow you to trigger a state change in Mecanim to play an attack animation. You can also play standard animations through the use of the Animate Node.

    http://support.rivaltheory.com/rainindie/wiki/doku.php?id=behavior:behaviortrees:nodes:mecanimparam

    http://support.rivaltheory.com/rainindie/wiki/doku.php?id=behavior:behaviortrees:nodes:animate

    Also check out this tutorial on how to make a melee/ranged attack behavior Hashbang games made. http://www.youtube.com/watch?v=KJKnB8peF_Y

    Let me know if this helps!

    Best,
    Jester
     
  22. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello Alex D,

    Thanks for the post!

    Changing the closeEnoughDistance of a target as you have done is a perfectly valid solution.

    Are you running into this problem because your AI are moving in a way that makes them overshoot a target or are their transforms just not getting close enough to the target when they are directly on it? As long as the AI's transform and the chosen targets are on the ground, the PathManager's CloseEnoughDistance should be set fairly low.

    We'll be improving this area of RAIN significantly in an upcoming version set to release in the Fall. In that version, a target's closeEnoughDistance will be much easier to set.

    Let me know if you need anything else.

    Best,
    Jester
     
  23. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    EDIT: Reposted with Part 2 added

    Hello Unity,

    I wanted to share this video created by community member Ryan Meowers. He gives step-by-step instruction on how to set up a Mecanim character with RAIN{indie}, using RAIN{indie}'s navigation, behavior tree, and sensor/aspect features.

    Check it out and let us know what you think!



    Part 2


    Best,
    Jester
     
  24. Precizion

    Precizion

    Joined:
    Nov 19, 2012
    Posts:
    8
    Moving discussion from other thread to this one:

    The problem is that that trees painted with the terrain tools are merged in to the terrain and are not really gameobjects anymore, and so the RAIN object avoidance just runs straight in to them (and gets stuck).
     
  25. Alex-3D

    Alex-3D

    Joined:
    May 21, 2013
    Posts:
    79
    Hello, Jester!
    thanks for your response!
    I decide that better way to work with RAIN.PathManager is to switch off Animator.ApplyRootMotion and use MoveLookController in AICharacterController. In this case overshoot is not available, actor just stop under (or below) target point and freeze. Or push and push it forever, if target is an object with phisics. Generally behavior depends on used animations. If use mocap animations from Unity examples with animated turns - actor may round and round under target point.

    This is a good news about new version!

    About if I need anything else... You woke voracious dragon!

    1. Case when MecanimMove.LookTarget != null
    I use animations like "step forward", "step left" and so on and blend tree "2D Freeform" specially for this case. But I don't found a way to use Velocity and TurnAngle params in this freeform directly (may be I don't learn Mecanim enough).
    So I wrote special script to calculate SpeedX and SpeedY (for 2D Freeform) from Speed, Velocity and TurnAngle.

    Code (csharp):
    1.     void Start () {
    2.         mecanim = gameObject.transform.GetComponentInChildren<Animator>();
    3.     }
    4.    
    5.     void Update ()
    6.     {
    7.         Vector3 _velocity = mecanim.GetVector("Velocity");
    8.         float _turnAngle = mecanim.GetFloat("TurnAngle");
    9.         float speed = mecanim.GetFloat("Speed");
    10.         float velocityAngle = Vector3.Angle(Vector3.right, _velocity);
    11.         if (_velocity.y < 0.0f) velocityAngle = 360.0f - velocityAngle;
    12.         float strifeAngle = _turnAngle - velocityAngle;
    13.         float SpeedX = Mathf.Cos(strifeAngle * Mathf.Deg2Rad) * speed;
    14.         float SpeedY = Mathf.Sin(strifeAngle * Mathf.Deg2Rad) * speed;
    15.         mecanim.SetFloat("SpeedX", SpeedX);
    16.         mecanim.SetFloat("SpeedY", SpeedY);
    17.     }
    Unhappy trigonometry... I'm not too pleased with the result, but mostly it works.
    Is it available to add some params like SpeedX and SpeedY in MecamMove action to use them in state machine directly?
    Or there is better way for 2D Freeform?

    2. Is it available to add for Custom action some params- may be editable in editor window integer or string Tag, or Sender = AIObject or = AIObject.Mind, or all of them?

    3. Experimentally I found that, before execution, any node with Precondition evaluated to false returns Failure. Is that right? I don't found about this in documenation. And is there ability (in future versions) that developer can choose - Failure or Success a node will return in this case?

    And some questions.

    1. The developer must manually maintain equality of PathManager.AvoidRadius and ObstacleAvoidanceCollider.SphereCollider.Radius or them don't depend on each other?

    2. Is there some run-time member like BehaviorTreeMind.CurrentAction to detect current executing action in scripts?

    Best,
    Alex
     
    Last edited: Jul 6, 2013
  26. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    Hi Jester,

    I have just started to use RAIN Indie with Mecanim.

    I have setup my own character with the Mecanim basic locomotion controller and animations and added the various RAIN component to the character. So basically my character has a similar setup to the teddy bear of the RAIN Mecanim example.

    I have checked the animations of the character and I have also tested the behavior of the character in the Mecanim Animator window. Everything works find there: no footskating and smooth animation.

    But when I test the character in game with the RAIN AI, I run into the two following problems:

    1/ footskating: when the walking animation is played, the feet of the character are skating continuously. It seems that the AI character is not moving fast enough.
    2/ jerky change of direction: instead of smoothly turning, The character's orientation changes almost in one frame giving him a very unnatural movement.

    Do you know how I could fix those problems?

    Thanks a lot.
    Deckard
     
  27. Disastorm

    Disastorm

    Joined:
    Jun 16, 2013
    Posts:
    132
    Hello, am I able to change the transform.position of objects that are managed by PathManager ? I tried doing it but it doesn't seem to change anything. How can I change the position of these objects without telling them to "MoveTo" a position?
     
  28. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    Apart from the above problems, I have noticed that:
    1/ the waypoint system does not work at all with the AI taking shortcuts through walls or getting stuck at a waypoint
    2/ the navmesh works a bit better but the AI does still go through walls from time to time. And that's with Avoid Obstacle turned ON. In fact, turning it ON or OFF does not modify the behavior of the AI in any way.
    3/ instead of walking in a natural way in the center of a corridor for example, the AI always chooses to walk as close to the walls as possible, making the character look dumb.
    4/ the MecanimMove action of the behavior tree editor just does not work with parameters other than Speed, for example Direction or AngularSpeed. If I try to pass these parameters to the Mecanim Controller, the AI gets all jerky with random rotations.

    So my additional comments are:
    a/ thank god this package is free. I would be pretty pissed off if I had spent even a penny for this.
    b/ Rival Theory claims to be a company doing "advanced AI". Well they may want to focus on a simple AI that just works before thinking about anything "advanced".
    c/ instead of working on a fancy website, they should probably spend more time making their system actually work.
    d/ they should think about releasing their code instead of hiding it. If they did we could at least try to fix some of the problems ourselves.

    Has anyone actually managed to make an AI character which looks even remotely correct with Rain or am I just losing my time trying to use this package?!
     
  29. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello Deckard,

    Thanks for posting.

    Waypoints tell an AI what points it must move through to reach a target location. Without knowing how you're using waypoints, it's difficult to say what problem you're running into.

    Same idea for navgrids. Moving through a wall while navigating using a navgrid is an indication that that wall was not excluded from the navgrid.

    AI always attempt to find the shortest, most efficient path. There is no prebuilt behavior for simulating walking down the center of a corridor. However, it's definitely possible to accomplish this using RAIN.

    MecanimMove sends parameters to the Mecanim state machine, but what that state machine does with them is outside our control. You'd have to see what is being done with those values to determine how to fix the foot-skating and rotation.

    In the meantime, here are some resources you can use in order to better understand RAIN{indie}'s features: We develop and maintain the Wiki, forums, and our awesome community generated tutorials-- it allows users to learn the parts of the system they're less familiar with, without having to go through information they already know (check my signature for the links). We do everything to answer questions, provide feedback, optimizations, code samples, tutorial examples etc. If there is something you're having trouble with, let me know. We can get you on track.

    We took the time to consolidate the best tutorials made with RAIN{indie} and put them into one easy-to-read thread. We also announce when new tutorials are added.

    http://support.rivaltheory.com/forum...and-documents-

    If you're completely new to an AI system, I would suggest starting with Tornado Twins (for movement and animation using FPS Control), CodersExpo (obstacle avoidance, behavior trees, custom actions, and waypoints), and JakeCasper (for a complete beginner's guide). We also have tutorials on how to set up RAIN{indie} with Mecanim characters if you're looking to go down the animation route.

    https://www.youtube.com/watch?v=Pi4t2IRkEL0

    Community member Ryan Meowers put together a 2-part tutorial on how it all works as well. https://www.youtube.com/channel/UCq5QtZoNzrF7ns9Y6TfzLMA

    Within a few hours you will be able to create an AI that paths, animates, chases, jumps, and makes decisions.

    Let me know if this helps.

    We understand that getting started with RAIN can be a complicated process and we're working hard to simplify and improve the experience. If you can send us a project that shows the issues you're having, we'd be happy to take a look and give you more detailed help.

    Let me know what you think! As always, your feedback is taken very seriously.

    Best,
    Jester
     
  30. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    Hello Jester,

    Thanks a lot for coming back to me.

    1/ Waypoints: I have been working as a videogame developer for 17 years. I have designed and directed several AAA console games. Believe me I know how to put a few waypoints in a level. Your system just does not work.

    2/ I have setup the navgrid following your tutorial. The navgrid is displayed correctly when the option is ticked. Nevertheless, the AI goes through the walls (or bumps against them if the collisions are ON)

    3/ What is the point in developing such a system, which is very closed with no source code available, and not implementing the standard behavior of walking down the center of a corridor, the most natural behavior? 99% of the time our AI characters are human and are supposed to walk this way, not slide along the walls. How are we supposed to fix this without any access to the source code?
    In addition, the motion of the AI is very unrealistic when navigating with the navgrid because it follows the grid in straight lines.

    4/Mecanim: that was exactly my point. My setup works perfectly when the character is controlled by the player and when testing it in the Animator but does not when the Speed, Direction and AngularSpeed values are passed by RAIN. So the problem must come from RAIN.

    5/ I have carefully read your documentation and the Wiki. I have watched your tutorials. I have also followed the tutorial from Ryan Meowers. In the end, as I explained, the waypoint navigation just doesn't work and the navmesh navigation has problems too. Besides, Ryan Meowers is facing the same problem as me with the character's rotation being jerky. So he removes the Direction parameter and only passes the Speed to Mecanim. It works. But it does not look good. Ryan Meowers also adds that he cannot get the obstacle avoidance to work so he ends up turning it off and removing the collider. Haven't you guys watched this tutorial?

    6/ I have tested the demo of FPS Control. It does not work. It is very very low quality. There is nothing interesting there.

    7/ RAIN is not complicated. It does not work.

    8/ Just to let you know. I have just added a Unity builtin navigation mesh to my test level (the exact same level in which I am testing RAIN). I have quickly written a c# script to control the AI character. And in 2mn I have an AI character with pathfinding working like a charm...

    9/ I was indeed hoping to quickly create an "advanced" AI, as stated on your website. But how could I do that when the pathfinding is not working at all, the obstacle avoidance is not working at all, the character is all jerky and unnatural and there is absolutely no way to even understand what's wrong because the source code is unavailable.

    What I would suggest, (apart from fixing things like the character sliding along the walls, the Direction and AngularSpeed parameters not working, the footskating, etc), is to create a real game example combining all the features of RAIN + Mecanim and with a realistic character like the bootcamp demo soldier (not a robot or a cartoon character).
     
  31. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    Hello Jester,

    Thanks a lot for coming back to me.

    1/ Waypoints: I have been working as a videogame developer for 17 years. I have designed and directed several AAA console games. Believe me I know how to put a few waypoints in a level. Your system just does not work.

    2/ I have setup the navgrid following your tutorial. The navgrid is displayed correctly when the option is ticked. Nevertheless, the AI goes through the walls from time to time (or bumps against them if the collisions are ON).

    3/ What is the point in developing such a system, which is very closed with no source code available, and not implementing the standard behavior of walking down the center of a corridor, the most natural behavior? 99% of the time our AI characters are human and are supposed to walk this way, not slide along the walls. How are we supposed to fix this without any access to the source code?
    In addition, the motion of the AI is very unrealistic when navigating with the navgrid because it follows the grid in straight lines.

    4/Mecanim: that was exactly my point. My setup works perfectly when the character is controlled by the player and when testing it in the Animator but does not when the Speed, Direction and AngularSpeed values are passed by RAIN. So the problem must come from RAIN.

    5/ I have carefully read your documentation and the Wiki. I have watched your tutorials. I have also followed the tutorial from Ryan Meowers. In the end, as I explained, the waypoint navigation just doesn't work and the navmesh navigation has problems too. Besides, Ryan Meowers is facing the same problem as me with the character's rotation being jerky. So he removes the Direction parameter and only passes the Speed to Mecanim. It works. But it does not look good. Ryan Meowers also adds that he cannot get the obstacle avoidance to work so he ends up turning it off and removing the collider. Haven't you guys watched this tutorial?

    6/ I have tested the demo of FPS Control. It does not work. It is very very low quality. There is nothing interesting there.

    7/ RAIN is not complicated. It does not work.

    8/ Just to let you know. I have just added a Unity builtin navigation mesh to my test level (the exact same level in which I am testing RAIN). I have quickly written a c# script to control the AI character. And in 2mn I have an AI character with pathfinding working like a charm...

    9/ I was indeed hoping to quickly create an "advanced" AI, as stated on your website. But how could I do that when the pathfinding is not working at all, the obstacle avoidance is not working at all, the character is all jerky and unnatural and there is absolutely no way to even understand what's wrong because the source code is unavailable.

    What I would suggest, (apart from fixing things like the character sliding along the walls, the Direction and AngularSpeed parameters not working, the footskating, etc), is to create a real game example combining all the features of RAIN + Mecanim and with a realistic character like the bootcamp demo soldier (not a robot or a cartoon character).
     
  32. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    Deckard - As a general response to your post, it would certainly be helpful for you to provide specifics in the cases where you make broad criticisms. For example, saying that Waypoints don't work isn't helpful. Clearly we've designed the waypoint system to solve a certain set of problems. If they aren't working for you, then it would be helpful to understand what type of problem you are trying to solve and how you are trying to solve it. It is very difficult to provide useful feedback when the comment says "it doesn't work." This is also the reason we often request test projects or samples from users - so that we can see specifically what you are trying to do and recommend a way to do it with RAIN.

    I'll also mention that RAIN is and will continue to be a work in progress. That means we provide regular updates and upgrades to both fix bugs and to provide new features. Constructive comments usually make their way into future builds.

    Finally, I'll mention that we don't intend to release the source code for RAIN. If that's an absolute requirement, then we suggest users try a few of the other nice packages on the Asset Store or write their own.

    Answers to other questions and comments are inline below

    Waypoints in RAIN are intended as an alternative to NavGrids for creating pathfinding graphs. They are not currently used as meta information, i.e., not used as additional hints for the pathfinding system in addition to the NavGrid setup. Of course, it is entirely possible to create behavior trees that combine the two. We've posted videos and projects that demonstrate how to do this (FPS Control being one.) Email jester or use our support website if you have trouble finding examples.

    AI that are using NavGrids really don't have the ability to move off the NavGrid. If they are doing so, it means they aren't using NavGrids for pathfinding. Keep in mind that the PathManager must be set to use NavGrids, and the NavGrid file must be set correctly. If either of these fail, the AI will revert to some other method (either waypoints or direct movement)

    The pathfinding system is set up to use shortest paths. As you probably noticed, there is no way to specify features like "corridors" within the system. Combining waypoints and navgrids (again, this requires a little custom code) helps with this.

    The integration between RAIN and Mecanim is pretty straight forward. RAIN has absolutely no control over what happens inside of Mecanim. It doesn't control Mecanim animation speed, turn rates, direction, or anything else. Since Mecanim relies on state machines built by users, each of which could operate in a unique way, RAIN can't exert direct control. Instead, the RAIN movement system calculates movement independently of Mecanim, then feeds data like speed, direction, and angular speed into Mecanim so that your custom state machine can deal with them as you wish.

    The most common issue we've seen with Mecanim has to do with root motion animations that change the root transform. This is true of the parkour character that is shipped in the Unity demos. Whenever the character leans into a turn, it actually moves and rotates its transform. Then when RAIN checks the current position and direction, it tries to adjust accordingly. This often causes a movement in the opposite direction, which removes the lean and causes the transform to swap back again. The result is a non-working setup with terrible jitter. Again, this isn't something RAIN can solve out of the box, but instead requires the developer to step in and deal with it. At the moment, our best recommendation is "don't use models that do that". Why? Because those models are rigged for human control and don't make sense for AI control. Better to use a model that is rigged for AI.

    As explained in (4) above - this is really a problem with the model not being easily compatible with AI control.


    We continue to improve the work done in FPS control. The setup was not intended to be a fully functional FPS enemy, but instead a simple demonstration of how to rig and add behavior using RAIN. The creation of a full character with behavior is intentionally left to the user (that's the whole intent of the FPS Control package.)

    If the version of FPS Control you used "does not work", it may be that you tested against an older build. There were builds that were released with AI problems. We've worked with Tornado Twins to correct the issues, and the latest build should demonstrate much of the functionality you are looking for.

    RAIN is built to be modular. We currently support swapping out our pathfinding setup with Unity's pathfinding and movement. Contact jester or hit our support site for examples.

    Based on your previous comments, I'd suggest that you switch to Unity pathfinding, but continue to experiment with RAIN Behavior trees and Sensors as a framework for your AI behavior.

    We'll certainly be working on additional examples and sample projects in the coming months. We'll also be releasing details soon of our Fall release, which will be a huge upgrade to many of the RAIN features. I'll be interested in your feedback. And, of course, as you are able to help us discover and resolve issues, we'll be able to deliver a package that really meets your needs.

    Thanks

    -prime
     
  33. deckard

    deckard

    Joined:
    Sep 15, 2009
    Posts:
    158
    Hi Prime,

    Thanks a lot for your detailed reply. I indeed made "broad criticism" because Rival Theory claims to provide "advanced" AI. But the truth is the features of RAIN Indie in fact are from an ancient era. On "Cold Fear" for example, we had a dynamic navigation mesh which was taking into account the real-time modifications of the environment (moving objects), the local dangers (for example a grenade), etc. There is nothing like this in RAIN. As I said, even the navigation algorithm is very ancient and the AI behavior is very unrealistic.

    An "advanced" AI should include current standard features like squad behavior, dynamic navmesh/navgraphs, a (even basic) cover system, etc.

    That's not mentioning more advanced AI like the AI of the HALO series. There are plenty of whitepapers describing the AI of these games.

    In the end, not only are the features of RAIN ancient, but they simply do not even work. This is very very disappointing, especially considering how the system is described on Rival Theory's website.

    I have checked all the AI packages on the Asset Store and none of them seems to be anywhere near functional for developing an actual game. Besides most of the AI packages on the Asset Store do not even offer to test a playable demo. I never purchase anything on the Asset Store unless I can verify it with a playable demo. So indeed RAIN Indie is better than those packages but not anywhere near usable for an actual production.

    1/ Regarding Waypoints: I know that they are an alternative way to do the pathfinding. This technic is very old. In fact, the last time I used it was when I was directing "Alone in the Dark: The New Nightmare" in 2000. Although adding the waypoints with RAIN Indie is uneasy (we had come up with a much more userfriendly way to add them to the game level on Alone in the Dark), I was planning to use them on my game for performance/memory reasons. But as I explained, they just don't work: the AI keeps taking shorcuts and going through walls or getting stuck at a waypoint for no reason.

    I have tried the very latest demo of FPS Control and the pathfinding just does not work: the AI often gets stuck and does not follow the player.

    2/ I have setup the Navgrid correctly. But as I explained the AI behavior is unrealistic in many ways. When the AI gets too close to a wall, it does move off the navgrid just a bit. But that's enough to disable the pathfinding.

    3/ I understand that the AI is programmed to take the shortest path. That was the standard behavior 20 years ago. Since then videogames have evolved and the current standard AI behavior is much more realistic. Having the AI going through the center of each edge of the navmesh is standard nowadays.

    4/ I have tested RAIN with the locomotion Animator from the Unity Mecanim example and also with the robot of the Mecanim/Ryan Meowers tutorials. In both cases, feeding Direction and Angular Speed does not work with RAIN. I have now dropped RAIN because I did not want to lose any more time with this package and I am using Unity's built in navmeshagent with my own code and the locomotion Animator and everything works perfectly.

    So now I am using Unity's builtin navigation system with my own AI code. And since yesterday I have developped a pretty nice cover system. I will also probably use one of the visual FSM editors available on the AssetStore for the behavior trees. Implementing a Sensor system similar to the one in RAIN shall be very quick as well. The next step will be the squad behavior and some of the main features described in the whitepapers about the AI of HALO.

    You keep saying that the solution would be to customize RAIN and make it work but:
    1/ the whole point of using such a package is not having to modify the existing behavior/code to make the system work but, on the contrary, to rely on a robust system and to focus on gameplay and on more advanced features. Eventually, it was a lot quicker to develop my own system than to try and fix RAIN.
    2/ Rival Theory does not supply the source code of RAIN. How are we supposed to debug it and customize it??!! I have had to fix or modify every package that I have purchased on the Asset Store, be it systems, shaders or tools. Why would Rival Theory not disclose the source code of RAIN? The only package I have which code is not accessible is Color3Grading. But this package works perfectly and is not meant for customization.
     
  34. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello Precizion,

    Thanks for the post and drawing out attention to this.

    After a few tests, it looks like Unity uses terrain colliders for it's terrain trees, which isn't going to work with RAIN's obstacle avoidance. We have a solution for you but it will require a few updates to RAIN. We'll have something to give out soon.

    Thanks again!

    Best,
    Jester
     
  35. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    Hello Jester/Prime

    does local Obstacle Avoidance work with Mecanim?

    I've been messing with this all day and i cant figure out why it doesn't work.

    I followed your brilliant tutorial on rain with mecanim but I cant figure out why Obstacle Avoidance wont work.

    It would be a shame if I didn't use this software because it doesnt support this feature.

    I'm making an RTS so it needs Obstacle Avoidance.

    I really like this software.

    You should make a few more videos prime, I think you're really good at it, very clear and easy to listen too. I know theres a few community tutorials but although they are trying to help, i find them difficult to listen to due to the stuttering and all the arhhmss armm armm arhhh armmm sorry this drives me mad. I think 60% of these tutorials are armmss.

    Please Mr prime make more videos... If i manage to learn a fair amount I will make some good tutorials without the arhhmmmmss and the mess

    Thank you
     
    Last edited: Jul 11, 2013
  36. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368

    Hello Alex, thanks for posting! It sounds like you may want to increase the CloseEnoughDistance of your AI's PathManager. Make it large enough to account for the inaccuracy that the movement animations create.

    RAIN provides another node for sending variables to a Mecanim state machine called MecanimParameter. You could also use a custom action to send imput. Is that what you're looking to do?

    Yes, failing a precondition will cause the node to return FAILURE from Start(). Execute() will not be called.

    PathManager.AvoidRadius determines the distance an AI will strive to stay away from an obstacle while the radius of the SphereCollider of the Obstacle Avoidance Collider determines the area within which the AI will check for obstacles. They do not have to be the same.

    Let me know how this helps.

    Best,
    Jester
     
  37. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello Disastorm,

    Thanks for posting! If you're doing it from within Update, you won't be able to set the position of the object directly since RAIN overrides it with the agent.Kinematic.Position. Set that instead and you will be able to directly move the AI.

    Let me know if you have more questions.

    Best,
    Jester
     
  38. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Hello MoHoe,

    Thanks for posting!

    Generally the two have little to do with one another. RAIN's obstacle avoidance relies on detecting gameobjects and modifying the path to avoid them.

    Check out the Obstacle Avoidance Demo on our website to see learn more about it:
    http://support.rivaltheory.com/sampleprojects

    Another common solution is to make sure your agent's radius is large enough to detect the objects.

    Let me know if this helps! As always, let me know if you have any questions. I look forward to getting you on the right track so you can make tutorials of your own (without all the arhhmss armm armm arhhh armmm lol).

    Best,
    Jester
     
  39. BuildABurgerBurg

    BuildABurgerBurg

    Joined:
    Nov 5, 2012
    Posts:
    566
    Thanks Jester :)

    I have been messing with the downloaded demo all day and although it works in the demo is doesn't work with my mecanim setup.
    I've gone through it again and again.. I've used the same assets in your tutorial, and yes i've changed the agent's radius size too.

    Any suggestions would be great. Could you try it with your teddy tutorial and see for yourself?

    Thanks for your time :)
     
  40. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    RAIN{indie} Features: Graph Modifier


    Hello Unity,

    Here's a RAIN{indie} feature showcase.

    The Graph Modifier feature in RAIN{indie} allows you to adjust the navigation graph at runtime without having to re-compute the nav grid using recast. Common uses are for doors that open/close or static items that appear and disappear like treasure chests or crates.



    Enjoy!

    Jester
     
  41. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    Try grabbing the latest obstacle avoidance demo from here:
    http://support.rivaltheory.com/rainindie/sampleprojects/ObstacleAvoidance_Unity4_1.3.4_13.zip

    Then swap your pathmanager with the custom path manager provided. Avoidance works better with that one.

    It still isn't a perfect solution, in that some additional work needs to be done to get the Mecanim parameters passed through correctly and to deal with the AI rotation, but it's a start.

    The MecanimMove node generates the turn angle passed to Mecanim by looking at the AI actionContext variable Path.PathConstants.PATHMOVETARGET as in:

    agent.actionContext.GetContextItem<Kinematic>(Path.PathConstants.PATHMOVETARGET);

    which you could reset to a point determined by your avoidance heading. Aside from that, you can edit the custom path manager Avoid override to calculate a better angular velocity (and thereby fix the rotation of the AI), which would be set as

    agent.Kinematic.SetAngularVelocity(new Vector3(0f, calculatedAngularVelocity, 0f);

    where calculatedAngularVelocity would be a delta between the current orientation and the new heading.

    Hope that helps.
     
  42. XilenceX

    XilenceX

    Joined:
    Jun 16, 2013
    Posts:
    122
    I have the problem that my AI enemies are not avoiding eachother properly as well. So I tried copying the custom PM script to my prototype project. Sadly I get this fatal error when it is imported:
    Here is a screenshot of 2 intersecting Golems with my settings for the Pathmanager. Let me know if I am doing something wrong with that...
    $GlitchyGolems.jpg
    When I doubled the Pathfinding steps from 100 to 200 it seemed to improve the situation quite a bit. However I presume that is quite bad for performance? I can't really test performance on my working machine as it has a i7-4770 :p , but I'll try on my old laptop tomorrow.

    Either way I am not really satisfied with how the AI is working for the Golems yet. This way I could only have like 3 of them attacking the player at any time without one of them not reaching the player/screwing up. That isn't enough, even though the Golems are the largest melee-range attackers in my game.
     
  43. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    It is very hard to debug a large Behavior Tree that is not allowed to set break point, is it possible to only disclose the source code of the action node (i.e. Action under RAIN.Primitives ) in the release package?
     
  44. XilenceX

    XilenceX

    Joined:
    Jun 16, 2013
    Posts:
    122
    I was able to fix both problems I had earlier. For the avoidance to work correctly I had to add a character controler first and THEN add the RAIN AI scripts. I did it the other way arround for some of the golems, so that's what caused the issues.

    I was able to use the custom PM script after updating RAIN to the latest version... I simply forgot to do that. :oops:
    Sadly the active obstacle avoidance has created another big issue for me:
    The golems queue up infront of the player instead of walking arround eachother and reaching him.
    $golems stuck.jpg
    I have experimented with all the available variables, but if I have 3 or more golems trying to attack the player at once it seems inevitable that one gets stuck eventually. Is there any way to unstuck AI actors after they haven't gotten noticeably closer to their target after x ammount of time?

    If there are some variables that I can increase to avoid the AI getting stuck I'd be happy to do so as I don't have any performance problems with the AI.
    I tested with 200 path calculations and 60 avoidance smoothing (which is double the default) and there was no difference in FPS. Sadly it didn't seem to help much with the Ai getting stuck either. ;( The only thing that really helped some was increasing the skin thickness of their character controlers, but obviously they start to intersect more as well then... so that's not really a solution.
     
  45. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    Here's a potential solution for your golems queuing up:
    http://support.rivaltheory.com/rain...tation:samplecode:ailogic:attackharness:start

    Avoidance smoothing is essentially a weighting that determines how long the AI "remembers" its prior velocity. New velocities are interpolated with avoidance velocities to create a smoother in/out effect.

    Make sure you are using the latest version of RAIN{indie}, currently only available from the Rival Theory website. (Asset Store version is still going through the approval process).
     
  46. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    I'm afraid it isn't possible. We do post the source for the primitives on our website, so if you are very stuck you could create a custom node using that code, then drop into it with the debugger. I suspect that's overkill though. Setting the debug flag on nodes gives you a pretty good indication of what's going on (although admittedly not as good as dropping into code.)

    http://support.rivaltheory.com/rainindie/wiki/doku.php?id=behavior:behaviortrees:nodes:start


    Our Fall Release of RAIN includes debug support within the editor.
     
  47. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Look great, hope that Behavior Tree get more and more powerful.
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I'm using the waypoint system for my AI to follow a pretty basic path. I have setup a series of sensors that when reached the AI will perform tasks such as play a blacksmith animation.

    I have everything working, but when the AI goes to play the hammer animation from the move event it cuts straight into it ignoring the fade in and out numbers.

    I have a tree setup as root>Detect (which consist of Detect and Move)>Work (consisting of Animation) this is where the hammer animation plays but doesn't fade in or out.

    Do you know what could be causing this and is there a solution?

    Also, I'm implementing my day and night weather system into RAIN Indie. It will be used to have AI work during the day then walk home and sleep at night. How can I have my AI change trees or events based on a custom script that isn't RAIN related? Am I able to grab variables from outside scripts within a tree or do I have to use a custom RAIN script?

    Update: Also RAIN Indie seems to be making my AI's animations jagged and not smooth. I'm using a simple Detect and Move tree so what could the problem be? It's really noticeable so I'd like to find a fix. The character uses the Legacy animation system in Unity.
     
    Last edited: Jul 24, 2013
  49. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    Can you send us your behavior tree file so we can take a look?

    RAIN{Indie} takes a fairly simple approach to animation. We've upgraded that in our upcoming release, but for now we may be able to spot a few issues in the BT and get rid of the animation jitter.
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    If you guys could get this working for me that'd be great. I have a demo video I'm working on for UniStorm.

    Here's the BT:

    Of just xml file: Sweeper AI

     
    Last edited: Jul 24, 2013