Re: [Quake-C] Tracebox / Traceline - advanced entity ops
Quake C mods and support - SSQC / CSQC
Brought to you by:
teknoskillz
From: Cobalt <co...@te...> - 2016-02-27 17:11:37
|
Encountered another oddity regarding freed edicts. Lets say you spawn a MOVETYPE_FOLLOW ent, for example and set it to follow missiles / projectiles. If by chance you dont code the missiles remove () function to find the FOLLOW_ENT, the ent stays on the server, and keeps its last known .aiment pointer to the now "free" edict. So if the server decides, lets re-use that previously removed edict for something new the QC spawns, the ent will have that other ent still follow it, or any other ent thats spawned with that same edict No. The cvars would not help in these cases, so I am gonna try this every frame : if (other.movetype == MOVETYPE_FOLLOW && wasfreed (other.aiment)) remove (other); But still, may not be 100% fix because we could be creating a MOVETYPE_FOLLOW which is being attached to a new ent which is legit / being created for the 1st time, and the engine still may have decided to pick a previously freed ent. If the spawn () feature was modified , maybe something like: entity (float edictno) spawn_apply = #14; ...where we get to pick a specific editc no in advance, this would increase the chances greatly we dont re-use an old edict no, and can pick more or less from a "reserved" set we outline in the mod. I suppose I could set prvm_reuseedicts_startuptime to a number very high, perhaps something like half the timelimit of the match played, since I am doing deathmatch right now, but still its kinda kicking the can down the road, unless you make the time equal to or greater than the time limit I suppose. Then you are never reusing them I suppose, and would just have to make sure your mode does not exceed 1024 overall edicts spawned in the mod...or I think the number may be greater in Darkplaces...I believe Lord Havoc told me its a few thousand. > You might want to check these out > > cvar prvm_reuseedicts_neverinsameframe is "1" ["1"] never allows re-use of > freed entity slots during same frame > cvar prvm_reuseedicts_startuptime is "2" ["2"] allows immediate re-use of > freed entity slots during start of new level (value in seconds) |