#How to improve performances with +1000 navmeshagents

1 messages · Page 1 of 1 (latest)

torn ibex
#

Hello here !
I'm new to Unity (following a french formator called Anthony) and after many "tuto-projects" I'm trying to create my own.

The project is quite simple: a simple clone of Ultimate Epic Battle Simulator.

There is two army (one of each team). With plenty of players. Those are controlled by NavMeshAgent and a Targeting script.

This is working very nice ! But, when I reach above +100 players, the RAM is blowing and the game crash.

I've try to disable ALL scripts and behavior (NavMeshAgent, Animator). But this is still the same issue.

Today I've only 16Gb of RAM. Seems pretty poor for this kind of game. But, I think there is some concepts of optimisation I miss.

I found many videos about optim in Unity. They are very complex for my level right now and not very accurate. So if you have any ideas of concept/tricks I can check on Google, it could be cool 🙂

#

Thanks

rotund hollow
#

You may want to look at stuff like boids or flood fill instead

torn ibex
#

Huh ! I didn't know about profiler. I was checking my performances with the "Stats" tabs of Unity haha. Indeed it could be very interesting to check that. Thanks !
As I said, I've already tried to disable every scripts and heavy components like nav mesh agent. There is no significative improvements.

rotund hollow
#

the profiler will tell you exactly whats happening. You probably don't need to go to the point of your game crashing but compare at 10 characters, maybe 50 characters, and see exactly what scripts are causing issues. You want to look at the CPU Usage and i think its called the hierarchy tab but i forgot the exact name

torn ibex
#

Thanks Bawsi. I will check that !

torn ibex
#

According to the profiler data. It seems to be a RAM issue. Before starting the game i'm already around at 85% of ram usage. When I create 100 players It goes to 95% (around 1Gb more).
The game crash when it overflow.
I've only 16Gb of ram and it seems to mainly full before starting the game (probably due to chrome lol)
What I don't understand is: some games like Ultimate Epic Battle Simulator are running very well on my 16Gb computer.
Is there a configuration to ask Unity to lock more memory on game start ?

rotund hollow
#

im not so sure about the memory side of things there. My only advice would be to look into whats actually using memory in the first place. I dont think you'd specifically need to allocate more RAM, unity should be able to just use what it needs

#

there is the memory profiler too which can give you more insight as to whats taking up space

torn ibex
#

Thanks for your time. I'm not sure to understand the profile very well so. Here it is two screens shot of the profile. The first one, on game started. The second one after display more than 200 players.
What I understand:

  • CPU line is getting red, meaning CPU has difficulties.
  • "Others" CPU Usage is taking a lot. For now, I don't know yet what does it mean
  • Scripts and rendering are the second and third biggest usage for CPU.
  • The timeline telling me there is around 314ms for RenderLoop which could explain the lost of FPS
  • In memory part, there is a gap. Total memory used is around 2.2Gb but all lines adds up give less than 1Gb. So there 1.2Gb lost somewhere ?
  • The memory profiler tells me there is around 4.4Gb allocated "Untracked" (Still don't know what does it mean yet)
    Also, I managed to see this:
    I've generated a lot of players. Ram increase near to 100% and the game has about 6/7Gb of ram. I stopped the game and the RAM still used. Maybe a memory leak ?
    I really need help to understand this profiler and I'm open to any ressources that can help me !