Global packet class

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Global packet class

Post by Jabantiz » Thu May 24, 2012 10:26 pm

After working on getting 1096(DoV client) working for the emu I have realised that hunting down where a packet is constructed and sent can be a pain so what I am suggesting is a global packet class. Basically all this class will do is contain the code for building and sending the packets and hopefully organized by packet type (all item packets grouped together and quest packets grouped together, not scattered throughout). This way in the actual code when you want to send a packet all you would have to do is something like this

Code: Select all

packets.SendItemInfo(client, item);
In the above example packets would be the global class. This is basically just putting all the packet code in the same spot making it easier for us to find the packet we need to make changes to instead of trying to hunt it down in the many files and not being where we expect them to be (some quest packets are in client.cpp and not quest.cpp). This can also be done over time, only moving a few functions over at a time, it doesn't have to be an all at once change.

What do you guys think about this?

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Global packet class

Post by John Adams » Fri May 25, 2012 6:48 pm

I'm all for anything that makes reading and writing this code easier and less frantic. I had started pushing for separating all functionality into their own files (Items-related stuff in Items.cpp/ItemsDB.cpp, for instance) and we've started moving that direction, slowly. Usually only when we're re-writing a module anyway.

I see nothing wrong with a Global, accessible from anywhere, as long as it makes sense... and that specific systems code can still be found in the WorldServer/{folder}/{module} project layout.

I'd say give it a whirl, tell us how it feels.

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: Global packet class

Post by Jabantiz » Thu Sep 13, 2012 5:59 pm

I have been thinking about this a lot lately with my work on combat, movement, and AoD and it is a pain to find the packets the server sends sometimes. It also dawned on me that we already have a class for this (ClientPacketFunctions) it just refers back to other classes to make the packet. While I work on tradeskills I will add a new file (TradeskillsPackets.cpp) and try to keep all packet creation code in this file and see what every one else thinks.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: Global packet class

Post by John Adams » Fri Sep 14, 2012 8:18 am

Go for it. I'm a "must see" kinda guy, so after you give an example it will make more sense to me. As I said previously, anything that makes this mess easier to read, I am totally down for. Let us know if you need anything from us.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests