Author | Message | Time |
---|---|---|
ChR0NiC | Can anybody tell me the structure of an SC in game packet? They seem to start out with the Size but I am not sure where the packet ID is. | July 8, 2004, 7:25 PM |
KkBlazekK | Why not do a packet log and find it yourself? | July 9, 2004, 7:36 PM |
iago | SC in-game packets are very complicated. I would suggest looking at the storm functions that handle them (they're the small 100's, like storm_100 to storm_130 or so). These are the SNet functions, in case you care. I'm not 100% sure that this is correct, but one place might be to start is storm_122: int __stdcall SNetReceiveTurns(void **,int,int,int,int) | July 9, 2004, 7:52 PM |
ChR0NiC | [quote author=Kk)Blaze(kK [Anti-yL] link=board=17;threadid=7628;start=0#msg69420 date=1089401786] Why not do a packet log and find it yourself? [/quote] They are very complicated [quote author=iago link=board=17;threadid=7628;start=0#msg69427 date=1089402720] SC in-game packets are very complicated. I would suggest looking at the storm functions that handle them (they're the small 100's, like storm_100 to storm_130 or so). These are the SNet functions, in case you care. I'm not 100% sure that this is correct, but one place might be to start is storm_122: int __stdcall SNetReceiveTurns(void **,int,int,int,int) [/quote] Thanks for the suggestions, I really appreciate it. No sarcasm | July 9, 2004, 10:47 PM |
Adron | They aren't that complicated at all. Post some samples here for parsing? Pick a set of sequential short packets from a two-player game, including a talk message and some other known message? | July 10, 2004, 9:27 AM |
Adron | [quote] [quote author=Adron link=board=17;threadid=7628;start=0#msg69505 date=1089451629] They aren't that complicated at all. Post some samples here for parsing? Pick a set of sequential short packets from a two-player game, including a talk message and some other known message? [/quote] [/quote] This will be a bit of guesswork, but I do remember some parts... Need more data to tell you more. Try to find packets that have different values in the unknown parts. [quote] 2 Player Game (Not host): Send: 00 00 00 00 EB 34 16 00 98 01 A3 01 01 00 01 00 00 20 69 27 6D 20 6E 65 77 00 Text: i'm new Breakdown: 00 00 00 00 Header of 00's EB 34 No idea 16 00 Packet length 98 Current packet sent (Keeps track of the amount of packets sent in-game) 01 A3 01 01 00 01 00 00 Not sure what every byte is for but I'll assume your playerID is one of these bytes. What are the others for? 20 PacketID (Space)? 69 27 6D 20 6E 65 77 00 Message [/quote] 00 00 00 00 : zero bytes EB 34 : checksum 34EB 16 00 : packet length 16 98 01 : sequence number 198 A3 01 : acknowledge for 1A3 01 01 00 01 00 00 : unknown for now 20 69 27 6D 20 6E 65 77 00 : <packet data, using another "standard" format> [quote] More messages... Send: 00 00 00 00 16 65 15 00 99 01 A3 01 01 00 01 00 00 20 61 72 65 20 75 3F 00 Text: are u? Send: 00 00 00 00 2D 2F 10 00 9A 01 A3 01 01 00 01 00 00 20 31 00 Text: 1 Send: 00 00 00 00 3D 1D 10 00 9B 01 A3 01 01 00 01 00 00 20 32 00 Text: 2 Send: 00 00 00 00 4D 0B 10 00 9C 01 A3 01 01 00 01 00 00 20 33 00 Text: 3 Send: 00 00 00 00 5D F8 10 00 9D 01 A3 01 01 00 01 00 00 20 34 00 Text: 4 Here are some seq. keepalives too: SEND-> 00 00 00 00 F7 D8 13 00 EE 00 EF 00 02 00 01 00 37 D2 0C D0 40 00 13 SEND-> 00 00 00 00 D5 7B 13 00 EF 00 F0 00 02 00 01 00 37 E1 F4 56 40 00 13 SEND-> 00 00 00 00 AC D2 13 00 F0 00 F1 00 02 00 01 00 37 F2 61 A8 40 00 13 No idea what this is: SEND-> 00 00 00 00 5D F8 10 00 9D 01 A3 01 01 00 01 00 00 20 34 00 If you could break the packets down better that would be groovy. [/quote] [code] 00 00 00 00 16 65 15 00 99 01 A3 01 01 00 01 00 00 20 61 72 65 20 75 3F 00 00 00 00 00 2D 2F 10 00 9A 01 A3 01 01 00 01 00 00 20 31 00 00 00 00 00 3D 1D 10 00 9B 01 A3 01 01 00 01 00 00 20 32 00 00 00 00 00 4D 0B 10 00 9C 01 A3 01 01 00 01 00 00 20 33 00 00 00 00 00 5D F8 10 00 9D 01 A3 01 01 00 01 00 00 20 34 00 00 00 00 00 F7 D8 13 00 EE 00 EF 00 02 00 01 00 37 D2 0C D0 40 00 13 00 00 00 00 D5 7B 13 00 EF 00 F0 00 02 00 01 00 37 E1 F4 56 40 00 13 00 00 00 00 AC D2 13 00 F0 00 F1 00 02 00 01 00 37 F2 61 A8 40 00 13 00 00 00 00 5D F8 10 00 9D 01 A3 01 01 00 01 00 00 20 34 00 AA AA AA AA BB BB CC CC DD DD EE EE FF GG HH II .. .. .. .. [/code] A: zero bytes B: checksum C: length D: sequence number (notice how it increases for each message sent) E: acknowledge number (will increase if the other guy sends a message) F: packet class (sequence / acknowledge numbers increase separately for each class) G, H, I: need more data, one of them should be source or destination player, another should contain flags (try to find a packet that is being resent because of packet loss, good time to capture this should be when the game is lagging), another should be something I called command and is mostly used for class 0 packets sent while joining a game (capture some of those!) .. : actual data - parse this differently depending on the class / command values found in the packet header. Some of the packets sent when selecting units and ordering them around would be good to see too. If you can do more than one thing really quick, you'll also see how multiple actions are put into the same packet. Try for example selecting different unit groups quickly, or clicking out different orders. Label these packets with what you've been doing too. You should find that they are all of class 2. Class 1 is used for messages and asynchronous stuff. Class 0 while joining a game. The class that causes the lag window to appear is class 2. Some class 1 packets can be lost for a long time and delivered much later, causing a lot of typed messages to appear at once on a laggy connection. | July 20, 2004, 3:22 PM |
Paul | The class information does actually help a lot. I never thought of or saw that after reviewing my logs. Presently I'm still continuing to document packet-building functions in the starcraft.exe before everything is passed through the battle.snp. And if you or anyone else cared I’m only doing this out of extreme boredom. I have no plans to write a game bot or anything entertaining; just a public doc/ref of my half-assed efforts. To re-clarify a few things, there are only 3 classes of in-game packets (00, 01 and 02) and each class contains a variety of packet types for different actions? This would be how I would weed out the annoying keepalives by filtering them on class 02. Off the top of your head Adron, do game actions (Like moving units) also fall under class 02? That may cause a headache in my parsing if they are also under the same class as keepalives. Edit: Just read the bottom of your post. I guess unit movement and such does fall under class 02. Ho hum! Oh well! | July 20, 2004, 5:05 PM |
Adron | Only three classes. Class 02 runs the game, one of these is received from each player on each game tick. The data consists of a number of "subpackets", each starting with a byte that indicates the type of subpacket. The length of the subpacket is mostly fixed, and the game knows the length for each type of subpacket. You may want to find this table of subpacket lengths inside the game. You could also just do various actions and assume that in most cases you'll have a 37 subpacket + that one action you just did in the packet. Class 00 is used when joining a game, I'd say "for administrative purposes". The packet data contains different things depending on the command byte in the packet header. It doesn't have the same subpacket structure. Class 01 is used for non-synchronous data such as talks. When I originally did this, I noticed the increasing sequence numbers, and that they increased in different ranges. Then I looked for what was common to all packets counting up in a specific range and found the class byte. | July 20, 2004, 6:23 PM |
hismajesty | Many of the values are unknown. I think they depend on other things such as game type/speed/etc. Here's what one of my friends gave me, I haven't looked into it myself: [code] (DWORD) Unknown (Protocol?/ID?) (WORD) Checksum result (WORD) Packet length, including this header (WORD) Unknown (WORD) Unknown (WORD) Unknown (WORD) Unknown (VOID) Packet Data[/code] | July 21, 2004, 12:22 AM |
Kp | [quote author=Adron link=board=17;threadid=7628;start=0#msg71521 date=1090347794]Only three classes. [/quote] Actually, if I recall correctly, there is a fourth class supported in Storm. However, to the best of my knowledge, it's never used. I haven't seen it in either Diablo or Starcraft game logs. | July 21, 2004, 6:59 PM |
iago | I have an old breakdown written by Adron, which I will post here with his permission. | July 21, 2004, 7:23 PM |
Adron | [quote author=Kp link=board=17;threadid=7628;start=0#msg71697 date=1090436381] Actually, if I recall correctly, there is a fourth class supported in Storm. However, to the best of my knowledge, it's never used. I haven't seen it in either Diablo or Starcraft game logs. [/quote] That's possible. I recall seeing room for another seq/ack counter somewhere, but I assumed it was a case of aligning - I never saw the fourth class used. | July 21, 2004, 9:36 PM |
Adron | [quote author=hismajesty[yL] link=board=17;threadid=7628;start=0#msg71571 date=1090369345] Many of the values are unknown. I think they depend on other things such as game type/speed/etc. [/quote] Did you look at my post? :P I actually specified what your friend gave you and more, and it all came from memories awakened by looking at that packet log he posted. Either way, I'm sure given some more samples, we, the great visitors to this forum, could figure out the rest. Unless iago posts that summary which I don't remember writing, but ... If he feels it should be posted, it's OK with me. | July 21, 2004, 9:38 PM |
iago | I'm pretty sure this was originally from you: struct message { unsigned long udptype; unsigned short checksum; unsigned short len; unsigned short pos1; unsigned short pos2; unsigned char cls; unsigned char cmd; unsigned char sender; unsigned char resend; char data[]; }; | July 21, 2004, 10:00 PM |
UserLoser. | [quote author=Adron link=board=17;threadid=7628;start=0#msg71723 date=1090445925] Did you look at my post? :P I actually specified what your friend gave you and more, and it all came from memories awakened by looking at that packet log he posted. Either way, I'm sure given some more samples, we, the great visitors to this forum, could figure out the rest. Unless iago posts that summary which I don't remember writing, but ... If he feels it should be posted, it's OK with me. [/quote] I'm sure I would be able to figure out a great deal of the rest once I first get my client joining the games :) | July 21, 2004, 10:02 PM |
Adron | [quote author=iago link=board=17;threadid=7628;start=0#msg71730 date=1090447238] I'm pretty sure this was originally from you: [/quote] That looks a bit like the definition from the NBBot sources :) The byte called "resend" has the flags, one of them marking retransmission(request). | July 21, 2004, 10:02 PM |