Quote:
Originally Posted by Yen
I have a similar system, but showing NPC nicknames was still causing quite a bit of lag on gmaps. So I just disabled NPC names from gmaps. :(
|
Well, if you haven't done this. if (obj.nick && !(obj in players))
---without the !(obj in players) it will make the player's nick invisible if set to 0.
---might be a more precise move to try if ("nick" in obj.getvarnames()), but I don't know if nick might be a static var for NPCs.
What I do for npcs on gmaps is something like findareanpcs(mapx(0,0),mapy(0,0),screenwidth/16,screenheight/16)
I do this on normal levels too. In the same sense I do it for players by checking the range of coordinates-- it might be faster if there was a findareaplayers function, but I can't honestly say.
My nick system continues showimgs in a timeout loop, and uses hideimgs on the very last indeces only by the amount of nicks that will no longer be displayed. If you hide all of the images and then redraw them all, it can make a lot more lag.
I'm pretty sure that the only way I can try to make my nick system less laggy now, though each way I think of could possibly make it laggier, is to incorporate the default nick system, which it wouldn't match quite precisely, keep track of precisely which indeces to hide and then let them fill up, or keep track of every single player to see if they've moved and only change the showimg if they have.
I can't really tell if incorporating the built-in nicks system is faster or slower because my computer isn't extremely affected by lag (unless it's really bad), and to add on that you can't measure the CPU time of the built-in nicks system.
Keeping track of precisely which indeces to hide and then let them fill themselves up would probably be the most likely to reduce lag, but probably wouldn't reduce it significantly, if at all.
Keeping track of every single player's coordinates could possibly create more lag... but I can't really say because I haven't tried it. Something like this would probably make more sense in the state script.