dethredic / WC3StreamerOverlay

A simple tool for wc3 streamers to display their opponent's race and stats
GNU General Public License v3.0
30 stars 7 forks source link

Documentation for parsing Warcraft 3 TFT byte stream #15

Closed Rookian closed 4 years ago

Rookian commented 4 years ago

Hi!

Could you maybe upload a short document of the format of the wc3 byte stream? Maybe you have link?

I would like to parse it by myself :)

dethredic commented 4 years ago

There are two different sources of data: 1) Packets sent / received to/from battle.net 2) Warcraft 3 observer API

Which one are you interested in?

Rookian commented 4 years ago

Hi @dethredic!

I would like to get the names of all players in wc3 tft battle net game (random team and 1vs1).

So far I could only receive my player name (TestC).

5.42.181.112/6112 Data: **** Raw Hex Output - length=104 bytes Data: Segment: Bytes: Ascii: Data: -------------------------------------------------------------------------- Data: 0000 f0 7d 68 5b 36 0a 88 d7 f6 40 41 d9 08 00 45 00 .}h[6... .@A...E. Data: 0010 00 5a d1 0a 40 00 80 06 00 00 c0 a8 00 02 05 2a .Z..@... ....... Data: 0020 b5 70 f0 b9 17 e0 08 89 57 fc a2 23 34 77 50 18 .p...... W..#4wP. Data: 0030 fa f0 7b 91 00 00 f7 1e 32 00 5e ae 06 00 cf 32 ..{..... 2.^....2 Data: 0040 7a c8 00 e0 17 02 00 00 00 54 65 73 74 43 00 08 z....... .TestC**.. Data: 0050 6f d9 07 2d 01 00 00 00 02 00 17 e0 c0 a8 00 02 o..-.... ........ Data: 0060 00 00 00 00 00 00 00 00 ........

But I could not find my opponents name.

Is your code in the repository up to date (eg the IP adresses and the ports are different)?

What is the observer API?

dethredic commented 4 years ago

I havent't tested this in a couple months, so maybe battle.net changed the packets which are sent. See BNetPlayerMonitor::__packet_callback for my packet parsing attempt.

To get that information I just ran wireshark, found a game, then searched all the packets it captured for my name / my opponents names. It looks like you are doing the same thing, or something similar, so maybe this approach is no longer viable. I remember this didn't work for custom games, and it's possible that blizzard changed regular games to work like custom games.

The observer API provides a lot of information about the different players. It's what back2warcraft uses in their streams. I parsed a bit of it in the GameState class, but there is a more complete example of using it here https://github.com/warlockbrawl/war3observer. The player information is only available if you are an observer though.

Rookian commented 4 years ago

Yes it seems like blizzard changed the protocol. But I know Grubby is still using such a tool for showing the stats without an observer. Could you maybe check your tool if it still working? Just to have a double check.

dethredic commented 4 years ago

I'm 95% sure Grubby's tool reads the game memory "illegally". Most likely the "internal" version of the Observer API data before it gets pushed to shared memory.

Rookian commented 4 years ago

According to Taker https://www.twitch.tv/videos/483651523 (50min10sec) he is using your tool :o

I downloaded your version and it is working. Seems like I am doing something wrong... Will take a look at this.

EDIT:

Got it to work. My mistake was that I only looked for packages that were sent to battle.net, but not from battle.net. Because of that I only retrieved my name. Wireshark helped me here a lot.