top | item 3162004

Starcraft 2 Automated Player

381 points| nostromo | 14 years ago |graphics.stanford.edu | reply

43 comments

order
[+] nostromo|14 years ago|reply
I hope people notice this cool feature in the documentation: trash talking! Turing would be proud.

> The AI maintains a set of personas it adopts when fighting humans. These are designed to intimidate the person with the AI's ability to type very complicated and computationally intensive sentences in the middle of battles. Currently this feature is not well developed since it does not affect the win-loss ratio much and I've decided not to unleash the AI on hapless Battle.net players, but I may revisit it eventually.

[+] sliverstorm|14 years ago|reply
^ My favorite strategy when I'm defeated and my teammate is still kicking. Try to get a rise out of the enemey just as my teammate executes a drop!
[+] moconnor|14 years ago|reply
Every AI I've ever seen or written has always sidestepped inconveniences such as a limited number of actions per frame and a limited field of view. Getting this working in a game as complex as Starcraft 2 is ridiculously impressive.

The thread-like programs is an interesting approach, too. I wonder if the author plans to treat stale state using Bayesian belief models instead of assuming it's still correct until a scheduled poll checks it.

[+] forrestthewoods|14 years ago|reply
For the record, this is how a lot of video game cheats work and it SUCKS. Aimbots in FPS games for example exist 100% out of the game executable so there is no way to stop it. The only option you have as a dev is to detect the behavior and ban with righteous fury.

It's both incredibly cool and wildly frustrating at the same time.

[+] bkrausz|14 years ago|reply
There's a lot of detection that can be done beyond just the behavior. The problem basically reduces to virus detection (and the ensuing arms race). You check all running programs for something that looks like this kind of bot. Right now it's probably easier to just detect the APM or jerky screen view, but in the long run that's the best way to shut these down.

Personally I'm really hoping Blizzard doesn't go after things like this too actively on SC2. It's unfortunate that there's no offline place for bots to play against each other, because the competitions that arise are really fun. There's definitely less money to be made here than in, say, WoW.

[+] devicenull|14 years ago|reply
While they are outside the game executable, they are typically injected into the game's memory space, and detour actual game functions.
[+] joelthelion|14 years ago|reply
Note that this is not just another AI for Starcraft: it actually plays the game like a human, by "looking at the screen", and issuing keyboard and mouse orders.
[+] snippyhollow|14 years ago|reply
With 1k-2k APM, _with_ grouping commands by contrast to BWAPI (Broodwar API) which does not allows for group commands (20 units attack move = 20 actions with BWAPI, only 2 actions here). And low-level SC2 AI which is at least one order of magnitude less micro-intensive than Broodwar's.
[+] albertzeyer|14 years ago|reply
It seems more like it is a DirectX wrapper, i.e. it gets all the DirectX calls and can insert any user events there.

Getting the DirectX graphic calls and using them is probably a much easier approach than to just looking at the final screen.

[+] martinkallstrom|14 years ago|reply
Hey Matt, if you're reading this - why not post replay files to show off it's abilities. Or send to HuskyStarcraft for him to cast, I think that would be awesome.
[+] dibs|14 years ago|reply
Matt has a reddit account. Also, from what I understand, this AI is a modification from work he has done making players for Warcraft 3 and Dota.

Regarding releasing replays:

>>"I'm also aware that Blizzard programmers might find the project interesting but Blizzard as a whole is obligated to not like the idea; this is also reason I've never released a replay, as this would be a clear indication I've played the bot on Battle.net (not to mention they might have a detector or two for things with 5000+ apm)."

http://www.reddit.com/user/techmatt

[+] trafficlight|14 years ago|reply
The replays would be awesome. Then you don't have to deal with the jumping camera.
[+] rkangel|14 years ago|reply
It would be interesting to see how it would fare against a top level human, but I'd be more interested to see how it would fare against other AI implementations.

There could be a whole separate community for SC2 AI competitions - a bit like there exists with chess.

[+] snippyhollow|14 years ago|reply
There are Broodwar's AI competitions with the use of BWAPI, they don't win against good-to-top humans yet. (Btw, Broodwar is way more balanced than SC2.)http://code.google.com/p/bwapi/
[+] johnmurch|14 years ago|reply
Yea - like someone like Whitera or TLO - husky should totally try and cast an AI vs Pro game
[+] fdudfsfa89|14 years ago|reply
Suggestions: (1) emulate the time required to move the mouse, (2) reduce the number of times that objects are focused as a human player would do by keeping track of recent commands and not repeating them especially when there is no attacking/defense occurring, (3) emulate human reaction delay. The goal should be that it shouldn't cause convulsions when watching it due to the rapid changes in focus. This is incredibly awesome, though.
[+] mentat|14 years ago|reply
Actually if you see pro players play, they jump around in a very similar fashion. That pattern similarity was one of the most impressive things about this.
[+] quasistar|14 years ago|reply
Kudos to Matt Fisher on an heroic undertaking. Internal states of D3D devices can be substantial on modern hardware, e.g. 100+ renderer calls in that single frame alone. And there are many impressive components in this AI: translating texture glyphs into literal meaning, the scene 'tree' gamestate, rational action choice based on a combo of said extracted gamestate and what I can only assume is his secret play strategy honed over countless hours of battle...

Here is one who is unwilling to sit idly by while an official API arrives from the vendor. And for that he should be applauded. But it begs the question: when will Blizzard release an official SC2 API? Or is there a way to take Matt's work and create a 'sandbox' battle.net solely for bot enthusiasts?

[+] notpmocd|14 years ago|reply
This is really cool. The closer-to-human aspect is great, and the graphics approach is definitely interesting. I love the idea of an AI whose difficulty could be largely tuned by implementing a max APS.

Added the code to my (long) list of things to read!

[+] JabavuAdams|14 years ago|reply
Fantastic! I've played around with BWAPI for Starcraft (1) AIs, but I like this approach.

So, when's the first SC2 AI competition? The nice thing about SC1 though is that there's no problem running 4 instances in VMs all on the same laptop.

[+] jamesu|14 years ago|reply
I'd be very interested in using something like this to unlock ridiculous achievements on steam.
[+] saraid216|14 years ago|reply
I still haven't gotten the "An engineer disarms a landmine after you spot it" achievement on Brink...
[+] andrewljohnson|14 years ago|reply
I wish it said what rank it played at... did I miss that bit?
[+] karpathy|14 years ago|reply
I believe he says somewhere that he didn't have it play against real players on battle net so far, but that he can beat AI up to insane, exclusive. I was happy to find out that he's a Stanford PhD student though, and that his office is right above mine :) So I need to drop by tomorrow and convince him to... properly evaluate the algorithm... for science.
[+] mutagen|14 years ago|reply
Based on his description of beating Very Hard opponents I'd guess it is gold to platinum level at the current stage.
[+] toblender|14 years ago|reply
Wow best research project ever!
[+] OZZlE|14 years ago|reply
This could be used as a cheat :/