Rust Marque Logo

The Performance Update

We took this month to focus heavily on performance, with lots of optimization. Let us know how we did. We also have a look at some upcoming additions: a new boat event, slot machines, and more. This patch wipes the servers. Enjoy!

06 September 2018
Devblog
There were quite a few optimizations made to Bandit Camp this month. From excess draw call reduction via art and code, as well as new ways of drawing trees and you can see in Diogo's and Andre's Tree rendering related sections. There has been some optimization on the art-side of the town as well. Damian has adjusted the LOD distances on dozens of small objects to make them LOD and cull quicker. Swamp cabins were given an additional LOD level and their LODs were merged to help with occlusion. Small foliage, such as reeds and water lilies, were also made to cull quicker. The trees present in the Bandit Camp and buildable swamps have seen a significant performance overhaul. Previously, they consisted of two materials each, however we have decided to merge their textures into an atlas. As a result, the number of drawcalls generated by the swamp trees (which make up a significant portion of the scene) was halved. Most of these tackled CPU performance, while only some really tackled GPU overhead. We figured it was time to move on to other optimization tasks when performance was decent and finally scalable or GPU dependent, which means it can be played properly well if players lower the game's graphics quality, resolution or get a more powerful GPU. Our goal for this patch was 50-60 fps at 1920x1080 on a GTX 1060 (3GB) with default settings. There is still a lot of work to do, and the Bandit Camp may still get slow with a lot of players. The cost of rendering players and NPCs themselves are a problem which we also plan to address as soon as possible.
Over the past few months we have made a huge collective effort to eliminate the majority of client-side CPU performance bottlenecks. This month, however, as we eliminated the last big ones, we ended up at a point where Unity's CPU-side rendering was essentially clogging up our main thread. However, the complexity of our scene just didn't match the inflated rendering times. Thankfully Unity had been working on a solution. We've enabled graphics jobs in Rust this month. This is a relatively new Unity feature that greatly reduces CPU overhead by making better use of multithreading. It's a somewhat risky move as Unity is still considering it an experimental feature, and in past releases we encountered significant issues with it and had to roll it back, but we've done thorough testing and couldn't find any issues we weren't able to work around this time. In our testing it significantly improves performance and Rust is now utilizing the GPU a lot better than before and is no longer CPU bound on most hardware, which means graphics settings actually have an effect on frame rate.
We profiled, tracked down and fixed various memory allocations that could lead to stuttering caused by the garbage collector. The main areas affected are:
  • Ambient sounds
  • Image effects
  • Prefab pooling
  • HUD (name tags, team indicators)
