Page 1 of 2

Rev 1407 and Combat Testing

Posted: Fri Jul 24, 2015 3:23 pm
by John Adams
I'm just going to post crash stuff here. We ran quite a long time without incident, then got our first crash with 8 clients active.

Code: Select all

>	WorldServer.exe!std::vector<DataStruct *,std::allocator<DataStruct *> >::begin() Line 982	C++
 	WorldServer.exe!PacketStruct::GetDataStruct(const char * name) Line 124	C++
 	WorldServer.exe!PacketStruct::GetUInt32(const char * name, unsigned int pos) Line 591	C++
 	WorldServer.exe!Loot::SendToClient(const std::shared_ptr<Client> & client, PacketStruct * packet) Line 143	C++
 	WorldServer.exe!ChunkServer::HandleClientLootRequest(const std::shared_ptr<Client> & client, PacketStruct * packet) Line 1254	C++
 	WorldServer.exe!ChunkServer::HandleNPCInteractionRequest(const std::shared_ptr<Client> & client) Line 1792	C++
 	WorldServer.exe!ChunkServer::ProcessPackets() Line 349	C++
 	WorldServer.exe!ChunkPacketThread(void * data) Line 120	C++
 	WorldServer.exe!ThreadRun(void * arg) Line 77	C++
 	WorldServer.exe!_callthreadstart() Line 255	C
 	WorldServer.exe!_threadstart(void * ptd) Line 239	C
 	kernel32.dll!7716337a()	Unknown
 	[Frames below may be incorrect and/or missing, no symbols loaded for kernel32.dll]	
 	ntdll.dll!77c492e2()	Unknown
 	ntdll.dll!77c492b5()	Unknown

