SmartlyDressedGames / Unturned-3.x-Community

Community portion of the Unturned-3.x repo. If you have access to the source code you can find it here:
https://github.com/SmartlyDressedGames/Unturned-3.x/
84 stars 18 forks source link

VERY BIG MULTIPLAYER FPS PROBLEM #4395

Closed QERT2002 closed 2 months ago

QERT2002 commented 2 months ago

I was trying to understand the reason for low fps on my server. -Numerous modification corrections did not produce any result. -I tried using a special module to turn off the rendering of the player’s clothes and weapons. But this did not give any result and FPS remained at the same level. Combined with these factors, I realized that it’s not about mods and the load on the video card, but about the processor load. I tested play on my server on another computer with a more powerful single-threaded processor (AMD Ryzen 5600) and same video card and this gave a fabulous boost of +120 fps. From this I concluded that with a large number of players the processor is heavily loaded and FPS drops.

Next, on my main computer, I tried using the module to turn off the main transform for each player except me (steamPlayer.Player.transform) And this gave an excellent result +(80-100) fps on my main computer.

I think you should do something about this because most Unturned players have weak hardware and experience difficulty in fps when playing on servers with 30+ online.

SDGNelson commented 2 months ago

Yes, it makes sense that Unturned is CPU-bottlenecked for most players.

If I could do-over some of the core replication features it would be obvious now to not create far away players and vehicles on clients. (e.g., 4.0 did this) It might happen someday in 3, but the game currently makes a lot of assumptions about vehicles and players always existing.

Deactivating far away players and vehicles locally might be an option, but would also break some mods - on the bright side they are culled from rendering past a certain distance.

For the meantime I get the impression that most of the community is tired of focus on foundational improvements, so this year I'm working on overhauls to some gameplay features per the 2024 survey.

QERT2002 commented 2 months ago

Maybe we should at least add support for disabling players from a distance? A couple of lines in the game code for you, but until you get around to improving it, we will have a temporary solution to the situation. For example, add a packet to disable the main player transformation in the game code (This will be more than enough)

Example: [SteamCall(ESteamCallValidation.ONLY_FROM_SERVER)] public static void ReceivePlayerVisible([In][IsReadOnly] ref ServerInvocationContext context, bool IsVisible) { Player player = context.GetPlayer(); if (!(player == null)) { player.transform.gameobject.SetActive(IsVisible); } }

rube200 commented 2 months ago

Also a option for vehicles that are on by default to not break back compatibility