Talk:NPC Lag Compensation: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 2: Line 2:
Rather than large code blocks, I had initially used the form "select this whole function and find & replace ''in selection'' Player, replacing with Entity" ... this got very confusing.
Rather than large code blocks, I had initially used the form "select this whole function and find & replace ''in selection'' Player, replacing with Entity" ... this got very confusing.
--[[User:Winston|Winston]] 16:40, 11 Apr 2008 (PDT)
--[[User:Winston|Winston]] 16:40, 11 Apr 2008 (PDT)
----
We used this code for [[Zombie Master]], and it appears to contain a memory leak (at the time of writing). I solved it by moving the NPC's lag compensation data (ie. its linked list of LagRecords etc) into BaseNPC. Not very pretty, but it stops leaking memory. I'd theorize that the switching around of tracks performed in UpdateAIIndexes() may be losing track of memory somehow, perhaps only in certain edge cases where many NPCs die. Whatever the cause, having each NPC hold its own lagcompensation data simplifies things a lot and prevents the leak from occurring.
I don't feel I have sufficient information on the cause of the leak to modify this article, and the solution I described isn't ideal, but I figured I'd at least leave a note for people who run into a similar problem.
--[[User:TheGreenBunny|theGreenBunny]] 01:12, 13 Dec 2008 (PST)

Revision as of 02:12, 13 December 2008

I appreciate that this article is messily laid out ... help on that front would be appreciated! Rather than large code blocks, I had initially used the form "select this whole function and find & replace in selection Player, replacing with Entity" ... this got very confusing. --Winston 16:40, 11 Apr 2008 (PDT)



We used this code for Zombie Master, and it appears to contain a memory leak (at the time of writing). I solved it by moving the NPC's lag compensation data (ie. its linked list of LagRecords etc) into BaseNPC. Not very pretty, but it stops leaking memory. I'd theorize that the switching around of tracks performed in UpdateAIIndexes() may be losing track of memory somehow, perhaps only in certain edge cases where many NPCs die. Whatever the cause, having each NPC hold its own lagcompensation data simplifies things a lot and prevents the leak from occurring.

I don't feel I have sufficient information on the cause of the leak to modify this article, and the solution I described isn't ideal, but I figured I'd at least leave a note for people who run into a similar problem. --theGreenBunny 01:12, 13 Dec 2008 (PST)