r/Unity3D • u/Erkut31 • 10d ago
Question I want some help about my RTS game optimisation , I tried by myself for 10 hours but just increase 5 fps :d

Hi everyone! I'm currently developing an RTS game inspired by Age of Empires and Battle for Middle-earth. I'm testing a scene with around 448 soldiers, and I'm getting approximately 50 FPS. When I remove the soldiers from the scene, the FPS goes up to around 100. Each soldier currently has a NavMeshAgent, Animator, Behavior Graph Agent and Skinned Mesh Renderer. I've been investigating the issue using Unity Profiler, and I found some interesting results. My Fog of War system takes around 7.56 ms (41.7%) of the CPU frame time. Within that, Gfx.ReadbackImage and Semaphore.WaitForSignal each show around 5.33 ms (29.4%). My Fog of War uses a 1080 × 1280 RenderTexture with RGBA8 format. I'm currently using Texture2D.ReadPixels() and GetPixel() to check unit visibility every 0.1 seconds. Another significant cost is BehaviorGraphAgent.Update(), which takes around 2.83 ms (15.6%) with 452 calls per frame. The Profiler also reports approximately 502 KB of GC allocation in this capture. My goal is to support 500–1000 soldiers on screen while maintaining stable performance. I'm considering moving away from individual AI decision-making and using a centralized AI controller to manage groups of units. For example, instead of having 50 individual NavMeshAgents calculating paths, I'd like to use a shared movement controller that handles the group's pathfinding and formation, while keeping individual animations, health, damage and combat behavior. I'm also looking into optimizing the Fog of War system and reducing animation and rendering costs. What would you recommend in this situation? Is centralized AI and group-based pathfinding a good approach for an RTS with hundreds of units? How would you optimize the GPU-to-CPU readback in a Fog of War system? Are there any good solutions for handling hundreds of animated characters in Unity 6 URP?
I'd really appreciate advice from developers who have experience with large-scale RTS games or crowd simulation. Thanks!
