IntroductionCurrently each packet has a name that takes up 1 byte per character. Thats not good, instead we want to keep the packet name, but only want it to take up 1-2 bytes per packet.
Backup your source!Begin with adding this in a module in the client:
Code:
Public Enum ClientPacketNames
End Enum
We will store the packet names inside it. And make them only take up 1-2 bytes, regarding what number thats assigned to them.
Now go into your handledata sub client side. The first packet on the top on a unedited mse1 is:
Code:
If LCase(Parse(0)) = "alertmsg" Then
We will rename that line of code to this:
Code:
If LCase(Parse(0)) = CPNAlertMsg Then
The CPN stands for ClientPacketNames, this is just how I'd like to organize it. Now, go into your:
Code:
Public Enum ClientPacketNames
And at the top of that add:
Code:
CPNAlertMsg = 0
So it looks like:
Code:
Public Enum ClientPacketNames
CPNAlertMsg = 0 '"alertmsg"
End Enum
I suggest you add the packet name as a comment after the new name as I did in the example above, cause that method will be very usefull when your starting on the server.Now all the names below that will have +1 on their number. So you dont need to write = 1, = 2 etc. It does that on its own.
Now basicly you do the same for all the packets in the client handledata sub. This is the
time consuming part, but it's worth it. I will do one more example for you though. The next packet in a unedited mse1 is:
Code:
If LCase(Parse(0)) = "allchars" Then
Now you should know how to write that, but if you don't, here it is:
Code:
If LCase(Parse(0)) = CPNAllChars Then
And after that, you will need to add that to the Enum, so it looks like this:
Code:
Public Enum ClientPacketNames
CPNAlertMsg = 0 ' "alertmsg"
CPNAllChars ' "allchars"
End Enum
That should give you enough information to carry this on through the whole client handledata sub.
When you have completed that! You will copy the whole Public Enum ClientPacketNames and paste it into the server in a module. When you've done that, you will start searching for the old packet names in the server. Now it's good that we saved those old names after the new onse in the enum type. So now, search for the first you have in your Enum type, in a unedited MSE1, It should be:
Code:
"alertmsg"
Now you will find this:
Code:
Sub AlertMsg(ByVal Index As Long, ByVal Msg As String)
Dim Packet As String
Packet = "ALERTMSG" & SEP_CHAR & Msg & SEP_CHAR & END_CHAR
Call SendDataTo(Index, Packet)
Call CloseSocket(Index)
End Sub
But we are focusing on this part:
Code:
Packet = "ALERTMSG" & SEP_CHAR & Msg & SEP_CHAR & END_CHAR
We will change that to the new packet name that only take 1 byte, instead of 8 bytes. So it looks like this:
Code:
Packet = CPNAlertMsg & SEP_CHAR & Msg & SEP_CHAR & END_CHAR
And you will keep doing that for all the packets thats being sent from the server to client. When this is done, probably after 1-2 hours. You will do the same procedure, but from the other direction.
Now you start on the server, with adding a:
Code:
Public Enum ServerPacketNames
End Enum
And do as you did in the client before, and also remember to paste the whole Public Enum ServerPacketNames into the client after your done with them.
If you need any further help, just post and I'd be glad to help you.