Complete.Org: Mailing Lists: Archives: freeciv-ai: May 2002:
[freeciv-ai] Settler fixes [Was: A better AI Eval buildings 1.1]

[freeciv-ai] Settler fixes [Was: A better AI Eval buildings 1.1]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: <freeciv-ai@xxxxxxxxxxx>
Subject: [freeciv-ai] Settler fixes [Was: A better AI Eval buildings 1.1]
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Sat, 11 May 2002 14:33:11 -0400

At 07:10 PM 02/05/09 -0700, Raahul Kumar wrote:
>--- "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx> wrote:
>> At 02:47 AM 02/05/09 -0700, you wrote:

>Ok, Ross, I have a bone to pick with the changes you made in advdomestic.c.
>The -1 change from 0 for default unit ids seemed good. Until I realised the
>consequences. Your AI is now easier to kill in the beginning. It just doesn't
>expand fast enough. There needs to be some sort of city limit / landmass
>available factor - if I have 50% landmass yet to be settled, more engineers,
>if I have more than 10+ cities fewer engineers etc.
>And to make it worse, you further kill settler desire elsewhere. Your
>changes are great. Very much needed. Oddly enough, I belive your foodneed
>changes make it possible for the AI to churn out more settlers than it

Great! I like fighting over bones when there is meat to be found :-)

Note, the places you are looking at really only kick in when there is
nothing much wanted. It is really a mistake to build settlers by default
as typically they will appear and starve to death in a turn or so if
you are in this mode. It is better to actually *want* settlers than get
stuck with them by some default.

I spent a fair bit of time cleaning up settlers.c so the want values were
reasonable. If you run the corecleanups at debug level 4, you should get
more information than you ever wanted to know about how the AI figures
things out. There are extra printouts and cleaner formatting that makes
it easier to read, plus the FOW and path finding noise is largely commented 

There are also fixes to artificially boost founder want when the number
of cities is less than 6. The food production values also reflect this
desire to grow and expand, plus new cities are sited at growth locations
i.e. locations where they have at least +2 food possibilities.

  want = evaluate_city_building(&virtualunit, &gx, &gy, &ferryboat);

  /* a little bump to boost early civ spread, but don't force unnecessarily */
  if(pplayer->cities.list.nelements < 6) {
    nn = want * (6-pplayer->cities.list.nelements);
    want = (want < 100 && nn >= 100) ? 99 : nn;
  /* Insure a new size 1 city can grow at 2 excess food per turn */
  /* This probably should account for current government type.   */
  f = food[2][2] + irrig[2][2];
  if ((a+= f) <= 2*MORT )
This sort of thing improves city placement.

      /* without this,
       * the computer will go 6-7 tiles from X to build a city at Y
       * and then build its NEXT city halfway between X and Y. -- Syela
       * Actually it does this anyway - once it steps more than 6 tiles
       * the next best place is the strip in between the two cities.
       * The problem is that the search radius is always from the same
       * spot and valid city locations get more and more constrained.
       * It would be better to do a global site search and static eval,
       * then compute the final best locations for each city/settler.
      d = (mv_cost + mv_rate - 1) / mv_rate;
        /* This adds a damping factor to stop long moves for the first few
         * cities where fast growth is worth more than longterm optimal. */
        if( pplayer->cities.list.nelements < 5
          && d > (b= (pplayer->cities.list.nelements < 1 ? 1 : 5)) )
          d += (d - b)*(6-pplayer->cities.list.nelements);

      /* This adds a cosine-like factor to space cities every 5 tiles */
      b = d;
      square_iterate(x, y, 5, x1, y1) {
        if( map_get_city(x1, y1) ) {
          static int cos[6] = { 1, 4, 16, 16, 4, 1};
          d += cos[real_map_distance(x1, y1, x, y)] * b;
      } square_iterate_end;
In fact I found new city placement too strong and have damped it with
things like.

      /* reduce city desire for higher government types to reflect the
       * general efficiency improvements, i.e. quality vs quantity */
      b= (1+gov_factor), b= b*b;
      newv /= b;



[Prev in Thread] Current Thread [Next in Thread]