• Welcome to Valhalla Legends Archive.
 

How difficult would it be to make a bot that does this...

Started by warz, April 21, 2006, 12:29 AM

Previous topic - Next topic

warz

I was just playing some chess online, thinking about a program that shows you the best move to make while playing. Then, I started wondering about SC, because a few people were wanting to play it. Then, I was thinking, well I really don't want to play, but I like SC, so you know, why not? Well, after this long process of thinking I thought, what if there was a bot that joined games and attempted to play? It'd take into account all the variable data being thrown its way, and calculate the best method of winning. Then, it'd try to play.

This would be a lot of work. Lots.. of.. work. But, how difficult would it really be? Is it even possible? Does the incomming data in BW give you enough information to actually know exactly whats going on in the game? I assume it does, because the client knows what's going on. I've seen Adron's programs that let you know exactly how much minerals etc, another play has, and where they are, etc. This is really one of the only tasks that truly interests me as far as SC and bnet goes.

I was just wondering what people thought about this program? Has anyone done it? I'm sure people have bots that join actual games.

l2k-Shadow

Well.. you'd have to take apart the whole starcraft protocol, and yeah you do get all the data the other player has because really all sc does is hide the map but the actual moves of the other player are transmitted. you could take apart the information being received and like hardcode stuff where.. ok if the other player is making dragoons, i'll go mass cracklings. etc.. i think the hardest part would be to actually take apart the protocol to know what every single thing does.. and if you have knowledge of assembly you could probably just disassemble sc and figure it out but it would take a lot of time. after that would be done then you'd have to figure out how to construct packets and make the characters move, make them micro, etc... it would be extremely time consuming.. and you'd probably figure out you have so many bugs in it that you'd just give up alltogether because people would find exploits on how to get around it all the time... it would be like 5-6 months or more project at least to pull off a good release... however if you actually accomplished it.. it would be pretty damn awesome i have to say.. i'm actually really interested in this project if you're willing to give it a shot, pm me or something.. i can't do much as far as assembly goes, but i can help research the protocol on my spare boredom time. gl :)

EDIT: also you could probably figure out what the Computer player does once in game.. but it doesn't really matter, they do the same thing every time, i'm assuming for your program you want it to have AI.. so yeah.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

warz

Well, it's no doubt that I will attempt this. Might as well put effort into something I'm interested in. It's either this or Guild Wars, seeing as how Guild Wars is free.

Physaro

Hmm that would be very hard. Because you would need to reverse all the Field of View and Pathfinding algorithms. I don't know if there is s.th. similar in SC:BW but in WC3 there is a seed set in the beginning from which the players calculate the dmg etc so if that also true in SC:BW and you don't know the proper algorithm your bot might not be acceppted by the other player or at least one could see it in the replay. So there would be many challenges.

But of course a good bot would nearly be unbeatable, not so much because he can think of the best strategie, but because his mirco which is very important in SC.

If you really get this, go to Korea and sell it there. SC:BW is so popular there and I bet you could earn some thousand dollars for such a "training bot".

Yegg

warz, this is obviously going to be an insanely difficult project to develope, but success would be amazing. Like shadow said, you'll probably need some sort of Artificial Intelligence which in this case I'm guessing won't be too much trouble compared to breaking down Starcraft's game protocol. I've never actually thought about such a project because I lacked the information of knowing that such information was included in the packets that you could know where other players were moving, let alone the fact that I've never personally packet logged anything on Starcraft. You mentioning this task gave me this interesting mental image of an automated player versing multiple players and knowing exactly what to do and when, and sooner or later the rest of the players yelling out things such as "map hacker!".

So anyways, I wish you the best of luck on this. I would love to see something like this exist with relatively well success some day.

warz

Quote from: Yegg on April 21, 2006, 01:59 PM
warz, this is obviously going to be an insanely difficult project to develope, but success would be amazing. Like shadow said, you'll probably need some sort of Artificial Intelligence which in this case I'm guessing won't be too much trouble compared to breaking down Starcraft's game protocol. I've never actually thought about such a project because I lacked the information of knowing that such information was included in the packets that you could know where other players were moving, let alone the fact that I've never personally packet logged anything on Starcraft. You mentioning this task gave me this interesting mental image of an automated player versing multiple players and knowing exactly what to do and when, and sooner or later the rest of the players yelling out things such as "map hacker!".

So anyways, I wish you the best of luck on this. I would love to see something like this exist with relatively well success some day.

Just have to take it step by step. Eventually, keeping at it, a final product can be made. I'm confident enough in my C++ skills that the only problems will be what Starcraft has to offer. Really, it's just a matter of packets and relative meaning, plus anything that needs to be done as far as disassembling starcraft, and such.

Who knows, we'll see. I'll start on it this afternoon.

l2k-Shadow

Quote from: warz on April 21, 2006, 02:09 AM
Well, it's no doubt that I will attempt this. Might as well put effort into something I'm interested in. It's either this or Guild Wars, seeing as how Guild Wars is free.

lol GW has been cutting into my programming time but getting the pms when we take halls with blood spike is pretty cool... Black Crescent (Wasted Ftw's team) represent :D

good luck on the project.
Quote from: replaced on November 04, 2006, 11:54 AM
I dunno wat it means, someone tell me whats ix86 and pmac?
Can someone send me a working bot source (with bnls support) to my email?  Then help me copy and paste it to my bot? ;D
Já jsem byl určenej abych tady žil,
Dával si ovar, křen a k tomu pivo pil.
Tam by ses povídaj jak prase v žitě měl,
Já nechci před nikym sednout si na prdel.

Já nejsem z USA, já nejsem z USA, já vážně nejsem z USA... a snad se proto na mě nezloběj.

warz

I didn't realize how in-depth the UDP protocol was. Intense, this is what I like. This will take some time. ;-)

Mesiah / haiseM

Interesting idea, warz. This is actually one of the better idea's I've seen in a while. This is what I check in here from time to time for. Something large, useful to an entire community, a pure show of complete mastery of the starcraft game protocol. I would be all for donating whatever I can to a project like this, But only if their are a fair amount of people involved. There are going to have to be at least a handful.. If your serious about undergoing a project of this stature, see if you can't gather a few handy people. PM me if you get going with this. gg.
]HighBrow Innovations
Coming soon...

