News Forums RAIN General Discussion and Troubleshooting AIRig.Update Takes More Than 10 to 15%

This topic contains 22 replies, has 3 voices, and was last updated by  Sigil 6 months ago.

Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
    Posts
  • #39517

    Sigil
    Keymaster

    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.

    #39581

    aqib sadiq
    Participant

    ok 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 profiler

    https://drive.google.com/file/d/0BwACGkvclpC3d0pjbmNybTgxY0E/view?usp=sharing

    #39595

    Sigil
    Keymaster

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

    #39596

    aqib sadiq
    Participant

    Here 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=sharing

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

    #39597

    aqib sadiq
    Participant

    Here 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.
    #39601

    Sigil
    Keymaster

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

    #40015

    RealGame
    Participant

    I’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.

    • This reply was modified 6 months ago by  RealGame.
    • This reply was modified 6 months ago by  RealGame.
    • This reply was modified 6 months ago by  RealGame.
    #40025

    Sigil
    Keymaster

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

Viewing 8 posts - 16 through 23 (of 23 total)

You must be logged in to reply to this topic.