• Welcome to Valhalla Legends Archive.
 

Creating Games

Started by MindArchon, December 04, 2004, 09:37 PM

Previous topic - Next topic

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:

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


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.

Eric

#1
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.

MindArchon

#2
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)

UserLoser.

Quote from: MindArchon on December 04, 2004, 10:31 PM
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)

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.

MindArchon

Is the header of UDP different? Its not on BNET DOCS.. Here's my recieved 0x05 (it sent this twice)..

0000: 05 00 00 00 74 65 6E 62                          ...tenb........

The first byte is the ID, then whats the next 3 bytes used for?

Kp

[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

MindArchon

Quote from: Kp on December 08, 2004, 02:36 PM
Quote from: MindArchon on December 07, 2004, 08:28 PMthen whats the next 3 bytes used for?

Zeroes.

So all UDP packets have zeros.. and I dont indicate the packet size anywhere? OK, ill try.

Adron

You do sometimes indicate sizes, and sometimes you infer from commands.

MindArchon

Quote from: Adron on December 08, 2004, 05:48 PM
You do sometimes indicate sizes, and sometimes you infer from commands.

Well, how am I supposed to know which packets I send include sizes, and what the header looks like?

Adron

Quote from: MindArchon on December 08, 2004, 06:05 PM
Well, how am I supposed to know which packets I send include sizes, and what the header looks like?

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.

Ringo

#10
Quote from: MindArchon on December 04, 2004, 09:37 PM
it displays no info on the little black screen on the BW client. How do I fix this?

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!

UserLoser.

There is no "Starcraft Gameserver"

Ringo

Quote from: UserLoser on December 12, 2004, 12:34 PM
There is no "Starcraft Gameserver"

Hi UserLoser, can you please explain a little more? :)

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.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Ringo

#14
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):


WsUPD.RemoteHost = WsTCP.RemoteHostIP
WsUPD.RemotePort = "6112"
PacketUPD &H9


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!