Valhalla Legends Forums Archive | Battle.net Bot Development | Been awhile... what's changed?

AuthorMessageTime
Mage
Hey all,

It's been awhile since I did any bot development with battle.net. I wrote Battle.net Plus more than 4 years ago. I am toying with the idea of writing a new client in .NET. I installed and old version of it and it fails to connect to exodus.battle.net. Obviously, much has changed.

After browsing around, everyone is talking about binary versus text protocol. Is the old text based protocol no longer functional? Is it binary only? Or is my code just slightly out of date/synch with the latest on battle.net. If someone can point me to the latest text based protocol, or if it is expired, the latest protocol specification for implementing a chat client (not emulating a game client), it would be much appreciated.

Thanks much,

Mage
November 11, 2003, 6:04 PM
Soul Taker
Failing to connect shouldn't have anything to do with the protocol changing, it would mean the server is not correct, try useast.battle.net
AFAIK, the CHAT protocol hasn't really changed at all. I can't think of any changes ever happening to it, actually, other than CHAT clients being restricted to certain channels.
November 11, 2003, 6:20 PM
Mage
Perhaps it's the firewall. I've opened port 6112. What else needs to be open? It should be opened outbound and inbound, correct? TCP only, right?

Hmm... I can connect via telnet, but I am not able to get anything to happen--I just get disconnected. Even though I sent it ALT-003 and ALT-004, then hit "ENTER", which I believe is the login sequence.

Thanks,

Mage
November 11, 2003, 6:31 PM
Soul Taker
[1:35:38 PM] Disconnected! 10054 - The connection is reset by remote side
I can't seem to connect to battle.net at all at the moment.
November 11, 2003, 6:36 PM
iago
To use CHAT, just telnet to useast.battle.net or uswest.battle.net on port 6112 and send ctrl-c or 0x03, and that's it.

The problem is, CHAT is now horribly limited. You can't join private channels, for example. If you want to be able to do anything, you have to write a Binary Bot.

Of course, there are many available tools to make that simple, like BNLS which helps you logon by telling you the appropriate responses and cuphead CleanSlateBot OCX, which is currently creating an army of morons who don't know how to add stuff to a textbox (see Kp's signature).

If you want to do serious bot development, I would recommend researching Binary Protocol yourself, and take a look at Arta's BNetDocs.
November 11, 2003, 7:27 PM
Soul Taker
What's a textbox?
November 11, 2003, 7:33 PM
Mage
Ahh, yeah, bnet must have been down around 12:30PM CST. It was working when I was back from lunch.

