Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2006:
[Freeciv-Dev] (PR#18206) largepoxing AI
Home

[Freeciv-Dev] (PR#18206) largepoxing AI

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#18206) largepoxing AI
From: "Curtis Warren" <cwarren89@xxxxxxxxx>
Date: Fri, 30 Jun 2006 17:04:53 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=18206 >

I've tweaked a few things and managed to get the AI to rapture
reasonably well and keep it from expanding forever. In order to get
the AI's cities to grow to size 3 as quickly as possible, I've
modified the city management code for placing workers to emphasize
growth up to size 3 rather than 2. To get the AI to rapture I set
ai->max_num_cities to a hard limit (8), which is pretty much a hack,
although it works reasonably well most of the time. It fairs pretty
well against the normal AI, although it definitely could be improved.
Probably the nicest thing about having a largepoxing AI is that 1) you
can actually establish traderoutes with it and 2) it's a bit more fun
to take over several heavily guarded cities rather than a lot of wimpy
cities.

I've actually played a few games with it and I find it quite
enjoyable. To see it in action, I've uploaded a screenshot of a game I
played on the large earth map as Greece:
http://home.comcast.net/~cwarren89/greece.png

diff -ur -Xfreeciv/diff_ignore freeciv-orig/ai/aidata.c freeciv/ai/aidata.c
--- freeciv-orig/ai/aidata.c    2006-06-30 18:11:44.000000000 -0500
+++ freeciv/ai/aidata.c 2006-06-30 18:39:34.000000000 -0500
@@ -484,31 +484,12 @@
     ai->wants_no_science = FALSE;
   }
   
-  /* max num cities
-   * The idea behind this code is that novice players don't understand that
-   * expansion is critical and find it very annoying.
-   * With the following code AI players will try to be only a bit better 
-   * than the best human players. This should lead to more exciting games
-   * for the beginners.
+  /* Let the AI grow its cities once there are enough. This is not a hard
+   * limit, the AI can and will go over this number of cities, although it's
+   * generally not important so long as it stops expanding sometime.
    */
-  if (ai_handicap(pplayer, H_EXPANSION)) {
-    bool found_human = FALSE;
-    ai->max_num_cities = 3;
-    players_iterate(aplayer) {
-      if (aplayer == pplayer || aplayer->ai.control || !aplayer->is_alive) {
-        continue;
-      }
-      ai->max_num_cities = MAX(ai->max_num_cities,
-                               city_list_size(aplayer->cities) + 3);
-      found_human = TRUE;
-    } players_iterate_end;
-    if (!found_human) {
-      ai->max_num_cities = MAP_INDEX_SIZE;
-    }
-  } else {
-    ai->max_num_cities = MAP_INDEX_SIZE;
-  }
-
+  ai->max_num_cities = 8;
+  
   count_my_units(pplayer);
 
   TIMING_LOG(AIT_AIDATA, TIMER_STOP);
diff -ur -Xfreeciv/diff_ignore freeciv-orig/server/cityturn.c 
freeciv/server/cityturn.c
--- freeciv-orig/server/cityturn.c      2006-06-30 18:11:27.000000000 -0500
+++ freeciv/server/cityturn.c   2006-06-19 11:01:44.000000000 -0500
@@ -220,14 +220,14 @@
    * to be used here.  However that doesn't work at all because those values
    * are on a different scale.  Later the ai may wish to adjust its
    * priorities - this should be done via a separate set of variables. */
-  if (pcity->size > 1) {
+  if (pcity->size > 2) {
     if (pcity->size <= game.info.notradesize) {
       cmp.factor[O_FOOD] = 15;
     } else {
       cmp.factor[O_FOOD] = 10;
     }
   } else {
-    /* Growing to size 2 is the highest priority. */
+    /* Growing to size 3 is the highest priority. */
     cmp.factor[O_FOOD] = 20;
   }
   cmp.factor[O_SHIELD] = 5;

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#18206) largepoxing AI, Curtis Warren <=