|
Post by projectonegames on Oct 6, 2016 1:29:32 GMT
If you deployed this great product and you see terrible FPS and you have a MANY Enemies and companions. try this..... After a few hours using the Unity profiler, compressing mesh and doing all kinds of performance tricks and all. All trying to figure out why the scene FPS was so slow. Here is what I found. There are two simple considerations:
1. Check the size of the AI_Sensor Sphere Collider radius. If it is too big, it causes FPS death. In the hierarchy, type "AI_Sensor". For each entry, view the size of your radius. reduce to the MIN that you really need. Search for "SphereSensor" also. When you reduce each, and then run, it dramatically increases your FPS.
Second consideration. 2. Within each NPC (enemy and Ai_Companion) look for your "AI Controller BY Invector". Or go to your project window and search for "V_AIController.cs" script. Right click it and choose, find references in scene. Under sensors, look for "Max Detect Distance". Change this to the min size you really need. Probably the same as #1 above.
I have not looked at the code behind this, but it would probably be best to only check the radius every X frames and cache the result until the next check. Either way, this is an awesome product.
|
|
|
Post by Invector on Oct 6, 2016 11:40:29 GMT
Really nice observation, we didn't notice that the sensor was consuming that much! I don't recall if we look into the sensor when doing this new update but another thing that consumes a LOT, is the actions and the off mesh link verification which we remove that in order to improve performance on v2.0.
|
|
|
Post by projectonegames on Oct 6, 2016 12:35:20 GMT
Are the "actions" within the animator for the NPCs? I changed the culling mode to "cull completely" and the update mode to animate physics. In the 3rd person camera, I changed the clipping plans (FAR =25) and turned on occlusion culling. Then added globalfog to the camera to start near the culling distance. Or do you suggest changing it somewhere else?
I did not think about trying to turn off the mesh link verification. {To do this, I selected all static objects. Opened the nav window (Window and navigation). Selected Object and turned off Generate OffMeshLinks, Then baked. } I tested a scene with 5400+ offmeshlinks. My before and after stats are nearly identical. I am thinking that my occlusion culling settings also takes care of this. (?)
Cheers, Jeff
|
|
|
Post by Invector on Oct 6, 2016 13:11:28 GMT
The actions are the verification inside the controller that check for jumpOver, stepUp or climbUp.. if you're AI doens't use those actions, remove it could increase performance considerably
|
|
|
Post by projectonegames on Oct 6, 2016 23:53:33 GMT
yes, I don't use these three actions (yet). So I will temp remove them. Thank you!
If someone else does not use these actions, within v_AIController.cs, comment out the section
try { if (hitObject.CompareTag("ClimbUp")) DoAction(hitObject, ref climbUp, AIActions.ClimbUp); else if (hitObject.CompareTag("StepUp")) DoAction(hitObject, ref stepUp, AIActions.StepUp); else if (hitObject.CompareTag("JumpOver")) DoAction(hitObject, ref jumpOver, AIActions.JumpOver); } catch (UnityException e) { Debug.LogWarning(e.Message); }
|
|
|
Post by kukuhbasuki on Oct 7, 2016 22:46:09 GMT
I'm not using it on mobile. But this kind of informations is very useful! Thanks guys.
|
|
|
Post by projectonegames on Oct 25, 2016 12:29:50 GMT
Muting all non player idle movement variations will also appear to vastly improve mobile FPS.
After reviewing the profiler, it is apparent that the offscreen enemy gameobject idle movements are chewing through CPU. When I turn the gameobjects off, my FPS doubles. When I go into the animator, IdleVariations, click null, and mute the 3 idle transitions, it doubles performance across the board. So, this must be the reason.
I am not sure why this is bringing down the CPU, because: The camera has occlusion culling on, and a very small clipping plane (far is 15). Each enemy game object has a normal update mode. And culling mode is "cull completely". And I have baked in occlusion culling. I think the scripts are running even if they are offscreen and all. Do you have any thoughts why they would still be running? Anyway, it is simple enough for me to turn off idle movements for now.
I tested on iOS/Android today, and FPS improved on the devices based on this change. cheers.
|
|
|
Post by Invector on Oct 25, 2016 14:37:39 GMT
I did run a mobile performance test of the v2.0 yesterday, and it runs pretty nice! it was not a stress test though. We change a lot of verificarions for the AI, so I wouldn't stress to much with the older version right now, try working on other parts of your game until the update is available, them you can work better with the new stuff.
|
|
|
Post by projectonegames on Oct 26, 2016 11:52:20 GMT
Yes, thank you. Do you know if there is a way to get a count of the enemies the player has within their sphere? I wrote a script to turn off the components of any enemy that is outside the players view. But I only want to turn back on any enemy if the total alive enemy count is less than 4. If I can figure out this, I will be much closer to be done.
I will post the idea and script when I have it ready. It is a slight change to v_AISphereSensor.cs
|
|
|
Post by Invector on Oct 26, 2016 13:30:03 GMT
You can make a verification using the Start method by getting any v_AIController and adding into a list, remove it when someone dies
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Dec 4, 2016 18:08:38 GMT
Has anyone made any mobile games with Invector?
|
|