Naruto Supreme Chaos
Problem description:Players usually experience some lag when they are around other players or NPC. I wanted to know what might be causing that
I am referring to movement lag, they kinda freeze up and no i coudn't find that, i only found a distance check proc to make sure they walk to them or somthing
|
So you have an ai proc that is looking for other mobs around them?
Is this proc available to both the player and npc mob tree, or only to the npc tree? |
Ok can you link the code for the players check then so we can see if that is causing it?
|
mob/var/tmp |
i need it so when the player moves AWAY from the npc it deactivates can u help me with that? I think that might by an issue cuz they stay active and walk around
|
for(var/mob/puppet/P in view(25)) See if that helps. |
no, i dont need it for puppet i need it for village shinobi for example so ill just change puppet to mob, P . M ok ill try
|
The thing is the var/mob/puppet/p in view(25) doesn't actually check if what you are passing into it is a puppet or not it is really checking:
for anything that the player can see within 25 tiles, but expect the player to only see puppet type mobs. By specifying that the argument should be of type mob/puppet we are telling the for loop to expect a puppet type so we can use it's variables. In your above case you could write it as: for(p in view(25)) and still have the same effect as we are not accessing any of P's variables inside the loop. What you want to do is this: for(var/mob/puppet/P in view(25)) This way anything inside the players view space of 25 tiles that is not a puppet type will be just parsed through. |
for(var/mob/puppet/P in view(25)) Do something like that, using whatever your output method is and see if it keeps calling the output even when you move 25 tiles away. Now remember view(25) is not 25 pixels, but rather 25 tiles. So if your tiles are say 32x32 than the view you are specifying is really 25*32 = 800 pixels away from the player, which if you look at your normal resolution of say 1900 x whatever screen that would mean that with the player on one edge of the screen and the enemie on the other edge of the screen the distance between the enemie and player would be about 42% of your screen width. |
after i added that code you told me about (puppet one) i wud freeze up close to npc and lag sooo damn hard that i wud have to quit the game and restart it.
|
do u have something that is like... if they players GOES OFF THE SCREEN OF THE NPC (isnt in the npc view) the npc decativates
|
You could move this proc to the mob/enemie/npc type and have it look for the mob/player type within view 25 and if the npc sees a mob/player than it would move. However, then you will have a bunch of NPC's that are constantly searching for a player.
Also inside: M.ai_random_wander() Do you have something that checks if an NPC is active or note? |
Such as a who type of event that looks for players/npcs or certain contents around the player?
I would suggest looking for things like that, also when you say lag do you mean network latency or are you referring to the CPU bottlenecking?