Well this was quite an endeavour! I kept asking myself, 'Why is my FPS great when I join a server with no-one on it, and as soon as I join a populated server my FPS tanks down to 30?' My assumption had been that lots of people meant lots of building and that meant more stuff to render, thus lower framerates. I was wrong. Check it out:
See all those black marks? Those are other players. They are either alive or sleeping, and they're Thinking, Rendering, Skinning, and doing a whole bunch of unnecessary garbage on my computer, even though I can't see nor interact with them. Players are by far the most CPU intensive entity to compute on our Clients, and even just seeing 10 would have a significant impact on frame-rate. I thought to myself, 'What if we just try and detect if the player would actually be visible to us, and if not we switch them off?' What started out as a test actually ended up leading surprising and impressive performance improvements. I’m drawing a ray between players and the local camera, and if you can’t see the player, they switch off. This has lead to a very significant performance improvement for most people I've talked to, the average improvement seems to be 20-30%!
Here is an On/Off comparison (note FPS/MS counter at the bottom).
Before
After
I had to do a few edge cases to solve problems with players popping in and out of view during battles, but right now here is how it works:
If none of the above edge case checks are true:
There is a list of convars that can help you configure Player Culling if you are so inclined, but the default settings should be fine. Write “find playercull” in the console (F1) to see the configuration options. They have help text to let you know what they all do.
If, for whatever reason, you end up having worse FPS, you can always disable player culling by typing “playercull.enabled false” in the console.
I really hope everyone sees a decent performance improvement with this optimization. You’ll notice it especially in highly populated areas or perhaps after a wipe when most players are on the beach.