• Welcome to Valhalla Legends Archive.
 

Clarifying D2GS

Started by OnlyMeat, July 18, 2004, 02:29 AM

Previous topic - Next topic

OnlyMeat

From what i have found their appears to be multiple formats for S-->C D2GS packets and i would like to clarify this situation.

Take for example the first couple packets sent to you from the server when first connected:-


RECV                    | D2GS (0xae)
AE 01 00 00 00 00

RECV                    | D2GS (0x05)
05 7A 09 2E EF 00


This has a format of:-
(BYTE) ID (This also appears to be the length of the packet in most cases)
(DATA)

Of course the packets are supposed to be compressed but again this appears to only apply to certain packets namely ones with larger sizes.

The main problem is inconsistencies while trying to perform generic processing of these packets.

Compressed packets for someone sending a chat message in game:-

(BYTE) Uncompressed length
(BYTE) 0x0f always this for some reason

Example:-

RECV                                 | D2GS (Unknown ID)
1D 0F 1E BF CA 22 D8 CA 34 0D AA C6 81 90 F4 42 16 55 9E 9E 8C A3 5C B4 33 0D 2B 07 18


The first byte here is the packet length but the packet seems to be compressed so the question would be how to extract the real packet length?
and is their an ID for these compressed packets if so which offset are they located at?

From the looks of sample decompression code on this forum it does something with the first 2 bytes to calculate the real length, can this be confirmed and is this standard huffman as my knowlege of it is limited.

And finally is the actual decompression standard huffman or maybe a variant?

Any ideas or thoughts would be appreciated.

K

#1
Although I have never done any work with this, I believe you are correct that is compressed with huffman.  There is some code posted around here somewhere that decompresses the packets, but I have also heard that it fails to handle several cases properly.   I'll search and post back.

Edit:
Check here; also if you go to the search, choose advanced search, search for posts containing "huffman" (you may need to change the default date to something older), you should find more conversations on the topic.