Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Topics - imbalisk

#1
Hey guys.


I've been playing SC1 since 2004 and I'm also interested in coding, so lets see if I can help the coders with some cool scripts to improve the AI :)


In Starcraft 1 I choose my build order or general gameplan based on the situation: is it a 1v1 or a 3v3? Or even a FFA?
When its a 1v1, what race I am playing against?
Wouldn't it be cool if the AI make the same decisions like a REAL (clever) player?
Here is the script:


First of all, we want to know how many players are in the game. I've tried AIGetNumEnemies (player); but it didn't work (returned a constant 13 no matter how much players are in). Here is the code of a working AI that analyze the game situation:



static void ProtossInit (int player) {
        ...   
   int numberOfPlayers = 0;
   string s = null;
   int i = 1;
   int enemyID;
   
   // Counting the players   
   while(i<=8){ // Asuming that blizzard has a maximum of 8 players
      s = PlayerRace(i); // getting a "Terr", "Zerg", "Prot" if this ID is used
      if(s != null) {  // otherwise a null if there is no player
          numberOfPlayers = numberOfPlayers + 1;
      }
      i = i + 1;
   }
   if(numberOfPlayers == 2) {
          // Lets find out our opponents playerID. It can't be our ID:
      if(player == 1) { // is my ID == 1?
         enemyID = 2;
      }
      else { // ok, my ID is 2
         enemyID = 1;
      }
      TriggerDebugOutput(1, StringToText("1v1 Mode vs " + PlayerRace(enemyID) ), true);
                 // add a state setting code here
                 // example: state = e_mainState_OpenGnd0; if you want to execute the ProtossOpenGnd0
   }
   else {
      TriggerDebugOutput(1, StringToText("FFA Mode vs " +               IntToString(numberOfPlayers-1)), true);

                // add a state setting code here
                // example: state = e_mainState_OpenGnd1; whatever
   }

Lets say AI is protoss and this script tells him that are 2 players in the game (1v1 baby) and PlayerRace(enemyID) == "Terr".
We can choose an opening that is good against Terran, lets say a Stalker into Immortal build.
If it's a FFA we could ajust our build so that if the AI is attacking, we make some defense, cause nobody likes an attack from player 3 when we attack player 2. Well thats what happens in FFA :)


Hope that helps a little bit, pls give me credit if you use that in your own AI.
- imbalisk
edit:
thx @ sYkO for providing this nice 1v1 obsmaps
#2
AI Discussion / DISCUSS AI v 4.0
February 28, 2010, 03:29:00 PM

Note: This thread is for discussing the NON-CHEATING AI of our current version 4.0

Please give us some feedback to the AI:
Is it too hard?
Easy to beat?
What are the weaknesses, what do you want to be changed?
Currently we try to implement more builds to have more variations in the game :)