Resource Usage & Optimization

From Snapwiki
Jump to: navigation, search

The campaign and multiplayer maps maintain rendering and network performance by following guidelines during development. Optimizing maps can take an experienced developer months of work. The maps in SnapMap use similar guidelines to maintain performance, ensuring that all players who can play singleplayer/multiplayer maps can also play any SnapMap.

These guidelines come in the form of three budgets: Network, Objects, and Memory. Everything in the editor will have an associated cost, and the editor will not let you place more items if there is no more remaining budget.

The Network budget applies to all dynamic objects in a map. Anything that can change during the course of a map (FX, Pickups, Interactives, Volumes, etc) will take up a portion of the Network budget. The Objects budget applies to anything that is rendered and appears as a 3D object in the map. The Memory budget applies to everything and is a general measure of how much memory each object uses during a match.


Empty map

An empty map with no modules uses 4.02% Network, 0.58% Objects, and 1.08% Memory.

Objects

All objects can be separated in 5 different classes by their use of map resources. All objects within the same class use exactly the same amount of resources regardless of their type and properties

Light objects

These use 0% Network, 0.01% Objects, and approximately 0.02% Memory. This class includes objects from the following categories:

This class of objects consume the least amount of resources per object. They use more Memory than Objects, so Memory is their limiting factor. A map may contain at most approximately 5000 Light objects.

Heavy objects

These objects use the same amount of Objects and Memory as the Light ones: 0.01% Objects and 0.02% Memory. The difference is that they also use 0.15% Network. This class includes objects from the following categories:

For these objects the limiting factor is Network. You can only have around 645 оf these in a map. These objects all use the same amount of resources each, whether it's a fancy FX, soda can, huge crate, volume of the size of the Foundry module, or just a boolean variable.

Demons

Aside from the 64 hand-placed demon limit, they also use 0.15% Network, 0.30% Objects and 0.02% Memory. Again, all demons are equal, whether it's a Baron of Hell or a Possessed Worker. One Demon is equal to one Heavy object in terms of Network and Memory and 30 Light/Heavy objects in terms of Objects.

World Text

These objects use 0% Network, 0.40% Objects and 0.04% (0.0385%) Memory. The limiting factor here is the Objects footprint. You can have at most around 250 World Texts in a map.

Doors

These are created when you attach a new module to an existing one. They cost 0.30% Network, 0.01% Objects and 0.02% Memory. (2 Heavy objects in terms of Network).

Modules

All modules use different amounts of Objects and Memory in varying proportions. Because of that, it is faster and easier to see their footprint in the editor. Here are some general observations:

  • Usage of Objects and Memory are not correlated. Let's take for example Foundry (9.03% O, 7.92% M) and Molten Vats (10.64% O, 4.94% M). Foundry uses ~3% more Memory, but Molten Vats uses ~1.5% more Objects. Total usage of resources though is proportional to the size of the module.
  • Usage of Objects may vary between 0.11% (Coupler Small) (~1/3 of a Demon) to 10.64% (Molten Vats) (36 Demons, 27 World Texts, 1064 Light/Heavy objects).
  • Usage of Memory may vary between 0.28% (Coupler Small) (14 objects) to 7.92% (Foundry) (~400 objects)
  • All modules when placed first have all their properties disabled except for the sound layer. Unlike Audio objects, which are Light objects, sound layers' Audio objects are Heavy, that is, they add 0.15% Network per Audio. By just disabling sound layer in all modules and manually placing 3D Speakers and Roomtones you can save some Network (although you will need to activate them on map start, which will need a chain Map->On Map Started->Play->sounds = 3 Light Objects, so this workaround will need some extra Objects/Memory instead)
  • Most modules (with disabled sound layer) don't use Network, but some do (like Skylight Nine – 0.59% Network), probably because they have embedded Heavy objects.
  • Changing a Module's environment doesn't cost any resources.
  • Adding Prop Layer and Floor/Ceiling/Wall clutter works like adding Props. These props, unlike Large/Small props, are Light objects, (they don't use Network). Use them instead of manually placed props when possible to save some Network. Props/Clutter use Objects/Memory in 1:2 proportion.
  • Decal layers use Objects/Memory in 1:1 proportion.
  • Different modules have different amounts of decals/props/clutter. The larger the module is, the more clutter/props/decals it will have.

Optimization

What does not affect resource usage?

  • Changing any properties of existing Objects.
  • Adding connections in logic chains without creating new input/output nodes.
  • Changing the Environment property in Modules.

Network optimization

Network is used by Heavy objects, Demons, some rare Modules, and the sound layer in Modules.

All objects use 0.15% Network, except for Doors (0.30%) and Modules (up to 1.19% - The Vats).

Strategies:

  • Setting the Static property on any Props or Player Blocking Volumes to get back their Network cost at the cost of disabling their inputs and outputs.
  • Disabling sound layers in all modules and placing audio nodes manually.
  • Using only one reference to Variable object in a whole map.
  • Using prop layers in modules instead of manually placed props, when possible.

Objects optimization

Ordered by usage:

Most Modules (0.11%-10.64%) > World Texts (0.40%) > Demons (0.30%) > Doors/Light objects/Heavy objects (0.01%)

Prop/clutter/decals layers in Modules may use from 0.01% up to 1% Objects and more.

Strategies:

Memory optimization

Ordered by usage:

Modules (0.28%-7.92%) > World Texts (0.04%) > Demons/Doors/Light objects/Heavy objects (0.02%)

Strategies:

  • Replacing World Texts with other means of communication.
  • Giving up Module's clutter/decals, especially in big Modules.

General tips

  • Use multicasting when possible (avoid creating extra input/output nodes).
  • Hovering over different objects in Object Menu will immediately add their resource usage to the indicators, so you can figure out, how much resources an object of any particular type will use before adding them. This way you can easily distinguish Heavy objects from Light ones by looking at the Network budget.
  • The above trick does not work well with Modules – predicted resource usage for them will always be less than the real one that will be shown after actually adding the module to the map (by 1-2% for large modules).