Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: titan0060 on August 21, 2004, 09:14 AM

Title: Bnet Bots
Post by: titan0060 on August 21, 2004, 09:14 AM
Hey, im tryin to make my first bot, i have Visual basic 6... i pretty much know my way arround VB, but i dont know what to do next.

I've got the main form laid out, but now i dont know what to do.

Please reach me at:
[ this forum ]

Removed contact info.  Ask your questions here so everyone can conveniently help you and others can benefit from the information.
- Spht
Title: Re:Bnet Bots
Post by: Kp on August 21, 2004, 10:45 AM
Quote from: titan0060 on August 21, 2004, 09:14 AMHey, im tryin to make my first bot, i have Visual basic 6... i pretty much know my way arround VB, but i dont know what to do next.
I've got the main form laid out, but now i dont know what to do.
Please reach me at:
[ this forum ]

Open a TCP socket to port 6112 on any of the active BNCS.  Send your connection select byte, then go into a net loop on the received data.  Beware of partial receipts as well as receiving multiple bncs messages in a single receive operation.  Consult BnetDocs for details of the individual packet formats.
Title: Re:Bnet Bots
Post by: TangoFour on August 21, 2004, 01:20 PM
QuoteBeware of partial receipts

Ummm - you mean packets getting scrambled? Didn't ever think of that as a possibility...

Ok, that means I gotta rewrite a part of my bot's connection code
Title: Re:Bnet Bots
Post by: Newby on August 21, 2004, 01:31 PM
I think he meant a packet that doesn't contain all the information it should, almost as if it had been cut off.
Title: Re:Bnet Bots
Post by: MyndFyre on August 21, 2004, 01:33 PM
Quote from: TangoFour on August 21, 2004, 01:20 PM
QuoteBeware of partial receipts

Ummm - you mean packets getting scrambled? Didn't ever think of that as a possibility...

Ok, that means I gotta rewrite a part of my bot's connection code

No -- what he means that, Battle.net will sometimes put more than one packet together:

Example: extremely unlikely, but it illustrates the point.

ff 00 04 00 ff 00 04 00


It will also sometimes not send an entire packet with one Receive callback:

ff 0b 4c 00 (P) (u) (b) (l) (i) (c) ( ) (C) (h) (a) (t) ( )
(U) (S) (A) (-) (1) 00 (O) (p) (e) (n) ( )


If you look at the length specifier (sorry, I was too lazy to look up hex codes for all the ASCII chars), you can see that the specified packet is supposed to be *much longer* than the data that was received (0x4c vs 0x1b).

That's what it means.  There's no "scrambling" of packet info.
Title: Re:Bnet Bots
Post by: TangoFour on August 21, 2004, 01:35 PM
So, more like: I receive a SID_PING, which should be 8 bytes long (1 for FF, 1 for Packet ID, 2 for length, 4 for Ping value), but I only receive 4 bytes - in that case I should wait for the other 4 bytes...

Is it possible then, that I receive 4 bytes for SID_PING, then receive a SID_AUTH_INFO, and then the rest of SID_PING?

My code already properly deals with packets that are "concatenated"
Title: Re:Bnet Bots
Post by: ChR0NiC on August 21, 2004, 02:33 PM
Quote from: titan0060 on August 21, 2004, 09:14 AM
Hey, im tryin to make my first bot, i have Visual basic 6... i pretty much know my way arround VB, but i dont know what to do next.
This has to stop, you mods should make a sticky saying before asking this question use the search button and look in the Battle.net Bot Development References (http://forum.valhallalegends.com/phpbbs/index.php?board=45) before you ask questions.

Thanks if any mods decide to do this.
Title: Re:Bnet Bots
Post by: Kp on August 21, 2004, 03:34 PM
Quote from: TangoFour on August 21, 2004, 01:35 PM
So, more like: I receive a SID_PING, which should be 8 bytes long (1 for FF, 1 for Packet ID, 2 for length, 4 for Ping value), but I only receive 4 bytes - in that case I should wait for the other 4 bytes...
Is it possible then, that I receive 4 bytes for SID_PING, then receive a SID_AUTH_INFO, and then the rest of SID_PING?

Yes.  No.  Therefore, you're ok.
Title: Re:Bnet Bots
Post by: Zakath on August 21, 2004, 07:34 PM
Indeed. You may get part of a packet, a whole packet, or multiple packets clumped together. Those are the situations you have to handle.
Title: Re:Bnet Bots
Post by: TangoFour on August 22, 2004, 04:25 AM
Alright, thank you very much
Title: Re:Bnet Bots
Post by: tA-Kane on August 22, 2004, 02:35 PM
So just to make sure it's clear, you should NEVER receive a partial packet, then another packet before receiving the rest of the partial packet.