Valhalla Legends Forums Archive | Battle.net Bot Development | Creating Games

AuthorMessageTime
MindArchon
OK, if some of you know I was having trouble with creating/joining games before, and took a break and came back. This time I can actually make it create the game... sort of. Heres my code:

[code]Dim statstr as string

statstr = "44,14,6,2,2,1,57d83ff4,4,," & usern & "The Lost Temple"

Dim packb as new packetbuffer
with packb
.InsertDWORD &H0
.InsertDWORD &H0
.InsertWORD &H2
.InsertWORD &H1
.InsertDWORD &H1
.InsertDWORD &H0
.InsertNTString "mind"
.InsertNTString ""
.InsertNTString statstr
.SendPacket &H1C
end with
[/code]

After sending it, the bot leaves the channel and joins the game "mind". It's in the channel list.. however when I try to join it, it just says "Unable to Join Game", and it displays no info on the little black screen on the BW client. How do I fix this?

Also, can somebody tell me what "44,14,6,2,2,1,57d83ff4,4,," & usern & "The Lost Temple" is, and how can I change it to play different maps? USERN is the username the bot is online as. I understand all of the packet except that last part.
December 5, 2004, 3:37 AM
LoRd
Since games are person to person, you're only doing the first, very small part, telling Battle.net that you wish to join/create a game.  However actually joining/creating a playable game is a little bit more complicated.  Your bot must support UDP which is the protocol used in gaming on products predating Diablo II.

There's a very good thread on map statstrings which can be found here.
December 5, 2004, 4:14 AM
MindArchon
I thought UDP was only for Diablo 2 Battle.net ???

However.. moving on.. do I need another winsock to connect to UDP, and how should I go about connecting to it, and figuring out how to use it (since I have no idea how to use UDP)
December 5, 2004, 4:31 AM
UserLoser.
[quote author=MindArchon link=topic=9787.msg91099#msg91099 date=1102221083]
I thought UDP was only for Diablo 2 Battle.net ???

However.. moving on.. do I need another winsock to connect to UDP, and how should I go about connecting to it, and figuring out how to use it (since I have no idea how to use UDP)
[/quote]

All Blizzard games use UDP for in-game communication, except for Diablo 2, Warcraft III, and their expansions, like stated above.

Also, yes; you'll need a separate UDP socket, and you don't connect UDP sockets.
December 5, 2004, 5:17 AM
MindArchon
Is the header of UDP different? Its not on BNET DOCS.. Here's my recieved 0x05 (it sent this twice)..

[code]0000: 05 00 00 00 74 65 6E 62                          ...tenb........[/code]

The first byte is the ID, then whats the next 3 bytes used for?
December 8, 2004, 2:28 AM
Kp
[quote author=MindArchon link=topic=9787.msg91456#msg91456 date=1102472938]then whats the next 3 bytes used for?[/quote]

Zeroes.
December 8, 2004, 8:36 PM
MindArchon
[quote author=Kp link=topic=9787.msg91528#msg91528 date=1102538188]
[quote author=MindArchon link=topic=9787.msg91456#msg91456 date=1102472938]then whats the next 3 bytes used for?[/quote]

Zeroes.
[/quote]

So all UDP packets have zeros.. and I dont indicate the packet size anywhere? OK, ill try.
December 8, 2004, 11:01 PM
Adron
You do sometimes indicate sizes, and sometimes you infer from commands.
December 8, 2004, 11:48 PM
MindArchon
[quote author=Adron link=topic=9787.msg91566#msg91566 date=1102549709]
You do sometimes indicate sizes, and sometimes you infer from commands.
[/quote]

Well, how am I supposed to know which packets I send include sizes, and what the header looks like?
December 9, 2004, 12:05 AM
Adron
[quote author=MindArchon link=topic=9787.msg91569#msg91569 date=1102550711]
Well, how am I supposed to know which packets I send include sizes, and what the header looks like?
[/quote]

Well, myself, I looked at packet logs. IIRC I loaded them into Excel, sorting them by various columns and slowly figuring out what everything meant.

You could also disassemble the code that builds them / processes them.

Or you could be cheap and bug us about it, but don't expect us to give you everything on a silver platter. We'll probably make you jump through hoops to get your answers if you don't prove you're willing to work for things yourself.
December 9, 2004, 8:20 PM
Ringo
[quote author=MindArchon link=topic=9787.msg91095#msg91095 date=1102217868]
it displays no info on the little black screen on the BW client. How do I fix this?
[/quote]

this should help a little:

InsertDWord 0
InsertDWord 0
InsertWord gametype
#possible gametypes:
#Top vs bottom
Word 0F

#Melee
Word 02

#Free for all
Word 03

#One on one
Word 04

#Ladder
Word 09

#Use map settings
Word 0A

#Capture the flag
Word 05

#Greed
Word 06

#Slaughter
Word 07

#Sudden death
Word 08

#Team melee
Word 0B

#Team free for all
Word 0C

#Team capture the flag"
Word 0D

InsertWord 2 for tvb, 1 for other (this is the player teams word)
InsertDWord 1F
InsertDWord 0
InsertNTString GameName
InsertBYTE 0
InsertNonNTString ",44,14," #Not 100% sure
InsertNonNTString Speed
#Possible speeds:
#Fastest
NonNTString "6"

#Faster
NonNTString "5"

#Fast
NonNTString ""  <-- used to be "4" for fast in 1.10, changed to make ladder speed fastest hacks harder to make?

#Normal
NonNTString "3"

#Slow
NonNTString "2"

#Slower
NonNTString "1"

#Slowest
NonNTString "0"

InsertNonNTString ","
InsertNonNTString MapIcon
#Possible mapicons:
#No icon
NonNTString "0"

#Blizzard icon
NonNTString "1"

#ladder icon
NonNTString "2"

#GF icon
NonNTString "3"

#KBK icon
NonNTString "4"

#Cup
NonNTString "5"

InsertNonNTString ","
InsertNonNTString GameType #Must be like: "f" or "1" etc
InsertNonNTString ",,1,af565c9," <-- hash of the map?
InsertNonNTString "4,," #<- number of players for the map
InsertNonNTString CreaterName #Generaly can be anything, doesnt have to be the username of the client.
InsertBYTE 0D
InsertNonNTString MapName #same rules as CreaterName
InsertBYTE 0D
InsertBYTE 0
Sendpacket 1C

I got that from packet logging with "The Lost Temple"
Not much more than:
"Not 100% sure"
"map hash?"
and "number of players for the map"
will generaly change when you create a game with a differnt map.

I to would like any infomation possible on the SC GS if possible, as i would like to learn more about it my self.
I am not sure how to talk with it :P
thanks!
December 12, 2004, 1:59 PM
UserLoser.
There is no "Starcraft Gameserver"
December 12, 2004, 6:34 PM
Ringo
[quote author=UserLoser link=topic=9787.msg92066#msg92066 date=1102876482]
There is no "Starcraft Gameserver"
[/quote]

Hi UserLoser, can you please explain a little more? :)
December 12, 2004, 9:25 PM
Zakath
There is no Starcraft game server. Each client participating in the game runs the entire game locally, and whenever they do anything, they send a notification to each other player.
December 13, 2004, 2:31 AM
Ringo
ye, i understand that bit, but the main problem im having atm is understanding what address is used to do this.
When ever i packet log this, my SC game sends/receves from my ISP address @ port 6112, but when i send data to that via a UPD winsock and packet log it, its sending it to the address: 0.0.0.0.

Any ideas?

**Edit**
63.241.83.13:6112 > 192.168.0.135:4562    Recv 
FF 07 0A 00 02 00 00 00 00 00
(Passed 0x07)

0.0.0.0:4564 > :0   SendTo 
0000  09 00 00 00

I know i am only sending a blank UPD packet on logon but first i am trying to get the send to address right ;(

An example of how it should be:

63.241.83.13:6112 > 192.168.0.135:4562    Recv 
192.168.0.135:6112> :0   SendTo 

This is the sort of thing iv been trying (In VB6):

[code]
WsUPD.RemoteHost = WsTCP.RemoteHostIP
WsUPD.RemotePort = "6112"
PacketUPD &H9
[/code]

Iv tryed:
WsUPD.RemoteHost = WsTCP.LocalIP

WsUPD.RemoteHost = WsTCP

WsUPD.RemoteHost = WsTCP.Remotehost

And many many other combos, but it will only seem to send to 0.0.0.0 and wromng port, rather than the port and IP i definded.

Please note: Im not trying to "connect" to my UPD winsock in anyway, i am purely having send address problems.

Or am i? any help would be great, thanks!
December 13, 2004, 10:38 AM
Kp
What's UPD [sic]?
December 13, 2004, 4:27 PM
Ringo
I have given up with UPD/UDP ( lol ) for a while :P
and did abit of 0x09 logging.

here are some results for people who may need it:
(i also posted these on bnet docs, S > C)

[code]
Game StatString for sc/bw goes as followed:
Example: ,22,16,6,1,a,,1,dd5881e4,1,,
Values: ,1*,2*,3,4,5,6,7,8******,9,10,
Values go as followed:
1 = map size(mapsize = 2x32 by 2x32 [64 by 64])
2 = Players(2nd number, 1st allways 1)
3 = Game speed(0 = slowest, 6 = fastest)
4 = map icon
5 = Game type
6 = UnKnown(allways blank)
7 = Penalty(Ladder Pen, Greed resorces, teams etc)
8 = Map hash(not sure of the map hash values yet)
9 = Title set(space, jungle, Installation etc)
10 = UnKnown(Allways Blank)[/code]

right after this is the creater name and the map name, split with byte 0x0D.

Its poassible for some values to be blank, like speed fast would be blank.
Im not going to say to much more, you will have to DIY :)
hope this helps!

**Edit**
I will give one example for the penalty:
If gametype is Top vs Bottom then penalty would be:
teams:

[code]
teams = Int(Players) - int(Penalty)
teams = Int(Penalty) & " vs " & int(teams)
[/code]
Hope this gives u a clue :)

Ringo.
December 18, 2004, 4:27 PM

Search