-
Search Results
-
First I want to congratulate, and thank, the developers for such a great product. I love what you are doing with Squad and Sentio and that you are keeping RAIN free. You guys rocks.
My problem:
I’m working on a game in my free time, and I opted to use RAIN because I needed a tool able to make Navigation Meshes at runtime (maps are generated procedurally). I then made my player controlled character use an AI rig to move, by getting its move variable from a raycast hit.
The complications started when I decided to use a Sensor to detect obstacles (ie. a door equipped with an Entity component). The idea is to make the character stop before a door/obstacle, that’s been put dynamically on the NavMesh, and not keep running on its collider. The NavMesh generation filtrates the layer containing the doors, so that once the door collider is removed (ie. the door opened) the character is able to walk in the next room.I thought the BT like this:
*root [parallel]
-detect (on repeat forever) with player’s sensor and door’s aspect
-selector (on repeat forever)
—-constraint on door variable (== null)
——move to raycast hit point
—-constraint on door variable (!= null)
——-move to character to the player gameobject position (aka stop where you sensed the door)If I click in the area in front of the door, the character moves there, and the door variable gets fired correctly (the second move action is never triggered though)
But if I click in the next room, and there’s a closed door in between, the character go hugs this door’s collider while continuing to try and walk past it…I suspect that I’m using RAIN in a unorthodox manner, and not for what it was thought for, but the NavMesh generation at runtime makes RAIN essential to my project. I do plan on using RAIN also for the AIs of the game’s enemies component, and I would like to integrate it with everything else.
Hope you guys can give me some directions.-
This topic was modified 2 weeks, 4 days ago by
klawd.
Hello,
I learned to build simple BTs that do simple tasks. But now when I tried to use BTs for my AI characters in the project I found difficulty building the BTs that will execute the behavior I wish to have. I have watched tutorials (all are very basic examples), and also read all the RAIN WIKI but still not able to build what I want.
My game is about fire fighting: For instance, I want my AI (Team Leader) to check if the game started or not, once it started, he should query the GameController script about the first situation to handle, once he get this answer, he should send a message to all Firefighters to go to the fire truck, and once they are all inside it, the fire truck should move to the situation, and then he should command them to line up in front of the Truck, and so forth.. querying about the game from the game environment, receive and send information to other AIs and do some actions.
Every other AI should also has its own BT, that controls his actions, receiving messages, doing actions, sensing and sending messages.
I have started with the following BT for the Team Leader, but I it really seems weak and not working as expected (because of not understanding the nodes rules and how the sequence follow from one step to the next).
<behaviortree version="1.1" repeatuntil="" name="FF_TL_BT" debugbreak="False"><sequencer usepriorities="False" repeatuntil="" name="TL_root" debugbreak="False"><constraint repeatuntil="" priority="" name="Game started? and there is at least one situation to handle?" debugbreak="False" constraint="gameStarted == true && numberOfSituations > 0"><constraint repeatuntil="" name="Far from situation?" debugbreak="False" constraint="distanceToSituation > 50"><sequencer usepriorities="False" repeatuntil="" name="sequencer" debugbreak="False"><action repeatuntil="" priority="" parametervalues="" parameters="" namespace="(global)" name="Send Message to FFs to go to FF Truck" debugbreak="False" classname="SendMessageToFFs" /></sequencer><parallel tiebreaker="fail" succeed="all" repeatuntil="" name="parallel" fail="any" debugbreak="False"><move turnspeed="" repeatuntil="" name="Move to my door in fire truck" movetarget="myDoor" movespeed="3" facetarget="myDoor" debugbreak="False" closeenoughdistance="" closeenoughangle="" /><animate repeatuntil="" name="animate" debugbreak="False" animationstate="Locomotion.WalkRun" /></parallel><constraint repeatuntil="" name="constraint" debugbreak="False" constraint="!ffDetector.active"><action repeatuntil="" parametervalues="" parameters="" namespace="(global)" name="Send message to FF Truck to go to currentsituation" debugbreak="True" classname="SendMessageToFFTruck" /></constraint></constraint></constraint></sequencer></behaviortree>
Any help will be appreciated.
Topic: Sensor not working
Hello
I try to finish my AI and setup 2 visual sensors to detect. To my Player I attached a Entity. In BT I wrote the Aspect and the
sensor with quotes but it’s still not working. Also in a constraint happens an error: varHeroNearby != null && myHealth > 0Have you an idea to fix it?
Thank you very much!
Hey I’m making a prototype project to show my client, the behavior of my game characters. I have two characters running towards each other following different patrol routes from opposite direction and I have two visual sensors on each of them, one for detecting from far away and one for detecting in close range. My behavior tree looks like this -
And this BT is working fine..The far detector detects the enemy and moves towards it and when the enemy comes in the range of the close range detector, they start attacking each other..But the problem is that, once they start attacking each other, if I move any of the characters manually, out of range of the detectors, nothing changes. They are supposed to stop attacking and start patrolling again, but instead they just keep attacking thin air even when there nothing inside the sensors range. The form variable of the detect nodes do not become null when I move the characters outside the sensor’s bounds. So the control does not flow out of the ‘Constraint’ node which I use to defines attack animations. Please help! either I’m doing something wrong or the detect is not working properly..
Basically what I am trying to do is I have a NPC who when he sees and enemy he runs away then stops and looks back to see if he is being chased, if he isn’t then he returns to wandering. The problem is that if I have the primary detect set to repeat until success then after he flees he won’t start detecting again because the detect is not repeating now. However if I have it set to repeating forever then as soon as he stops seeing the enemy he instantly forgets as soon as it leaves the visual detector. So ether I need to set it up so that once he is safe it resets the detect so that he starts wandering again or I need to have the detect send the info to a separate var when he sees the enemy and then clear it once he is safe. Is there a way to do this within the UI or do I have to make a script if so where do I start?
EDIT: After toying around more I managed to get it working for those who wish to know how I did it here is the export of the XML file.
<behaviortree version="1.1" repeatuntil="" name="HumanAI" debugbreak="False"> <sequencer usepriorities="False" repeatuntil="" name="root" debugbreak="False"> <parallel tiebreaker="fail" succeed="all" repeatuntil="running" name="parallel" fail="any" debugbreak="False"> <selector usepriorities="False" repeatuntil="running" name="selector" debugbreak="False"> <constraint repeatuntil="" priority="" name="Wander" debugbreak="False" constraint="Enemies == null"> <sequencer usepriorities="False" repeatuntil="" name="sequencer" debugbreak="False"> <parallel tiebreaker="fail" succeed="all" repeatuntil="running" priority="" name="parallel" fail="any" debugbreak="False"> <detect sensor=""Eyes"" repeatuntil="running" name="detect" matchtype="best" entityobjectvariable="Enemies" debugbreak="False" consistent="True" aspectvariable="" aspectobjectvariable="" aspect=""Enemy"" /> <sequencer usepriorities="False" repeatuntil="running" name="sequencer" debugbreak="False"> <action repeatuntil="success" priority="" parametervalues="UmFuZG9tKDQsOCkAdHJ1ZQBIV1A=" parameters="V2FuZGVyRGlzdGFuY2UAU3RheU9uR3JhcGgAV2FuZGVyVGFyZ2V0VmFyaWFibGU=" namespace="" name="action" debugbreak="False" classname="ChooseWanderPosition" /> <move turnspeed="" repeatuntil="" priority="" name="move" movetarget="HWP" movespeed="HSpeed" facetarget="" debugbreak="False" closeenoughdistance="" closeenoughangle="" /> <timer waitforsec="Random(4,8)" returnvalue="success" priority="" name="timer" debugbreak="False" /> </sequencer></parallel></sequencer></constraint> <parallel tiebreaker="fail" succeed="all" repeatuntil="" priority="" name="Check for Enemies" fail="any" debugbreak="False"> <sequencer usepriorities="False" repeatuntil="" name="sequencer" debugbreak="False"> <action repeatuntil="success" priority="" parametervalues="MzIAWm9tYmxlcwB0cnVlAEZQ" parameters="RmxlZURpc3RhbmNlAEZsZWVGcm9tAFN0YXlPbkdyYXBoAEZsZWVUYXJnZXRWYXJpYWJsZQ==" namespace="" name="Run" debugbreak="False" classname="ChooseFleePosition" /> <move turnspeed="" repeatuntil="" priority="" name="Run" movetarget="FP" movespeed="HSpeed" facetarget="" debugbreak="False" closeenoughdistance="" closeenoughangle="" /> <move turnspeed="" repeatuntil="" priority="" name="Check" movetarget="" movespeed="" facetarget="Enemies" debugbreak="False" closeenoughdistance="" closeenoughangle="" /> <move turnspeed="" repeatuntil="" priority="" name="Clear" movetarget="" movespeed="" facetarget="" debugbreak="False" closeenoughdistance="" closeenoughangle="" /> <parallel tiebreaker="fail" succeed="any" repeatuntil="" priority="" name="parallel" fail="all" debugbreak="False"> <timer waitforsec="Random(4.8)" returnvalue="failure" name="timer" debugbreak="False" /> <detect sensor=""Eyes"" repeatuntil="success" name="detect" matchtype="best" entityobjectvariable="Enemies" debugbreak="False" consistent="True" aspectvariable="" aspectobjectvariable="" aspect=""Enemy"" /> </parallel></sequencer></parallel></selector></parallel></constraint></sequencer></behaviortree>
Topic: Constraint Issue
Hi! I’m pretty new to RAIN, in fact I started using it two days ago. I’ve been following tutorials to try to create a simple AI that patrols a Waypoint Route as it starts and whenever the AI sees the player starts to follow him.
The AI has just one sensor called “Visual Sensor” and one variable in the memory called “FPS” related to the FPSController.
The FPSController’s entity has the visual aspect “Player”.The Behaviour Tree for the AI is pretty simple, I’ll try to attach a pic below.
It has a Parallel decision with a Detect option repeating forever, with a Form Variable called “seen”, and a Selector with two constraints. And here’s where I think there’s my issue.The first constraint is for when the AI sees the player (seen != null) and the other one for when it doesn’t (seen == null)
Whenever I run the game and check the Behaviour Tree the “seen != null” constraint just doesn’t work.
I tried not using a constraint for that option by adding a Sequence with the Move action for whenever the other constraint fails, but doesn’t work neither.I thought there might be a problem with constraints but the “seen == null” works, so the other should be working too.
I’ve checked all the variables and I think they’re right.I’ve been searching for answers or similar issues around the forum and in other places, as well as the starter kit given in here but I just can’t figure out why it isn’t working.
Thanks in advance!
Hello! I am working with RAIN, and I am really enjoying it so far. So first off, thanks for all of the great work!
I have searched for a lot of my other issues, but I am running into a bit of a wall on these ones, sorry if they were answered elsewhere.I have a couple questions, so first let me show you my tree:
So here are my questions:
1. The low HP constraint right now is either always on, and blocks the other constraints from triggering, or it has to wait for other constraints to finish. What would a better way to make sure that the low HP stuff always triggers when reached? I need the animal to take off running whenever it’s HP falls below a threshold. (Like even in the middle of it’s patrol)2. The “Restore HP” node is an action that restores the HP over time. It works to restore the HP until it gets enough to fix the constraint, but I want it to continue until the HP is full, but not be blocking. I had it set to repeat until true. I thought the best thing then would be for it to start a coroutine in a script. Is there a better idea, or just go with that?
3. When moving to get back into attack range (setup is similar to the great tutorial vids (#2)), moving just out of range causes some jerky movement. I remeber seeing a post that movement isn’t acceleration based, but I think it was an older post. Is there a way to move just a little bit?
I am sure I have more things, but this is already a wall of text I am sending, sorry!
Thanks a lot!
Hi,
I’m new to RAIN with some programming experience. I am really excited about RAIN but am really struggling to make it work sometimes. I have followed all four tutorials from CodersExpo and gone through the sample project which can be downloaded from the RAIN Tutorial section. I am definitely missing something but have wasted 3 days already trying to make the below bahavior tree work.
Now. For starters the problem that I have is I can’t get RAIN working with basic behaviors like timers for example. Yes…
I have a scene where the AI gets spawned in the corridor then it is heading to a nav target at the entrance of the hall and then it is heading to capture the flag nav target at the center of the hall. When AI gets there it detects the player and fires at him in rounds.
Here my problems start.
After detecting player the behavior tree of the AI should shoot endlessly at the player in rounds, 5 shots each, 1 second btw each shot and one 3 seconds btw each round. In parallel it is rotating to face the player. The AI behavior tree goes like this.
[BT] AI logic
*[SEL] selector
**[CON] AI in the corridor
***[PAR] Move and animate in paraller - this is working. When AI gets to the hall set the inTheHall = true.
**[CON] isInTheHall == true.
***[SEQ] sequencer
****[PAR] Move and animate to the nav target ‘flag’ at the center of the hall. When AI gets there…
****[PAR] paraller
*****[ANIM] Stop
*****[DETECT] Detect player. repeat = forever
*****[SEL] check if aspect visible
******[CON] visible.
*******[B] Behavior tree binding it handles shooting in rounds /* XML of the below at the end of this post */
********[PAR] parallel
*********[ANIM] face target = player aspect
*********[SEQ] sequencer. Fire 5 shots then 3 seconds break.
**********[ITE] count = 5 /* Fire 5 shots */
***********[CUST ACN] custom action to spawn the shot prefab. This has been tested in a separate standalone [BT].
***********[TIMER] shot interval set to 1 second. Return = success This node is being executed endlessly and returns RUNNING
**********[TIMER] round interval set to 3 seconds. Return = success. Tree execution never gets here because of the aboveWHAT AM I DOING WRONG ??? Please help.
Using: UNITY 5.0.0f4 & RAIN 2.1.10.0
The XML of the first [BT] tree for getting to the flag:
<behaviortree version="1.1" repeatuntil="" name="BDLogic" debugbreak="False"><selector usepriorities="False" repeatuntil="" name="selector" debugbreak="False"><constraint repeatuntil="" priority="" name="Not in Hall" debugbreak="False" constraint="!isInTheHall"><parallel tiebreaker="succeed" succeed="any" repeatuntil="" name="parallel" fail="any" debugbreak="False"><move turnspeed="" repeatuntil="" name="Target - Hall Entrance" movetarget="navigationtarget("HallEntrance")" movespeed="3" facetarget="" debugbreak="False" closeenoughdistance="" closeenoughangle="" /><animate repeatuntil="" name="WalkAnim" debugbreak="False" animationstate="" /></parallel><expression returnvalue="evaluate" repeatuntil="" name="isInTheHall = true" expression="isInTheHall = true" debugbreak="False" /> </constraint><constraint repeatuntil="" priority="" name="In the Hall" debugbreak="False" constraint="isInTheHall == true"> <sequencer usepriorities="False" repeatuntil="" name="sequencer" debugbreak="False"><parallel tiebreaker="succeed" succeed="any" repeatuntil="" priority="" name="Take the Flag" fail="all" debugbreak="False"><move turnspeed="" repeatuntil="" name="Target - Flag" movetarget="navigationtarget("Flag")" movespeed="3" facetarget=""Flag"" debugbreak="False" closeenoughdistance="1" closeenoughangle="" /><animate repeatuntil="" name="WalkAnim" debugbreak="False" animationstate="" /> </parallel><parallel tiebreaker="fail" succeed="all" repeatuntil="" priority="" name="parallel" fail="any" debugbreak="False"> <animate repeatuntil="" name="Stop" debugbreak="False" animationstate="" /><detect sensor=""eyes"" repeatuntil="running" name="Detect Trooper" matchtype="best" entityobjectvariable="varCloneTrooper" debugbreak="False" consistent="True" aspectvariable="aspCloneTrooper" aspectobjectvariable="" aspect=""aCloneTrooper"" /><selector usepriorities="False" repeatuntil="" name="selector" debugbreak="False"><constraint repeatuntil="" priority="" name="varCloneTrooper != null" debugbreak="False" constraint="varCloneTrooper != null"><treebinding repeatuntil="" name="BDShoot" debugbreak="False" binding="BDShoot" /></constraint></selector></parallel></sequencer></constraint></selector></behaviortree>
The XML of the second [B] tree for shooting in rounds:
<behaviortree version="1.1" repeatuntil="" name="BDShootRounds" debugbreak="False"><parallel tiebreaker="fail" succeed="any" repeatuntil="" name="parallel" fail="all" debugbreak="False"><move turnspeed="" repeatuntil="" name="Face Trooper" movetarget="" movespeed="" facetarget="aspCloneTrooper" debugbreak="False" closeenoughdistance="" closeenoughangle="" /> <sequencer usepriorities="False" repeatuntil="" name="sequencer" debugbreak="False"><iterator repeatuntil="" priority="" name="FireRound" debugbreak="False" count="5"><timer waitforsec="1" returnvalue="success" name="Shot Interval" debugbreak="False" /></iterator><timer waitforsec="3" returnvalue="success" priority="" name="Round Interval" debugbreak="False" /><action repeatuntil="" priority="" parametervalues="MC41ADIANQ==" parameters="U2hvdEludGVydmFsAFJvdW5kSW50ZXJ2YWwATWF4U2hvdHNQZXJSb3VuZA==" namespace="" name="Shoot Action" debugbreak="False" classname="AIBDShoot" /></sequencer></parallel></behaviortree>
-
This topic was modified 10 months, 3 weeks ago by
Olin.
-
This topic was modified 10 months, 3 weeks ago by
Olin.
-
This topic was modified 10 months, 3 weeks ago by
prime.
-
This topic was modified 10 months, 3 weeks ago by
prime.
-
This topic was modified 10 months, 3 weeks ago by
prime.
-
This topic was modified 10 months, 3 weeks ago by
prime.
-
This topic was modified 2 weeks, 4 days ago by