News › Forums › RAIN › Sample Projects, How To, and Code › Example XML Files OR A Tutorial For Wander, Eat, Attack, and Reset.
Tagged: AI, Behavior Tree, Behavior Tree example requests, motor, root motion, sample
This topic contains 55 replies, has 4 voices, and was last updated by Sigil 4 months, 4 weeks ago.
October 1, 2022 at 4:08 pm #39268
No, you are fine, feel free to add more game logic. The only reason I had us revert the code and step back, is because you had anomalies that you were trying to account for, but the anomalies shouldn’t have been there at all. Accounting for problems that shouldn’t be there just leads to more problems later on.
You have two prime places to add game logic, the custom action for eating (maybe this heals the zombies, or empowers them, or …), and the custom action for attacking (obvious one). I’ll leave the game logic to you though.
Let’s fix the double attack, my guess is that the facing call is causing problems. To figure it out though, get the game into the state where he stops chasing you after an attack. Before you move out of distance open up the behavior tree editor, select the zombie, and make sure the drop down is on “Current AI”. It should be color coded and indicate where the AI currently is stuck (yellow indicates running). Send a screen shot along.
After you send that, what other behavior would you like to see? I’ll work with you to put that together.October 1, 2022 at 4:09 pm #39269
I may go through here and clean house in a moment, so only relevant posts are here, since the conversation is long.October 2, 2022 at 10:03 am #39274
Yeah, there’s a lot of jabber in the thread.
So what would be the best method, code or BT node, for selecting from 4 attack animations?
- Attack1 = Swiping hands
- Attack2 = Double hand slapping
- Attack3 = Grab & Scratch
- Attack4 = Grab & Bite
All are melee (zombies don’t use guns) and require close proximity to the player to not look silly.
MarkOctober 6, 2022 at 7:29 pm #39287
Sorry, coming back around to this.
I usually try to keep my behavior trees simple, so I would recommend putting this all in the AttackTarget custom action. You could merge the trigger into the custom action, and add the logic to either choose a random attack, or something similar.
I’ll come back around with a custom action with this modification. Just a bit busy right now.October 12, 2022 at 11:04 pm #39312
MarkOctober 14, 2022 at 8:59 am #39319
Yes unfortunately. I think I need to let this one go actually, it’s gotten fairly large and at some point I need to move on.
I am planning on taking everything in here and adding it to the starter kit though, I just need to go find a model and some animations that match. I will attempt to add more of the behavior we talked about before as well.
We’ve been needing a good example of mecanim anyhow.
Give it a go on your own for awhile, and come back with questions.November 22, 2022 at 10:29 am #39545
This was cool! Anyway you could upload the XML file???? I could use this for my zombie game i’m making.November 24, 2022 at 11:58 pm #39566
I never actually put together the tree for this, the pseudocode is pretty straightforward though so you can probably create the tree without too many issues (there are a lot of variables as this thread shows, so your mileage may vary).
I may take some of this and rig up a character for our starter kit though, we’ve been needing a good mecanim example and this may be the one.December 22, 2022 at 9:13 pm #39796
Hey Sigil or others,
So progress is slow, I’m tackling one detection and reaction at a time in individual BT’s.
I am stuck on the ConsumeFood function. I can now get the tEntityRig.Entity.IsActive = false, but Can’t seem to re-enable it after 30 seconds.
I have tried setting up an AI on the cube I am using to be the food item, and have:
SEQ (root) (repeat: forever) CON (repeat: never, Constraint: Entity.IsActive != true) SEQ (repeat: never) TIMER (Seconds: 30) EXPRESSION (Entity.IsActive == true, Returns: Success)
Is this not right?
January 17, 2023 at 2:50 pm #39913
- This reply was modified 5 months, 3 weeks ago by Mad_Mark.
This is a great thread. I’m curious, how to get wandering to work when using Unity’s NavMesh?January 18, 2023 at 10:11 am #39914
You must be logged in to reply to this topic.