[INFO] How to make a complex map not entity CRASH!

Vilepickle

Banned
Oct 25, 2007
372
199
If you're like me, you use a lot of entities in your map. This can be a harmful thing when approaching the end stages of a very complex level, and I'm here to show you just why your level may be crashing on servers with only a few people up to 32 players.

According to the SDK wiki, the source engine can handle up to 4096 entities at a time. You may think you have that many to work with in your map, but in fact you have a good deal less than that. You see, play models in game, projectiles, whatever are considered entities as well and if there's a large number of them going off at once you may end up with a server crash that gets this engine error:

ED_Alloc: no free edicts

EDIT: 3/26/08
There is a second reason for a map that turns the edict error. If you are using too many of a certain type of entity, this will also crash the map under load, or even as the map loads, if there are enough of that entity type. If you use too many prop_dynamics or point_spotlight entities, the level will crash. There may be other entity types with low limits, but these are what I have encountered.

You can find how many you have by going to Map > Show Information in Hammer and adding up PointEntities and SolidEntities.

If you use prop_dynamic for your models, you can only have around 1600-1800 entities in your map. If you convert them to prop_static and limit your point_spotlight usage, you can easily have 3000+ entities in the map.

----------------------------------------------------
TESTING IF YOU ARE OUTSIDE OF "CRASH" RANGE

You should always test if your map crashes if you have a complex and intricate map. First, load up TF2 and in the console type "maxplayers 32". Next, Start your map.

It's handy to have a .cfg file similar to this in your "cfg" folder so you can exec bots.cfg and you'll have 31 bots with yourself on the blue team. Here's my bots.cfg:

sv_cheats 1
mp_teams_unbalance_limit 0
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot
bot_mimic 1


Now, type "exec bots.cfg" in the console.

