Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7129) server-side CMA uses bad parameters
Home

[Freeciv-Dev] (PR#7129) server-side CMA uses bad parameters

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#7129) server-side CMA uses bad parameters
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 27 Jan 2004 14:24:04 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7129 >

> [ue80@xxxxxxxxxxxxxxxxxxxxx - Sun Jan 11 18:25:57 2004]:
> 
> On Sun, Jan 11, 2004 at 09:56:50AM -0800, Jason Short wrote:
> > 
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=7129 >
> > 
> > What are "good" parameters for the CMA to use for general/default play?
> > 
> > Any "good" players want to come up with sensible defaults?
> 
> The default depends on the size of a city. Good values for size 1 cities
> could be 
> food * 20 
> prod * 5
> gold * 2
> techout * 2
> 
> But when cities get bigger the food can be reduced and it depends on the
> goals if food is necessary or not.

Um, the attached patch changes this.

What was the purpose of the code that was there before?

1.  It uses pplayer->ai "priority" values.  This doesn't make much sense
for human players.
2.  It adjusts these values at random.  What's up with this?
3.  It has non-zero values for trade and luxury.  Neither of these are
of any use on their own (trade goes into gold/science/luxury; luxury
affects happiness which is judged separately).

With this patch everything is much happier.  However if the minimums (+1
food, +1 shield) cannot be reached the fallback is pretty poor.

The code that is there now is unacceptable IMO.  But it would be nice to
know what its purpose is before changing it.  I suspect that the AI
"priority" values were being used for another purpose elsewhere and were
conscripted into CM usage, with tweaks.  This does not seem like a good
idea!

jason

Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.240
diff -u -r1.240 cityturn.c
--- server/cityturn.c   2004/01/25 14:28:10     1.240
+++ server/cityturn.c   2004/01/27 22:23:43
@@ -151,7 +151,6 @@
   struct cm_parameter cmp;
   struct cm_result cmr;
   struct player *pplayer = city_owner(pcity);
-  struct ai_data *ai = ai_data_get(pplayer);
 
   /* HACK: make sure everything is up-to-date before continuing.  This may
    * result in recursive calls to auto_arrange_workers, but it's better
@@ -172,18 +171,18 @@
   /* WAGs. These are set for both AI and humans.
    * FIXME: Adjust & remove kludges */
   if (pcity->size > 1) {
-    cmp.factor[FOOD] = ai->food_priority - 9;
+    cmp.factor[FOOD] = 10;
   } else {
     /* Growing to size 2 is priority #1, since then we have the
      * option of making settlers. */
     cmp.factor[FOOD] = 20;
   }
-  cmp.factor[SHIELD] = ai->shield_priority - 7;
-  cmp.factor[TRADE] = 10;
-  cmp.factor[GOLD] = ai->gold_priority - 11;
-  cmp.factor[LUXURY] = ai->luxury_priority;
-  cmp.factor[SCIENCE] = ai->science_priority + 3;
-  cmp.happy_factor = ai->happy_priority - 1;
+  cmp.factor[SHIELD] = 5;
+  cmp.factor[TRADE] = 0;
+  cmp.factor[GOLD] = 2;
+  cmp.factor[LUXURY] = 0;
+  cmp.factor[SCIENCE] = 2;
+  cmp.happy_factor = 0;
 
   cmp.minimal_surplus[FOOD] = 1;
   cmp.minimal_surplus[SHIELD] = 1;

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