So as you can imagine, given the frequency those elements are being used in the game, this added up to a pretty significant performance issue.
In early August we released an update to include all workshop skins in the main game install so new players no longer have to download hundreds of megabytes while playing. We were able to limit both download size and the amount of disk space used by those skins using texture compression to ensure this is a future proof system. Future skin releases will still be downloaded from the workshop until the next game update is released, at which point they will be included in the update download.
I implemented a system to limit the amount of tree meshes to render independently from how many trees are actually around you. This is done by forcing all trees that exceed the limit to be rendered as billboards, only rendering the trees closest to the camera as meshes. This has the advantage that thick forests have less of an impact on performance, so if you're suffering from performance issues inside forests make sure to enable this. You can adjust the number of trees to render in the graphics settings.
I implemented the third, and hopefully final, iteration of prefab pooling this month. The old prefab pooling system could reuse prefabs once instantiated. However, the pool was starting out empty when joining a server, which for example meant some lag could occur the first time you fired a gun. This was causing frame drops in many situations and made the overall performance feel rather terrible. The new system solves this and as a side effect is much more efficient for the garbage collector since any dynamic memory allocation from Unity's game object instantiation is done in the loading screen and immediately cleaned up before even entering the game.
Rust uses a physics based character controller. This means both the player and the camera move in fixed time intervals with the rest of the physics system. The problem is the physics system only runs at 32 frames per second by default to avoid excessive CPU load. This meant only the camera rotation (mouse input) could take advantage of high frame rates and not the camera movement (keyboard input), which is locked to player movement in first person view. I found a way around this so the camera is now both moving and rotating in every frame, which makes things look a lot smoother on hardware that can handle high frame rates.
A few months ago we deployed an optimization for the terrain shader and textures that involved texture arrays. Because of it, and since we upgraded to Unity 2018, lowering graphics quality had no effect on terrain texture resolution, which means you may not be taking full advantage of lowering graphics quality since rendering the terrain still cost the same. This issue is now fixed and terrain texture density is now properly downscaled according to settings. Lowering terrain texture density will benefit low-end graphics cards the most.
Ever since we increased the viewing distance for trees, impostors have become one of the biggest CPU bottlenecks. Rendering thousands of independent objects, even simple ones like impostors, may involve a lot of culling, sorting and drawing calls. As part of the CPU optimization push we made this month, I took the opportunity to tackle impostor performance and wrote a specialized renderer for impostors that maximizes hardware batching potential. While it has minimal effects on GPU performance, it essentially eliminated all CPU cost. In practice this improvement will benefit some machines more than others. However, the benefit will be apparent when combined with all other changes and you should see an reasonable FPS improvement. Please note that, unfortunately, due to a Unity bug this optimization is disabled on macOS. We plan to correct this, hopefully on the next patch, as we switch from OpenGL to Metal.
Last month, when we introduced Bandit Camp, it featured our new atmosphere/fog volumes. As promised in the last update, instead of simply slowly fading in after we walk into the compound, I've updated the volume fog rendering to also work correctly when we're outside looking in. This makes the transition smoother and less awkward. The entire volume is faded with distance, so after 500m it starts fading away until it's no longer visible. Also fixed an issue where standing at the volume edges would reveal some hard edges forming the shape.
Due to this month's CPU optimization push, occlusion culling may be less of an advantage because the CPU cost of running it may overshadow the benefits we're getting on the GPU. We plan to address this going forward by moving most of the work to the GPU. It is only then, without that overhead on the CPU, that the benefits will be net positive in all stages of rendering. In the meantime, if you notice any lag when rotating the camera or in other instances, you can find a new option to toggle occlusion culling under Graphics Options / Experimental. Feel free to try disabling it (on by default) to see whether it helps with your particular configuration.
Earlier this month a hotfix was pushed out to address a serious FPS issue that had been present ever since the new name tags were added. The improvement will mainly help those clients with slower CPUs, but everyone should have seen a 10-20% FPS improvement.
I added a new uncraftable grenade this month, the Smoke Grenade. The new ‘nade will obscure the area they are thrown in for 45 seconds, and can only be purchased at Bandit Town for 10 Scrap.
I recently changed both corn and pumpkins to be stackable, which should make them less annoying. I removed their condition value as well, so no more 0.1hp pumpkins. I also changed how plants work, so you can only harvest the fruit when it is fully ripe, which now lasts 48 hours before dying. To combat food spam we changed the rate at which you gain health from health over time to be half as fast, this renders the large Medkit even more useless, but it is due for a rework next month anyway.
Some experimental work was done on a CCTV camera system. This will work by allowing you to deploy a laptop on a table and cycle between cameras nearby. Initial tests seemed to indicate this would be viable so we may move forward with this new feature next month.
In a small oversight, we forgot to add the recycler to the Bandit Town. This is now fixed. The recycler can be found in the wheel house of the dredge.
A long time community request was to be able to place deployables under the repair bench. You can now do this, and I enabled it on the BBQ as well.
This month saw a rewrite of the AI’s sensory, behavior and aim systems. They’re only applied to the scientists at the Military Tunnel this month. The sensory system lets us update different sensory modules at different frequencies, which allow the sensors that matter to be much more reactive than before. Preliminary steps have been made to make this much more efficient performance wise in the future. The new behavior system is able to plan into the future and think multiple steps ahead when making decisions. This makes it both easier to design the behavior we want and debug their behavior when they act oddly. The aim system works on a model of deliberate hits and deliberate misses, so that the AI can control how well they hit their targets based on alertness and timing. The Military Tunnel Scientists should now stay much more engaged with players. They hear footsteps, explosions and gunfire. They are better at using cover and they have learned to throw grenades and use syringes. Animals saw another tweak to their roaming. They are now restricted to not roam too far away from where they spawned, which should keep them all from ending up at the coast of the island.
Our system for playing back localized ambience (tree leaves rustling in the wind, waves on the shore, etc) had ended up used in some ways it wasn't originally designed for over the last few months, and we discovered some performance issues stemming from it. The Unity CullingGroups we use to enable/disable these sounds were being updated too frequently. I've made some changes this month that greatly reduce how often we need to update those CullingGroups and have made those updates much more granular, which means they're much faster when they do need to happen.
Streamers' dreams have come true: I've added a new option to hide signs which can be found in the options menu. This will hide all player painted signs in-game.
For the past few weeks, Vincent and I have been hard at work on a new monument. The Lazarus is a large shipping vessel owned by the Cobalt Cargo Shipping Company. It is meant to circle the Rust island and deliver goods to the scientists working there. This large ship will contain valuable loot and will be protected by the scientists that players will have to defeat in order to access it. While all of the artwork for this monument is currently finished, we decided against releasing it this month. Currently, the ship works only as a static monument and spawns out in the ocean. However, the idea is to have it move around the island. To achieve that, some new game code will be required, and it's not an easy task as players and scientists will have to be parented to a large moving vehicle. In the meantime, below are some screenshots that will tide you over while you wait:
I've been working on some new glove types: Burlap, Roadsign and Tactical versions based on some concepts Paul made. I was doing some final fixes when we locked down the patch, but they're all done now so expect them in next month's update! These are designed to take advantage of the new(ish) first-person clothing and look pretty neat from the first-person view:
To expand the casino, I made a slot machine. The winning conditions aren't set yet, and so the conditions will be added at a later date to the texture on the top sign.
This is the new L96 Sniper Rifle. It's the military counterpart to the Bolt Action Rifle currently in-game, and like the other military grade guns it's expected to not be craftable. It was super fun making this, so I hope you all have fun using it when you get the chance.
add_circle

