Want to play against my own AI

Anything related on how to build / improve your AI using BWAPI, BWTA, BWSAL, etc.
aip
Posts: 2
Joined: Tue Dec 22, 2009 6:15 pm

Want to play against my own AI

Postby aip » Tue Dec 22, 2009 6:25 pm

hi,

i am a new one in here and a beginner one. i have different questions.

1. How can i play against my own AI?
2. I am bit confused about these fictions provided by BWAPI. Normally to edit AI i have to edit AI scripts but what is happening in these function calls. options are, correct me if i am wrong.
2.1 AI scripts call these type of functions in normal conditions.
2.2 These functions generates new AI scripts.
3. I want to work(access) on predefined scripts bundled with Starcraft by blizzard, how can i access them?


if any question makes no sense please tell me coz i am a beginner.
User avatar
lowerlogic
Posts: 92
Joined: Sat Jun 21, 2008 11:50 pm

Postby lowerlogic » Wed Dec 23, 2009 4:45 am

1. To play against your own AI or another AI that uses BWAPI you need to set up a LAN or online game. Tofucake wrote a guide for testing bots on ICCup: http://starcraftai.rabbitx86.net/index.php?topic=3.0

2. BWAPI controls Starcraft in a completely different way from AI Scripts. AI Scripts cannot be used with BWAPI or vice versa. To make an AI using BWAPI, you need to write the AI in C++ or one of the other programming languages that BWAPI has proxies or wrappers for (Java, Python, etc).

3. I don't know the answer to this, but this question appears to be mostly unrelated to making AIs with BWAPI.

If you're familiar with writing AI Scripts, the BWSAL project is an example of one possible AI that could be created with BWAPI. BWSAL has a build order manager class and other things to help get you started, but best of all it is open source, so you can see how it works and get ideas for how to write your own AIs using BWAPI. The build order manager in BWSAL can execute build orders such as the following:

Code: Select all

     this->buildOrderManager->buildAdditional(1,UnitTypes::Terran_Barracks,60);
     this->buildOrderManager->buildAdditional(9,UnitTypes::Terran_Marine,45);
     this->buildOrderManager->buildAdditional(1,UnitTypes::Terran_Barracks,40);
     this->buildOrderManager->buildAdditional(1,UnitTypes::Terran_Academy,39);
     this->buildOrderManager->buildAdditional(9,UnitTypes::Terran_Medic,38);
     this->buildOrderManager->research(TechTypes::Stim_Packs,35);
     this->buildOrderManager->research(TechTypes::Tank_Siege_Mode,35);
     this->buildOrderManager->buildAdditional(3,UnitTypes::Terran_Siege_Tank_Tank_Mode,34);
     this->buildOrderManager->buildAdditional(2,UnitTypes::Terran_Science_Vessel,30);
     this->buildOrderManager->research(TechTypes::Irradiate,30);
     this->buildOrderManager->upgrade(1,UpgradeTypes::Terran_Infantry_Weapons,20);
     this->buildOrderManager->build(3,UnitTypes::Terran_Missile_Turret,13);
     this->buildOrderManager->upgrade(3,UpgradeTypes::Terran_Infantry_Weapons,12);
     this->buildOrderManager->upgrade(3,UpgradeTypes::Terran_Infantry_Armor,12);
     this->buildOrderManager->build(2,UnitTypes::Terran_Engineering_Bay,11);
     this->buildOrderManager->buildAdditional(40,UnitTypes::Terran_Marine,10);
     this->buildOrderManager->build(6,UnitTypes::Terran_Barracks,8);
     this->buildOrderManager->buildAdditional(10,UnitTypes::Terran_Siege_Tank_Tank_Mode,5);

It also automatically handles dependencies, so if you tell it to build a siege tank, but forget to tell it to build a factory (as in the example above), it will automatically build the factory when needed.
aip
Posts: 2
Joined: Tue Dec 22, 2009 6:15 pm

Postby aip » Wed Dec 23, 2009 6:04 pm

Thanks for replying.

BWSAL is something higher level more understandable but at lower level it is using BWAPI, is this the case?
laffo16
Posts: 6
Joined: Wed Sep 16, 2009 1:54 am

Postby laffo16 » Sun Feb 07, 2010 3:43 pm

http://starcraftai.rabbitx86.net/index.php?topic=3.0
It appears this thread was removed, could some one clarify these questions for me.

1) can you run a BWAPI script on ICCup with AH on. (i dont think chaos launcher allows this)

