News › Forums › RAIN › General Discussion and Troubleshooting › AIRig.Update Takes More Than 10 to 15%
Tagged: AIRIg.Update, profiler
This topic contains 22 replies, has 3 voices, and was last updated by Sigil 6 months ago.
-
AuthorPosts
-
November 19, 2022 at 12:40 am #39517
Try out the version I sent you first and let me know if any of the other issues go away. There is a particular pathing problem that shows up in the current RAIN that may explain your AI not moving sometimes.
Aside from that I don’t know why the animation would fail to play, but let’s start with the new version and see if any of the rest clears up.
November 30, 2022 at 3:24 am #39581ok i have used the new Developmental Build of Rain AI that you send me and it is not showing any Improvements Because there are Huge Glitches in the Game Where GC Collection is Under AIRig.Update is Up to 80% actually more than 80%
Here is the Screenshot of profilerhttps://drive.google.com/file/d/0BwACGkvclpC3d0pjbmNybTgxY0E/view?usp=sharing
December 2, 2022 at 2:46 pm #39595Could you give me a wider shot of the profiler with a couple spike showing? In the previous profiling you were probably around 80% at those spikes too (not positive, but it looks similar). I would like to see how often they are occurring compared to the old setup.
I’m not sure why you are still getting the spikes though. I ran a similar build with Squad Command and was able to remove almost all of them across a very large number of AI. I’ll double check that though.
December 2, 2022 at 10:29 pm #39596Here is Some Screen Shots of Profiler
https://drive.google.com/file/d/0BwACGkvclpC3VzNtZkxpNHZNZUU/view?usp=sharing
https://drive.google.com/file/d/0BwACGkvclpC3a2xjWFVvZE1NcFk/view?usp=sharing
https://drive.google.com/file/d/0BwACGkvclpC3OVpEcUhmOWdiWU0/view?usp=sharing
https://drive.google.com/file/d/0BwACGkvclpC3M2NWM3F4YmNya2M/view?usp=sharing
https://drive.google.com/file/d/0BwACGkvclpC3MkpnR21wMUs1MVE/view?usp=sharingand 1 more thing as i am having about 25 30 characters in the Scene so i disable AIRig component of those characters which are far away from player through a trigger collider.
if they enter that trigger collider their AIRig component is Enabled and if they exit that trigger Collider their AIRig Component is Disabled.i Do this because FPS will drops hugely if 25 characters AI is enabled at once.so its kind of optimization technique to disable AIRig of those Characters Which are far away from player through a trigger collider.
and to be clear that optimization Script is applied on every character that if they enters Trigger They are enabled and if they exit’s trigger they are disabled.
December 2, 2022 at 10:31 pm #39597Here is that Optimization Script
public class PerformanceOptimization : MonoBehaviour { AIRig rig; Animator anim; Rigidbody body; MonoBehaviour[] mono; Animation animate; void Awake () { if(GetComponentInChildren<AIRig>()){ rig=GetComponentInChildren<AIRig>(); } if(GetComponent<Animator>()){ anim=GetComponent<Animator>(); } if(GetComponent<Rigidbody>()){ body=GetComponent<Rigidbody>(); } mono=GetComponentsInChildren<MonoBehaviour>(); } void EnableScripts(bool value){ for(int i=0;i<mono.Length;i++){ if(mono[i].GetType()!=typeof(PerformanceOptimization)){ mono[i].enabled=value; } } } void OnTriggerEnter(Collider col){ if(col.transform.CompareTag("EnableDisable") && this.enabled){ body.isKinematic=false; if(anim){ anim.enabled=true; } EnableScripts(true); if(rig){ rig.enabled=true; } } } void OnTriggerExit(Collider col){ if(col.transform.CompareTag("EnableDisable") && this.enabled){ body.isKinematic=true; if(anim){ anim.enabled=false; } EnableScripts(false); if(rig){ rig.enabled=false; } } } }
- This reply was modified 8 months, 1 week ago by aqib sadiq.
December 3, 2022 at 1:20 pm #39601Is there a way you could get me a project reproducing this to help me hunt this down for you? It is possible there is nothing I can do, as we do use managed memory and that does require garbage collection, it is possible that I overlooked something major that I can fix and will get you some better results.
I just suggest this as we’ve gone back and forth and tried a few things and there still seems to be an issue.
February 7, 2023 at 2:06 am #40015I’m having the same problem as above poster. Around 30 AI’s spawned in the game and the AIRig.Update process is taking 100ms+. Frame rate drops to under 10 FPS. I’m also getting the ‘look rotation zero’ error spam in the debug log occasionally. Fairly simple tree like original poster, a bit more detailed. Basic waypoint route patroller + detect sensor to chase enemyHero. That’s it.
XML file is available upon request. I’m on a team so exporting project can be problematic, as I’m not the merge manager.
I’m really desperate. Programmer - 15+ years professional experience.
February 10, 2022 at 9:45 am #40025Contact me at sigil@rivaltheory.com and we’ll get you a development build to try out. It should fix some of these issues, and then we can try and track down the rest.
-
AuthorPosts
You must be logged in to reply to this topic.