AIM Online Status: 

MyndFyre

If I may suggest, get it going far enough for you to get the bot in there and doing nothing (kind of like what happens when a zerg spawns at 3 o'clock and 9 o'clock on BGH).
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Laverick

I've dreamed about making a bot like this for years, I just don't have the time or energy to do it. I wish you the best of luck on this man.
Pro Gamers Tour Staff

warz

A possible reason this project is so often strayed away from is because of functions like this rather trivial one...

large function

Not to mention this isn't even the full, correct function. I believe a much, much larger function in storm calls this battle.snp function. The storm one is several thousand lines of code. :-p
:o

UserLoser

Should be looking more in Storm.dll rather than Battle.snp

warz

Yeah. I've found a function in storm that looks like it's checking to see if there's any more packets to be assembled, or something.. note, this is the function that calls the function that calls sendto :-p


15022b90 51               push    ecx
15022b91 a108a90415 mov eax,[Storm!Ordinal459+0x14328 (1504a908)] ds:0023:1504a908=0265009c
15022b96 85c0             test    eax,eax
15022b98 53               push    ebx
15022b99 55               push    ebp
15022b9a 56               push    esi
15022b9b 57               push    edi
15022b9c 89542410         mov     [esp+0x10],edx
15022ba0 8bf9             mov     edi,ecx
15022ba2 750a             jnz     Storm!Ordinal106+0x46e (15022bae)
15022ba4 5f               pop     edi
15022ba5 5e               pop     esi
15022ba6 5d               pop     ebp
15022ba7 33c0             xor     eax,eax
15022ba9 5b               pop     ebx
15022baa 59               pop     ecx
15022bab c20800           ret     0x8
15022bae ff1580810315     call dword ptr [Storm!Ordinal459+0x1ba0 (15038180)]
15022bb4 8b3510a90415     mov     esi,[Storm!Ordinal459+0x14330 (1504a910)]
15022bba 8bc8             mov     ecx,eax
15022bbc 2bce             sub     ecx,esi
15022bbe 81f9ffffff7f     cmp     ecx,0x7fffffff
15022bc4 7305             jnb     Storm!Ordinal106+0x48b (15022bcb)
15022bc6 a310a90415       mov     [Storm!Ordinal459+0x14330 (1504a910)],eax
15022bcb 8b6c241c         mov     ebp,[esp+0x1c]
15022bcf 8b0d14a90415     mov     ecx,[Storm!Ordinal459+0x14334 (1504a914)]
15022bd5 8d4540           lea     eax,[ebp+0x40]
15022bd8 0fafc7           imul    eax,edi
15022bdb 69c0e8030000     imul    eax,eax,0x3e8
15022be1 33d2             xor     edx,edx
15022be3 f7b128020000     div     dword ptr [ecx+0x228]
15022be9 8b1510a90415     mov     edx,[Storm!Ordinal459+0x14330 (1504a910)]
15022bef 03d0             add     edx,eax
15022bf1 a11ca90415       mov     eax,[Storm!Ordinal459+0x1433c (1504a91c)]
15022bf6 85c0             test    eax,eax
15022bf8 891510a90415     mov     [Storm!Ordinal459+0x14330 (1504a910)],edx
15022bfe 7471             jz      Storm!Ordinal106+0x531 (15022c71)
15022c00 83ff10           cmp     edi,0x10
15022c03 779f             ja      Storm!Ordinal106+0x464 (15022ba4)
15022c05 81fd001f0000     cmp     ebp,0x1f00
15022c0b 7797             ja      Storm!Ordinal106+0x464 (15022ba4)
15022c0d 33c9             xor     ecx,ecx
15022c0f 85ff             test    edi,edi
15022c11 7616             jbe     Storm!Ordinal106+0x4e9 (15022c29)
15022c13 33d2             xor     edx,edx
15022c15 8d740240         lea     esi,[edx+eax+0x40]
15022c19 893488           mov     [eax+ecx*4],esi
15022c1c a11ca90415       mov     eax,[Storm!Ordinal459+0x1433c (1504a91c)]
15022c21 41               inc     ecx
...


that's not the whole thing, but once it reaches the bottom it ret's back to the beginning and does it all over again until the data at Storm!Ordinal106[...] is 0 it looks like. Once that's 0, the function breaks, pops the operands off the stack and returns

Edit: .. which is very rare it appears. i set a break point there and played several games without it breaking.

Anyone know if this is even the correct function?

Physaro

Hi,
it's great that you still want to accomplish this. But why do you want to look into the Storm.dll? Network and MPQ files are already very good documencted.

On another note, I am currently doing (among other things) a replay parser. The parser itself is finnished, but it doesn't show much information because in replays there is not documented how much dmg one unit deals to another. And also it does not say when a unit gets killed. This gets all calculated during runtime with a SeedValue that is saved in the replay.
I think that would be a great start point to reverse engineer the algorithm that calculates the dmg from the seed and maybe some other data (the time the game is running??) and of course you would help me alot :D

Wfg
Physaro