[Freeciv-Dev] (PR#9623) Re: terrain improvers (fwd)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9623 >
> ---------- Forwarded message ----------
> Date: Thu, 05 Aug 2004 11:03:27 -0400
> From: Jason Dorje Short <jdorje@xxxxxxxxxxxxxxxxxxxxx>
> Cc: freeciv-dev@xxxxxxxxxxx
> Subject: [Freeciv-Dev] Re: terrain improvers
>
> Per Inge Mathisen wrote:
> > The AI want for terrain improvers seems to have exploded. It builds way
> > too many of them. Perhaps related to recent cleanup of this code?
>
> Yes, it surely does. Since the times-10-turns-to-build bug was fixed,
> the evaluated goodness of a post-improved tile is higher. This
> apparently results in a higher settler want.
Attached patch doesn't fix anything but does some cleaning of
contemplate_terrain_improvements and adds a debug message. From playing
around I get a feeling that:
roads get a huge want (100 to 300)
before amortization, road want is less then mine want
because mines take ages to complete, they lose to roads.
At the moment I don't know how to bring the want to reasonable size.
Maybe we shouldn't.
G.
P.S. I will load a savegame on which I was experimenting directly to RT
? saves
? ttt
? ttt.gz
? ai/aiexplorer.c
? ai/aiexplorer.h
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.190
diff -u -r1.190 settlers.c
--- server/settlers.c 6 Aug 2004 10:35:49 -0000 1.190
+++ server/settlers.c 6 Aug 2004 15:29:32 -0000
@@ -1073,7 +1073,7 @@
map_get_tile(gx, gy)->assigned =
map_get_tile(gx, gy)->assigned | 1<<pplayer->player_no;
} else {
- UNIT_LOG(LOG_NORMAL, punit, "giving up trying to improve terrain");
+ UNIT_LOG(LOG_DEBUG, punit, "giving up trying to improve terrain");
return; /* We cannot do anything */
}
set_goto_dest(punit, gx, gy); /* TMP */
@@ -1372,15 +1372,17 @@
}
/**************************************************************************
-used to use old crappy formulas for settler want, but now using actual
-want!
+ Estimates the want for a terrain improver (aka worker) by creating a
+ virtual unit and feeding it to evaluate_improvements.
+
+ TODO: AI does not ship F_SETTLERS around, only F_CITIES - Per
**************************************************************************/
void contemplate_terrain_improvements(struct city *pcity)
{
struct player *pplayer = city_owner(pcity);
struct unit *virtualunit;
int want;
- int gx, gy; /* dummies */
+ int gx, gy;
enum unit_activity best_act;
struct tile *ptile = map_get_tile(pcity->x, pcity->y);
struct ai_data *ai = ai_data_get(pplayer);
@@ -1398,21 +1400,14 @@
want = evaluate_improvements(virtualunit, &best_act, &gx, &gy);
free(virtualunit);
-/* FIXME: AI does not ship F_SETTLERS around, only F_CITIES - Per */
-#ifdef AI_SMART
- unit_list_iterate(pplayer->units, qpass) {
- /* We want a ferryboat with want 199 */
- if (qpass->ai.ferryboat == pcity->id)
- want = -199;
- } unit_list_iterate_end;
-#endif
-
/* modify our desire based on available statistics to prevent
* overflooding with worker type units if they come cheap in
* the ruleset */
want /= MAX(1, ai->stats.workers[ptile->continent]
/ MAX(1, ai->stats.cities[ptile->continent]));
+ CITY_LOG(LOG_DEBUG, pcity, "wants %s with want %d to do %s at (%d,%d)",
+ unit_name(unit_type), want, get_activity_text(best_act), gx, gy);
assert(want >= 0);
pcity->ai.settler_want = want;
}
|
|