I have been having this issues and couldn’t figure out what was causing it till i made a simple scene and just kept disabling things. I got to the point where when the AI is enabled on the NPC and I touch the npc with my fps character, the game with just crash/freeze…(On play in editor, and on built mode) I have to end the process and restart unity. When I disable the AI its fine and game does not crash.
I followed a tutorial for setting up my AI so I have no idea what is wrong. Any ideas??
The behavior tree i used is in this tutorial. I followed this to the T and it works great, but not if the NPC/enemy gets up in my face. And its a Zombie…. So…
Topic: AI Troubleshooting
I’m having a few issues with my current AI Behavior and was seeking any possible solutions to these issues. I’d like to note I have a a Time restraint of three full in days which I have to solve these issues by and in my desperation have come to seek some advice from other Developers.
this is the current behavior tree I’m using if you were unsure how each node worked.
Below is an image of the behavior tree my problems will be relating to.
Below is an image of the Navmesh
The first issue is when I walk into a room with a door. When I enter a room and my AI is chasing the player, the rain behavior will not show any state active (no nodes coloured in the debugging) untill it finally stops where he will continue his patrol route or pursue the player., and I will hear a sound similar to when a program crashes (the start of a sound looping). I assume this is caused by the ai jumping in between states and its due to the colliders or the ai being unable to see the player the moment he moves. I’ve tried enlarging the colliders on the doors to ensure there are no gaps although the issue still resides. I later discovered that he can occasionally do this around corners as well so I’m sure its due to the way U;ve build the behavior tree. Optimally id like the ai to do a set animation and just wait for the player until LOS is broken. Additionally I considered a short idle state to wait if the player appears before continuing to resume his patrol rounds although I’m struggling to understand the Behavior system rain uses and have made a few attempts but all resulted in my current behavior breaking.
The second issue is when the AI gets to the edge of the Navmesh and the player is visible but to far away for him to reach, the ai will just freeze and sit there as one of the nodes returns fail and it becomes stuck in an infinite loop. I’m really struggling to wrap my head around the logic these behavior trees use, and I’m not sure how I can combat these issues.
I’ve rebuild my behavior tree multiple times and the current version I shared above so far is the most optimal. I’ve read through a few posts over the past 10 weeks and looked a few tutorials but I struggle to understand how to hiearch and build these behavior trees in an optimal. I know the issue is the way I’ve build the Behavior Tree but I’ve tried a variety of builds and just can’t seem to get it right.
Any solutions or suggestions would be a huge help!
- This topic was modified 6 months, 1 week ago by Joshichimaru3.
Ill try to explain my problem briefly.
1. Ive a terrain which is consisting of Chunk (GameObject)with a mesh that holds a set of blocks, what basically is a lowest unit in terrain. Those blocks can be created and destroyed at runtime. This terrain is generated at runtime and blocks can be edited at runtime.
As You can probably see - ive added a Convex mesh collider, but it seems that convex wont do the thing here.
Here i have the same chunk with meshcollider, but its not convex anymore. Ive emphasized two blocks with cycles.
2. This terrain uses custom Physics and with all that - no Unity raycast support (custom intersection logic / raycasts). For example, Player and AIs use custom character controller;
3. As Terrain is generated at runtime and can be updated at runtime (each chunk can be changed in realtime) - AFAIK there is no way to actually use RAIN Navmesh for navigation (runtime navmesh gen is not an option because on terrain create it will work, but at runtime chunk updates it would freeze the game as Navmeshes should be re-generated);
For example, i want to suddenly create a hole - AI should be immediately be aware of that and avoid it.
4. This Meshcollider that im adding to each chunk is a unused feature - its added specially for RAIN (currently it uses memory for no reason - if there is a way to not use it - i would love it and remove it);
What i have done so far?
1. Added CustomCharacterMotor and managed to use the custom CharacterController that this VoxelEngine uses. See code here -> http://hastebin.com/oludobejak.avrasm
Movement is working fine.
2. Added Custom Navigator, but havent got any functionality working - thats why i am writing here. Current version: http://hastebin.com/poxinirofi.cs
I would love to somehow get AIs to be aware of current Terrain(the same layer where they are)
do i need to create custom pathfinding or somehow register my blocks (they are not gameObjects) for RAIN as obstacles or somehow build a navmesh-like mesh for each chunk that AI uses for pathfinding ?
Any ideas? Sigil, perhaps You can help me out with this.
Please dont hesitate to ask more questions or correct me regarding this problem. I need to lauch this game ASAP.
- This topic was modified 6 months, 2 weeks ago by Sacristan.
So I am using RAIN AI to set up my enemy AI behaviour:
Enemies will patrol in a specific route, and keep detect player, once the player is found,
they will start to follow player and try to attack when get close enough.
And here is my problem when I test it:
Each enemy will start to follow player which is ok but, instead of avoid each other’s path
and pathfinding a new way to get to the player, they just block each other, and the blocked
enemies just keep going in the wrong direction and could not find a new way…
Here are what I did so far:
1 Navgation Mesh added.
2 Enemy using CapsuleCollider and Rigidbody with rotation freezed, and using BasicMotor.
3 Using “Move” Node in the BehaviourTree to move to the player when detect.
4 Using EntityRig to set up the player to make it detectable.
I’ve never introduced myself properly here so let’s begin with that.
I’m Stiffer, an Indie developer from Sweden. (so pardon my language skills…)
Have no clue what I should tell about myself… so lets get into the real stuff…
So, let me try to explain this as detailed as possible…
I have a project I’ve been working on for some time, and I’ve been using RAIN AI the whole time.
I had my monsters AI set up and Patrol-route set up with a nav-mesh and nav-targets.
After i saw that the basics of the monster worked, I focused on other stuff for a time.
A few days ago I checked back on my monster, saw that RAIN had updates (2.1.10) from god knows what.
So I downloaded the update from the website and imported it right on top of the old one… without thinking(facepalm)…
It still worked tough… so I kinda felt like it was ok so save the project and keep up my work.
The problem started when I removed the old nav-mesh, since I needed a bigger one…
I add a navmesh, choose to see gridlines so I can set it up properly, then I press Generate and Unity freezes for a few seconds.
After this I get an error message and no navmesh, even if I choose to see the navmesh.
(The error code is further down)
I feel like I’ve tried everything now, without any luck…
I tried just removing RAIN AI from the project to install it anew…. no change.
I tried restart Unity…no luck.
I tried without the AI folder too…no luck…
I tried all three above in every thinkable combination, no luck.
So I tought… hey, let’s try with a new project… tried that, installed Rain AI, generated a navmesh… success…
Created a new project, imported everything from my project (nothing with RAIN tough)… installed Rain AI, generated a nav-mesh… ERROR… same error…
my question is, can I bypass this error or do I have to create a whole new project, using no prefabs, only import the basics of my real project and go from there? (maybe I’m missing something obvious here too)…
Object reference not set to an instance of an object
at RAIN.Navigation.NavMesh.Collectors.TerrainColliderCollector.InitCollector (Single aCellSize, Single aMaxSlope, System.Collections.Generic.List`1 aUnwalkableTags, System.Collections.Generic.List`1 aIgnoredTags, LayerMask aIncludedLayers) [0x00000] in <filename unknown>:0
at RAIN.Navigation.NavMesh.RecastProcess.ContourCreator..ctor (Bounds aBounds, LayerMask aIncludedLayers, System.Collections.Generic.List`1 aIgnoredTags, System.Collections.Generic.List`1 aUnwalkableTags, Single aMaxSlope, Single aCellSize, Int32 aGridSize, Single aBorderSize, Single aWalkableHeight, Single aWalkableRadius, Single aUnwalkableRadius, Single aStepHeight, Single aMinRegionArea, Single aMergeRegionArea, Single aMaxVertexError, Single aMaxSegmentLength, Int32 aThreadCount) [0x00000] in <filename unknown>:0
at RAIN.Navigation.NavMesh.NavMesh.StartCreatingContours (Vector3 aPosition, Vector3 aScale, Int32 aThreadCount) [0x00000] in <filename unknown>:0
at RAIN.Navigation.NavMesh.NavMesh.StartCreatingContours (RAIN.Core.RAINComponent aComponent, Int32 aThreadCount) [0x00000] in <filename unknown>:0
at RAINEditor.Navigation.NavMesh.NavMeshEditor.DrawInspector (System.String aLabel, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0
at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAINEditor.Core.RAINComponentEditor aComponentEditor, System.String aLabel, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0
at RAINEditor.TypeEditors.RAINTypeEditor.DrawFieldForInspector (RAINEditor.Core.RAINComponentEditor aEditor, RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0
at RAINEditor.Navigation.NavMesh.NavMeshRigEditor.DrawComponentForInspector (RAIN.Serialization.FieldWalkerList aWalker) [0x00000] in <filename unknown>:0
at RAINEditor.Core.RAINComponentEditor.OnInspectorGUI () [0x00000] in <filename unknown>:0
Topic: Navmesh on infinite terrain