View Full Version : [INFO] How to make a complex map not entity CRASH!
Vilepickle
12-31-2007, 02:16 AM
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
jakeparlay
12-31-2007, 08:26 AM
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
12-31-2007, 11:34 AM
Map > Show Information in Hammer and adding up PointEntities and SolidEntities
Vilepickle
12-31-2007, 04:35 PM
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?
Nizzem
12-31-2007, 05:15 PM
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
12-31-2007, 05:44 PM
Yes. I thought it would actually be lower than it should be, not higher. Guess I was wrong.
phatal
01-13-2008, 08:28 PM
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
01-13-2008, 09:07 PM
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.
phatal
01-13-2008, 10:05 PM
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.
Can you not just enter that through the console?
Vilepickle
01-14-2008, 07:35 AM
Yes, it's just there so you don't have to type it.
DrHaphazard
01-14-2008, 10:36 AM
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
02-25-2008, 03:45 PM
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 (http://tf2maps.net/downloads.php?do=file&id=140) and constantly having to sacrifice entities to get my numbers down in order to add other things?
Vilepickle
02-25-2008, 05:10 PM
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
03-06-2008, 04:11 PM
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
03-06-2008, 08:00 PM
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
03-07-2008, 12:19 PM
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
03-07-2008, 12:30 PM
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,
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
03-07-2008, 02:01 PM
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
VelvetFistIronGlove
03-08-2008, 12:15 PM
I understood that func_details weren't compiled into actual entities in the final map, but that they were just geometry that was ignored by vis.
http://developer.valvesoftware.com/wiki/Func_detail says this:
This type of entity is only handled during vbsp compiling, and cannot be created or modified during runtime
Paria
03-09-2008, 06:50 PM
found a nice article posted on the wiki concerning entities, the first section probably goes way over and above anything we need to know, but the section about
cl_entityreport 1
seemed like a useful read http://developer.valvesoftware.com/wiki/Networking_Entities
and a pic of me trying to make my map crash (which it didnt \o/)
http://img98.imageshack.us/my.php?image=geothermal2880001pr5.jpg
Vilepickle
03-09-2008, 07:39 PM
I understood that func_details weren't compiled into actual entities in the final map, but that they were just geometry that was ignored by vis.
http://developer.valvesoftware.com/wiki/Func_detail says this:
They count towards the edict crash for sure. They may not be entities in the map, but when I reduced their number I definitely noticed crash count go down. Which means the engine probably flags func_details as entities during the compile and takes up those slots in the final map's count.
Vilepickle
03-26-2008, 12:41 PM
I discovered how to have up to the 4096 limit of entities. I was using prop_dynamics for models, and that ent type crashes with less entities.
Read the tutorial for updated info.
Paria
03-26-2008, 01:35 PM
as a footnot i think anything that appears in cl_entityreport 1 is using edicts, so anything you have a lot of that appear in this llist in-game are likely candidates for the crashing.
For me i went a bit overboard on the lighting - removed 20 or so spotlights and i've been fine since.
And although func_detailing as 1 total group lowers the total count i dont think it has any effect on the crashes either way.
Vilepickle
03-26-2008, 02:55 PM
as a footnot i think anything that appears in cl_entityreport 1 is using edicts, so anything you have a lot of that appear in this llist in-game are likely candidates for the crashing.
For me i went a bit overboard on the lighting - removed 20 or so spotlights and i've been fine since.
And although func_detailing as 1 total group lowers the total count i dont think it has any effect on the crashes either way.
the only thing detail combining would do is when you're near 4096 probably. Otherwise, not needed.
vBulletin® v3.8.2, Copyright ©2000-2013, Jelsoft Enterprises Ltd.