Alright, so then most likely, my old chat client still works (I don't have a bnet account anymore and it seems that Guest does not work anymore :).

So, since the CHAT functionality has been severely crippled, the best way to proceed would be to write against the binary protocol. I do not want to use someone else's control since I want to write this in 100% .NET. However, if anyone has source code re: the binary protocol implementation, that would help.

For now, I'll see what I can gather from all the information at that site.

Thanks,

Mage
November 11, 2003, 7:51 PM
iago
[quote author=Mage link=board=17;threadid=3546;start=0#msg28698 date=1068580294]
Ahh, yeah, bnet must have been down around 12:30PM CST. It was working when I was back from lunch.

Alright, so then most likely, my old chat client still works (I don't have a bnet account anymore and it seems that Guest does not work anymore :).

So, since the CHAT functionality has been severely crippled, the best way to proceed would be to write against the binary protocol. I do not want to use someone else's control since I want to write this in 100% .NET. However, if anyone has source code re: the binary protocol implementation, that would help.

For now, I'll see what I can gather from all the information at that site.

Thanks,

Mage

[/quote]

Yay CST!

I'm not sure how to feel, since on one hand you don't want to use CSB but on the other you asked for source! :(

And to login anonymousely on CHAT, use the account name anonymous. But you don't get to join any channels, just do some commands.
November 11, 2003, 8:07 PM
Mage
[quote author=St0rm.iD link=board=17;threadid=3546;start=0#msg28699 date=1068580900]
You could look at http://wiki.ik0ns.com
Or, if you still want to use your bot, use Binary Gateway (http://www.binarygateway.com)

</shameless_plugs>
[/quote]

Hey...

http://wiki.ik0ns.com/ did not resolve for me. ???

Ah yeah, I found this when I was searching on the latest information on the battle.net protocol. Cool. Well, I do want to start over... so I might as well write to the binary protocol.

Can someone tell me which parts of the protocol I must implement? There are a lot of flags on the bnetDocs site. At first look, it appears I need to implement the Battle.net flags for sure, and maybe the BNLS flags? What about the others?

Thanks,

Mage

November 11, 2003, 8:10 PM
St0rm.iD
Weird about the wiki. Sorry...
November 11, 2003, 8:25 PM
iago
If you want to do it mostly on your own, you would have to do some reverse engineering. On the other hand, all the information (Except for war3 stuff) is available somewheres.

I would recommend starting by packetlogging a few successful connections to battle.net using a real client or bot, and seeing what's happening. From there, match up that data with what is expected according to BNetDocs, to get some idea of what has to be sent/what is recieved.
November 11, 2003, 8:38 PM
Mage
Cool, sounds good.

I'm currently defining all the constants/structures I'll need for the protocol. Is my thinking correct in defining a structure for each message like SID_AUTH_INFO, etc. and then converting it to bytes and sending the it over the socket?

Thanks,

Mage
November 11, 2003, 11:09 PM
iago
That's what I do. And you don't have to convert to bytes, probably. In C++, at least, you can just do:
send(&myStruct, sizeof(struct_type), ...), assuming that myStruct isn't a pointer.
November 11, 2003, 11:37 PM
Kp
[quote author=iago link=board=17;threadid=3546;start=0#msg28744 date=1068593861]
That's what I do. And you don't have to convert to bytes, probably. In C++, at least, you can just do:
send(&myStruct, sizeof(struct_type), ...), assuming that myStruct isn't a pointer.[/quote]and assuming you set the structure's packing appropriately.

Also, be sure to use byte, not char for your data storage, Mage. Certain bleeding edge languages have an unfortunate tendency to waste space, and when you're trying for binary compatibility with something that assumes a char is 8 bits wide...
November 12, 2003, 12:01 AM
iago
that reminds me, sometimes structs line stuff up on 32 bit boundries to speed it up. There's a preprocessor directive to disable that, but I forget what it is.
November 12, 2003, 12:06 AM
Kp
[quote author=iago link=board=17;threadid=3546;start=0#msg28749 date=1068595562]There's a preprocessor directive to disable that, but I forget what it is.[/quote]Under gcc, it's the compiler-specific extension __attribute__ ((__packed__)) iirc. Either there isn't a standard way of requesting data packing or nobody follows it, so don't assume it's a preprocessor definition everywhere. :)
November 12, 2003, 2:23 AM
kamakazie
[quote author=iago link=board=17;threadid=3546;start=0#msg28749 date=1068595562]
that reminds me, sometimes structs line stuff up on 32 bit boundries to speed it up. There's a preprocessor directive to disable that, but I forget what it is.
[/quote]
#pragma pack(1) for MSVC++ 6 I believe.
November 12, 2003, 4:18 AM
warz
Well, I know you're not looking for code, but if you're looking for code regarding battle.net, feel free to check out http://tks.slacktech.com - it has plenty of examples in different languages, so you can get the feel of a possible good way, or method of doing things.
November 12, 2003, 4:33 AM
iago
[quote author=warz link=board=17;threadid=3546;start=15#msg28776 date=1068611609]
Well, I know you're not looking for code, but if you're looking for code regarding battle.net, feel free to check out http://tks.slacktech.com - it has plenty of examples in different languages, so you can get the feel of a possible good way, or method of doing things.
[/quote]
eww, winbot source? Shouldn't make that public, people should work if they want something like that! :P
November 12, 2003, 6:28 AM
Mage
I see all the constants are defined in CPP/VB/etc. but no structures? Does anyone have all the C++ structures defined that they can post? Will save a lot of time. It's much easier to convert C++ to C# as opposed to browsing around each message on BnetDocs and creating the structures one by one. :)

Thanks again for the help...

Mage
November 12, 2003, 3:27 PM
Adron
[quote author=Mage link=board=17;threadid=3546;start=15#msg28814 date=1068650848]
I see all the constants are defined in CPP/VB/etc. but no structures? Does anyone have all the C++ structures defined that they can post? Will save a lot of time. It's much easier to convert C++ to C# as opposed to browsing around each message on BnetDocs and creating the structures one by one. :)
[/quote]

I think most people create the structures dynamically by calls like "insertbyte", "insertword", "insertdword", "insertzeroterminatedstring" etc. Because many of the packets have variable length fields, you can't use C++ structures for everything, and the packets that you could use them for are easy enough to generate anyway.
November 12, 2003, 4:54 PM
Mage
[quote author=Adron link=board=17;threadid=3546;start=15#msg28825 date=1068656081]

I think most people create the structures dynamically by calls like "insertbyte", "insertword", "insertdword", "insertzeroterminatedstring" etc. Because many of the packets have variable length fields, you can't use C++ structures for everything, and the packets that you could use them for are easy enough to generate anyway.
[/quote]

Ah, I see. Alright, that'll do. I'll follow suit then.

Thanks,

Mage
November 12, 2003, 5:24 PM
St0rm.iD
Or, could write structures which have serialize/deserialize methods.
November 12, 2003, 8:27 PM
Maddox
[quote author=kamakazie link=board=17;threadid=3546;start=15#msg28775 date=1068610690]
[quote author=iago link=board=17;threadid=3546;start=0#msg28749 date=1068595562]
that reminds me, sometimes structs line stuff up on 32 bit boundries to speed it up. There's a preprocessor directive to disable that, but I forget what it is.
[/quote]
#pragma pack(1) for MSVC++ 6 I believe.
[/quote]

I believe it would be something like
[code]
#pragma pack(push, r1, 1)
//struct
#pragma pack(pop, r1)
[/code]
or
[code]
#include <pshpack1.h>
//struct
#include <poppack.h>
[/code]
November 14, 2003, 11:52 PM

Search