Questions regarding entities

ics

http://ics-base.net
aa
Jun 17, 2010
841
541
Thing is, i'm trying to reduce entities in the map and looking for ways to do this. I know which ones are taking the space and i'm looking into how i can reduce them without hitting the magical 1400 that i've kept as a limit to have working map for 32 slot players.

In order for me to save time instead for testing out, does killing entities such as info_player_teamspawn or path_track entities decrease edicts count? Also, are there problems when teams switch sides and map starts over if these entities are killed in previous round?
 

worMatty

Repacking Evangelist
aa
Jul 22, 2014
1,257
999
Yes, when you kill entities, the edict count is reduced. Don't worry, killed entities are resurrected when the map is reset when the round changes. Killing entities that you don't need any more is good practice. As you'll probably have seen in the Source wiki, in Left 4 Dead 2's engine branch, lots of entities have an OnKill output, meaning killing entities is more like part of the logic process and not just cleaning up.

A good rule of thumb is that anything that can accept an input counts towards an edict (with the exception of light and light_spot that haven't been given a targetname). So watch out for things like prop_dynamic, point_spotlight and env_sprite.

Cleaning up your logic by consolidating instructions in to less entities will help cut down edicts. For example, moving the contents of logic_relay in to the button that triggers it. Or using the OnMotionEnable output of a prop_physics_multiplayer rather than a separate trigger_multiple set up to detect physics objects.
 
Mar 23, 2013
1,013
347
Something I've picked up that dynamic models with a lot of different animations (I believe it is), take up more on the edict limit than ones with less.

Not if they don't have a collision model. A dynamic prop takes up as many edicts as many bones the model has UNLESS it has no colision model, then it only counts as a single edict.
So if you delete the .pys file (the file for the colision model) on custom props you will be fine, but if you are using player models or sentries as prop on your map, the entity count rises quickly
 

henke37

aa
Sep 23, 2011
2,075
515
In conclusion, don't use models with lots of bones. Luckily, most only have one.
 

henke37

aa
Sep 23, 2011
2,075
515
There's models with lots of bones, but no collision model? Kinda strange combination.
 
Mar 23, 2013
1,013
347
There's models with lots of bones, but no collision model? Kinda strange combination.

IStrange? Snowplows train-destruction-devices have many bones originally and added a lot to the entity count. I think they removed the colision model and made the colision with nodraw brushes.
Also all of FissionMetroid101's models in our old szf_isaac map had their colision removed after I found out that I would get rid of around 500 (!) edicts that way
 
Last edited:

ics

http://ics-base.net
aa
Jun 17, 2010
841
541
IStrange? Snowplows train-destruction-devices have many bones originally and added a lto to the entity count. I think they removed the colision model and made the colision with nodraw brushes.
Also all of FissionMetroid101's models in our old szf_isaac map had their colision removed after I found out that I would get rid of around 500 (!) edicts that way

Well this certainly explains some things that i've been wondering over the years. Valve usually makes stuff out of nodraw brush and doesn't use the model collision if the model is big. But this was good to know that also collision models can cause edict count to raise up.

But what is the easiest way to notice in Hammer if the model is edict heavy as in having more than 1 bone? I get that it's something that is part of current maps or larger object usually but anything else than just knowing it? I'm working on a map that uses 1200 entities now, and it's payload. I can reduce the stuff with 200 easily by cutting some lighting and making those payload curves that are more longer to tighter etc but still i get left with 1000 edicts which is still high if i plan to keep it under 1400 after i'm done what i'm about to do.
 

henke37

aa
Sep 23, 2011
2,075
515
Your best bet is to profile. There is a console command to count the edict use by entity class.
 
Mar 23, 2013
1,013
347
But what is the easiest way to notice in Hammer if the model is edict heavy as in having more than 1 bone? I get that it's something that is part of current maps or larger object usually but anything else than just knowing it? I'm working on a map that uses 1200 entities now, and it's payload. I can reduce the stuff with 200 easily by cutting some lighting and making those payload curves that are more longer to tighter etc but still i get left with 1000 edicts which is still high if i plan to keep it under 1400 after i'm done what i'm about to do.

Just look at the model and check if it's has a complex animation, since bones are used to move different parts of the model in induvidual direction. A player has bones for every limb (just like real live :O) a sentry has bones the main part, the bullet chain, the rocket launcher, the barels and maybe some metal parts.
The grandfarther clock from cp_mann_manor only has two bones: one for the clock and one for that swinging thingy.



You said you are cuting down lighting to remove edicts? Some entities in hammer dosn't add to the edict count in game:
-prop_static
-info_overlay
-info_overlay
-func_viscluster
-light, light_spot, (UNLESS it has a name)
-info_lighting
-env_cubemap
-func_detail
-func_instance

So you don't need to cut down on them. However you could remove some point_spotlights which are barely noticeable or are used on pairs certain lamps. Or like you said: place func_paths so that curves are sliughtly less smooth.
ALso quite effective is to merge certain brush-entities which have the same properties. Like if you have several trigger_hurt on your map for death pits or other hazzards, you can merge them to one entitie. Just beware that you don't merge entities with different properties like a func_respawnroomvisualizer for different teams.

Hope that helps
 

henke37

aa
Sep 23, 2011
2,075
515
About that merging, has anybody made a tool to do that?
 
Mar 23, 2013
1,013
347
don't think so and I think you should do that manually, before some programm screws stuff up. It isn't much work anyway.
 

henke37

aa
Sep 23, 2011
2,075
515
It is rather easy to check that the entity class, the keyvars, the spawnflags and the I/O are all identical.
 

ics

http://ics-base.net
aa
Jun 17, 2010
841
541
So one more question related to this. Has anyone have any experience if entity, lets say for example logic_relay within a map is disabled, does it still count as an active edict or does it activate only after it has been enabled?
 
Mar 23, 2013
1,013
347
So one more question related to this. Has anyone have any experience if entity, lets say for example logic_relay within a map is disabled, does it still count as an active edict or does it activate only after it has been enabled?

yes, it still counts as an edict until it is killed.