2) if i launch without AH, i can then Tick the "BWAPI Injector" and "Lan Latency" individualy. Will Lan Lantency still work against other players who are using the ICCup launcher.

3) is it possible (on one machine) to fight against your constructed AI.

4) is it possible to navigate through the game menus, and lobby with cmds?
Nuclear
Posts: 13
Joined: Thu Jan 28, 2010 8:32 pm

Postby Nuclear » Sun Feb 07, 2010 6:23 pm

1) can you run a BWAPI script on ICCup with AH on. (i dont think chaos launcher allows this)


Well, I don't think that this can be possible. BWAPI, as any external program could be considered as a hack/cheat. Imagine, if you could run an AI, which helps you while you play. Automine, autoqueue, information about enemy - all in one. Even if you run AH together with BWAPI, AH will find BWAPI as a hack and you will be dropped. Yes, when there are good AI's, maybe we will play AI vs AI or AI vs Human battles without antihack, or there will be special "BWAPI mode" of the AH launcher, which allows only BWAPI (with CompleteMapInformation and UserInput flags turned off).


3) is it possible (on one machine) to fight against your constructed AI.

The only way is to run two instances of Starcraft, second started with BWAPI. But maybe they will have network conflict. If you use a virtual machine, I think you will have success (I haven't tested it, because I have 2PCs at home and dont need to run all on one (there is a long way, until I start playing vs the AI, which I am creating now)).

4) is it possible to navigate through the game menus, and lobby with cmds?

You can use a program like AutoHotkey - something, that executes keystrokes (load starcraft.exe, wait 5 seconds, press m, press e, wait 500 miliseconds, press PageDown, etc...) But so you can't autostart games (because of race selection, starting).
If you want the AI to play infinite games (vs another AI's maybe), you can use UMS mode and make a map, which resets it's initial state, when one of the players wins. The easiest solution is to play in single player mode and when needed to restart the game, using BWAPI::Game::restartGame();
I don't know about BWAPI functions, that control events before the start of the game (like new multiplayer lan udp game, choose map python, set me terran, set 1 enemy protoss, press the start button).
laffo16
Posts: 6
Joined: Wed Sep 16, 2009 1:54 am

Postby laffo16 » Sun Feb 07, 2010 6:46 pm

thanks for the reply, yes i know of autohotkey, im quite familuar with autoit (simular program), but new to c++. automating key strokes wouldnt be a problem, but reading data from the channel lobby and pre-game lobby would be nice to do this through some bwapi calls (particularly, reading player names, in which force, races, and pre-game dialog "go", "glhf"). Any ways, 4) is not such a big thing but just wondering about that.

3) do you think it will be possible at any point in the future to be able to play against a comp running the ai (from a single pc without vm), i wonder why this has been ruled out of bwapi and is not possible at the mo
Nuclear
Posts: 13
Joined: Thu Jan 28, 2010 8:32 pm

Postby Nuclear » Sun Feb 07, 2010 7:29 pm

BWAPI is totally different from the built-in AI scripts. BWAPI "replaces" the user in playing the game.
Playing Human vs BWAPI on 1 PC and 1 starcraft process running is the same as 2 humans playing Starcraft on the same PC (The game doesn't allow this).
The built-in scripts can be modified, but things like micro (there is actually no micro) and building placemest can't be modified. Maybe it can be possile to modify them and replace them, together with the AI scripts (build orders) with the entire BWAPI module. This will damage the global unit AI, that works also on own units (if a unit isn't on hold position and enemy unit comes nearby, chase it and attack it, or target choice when attacking) (or all that must be included in BWAPI). I think that something like a virtual machine or another PC (yes, starcraft doesn't have big system requirements) will be easier.
laffo16
Posts: 6
Joined: Wed Sep 16, 2009 1:54 am

Postby laffo16 » Sun Feb 07, 2010 11:02 pm

thanks Nuclear
Heinermann
Posts: 362
Joined: Thu Apr 26, 2007 12:42 am

Postby Heinermann » Mon Feb 08, 2010 9:51 pm

It's possible to make BWAPI work with the Anti-hack, just like it's possible for hacks to work with Blizzard's Warden etc. But we won't be doing that for obvious reasons.
bugking
Posts: 18
Joined: Sun Dec 20, 2009 5:29 am

Postby bugking » Mon Feb 22, 2010 11:57 am


Return to “AI development (BWAPI Bots)”

Who is online

Users browsing this forum: No registered users and 1 guest