Features

  • Scientists at Military Tunnel throw grenades.
  • Scientists at Military Tunnel use syringes.
  • Workshop skins are now included in the main game download
  • Added prefab warmup to loading screen
  • Added new prefab pooling system
  • Added "Max Tree Meshes" graphics option
  • Added ladder trigger for custom maps
  • Added high frame rate camera movement
  • Added Smoke Grenade item
  • Added "Hide Sign" option
  • Added multi-threaded rendering
  • Added occlusion culling graphics option
  • Added new optimized impostor rendering
arrow_circle_up

Improvements

  • Scientists at Military Tunnel hear footsteps, explosions and gunfire.
  • Scientists at Military Tunnel use a new aim system.
  • Scientists at Military Tunnel use a new, more reactive, sensory system.
  • Optimized asset bundles
  • Optimized loot panels
  • Fixed various skin icon issues
  • Optimized various dynamic memory allocations
  • Health over time takes longer to convert into health
  • Optimized mesh LOD updates
  • Reorganized graphics and performance settings
  • Optimized low level memory pool
  • Pumpkin and corn now stackable to 10
  • Removed pumpkin condition
  • Workbenches now decay after a long period
  • BBQ allows deployables underneath
  • Repair Bench allows deployables on shelve
  • Pumpkins and corns give less seeds when consumed
  • Atmosphere volumes now visible from outside Bandit Camp
  • Optimized some rendering related dynamic memory allocations
  • Optimized localized ambience system
handyman

Fixed

  • Scientists at Military Tunnel stay engaged with enemies.
  • Scientists at Military Tunnel now reload in cover.
  • Bandit guards now aggro smoke grenade throwers.
  • Bandit guards shoot better at long range.
  • Bandit guards now kill sleeping players after 20 minutes.
  • Recycler at bandit town is now better protected by bandit guards.
  • Junkpile scientists fire their pistol instead of just fleeing.
  • Animals now roam in a restricted distance from where they spawned.
  • Fixed entities sometimes showing wrong skins
  • Fixed stall during ocean patrol point generation on some custom maps
  • Fixed Nametag Performance issue
  • Fixed workbench phrases
  • Fixed passing loot through floor using BBQ exploit
  • Fixed Snow jacket name
  • Fixed RHIB disappearing on server restarts
  • Fixed rowboat becoming invisible
  • Fixed invisible supply signal smoke
  • Fixed being able to turn recycler on/off if you are not the user
  • Fixed boats decaying while in use
  • Fixed tree impostor shadow orientation
  • Fixed terrain texture not resized on graphics quality change
  • Fixed smoke grenade issues with glass windows
  • Fixed censor cube glitches around smoke grenade
  • Frame-rate stutter caused by ambience sound emitter removal
remove_circle

Removed

  • Removed world reflection quality as it is currently not supported
  • Removed "MoveToContainer failed!" message
  • Deprecated navmesh grid system removed.

Newsletter

Recieve monthly updates straight to your inbox