Performance

From Valve Developer Community
Jump to: navigation, search
简体中文

Notes about performance costs and possible optimizations to consider when building custom maps.

Client Side Entities

Most entities in Source are networked and send their state to the server so clients don't fall out of sync with one another. To optimize this the "_clientside" entity type exists to reduce network traffic and is primarily used on cosmetic non-gameplay affecting entities.

A good example of this is all of the ambient creatures in Dota 2 are placed using the "prop_dynamic_clientside" entity. These do not send their state to the server. Each client may see them at different times, but they have no effect on gameplay.

If the entity's state was important to the gameplay a regular prop_dynamic should be used instead.

Tree Placement

Trees placed using ent_dota_tree create destructible trees that will snap to 64 grid increments to keep them aligned to the navigation grid. Placing numerous trees inside a 64x64 grid square will often have them snap to the same location, resulting in a number of trees overlapping in the exact same location. This is bad. A good way to avoid this is placing any "ent_dota_tree" on a minimum of a 64 grid square to keep the tree from ending up in an unexpected spot at run time.

Note:The Tile Editor takes this into account and will not allow any painted trees to overlap.

There is a limit of trees on map: 4096. No matter how you created it, with spray tools or through tile set editor.

Tile Editor Perf Implications

The tile editor will allow users to build very detailed maps. It is very possible to place too many objects, plants, and trees, in a small space slowing down lower end machines. Performance constraints should still be adhered to when using the tile editor.

Lighting Performance

When adding deferred point lights to custom maps be aware of overlapping a number of them will cause a hit to performance. A good tool to use when evaluating performance is "r_deferred_simple_light 2" which will display a point light's radius in game with some color information. If the color shifts to green as more and more lights overlap then there is a significant amount of overdraw caused by having a number of lights in the same space. Reduce the number of overlapping light radii to reduce overdraw.