This will spawn 31 bots and make them mimic you. If you jump and repeatedly hold down fire, you can stress the number of entities being drawn and possibly crash the server if your map is over the limit. Note that IF you crash your local game, your computer _may_ be hardlocked. If you have a Logitech G15 keyboard, there is a program called G15 Task Manager (http://www.jasonweimann.com/g15Tools.aspx) that allows you to kill the process and not have to restart your computer.

Another useful bot command is bot_changeteam 1 which will swap all bots to the other team (you can use this to balance the teams with bots, but it's not really needed).

----------------------------------------------------
I'M OVER THE LIMIT! I'M CRASHING!

If you're over the limit, work on reducing things like spotlights and prop_dynamic if you have a lot. Combining func_detail can reduce the general amount of entities as well.

Have fun...... err. well, if you're having a problem like this you probably aren't having much fun.

Good luck :p
 
Last edited:

jakeparlay

L2: Junior Member
Dec 11, 2007
66
2
vile, how are you arriving at those numbers? (ie, 1559 ents in Castle) is there a console command in-game, compile log, hammer method?
 

Vilepickle

Banned
Oct 25, 2007
372
199
Map > Show Information in Hammer and adding up PointEntities and SolidEntities
 

Vilepickle

Banned
Oct 25, 2007
372
199
Actually, now I'm pretty confused because i loaded granary and it has 4800+ entities.

The strange part about it is, when I reduced them in my map from the 1850 range to around 1500 it DID fix the crashes. Could there be a bug in the compiler or something?
 
Last edited:

Nizzem

L2: Junior Member
Nov 29, 2007
57
0
Are you looking at a decompiled granary?
Because I think Decompiled maps loose all of the func_detail grouping... meaning the entity count would be much much higher
 

Vilepickle

Banned
Oct 25, 2007
372
199
Yes. I thought it would actually be lower than it should be, not higher. Guess I was wrong.
 

phatal

L6: Sharp Member
Jan 8, 2008
259
21
The bot config is a great way to test, but we had a problem getting the bots to do anything more than stand there. Ideas why they might have not "mimiced" us?
 

Vilepickle

Banned
Oct 25, 2007
372
199
Hmm, maybe you forgot to copy the bot_mimic 1 command at the bottom of the config there? that's the command that makes them mimic your keys.
 

Vilepickle

Banned
Oct 25, 2007
372
199
Yes, it's just there so you don't have to type it.
 

DrHaphazard

L5: Dapper Member
Jan 6, 2008
249
12
Sorry, I was confused about the whole func_detail bit. I thought func_details were for brushes, not for entities. Are you simply saying that the func_details will reduce the strain on the computer drawing all those brushes, thereby leaving more computing power for entities?
 

Termaximus

L5: Dapper Member
Jan 11, 2008
229
32
Basic Answer

Sorry, I was confused about the whole func_detail bit. I thought func_details were for brushes, not for entities. Are you simply saying that the func_details will reduce the strain on the computer drawing all those brushes, thereby leaving more computing power for entities?

I see you posted this a long time ago, but for someone else reading it basically when you take world geometry and turn it into a func_detail it "becomes" an entity. This is my understanding and could be completely wrong.

If you are still seeing this Vile (or anyone else who may know) have you revised your 1600 limit any as I am at this for my map cp_2Skyscraper and constantly having to sacrifice entities to get my numbers down in order to add other things?
 

Vilepickle

Banned
Oct 25, 2007
372
199
They might have fixed this (doubtful, since it's probably something capped for consoles or something). If you're unsure I'd be safe and check for it.

As for func_details, they DO count towards entities in the map. Combining them into 1 when you're done goes a long way in reducing the final count.
 

Vilepickle

Banned
Oct 25, 2007
372
199
Updated, removed the player limit remover link since maxplayers is now unlocked from latest patch. Added link to G15 task manager, updated config to include 31 bots... etc.
 

Paria

L5: Dapper Member
Dec 12, 2007
202
31
this is really bugging me atm, ive tested my map on a 24 man server and encountered no errors, i've ran the bots on a local server mimicing me no problems, as soon as i introduce 31 bots on a local server and mimic my map will crash with

ed_alloc : no free edicts

so i had a look through the valve decompiled maps - i even re-grouped the func_detail to 1 entire group

and even then taking 2 fort as an example

point entities 3480
solid entities 188 (after i func_detailed in 1 group)

my map is currently sitting on

point entities 2839
solid entities 82 (now all func_detail is 1 group)

and my map with crash with 31 bots mimicing me, so what other measures have valve taken that dosent show up in a decomplied vmf ?

if there are any other ways to reduce the count i'd be glad to hear since i dont want to start stripping my map to pieces just so it can run on a 32 man server just yet :/
 

Vilepickle

Banned
Oct 25, 2007
372
199
Hmm, interesting. I know some other people have said they're over now too, but I'm not sure if they've run this test completely yet.

As far as I figured out the only way to get it working properly was to reduce the count. What do you have a lot of? I assume you have a lot of the spotlight effects coming off of lights. You can probably remove a lot of those in non-important areas and get off ok.
 

Paria

L5: Dapper Member
Dec 12, 2007
202
31
it really does seem hit and miss, since its my first map i save maps like a bitch to make sure if i screw up i havent screwed up too much :)

i've gone through some parts today and removed alot of point spotlights that were just for show, and tbh you dont miss them, i've managed to get a 32 man server to spam themselves out of ammo and not crash, and some later builds when i've made the tiniest of changes seem to crash again,

this is what my current compile contains,

Code:
Object names       Objects/Maxobjs  Memory / Maxmem  Fullness 
------------       ---------------  ---------------  -------- 
models                  26/1024         1248/49152    ( 2.5%) 
brushes               5208/8192        62496/98304    (63.6%) 
brushsides           39415/65536      315320/524288   (60.1%) 
planes               12928/65536      258560/1310720  (19.7%) 
vertexes             25020/65536      300240/786432   (38.2%) 
nodes                 2667/65536       85344/2097152  ( 4.1%) 
texinfos              3078/12288      221616/884736   (25.0%) 
texdata                213/2048         6816/65536    (10.4%) 
dispinfos                0/0               0/0        ( 0.0%) 
disp_verts               0/0               0/0        ( 0.0%) 
disp_tris                0/0               0/0        ( 0.0%) 
disp_lmsamples           0/0               0/0        ( 0.0%) 
faces                14218/65536      796208/3670016  (21.7%) 
hdr faces                0/65536           0/3670016  ( 0.0%) 
origfaces            12520/65536      701120/3670016  (19.1%) 
leaves                2694/65536       86208/2097152  ( 4.1%) 
leaffaces            19004/65536       38008/131072   (29.0%) 
leafbrushes           8779/65536       17558/131072   (13.4%) 
areas                    2/256            16/2048     ( 0.8%) 
surfedges           123220/512000     492880/2048000  (24.1%) 
edges                79299/256000     317196/1024000  (31.0%) 
LDR worldlights        488/8192        42944/720896   ( 6.0%) 
HDR worldlights          0/8192            0/720896   ( 0.0%) 
leafwaterdata            7/32768          84/393216   ( 0.0%) 
waterstrips           1994/32768       19940/327680   ( 6.1%) 
waterverts               0/65536           0/786432   ( 0.0%) 
waterindices         41991/65536       83982/131072   (64.1%) 
cubemapsamples          57/1024          912/16384    ( 5.6%) 
overlays               159/512         55968/180224   (31.1%) 
LDR lightdata         [variable]     4256000/0        ( 0.0%) 
HDR lightdata         [variable]           0/0        ( 0.0%) 
visdata               [variable]      218046/16777216 ( 1.3%) 
entdata               [variable]      324776/393216   (82.6%) VERY FULL!
LDR ambient table     2694/65536       10776/262144   ( 4.1%) 
HDR ambient table     2694/65536       10776/262144   ( 4.1%) 
LDR leaf ambient     11761/65536      329308/1835008  (17.9%) 
HDR leaf ambient      2694/65536       75432/1835008  ( 4.1%) 
occluders                0/0               0/0        ( 0.0%) 
occluder polygons        0/0               0/0        ( 0.0%) 
occluder vert ind        0/0               0/0        ( 0.0%) 
detail props          [variable]           1/12       ( 8.3%) 
static props          [variable]           1/106560   ( 0.0%) 
pakfile               [variable]     6170413/0        ( 0.0%) 
physics               [variable]     1859905/4194304  (44.3%) 
physics terrain       [variable]           2/1048576  ( 0.0%)

ive reduced the entdata from 89.3% , however im not 100% trusting that it wont fall over on its arse on a 32 man server now :<
 

Vilepickle

Banned
Oct 25, 2007
372
199
Entdata is just the size of the entity block itself and I'm fairly sure it has nothing to do with crashes. 384kb is the recommended entity block size, but it can go above it. This includes stuff like the entity's name, and any information included in it. What DOES matter is the number of entities under Map > Show Information
 
Dec 25, 2007
566
440