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

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Is Rain{Indie} work for mobile device ( iOS )?
     
  2. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    yuewahchan,

    Thanks for the post! Yes, RAIN{indie} supports all platforms that Unity3D currently supports. Here is a list of the full features of RAIN{indie} http://rivaltheory.com/rainindie/

    Let me know if you need anything else.

    Best,
    Jester
     
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    This is an awesome free tool, but we have a problem.

    We created a wave system spawning enemies using your AI system. When we get about 6 to 8 enemies in the game we encounter a lot of lag, anywhere from 2 to 15 fps, when it was a solid 70 fps prior. We have a relatively small behavior tree that consists of Find, Aim, then Shoot. The lag seems to only happen with the Find behavior. We have followed some tutorials from YouTube and have set thing up properly. This Find behavior uses the detect action. So, what could be causing the lag?
     
  4. RT_Jester

    RT_Jester

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

    Thank you for the post. It's difficult to know what is causing performance issues without more details.

    Could you send us a sample project or perhaps a behavior tree?

    Best,
    Jester
     
  5. zeeawk

    zeeawk

    Joined:
    Sep 12, 2012
    Posts:
    67
    Doesn't sound like something is right too me. I had about 60 Zombies running around using Detect and then Move. I had around 70 fps or so.
    When you say "Find behavior" are you talking about Detect ?
     
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Actually, after looking through everything I seemed to figure out what was causing it. It was the Max size on the Expanding Box Sensor. I set it high, around 150x10x150 because the enemies would spawn and run in place. They don't detect the player if it's not set higher. How can I get the enemies to detect the player without turning up the Expanding Box Sensor?
     
  7. HH_Gorgon

    HH_Gorgon

    Joined:
    Nov 8, 2012
    Posts:
    8
    This is great information. I'd really like to see this as a default option for the move command, since it is so common when using it for movement to AI targets that have any sort of visual depth or collision.
     
  8. RT_Jester

    RT_Jester

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

    Thank you for bringing it to our attention. Please continue to use kinematic controllers since there is no need for the extra overhead of character controllers. We've noticed there can still be issues with kinematic controllers and we're hoping to have a fix in for it with the next version of RAIN{indie}.

    Thanks again!

    Best,
    Jester
     
  9. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    BHS,

    First, make sure you're using kinematic controllers instead of character controllers. That should greatly improve performance. Next, create layers for sensors and aspects and have them collide only with each other. That way you'll eliminate a lot of unnecessary collision checks.

    Let me know if this helps!

    Best,
    Jester
     
  10. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    I am trying the 1.3.4 beta for "Mecanim Move" and using my custom Path Finding. I override Move (Agent agent, float deltaTime) function and apply the velocity and rotation to agent.Kinematic, but don't know how to apply Direction. In the Locomotion Animator state machine window, I see the Parameters of Speed, AngularSpeed is set, but Direction is not set in runtime.
     
  11. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    The MecanimMove behavior tree node will set parameters for Speed, Angular Speed, Turn angle, Velocity, and Angular Velocity. It does this after movement has been processed through the path manager, but before it has been applied by your movement controller.

    The Parameters you see in our example project (Speed, AngularSpeed, Direction) are Mecanim state machine parameters that match our Speed, Angular Speed, and Turn Angle.

    Since you are setting velocity and rotation within the agent.Kinematic, RAIN will take care of the rest for you automatically. You don't set "Direction" at run time - instead RAIN calculates Turn Angle and can pass it through to the Mecanim "Direction" variable.
     
  12. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    I am using my custom path manager, not movement controller. I can not see the Mecanim receive the Direction at runtime
     
  13. RT_Jester

    RT_Jester

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

    We have great announcement!

    RAIN{indie} v1.3.4 (with Mecanim integration) is now available directly from Rival Theory. To get a headstart on development we updated our support site with a few new sample projects you can use to follow along in these video tutorials. Get the sample projects here.

    RAIN{indie} Movement + Mecanim Animation Tutorial


    RAIN{indie} + Mecanim IK Tutorial


    Let us know if you have any questions!

    -Rival Theory
     
    Last edited: May 17, 2013
  14. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    I am using my custom path manager, not movement controller. I can not see the Mecanim receive the Direction at runtime

    Code (csharp):
    1. public class MyPathManager : RAIN.Path.PathManager {
    2.    
    3.     private MyAIPath aiPath;
    4.    
    5.     public void Awake()
    6.     {
    7.         aiPath = GetComponent<MyAIPath>();
    8.     }
    9.    
    10.     public override bool Move (Agent agent, float deltaTime)
    11.     {
    12.         bool targetReached = false;
    13.  
    14.         aiPath.targetPosition = agent.MoveTarget.VectorTarget;
    15.        
    16.         agent.Kinematic.SetVelocity( aiPath.LinearVelocity, aiPath.AngularVelocity );
    17.  
    18.         ....
    19.     }
    20.  
     
  15. Proportion1

    Proportion1

    Joined:
    Jan 6, 2013
    Posts:
    35
    is there any plans for mesh transitions, eg up and down platforms similar to unity navmesh's off mesh links?
     
  16. RT_Jester

    RT_Jester

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

    Thanks for the question. We sent you this same answer directly to your email.

    RAIN{indie} does not currently support AI moving (jumping) up and down platforms. We do have planned support for this and similar features in an upcoming version of RAIN (also free). If off-mesh links are important to your pathfinding system in the near term, we suggest that you go ahead and use Unity's built in Navmesh system (or one of the other good plugins) for pathfinding and movement. RAIN may still be used for top level control, behavior, and sensors. If your project has a longer time horizon and you would prefer to wait for the new RAIN product, just let us know and we'll keep you posted on our timelines, features, etc.

    Let me know if this helps!

    Best,
    Jester
     
  17. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    @yuewahchan; Direction (actually, Turn Angle) is calculated to be the difference between the AI's current y orientation and the angle of its forward velocity. I can't see enough of your code to tell how you are calculating either. Is your Mecanim Direction parameter not being set, or is it being set to 0 or some other unwanted value?
     
  18. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    aiPath is my custom pathfinding library, when aiPath.targetPosition is set, aiPath.LinearVelocity, aiPath.AngularVelocity and aiPath.Direction will call be calculated, but I can only set LinearVelocity, AngularVelocity using agent.Kinematic.SetVelocity() to the Mecanim, but not the Direction.
     
  19. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    @yuewahchan: I'm not sure what you are asking. RAIN doesn't have a Direction parameter, field or variable. Neither does Mecanim.

    If you are referring to the sample project, then see my prior answer. RAIN calculates a Turn Angle, which is what the sample project expects in its Direction state machine parameter. The Turn Angle is calculated and set using our Mecanim Move behavior tree node. In the sample project, this is assigned to the Direction parameter.

    Since Turn Angle is calculated from current transform.rotation.y and agent.Kinematic.Velocity, you will not be able to set the Turn Angle/Direction directly. As long as your code is setting linear and angular velocity correctly, everything else should just work.
     
  20. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    @prime, It just doesn't work, can I sent you a modified sample project with simple test case ( custom pathfinding ) ?
     
  21. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Yes,

    Send it to jester [at] Rivaltheory [dot] com

    We look forward to seeing it!

    Best,
    Jester
     
  22. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    sent, please check it out
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    I've continued to use Rain Indie and am unable to get decent AI working. My characters run into things and don't pick new paths when they get stuck (using Nav Grid and waypoints). I also have a lot of lag when I get 4+ enemies in a scene. I think part of this is caused by the enemies running into each other. I've checked through every component and cannot find out how to have enemies ignore each other. I know it's most likely something I'm doing wrong, but there's just not enough tutorials for me to get a working behavior script.

    I've looked at several examples and have to piece together what you guys have done. Most examples require custom actions and it's hard to try to implement it into my enemies.

    Is there anyway you guys can supply a simple AI example and post it here? I know you guys have the mouse and the pathfinding soldier, but those are too specific. Could you make a zombie like example or something for first person? Something simple where an enemy has to detect, chase, and attack a player.

    I appreciate the great work you guys have done with this awesome free product. I would just like to use it to its full potential.
     
  24. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Yuewahchan,

    Thanks for sending it over. We received it and will be taking a look at it! Thanks again!

    Best,
    Jester
     
  25. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    BHS,

    Thank you for posting this and your support of RAIN{indie}. We have a few resources for you.

    In this thread (also located in my signature) http://support.rivaltheory.com/forums#/discussion/390/community-generated-tutorials-and-documents- we have user-generated tutorials. CodersExpo has made a 3 part series that outlines how to use custom code to achieve the goals you're describing.

    If you want the most up-to-date news and video posts follow us on Facebook and Twitter. We post there first when we have new announcements.

    Let me know if this helps! Be sure to give CodersExpo a shout-out!

    Best,
    Jester
     
  26. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    Any idea when the Asset Store version will be updated with Mecanim support?
     
  27. RT_Jester

    RT_Jester

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

    Thanks for posting this. We are going to try to get a new version of RAIN{indie} (v1.3.4) to the asset store today. Look for it to be approved early next week.

    Thanks again!
    Best,
    Jester
     
  28. RT_Jester

    RT_Jester

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

    With the help of Yuewahchan we have identified an issue.

    When using a custom path manager and RAIN{indie}, Mecanim does not receive the Direction at runtime.

    The Mecanim Move node is using a path variable in the AI's action context to help determine the Turn Angle. Looks like this:

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

    This is probably something we'll change in a future version. It was an oversight to leave a hidden variable in there, but for now the workaround is to

    agent.actionContext.SetContextItem<Kinematic>Path.PathConstants.PATHMOVETARGET, new Kinematic(value));

    where "value" is a Kinematic whose Position is set to the current move target.

    Let me know if this helps! Thanks again Yuewahchan! If anyone has any other issues please let us know. It helps us make RAIN{indie} the best product it can be.

    Best,
    Jester
     
  29. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Using Rain {indie} - Custom Actions and Parallel nodes

    Hashbang Games (the makers of Gravi) show off how to create ranged and melee AI with RAIN{indie}.



    Thanks guys, great job!

    Best,
    Jester
     
  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,764
    Thanks for the help. We'll take a look at these.
     
  31. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    Code (csharp):
    1.         Kinematic k = new Kinematic();
    2.         k.SetVelocity( aiPath.LinearVelocity, aiPath.AngularVelocity );
    3.        
    4.         agent.actionContext.SetContextItem<Kinematic>( PathConstants.PATHMOVETARGET, k );
    It only assign to Direction, but not Speed and AngularVelocity this time.
     
  32. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
  33. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Yuewahchan.

    Thanks for sending that over. We will take a look at it and let you know what we think!

    Best,
    Jester
     
  34. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Yuewahchan,

    The sample project looks great! This is a perfect example of why we wanted to be RAIN so extensible. Are there any specific questions you have about making your own pathmanager?

    Let me know what you think!

    Best,
    Jester
     
  35. yuewahchan

    yuewahchan

    Joined:
    Jul 2, 2012
    Posts:
    309
    @jester, the workaround of "agent.actionContext.SetContextItem<Kinematic>Path. PathConstants.PATHMOVETARGET, new Kinematic(value));" is not work as expected. [FONT=Tahoma, Calibri, Verdana, Geneva, sans-serif][/FONT]
     
  36. Prime

    Prime

    Joined:
    Jul 22, 2011
    Posts:
    39
    The PATHMOVETARGET should be set to the path waypoint you are currently moving toward. Your example sets it to a Kinematic with no position (defaults to 0,0,0). You will want to set k.Position = [your next waypoint], then use it to set the PATHMOVETARGET.

    Also, your prior code for movement was fine - i.e., you should just call agent.Kinematic.SetVelocity(aiPath.LinearVelocity, aiPath.AngularVelocity)
     
  37. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Yuewahchan,

    We've modified your project to set the Direction. It should be in your inbox. Please look at the Move() function of your custom pathmanager. Speed, AngularSpeed, and Direction are now all being set in Mecanim properly.

    Let us know how what you think!

    Best,
    Jester
     
  38. iHavo

    iHavo

    Joined:
    Oct 7, 2012
    Posts:
    10
    Okay... This is EXTREMELY annoying. So, I followed every step in this tutorial, and the behavior tree doesn't work. I can get here: $RAINDoesntWork.png
    And then I can't press 'ok'. Can you help me? I'm working with a project, and it's either I use RAIN or I have to make my own version of it... and I'd much rather use this.
     
  39. RT_Jester

    RT_Jester

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

    Thanks for posting! What tutorial are you following and what version of RAIN{indie} are you using?

    I look forward to hearing from you.

    Best,
    Jester
     
  40. iHavo

    iHavo

    Joined:
    Oct 7, 2012
    Posts:
    10
    Woops! Sorry, my bad! I moved the 'Editor' folder, and it couldnt find the right components for the job... Thanks for the great system, and sorry for the confusion!
     
  41. RT_Jester

    RT_Jester

    Joined:
    Jul 21, 2011
    Posts:
    368
    Bgriley2,

    No problem! I'm glad it was resolved. Let me know if you need anything else. We're here to help. :)

    Best,
    Jester
     
  42. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I'm using the Mecanim animations from the sample along with a simple chase the player behavior tree using the Mecanim Move node. When I run around in circles, the angular velocity of the AI changes very quickly, which causes the animation to jitter badly (the sample animation is a blend tree that makes the character lean to one side based on angular velocity). What's the best way to deal with this? I tried messing with the Damp Time value but if I make it higher than .4 or so, it removes the jitter but then the animations lag too much, like walking in place after the character has come to a stop. I feel like it could be solved by reducing the rate at which the Mecanim Move node updates the Angular Velocity value, but I'm not sure how to do that without also stopping it from regularly updating the speed or whether this would actually solve anything. Any advice on how to deal with this?
     
    Last edited: Jun 3, 2013
  43. skalev

    skalev

    Joined:
    Feb 16, 2012
    Posts:
    264
    Hi Guys.

    First of all thank you for putting so much work into an awesome package. I'm very happy to have found this and will be using it to drive the AI for our game, and am very excited about that.

    I have been trying to create a good recast mesh for one of our levels, but it seems that there are some problems with setting un-walkable tags. a few of my objects get set properly, and others don't.

    This might be related to the hierarchical structure, I have props sitting on top of the floor. all props are marked unwalkable. however the floor underneath it is still marked as walkable (since those are just prefabed floor tiles). I would expect everything covered by props, and the props themselves to all be obstacles basically, yet this isn't the case. Some are correctly marked, but some get added into the mesh. I've set the cell sizes as small as possible, but that still doesn't resolve the issue.

    Is there something i'm missing?

    also, @yuewahchan - can you give an example or a brief description on how do you work with a* and rain combined? i'm interested in doing that as well.
     
  44. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    I'm kind of new to the concept of behavior trees and I'm having some trouble grasping the flow in certain situations. If I've got a node that stays in the "Running" state for a long time, like a Move between two waypoints, but I want it to be able to break out of that when something happens, like getting shot or seeing the player, what is the best way to handle that? I can't just have detect nodes or condition nodes further up in the tree because those will just keep getting skipped as long as the Running node is running. Do I need to have a precondition on the parent node for walking between waypoints? And what exactly gets returned when a node is skipped due to not passing its precondition? Like if I have a sequence node that's currently in "Running", and when it gets to there, its child running node is no longer passing its precondition, what is the return result of the parent node? It doesn't seem to be either Success or Failure so I'm not sure what happens.
     
  45. RT_Jester

    RT_Jester

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

    Thanks for posting! You can use preconditions to break execution of a running node.

    You can also use parallel nodes to get this behavior. Place both the move node and your detect node inside the parallel. Set the detect node to repeat until success and the parallel to succeed any. that will cause execution to exit the parallel, and the move node, when the player is detected.

    Let me know if this helps. You can also check out more information on BTs on our wiki http://support.rivaltheory.com/rainindie/wiki/doku.php?id=behavior:behaviortrees:nodes:start

    Best,
    Jester
     
  46. RT_Jester

    RT_Jester

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

    What model are you using? Is it the one of the parkour guys that Unity distributes?

    Talk to you soon.

    Best,
    Jester
     
  47. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,350
    The animations and animation controller are from the teddy bear in the Mecanim/RAIN demo from your site (so yes, they're Unity's parkour guy). But the model I was using is one of my own. I don't think it has anything to do with the model in particular; when looking at the animation controller at runtime, I can see it flashing between "Run", "Run Wide Right", "Run Sharp Right" really quickly (like 30 times per second) because the angular velocity value changes so quickly as it tries to follow something moving in front of it. In Unity's demos where you're controlling the character this doesn't happen because the angular velocity is dampened quite a bit and you can't adjust your rotation that quickly; if you try to change it too much, that's where "Direction" takes over and makes the character stop and pivot. But I can't just set the Damp value in RAIN's Mecanim Move really high because the Speed looks terrible when dampened that much; it means that the character will still be playing his running animation for a few seconds when he comes to a stop or his idle animation for a few seconds when he starts to run. I think it would look ok if there were separate Damp values for each Mecanim parameter... speed shouldn't be dampened much at all, but angular velocity should be dampened by quite a bit.
     
  48. RT_Jester

    RT_Jester

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

    The animations from the parkour guys move the root transform out of position and orientation which causes RAIN to fight with the animations to correct the character's alignment. Which is why you see him move around so oddly.

    Can you reproduce it with the teddy bear and its animations?

    We'll look into it further. You can help us by sending us a sample project or tell us how to reproduce it.

    I look forward to hearing from you!

    Best,
    Jester
     
  49. RT_Jester

    RT_Jester

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

    Thanks for posting this. It sounds like you're going about it the right way. Please send us a project that shows the issue and we'll see if we can resolve it. jester@rivaltheory.com


    We look forward to hearing from you.
    Best,
    Jester
     
  50. KalKyl87

    KalKyl87

    Joined:
    Jun 7, 2013
    Posts:
    3
    I'm a huge n00b when it comes to Unity (started yesterday) but here it goes :)

    I've succesfully used Rain to get my AI to detect me and start following me but where do I go from there? How do I execute scripting when he touches me or just detects me?

    For now I'd just be happy being able to write my own Debug.Log when he detects me but I'd also love to know how to succesfully use "GetAllObjectsWithAspect" or similar in my own scripts.

    Right now I only get "An instance of type 'RAIN.Core.Agent' is required to access non static member 'GetAllObjectsWithAspect'." When I try to execute "RAIN.Core.Agent.GetAllObjectsWithAspect()" in a script attached to my AI :(