Last few lines of the console:
[quote]15:20:23.196 D Combat Processing Kill.
15:20:23.197 D Combat PlayerCombat::ProcessKill() Removing Autoattack
15:20:23.198 D Combat Processing NPC Death.
15:20:23.199 D Command PlayerCombat::ProcessNPCDeath() Player Apaelias killed Waspling, database id 850724.
15:20:23.204 D Item Adding item 1424947 (Qalian Defender's Pauldrons) with unique_id 0 to pawn inventory.
15:20:23.205 D Command PlayerCombat::ProcessNPCDeath() attaching loot to target.
15:20:23.206 D Command PlayerCombat::ProcessNPCDeath() Processing experience.
15:20:23.207 D Combat PlayerCombat::ProcessNPCDeath() Getting adventure experience...
15:20:23.208 D Combat PlayerCombat::ProcessNPCDeath() Getting adventure level of target...
15:20:23.209 D Combat PlayerCombat::ProcessNPCDeath() NPC Level: 4. Setting adventure experience...
15:20:23.210 D Combat PlayerCombat::ProcessNPCDeath() Sending character update...
15:20:23.218 D Combat PlayerCombat::ProcessNPCDeath() Awarded player Apaelias 40 experience.
15:20:23.342 D NPC NpcMotor::CombatExit: Exiting Combat
15:20:25.926 D Item Sending Pawn Items to Loot Window[/quote]

Oddly here, the packet struct was empty:

Code: Select all

void Loot::SendToClient(const shared_ptr<Client>& client, PacketStruct *packet){

Re: Rev 1407 and Combat Testing

Posted: Fri Jul 24, 2015 3:29 pm
by Apaelias
I think I broke it again

Re: Rev 1407 and Combat Testing

Posted: Fri Jul 24, 2015 3:33 pm
by John Adams
You did, but it's consistent. Not sure if Zippy is around for this right now, but I'm going to have to disable Loot for a moment til he has a chance to look at why the struct is blank.

Apaelias, try it again please?


Notes: Apaeleyos killed a Rat, a few seconds later was told he just lost 6bil plat. HIs "money" field in the database is currently: 14829735431815798992

Something amiss with the player HP calcs; I am level 50 but still only have 128 HP. I thought there was a basic calc by level? If not, skip it.


Performance-wise, the CPU is running very hot for only having 8 connections and no movement (outside of combat). 45-55% CPU steady. Collecting a 2 hour report of the machine's performance we can analyze later. Performance isn't important today, as we will make it better over time.

Re: Rev 1407 and Combat Testing

Posted: Fri Jul 24, 2015 7:17 pm
by zippyzee
Sorry to hear about the issues. I'm dealing with class reunion events tonight and tomorrow. I'll look into it as soon as I can.

Lots of things we can improve on performance-wise so that will take some sorting out as well.

Re: Rev 1407 and Combat Testing

Posted: Fri Jul 24, 2015 7:36 pm
by John Adams
Not a single thing in this universe to be sorry about. From another post earlier:

[quote="John Adams"]Added note, considering the pounding the few of us are giving this code, it is amazingly solid (no crashes) with all that it is doing. Respawns are working, just the one loot issue so far and it hasn't happened again after restarting the world.[/quote]

I used two words I never use together:

amazingly
solid

Good work, zippy. Take the night off.

Re: Rev 1407 and Combat Testing

Posted: Fri Jul 24, 2015 9:20 pm
by John Adams
Zippy, this might be telling. Earlier when I saw the loot crash, I commented out this call to HandleClientLootRequest, which was where the stack led me:

Code: Select all

	// case target is Lootable:
	if (interaction_target_npc->GetEntityTypes() & EntityBitmaskLootable) {
		HandleClientLootRequest(client, nullptr); 
		return;
	}
Just a bit ago, after no more crashes and hundreds of kills/loots, I put the code back in and with the hour and a couple of attacks, we're crashed at the same place.

Looting still worked without this, so I'm not sure what is driving it. Maybe it'll help debug.

Re: Rev 1407 and Combat Testing

Posted: Fri Jul 24, 2015 10:52 pm
by John Adams
Hydrazine pointed out that when one character in the chunk casts an ability, everyone's cool downs trigger. I am standing next to him and not doing anything, but my spell gems go dark like I cast them myself. Is this Abilities, which are not yet implemented into combat code? Or is this a bigger issue for Faux to investigate with abilities and cooldown timers?

Re: Rev 1407 and Combat Testing

Posted: Sat Jul 25, 2015 3:50 am
by zippyzee
[quote="John Adams"]Zippy, this might be telling. Earlier when I saw the loot crash, I commented out this call to HandleClientLootRequest, which was where the stack led me:

Code: Select all

	// case target is Lootable:
	if (interaction_target_npc->GetEntityTypes() & EntityBitmaskLootable) {
		HandleClientLootRequest(client, nullptr); 
		return;
	}
Just a bit ago, after no more crashes and hundreds of kills/loots, I put the code back in and with the hour and a couple of attacks, we're crashed at the same place.

Looting still worked without this, so I'm not sure what is driving it. Maybe it'll help debug.[/quote]

I will certainly look into it today. The loot code is from a while back, and maybe in moving it around to fit the combat needs I've got something unnecessary in there. In any case there needs to be some check somewhere to not send a faulty packet. If it works without it, leave it commented out for now.

Re: Rev 1407 and Combat Testing

Posted: Sat Jul 25, 2015 4:42 am
by Faux
[quote="John Adams"]Hydrazine pointed out that when one character in the chunk casts an ability, everyone's cool downs trigger. I am standing next to him and not doing anything, but my spell gems go dark like I cast them myself. Is this Abilities, which are not yet implemented into combat code? Or is this a bigger issue for Faux to investigate with abilities and cooldown timers?[/quote]

I glanced at my code for this and the only thing I can think of is that this might occur because I was reusing a packetstruct to send the various components of spell casting. Global cool down and refresh were only being sent to the client that cast the spell, but maybe there was some bad data in there from the previous usage of that packetstruct (i.e. packetstruct *out was used for cast animations which are sent to all clients and for refresh which is sent to only 1 client.)

I changed them all to use their own packetstruct.

Edit: I had a moment so I fired up my non-local world server, logged in two accounts and had them casting right next to each other, both individually and simultaneously. Neither character was getting the other character's cool down info. Let me know if you see something different.

Re: Rev 1407 and Combat Testing

Posted: Sat Jul 25, 2015 7:34 am
by zippyzee
[quote="zippyzee"][quote="John Adams"]Zippy, this might be telling. Earlier when I saw the loot crash, I commented out this call to HandleClientLootRequest, which was where the stack led me:

Code: Select all

	// case target is Lootable:
	if (interaction_target_npc->GetEntityTypes() & EntityBitmaskLootable) {
		HandleClientLootRequest(client, nullptr); 
		return;
	}
Just a bit ago, after no more crashes and hundreds of kills/loots, I put the code back in and with the hour and a couple of attacks, we're crashed at the same place.

Looting still worked without this, so I'm not sure what is driving it. Maybe it'll help debug.[/quote]

I will certainly look into it today. The loot code is from a while back, and maybe in moving it around to fit the combat needs I've got something unnecessary in there. In any case there needs to be some check somewhere to not send a faulty packet. If it works without it, leave it commented out for now.[/quote]

That looks like some code I didn't put in or even know about. I am not in the habit of using nullptr for anything, so it seems odd to me. I already have it handled with a separate opcode so that looks to be redundant and definitely a source of problems.