PDA

View Full Version : 0.2.5 Bug in Process(), AddHateToNPC() ?


ScotchTape
03-20-2002, 02:59 AM
I'm finding that the world server is disconnecting the client, which then alerts the zone server, and soon I'm like bad tape: curled, mangled, and finally let go.

I'm just assuming that someone else has seen this problem too.

Right before the release, the client sends up to the server the opcode to player save (not the profile save), then sends out a scattering of unknowns (0x442 I think). While hunting through the code base, it looks like the problem lies somewhere in the process() thread for the client.

For a while I thought there was a bug in AddHateToNPC()*, but I've since removed that and things run a little smoother, but the problem is still there (world server disconnect because). It isn't from a client timeout, either, as the world server detects that the client is no long active (see Packet_Manager.CheckActive()).

Back in the zone server, Client::Process(), I'm finding that I remain active for a long time -- even after the world server disconnects me. This leads me to believe that there is a segment somewhere that I'm missing, but I'm not sure what. I've scoured the world source, and the only thing I can figure is that the world server just stops responding to the client, and I'm assuming it's connected with how the zone server is processing ::Process(), but I admit that I'm just reaching here.

* AddHateToNPC() I think could use some tweaking. In that bulk of code is an else, translates to (!Npc->IsEngaged()), that is being called whenever an NPC is not engaged. Someone has a comment in there to the effect of //heal buddy or some such, and well I'm telling you, that by default all NPCs are not engaged, so I wouldn't think that to be a good idea to put anything in there. I'm also trying to figure out, maybe someone could enlighten me, as to why AddHateToNPC() is being called at the char select screen and even after the client has disconnected up until zone sleep?

TIA

-ST

Shawn319
03-20-2002, 03:23 AM
Are you using latest patch? if so your screwed until 0.2.6 comes out.. u can play 0.2.6 on Lyenu's or Hogies server. no eta on public release yet.

ScotchTape
03-20-2002, 03:29 AM
No, this is prepatch and in a fairly isolated environment (me being fancy and saying that I haven't patched).

There have been some other posts (one from drawde about lag) about the 0.2.5 base. Have there been any changes to the way communication between server/client is handled is 0.2.6?

Merkur
03-20-2002, 05:55 AM
* AddHateToNPC() I think could use some tweaking. In that bulk of code is an else, translates to (!Npc->IsEngaged()), that is being called whenever an NPC is not engaged. Someone has a comment in there to the effect of //heal buddy or some such, and well I'm telling you, that by default all NPCs are not engaged, so I wouldn't think that to be a good idea to put anything in there. I'm also trying to figure out, maybe someone could enlighten me, as to why AddHateToNPC() is being called at the char select screen and even after the client has disconnected up until zone sleep?

TIA

-ST

Because its in the NPC Process(). Every NPC scans for foes or friends evertime. The procedures for friends are not in yet, so don't say that would be bad :).
BTW this function does not send any packet to the client so it does not cause any lag cleintside. But of course it uses some CPU time and bandwith to your SQL Server (which should be local).
If you want this function to use less CPU Time set scanarea_timer up, its currently 500 ms (that means every NPCs will run this procedure every 500 ms)

im going to update this procedure soon though to reduce the sql querys :)

ScotchTape
03-20-2002, 06:33 AM
Because its in the NPC Process(). Every NPC scans for foes or friends evertime. The procedures for friends are not in yet, so don't say that would be bad :).
[/B]


Ah, now that makes more sense. It's starting to click for me, especially after looking at the check in npc.cpp before you step into it.

As for performance, I'm trying to track down some spots that could use a little tweaking. You guys wouldn't happen to have any on your 'todo' list would you?