SEED - Combining entities

From The DarkMod Wiki
Jump to navigationJump to search

Introduction

The SEED (System for Environmental Entity Distribution) was created by Tels in Summer 2010 and can either create entities at random places (depending on underground, height, distribution patterns and so on), or manage manually placed entities.

In both cases there are usually a lot of entities placed in a map. To improve the performance, the system can also combine entities and this page describes how that works.

Combining created entities

Whenever the SEED places entities in your map, it can also attempt to merge these entities into larger entities. This can achieve higher performance, because instead of drawing 1000 single grass-entities, only 1 entity needs to be drawn.

This system works entirely automatic, and you usually do not need to think about it.

Combining manually placed entities

If you placed a few dozend or even more models of the same type in your map (f.i. a lot of ivy pieces), then it makes sense to combine these into one entity to save on drawcalls. This technique is called "watching over entities" and is described in detail in the SEED_-_Watching_entities article.

Parameters

There are a few rules and parameters which influence which entities are combined/merged. The following rules are always automatically in effect and cannot be changed:

  1. Merged entities will not cross visportals.
  2. Moveable entities, AI, func_smoke and other special entities will not be combined. Mostly only func_statics will be combined together.
  3. Entities can be solid or non-solid; both cases work. Solid models will also get a collision model that consists of multiple parts.
  4. Whether entities use a real model (something.lwo) or are made from map geometry (brushes/patches) does not make a difference, the SEED system can work with both by using some clever tricks behind the scenes to recover the map geometry of brushes/patches. This means you can have one copy of a brush in your map, and at runtime it gets duplicated into multiple render models.
  5. The number of maximal tris/indexes per combined entity is hardcoded into the source code and cannot be changed. (The limit was found empirically by raising it until the system crashed, then lowering it again one step.)

These parameters can be changed:

  1. If the "combine" spawnarg is set to 0 on the SEED entity, it will not combine entities. Warning: Using this can bring the system to its knees by spawning a couple thousand entities!
  2. The maximum distance for entities to be combined is 2048 units, but can be changed with the spawnarg combine_distance on the SEED entity. Raising this distance can reduce the entity count, but be warned that very large entities might take a long time to be updated, which can lead to stuttering when the player walks around.

Apparently when all your entities are combined into one, they all of them hide at once when using hide_distance.