> How are entindices ordered on the client? I know entindex 0 is worldspawn, > then comes 1-32 for players, but what comes after that? Are the rest of the > ents grouped by classname, by position, by order in the BSP, or some other > way I haven't come up with yet? > > I'm currently parsing the BSP myself on the client so I can pull keyvalues > straight from the map without a message. I'm looping through all the > entities in the ent lump and storing off the index of each if it's an entity > I want to look at, but GetEntityByIndex() called with that index isn't > returning the correct entity so I can poll its origin and angles. Anyone > have any tips on why this doesn't appear to be working correctly?
Leon or someone else from Valve can correct me if I'm wrong, but I believe that the entities are stored in-game using a linked list that the engine keeps internally. When you look through the entities (using UTIL_FindEntityInSphere, etc.), the engine interates through this linked list. When an entity gets removed (UTIL_Remove), the engine simply unlinks that entity from the linked list and frees the memory associated with that entity. My quess is that the entities are originally spawned in the same order that they appear in the BSP file, but since some entities spawn other entities when they are created, the index in the BSP file would not match the index of the entities that were created in-game (especially the ones toward the end of the list), of course as the game progresses, old entities are removed and new entities are created, grabbing whatever index is free in the existing list. I don't think you have a hope of matching up indexes in the BSP file with anything that exists while the game is running. Jeffrey "botman" Broome _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders