[freeciv-ai] (PR#13407) Stop easy AI expanding so fast.
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[freeciv-ai] (PR#13407) Stop easy AI expanding so fast. |
From: |
"Mateusz Stefek" <mstefek@xxxxxxxxx> |
Date: |
Tue, 5 Jul 2005 00:48:18 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13407 >
> [mstefek - Tue Jul 05 07:47:49 2005]:
>
> Many beginners complain about AI expanding too fast. No matter how much
> handicaps we give to novice AI, it will build more cities than human and
> eventually win.
>
> So here's my proposition: Allow easy AI players be only a litlle bit
> bigger than a human player.
>
> The patch is attached.
>
> --
> mateusz
>
? civgame.log
? civscore.log
? regression
? server/civgame-1000.sav.gz
? server/civgame-1500.sav.gz
? server/civgame-2000.sav.gz
? server/civgame-2500.sav.gz
? server/civgame-3000.sav.gz
? server/civgame-3500.sav.gz
Index: ai/advdomestic.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v
retrieving revision 1.132
diff -u -r1.132 advdomestic.c
--- ai/advdomestic.c 2 May 2005 08:45:18 -0000 1.132
+++ ai/advdomestic.c 5 Jul 2005 07:42:47 -0000
@@ -188,6 +188,10 @@
if (ai->wonder_city == pcity->id) {
want /= 5;
}
+
+ if (ai->max_num_cities >= city_list_size(pplayer->cities)) {
+ want /= 100;
+ }
if (want > choice->want) {
CITY_LOG(LOG_DEBUG, pcity, "desires founders with passion %d", want);
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.70
diff -u -r1.70 aidata.c
--- ai/aidata.c 21 Jun 2005 16:20:59 -0000 1.70
+++ ai/aidata.c 5 Jul 2005 07:42:49 -0000
@@ -685,6 +685,26 @@
} else {
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.
+ */
+ if (ai_handicap(pplayer, H_EXPANSION)) {
+ ai->max_num_cities = 3;
+ players_iterate(aplayer) {
+ if (aplayer == pplayer || aplayer->ai.control) {
+ continue;
+ }
+ ai->max_num_cities = MAX(ai->max_num_cities,
+ city_list_size(aplayer->cities) + 3);
+ } players_iterate_end;
+ } else {
+ ai->max_num_cities = MAP_INDEX_SIZE;
+ }
count_my_units(pplayer);
@@ -776,4 +796,5 @@
ai->diplomacy.player_intel[i].warned_about_space = 0;
}
ai->wants_no_science = FALSE;
+ ai->max_num_cities = 10000;
}
Index: ai/aidata.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.h,v
retrieving revision 1.29
diff -u -r1.29 aidata.h
--- ai/aidata.h 20 May 2005 16:07:32 -0000 1.29
+++ ai/aidata.h 5 Jul 2005 07:42:49 -0000
@@ -170,6 +170,9 @@
/* If the ai doesn't want/need any research */
bool wants_no_science;
+
+ /* AI doesn't like having more than this number of cities */
+ int max_num_cities;
};
void ai_data_init(struct player *pplayer);
Index: common/player.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/player.h,v
retrieving revision 1.157
diff -u -r1.157 player.h
--- common/player.h 21 Jun 2005 16:21:01 -0000 1.157
+++ common/player.h 5 Jul 2005 07:43:25 -0000
@@ -55,7 +55,8 @@
H_NOPLANES = 512, /* Doesn't build air units */
H_MAP = 1024, /* Only knows map_is_known tiles */
H_DIPLOMACY = 2048, /* Not very good at diplomacy */
- H_REVOLUTION = 4096 /* Cannot skip anarchy */
+ H_REVOLUTION = 4096, /* Cannot skip anarchy */
+ H_EXPANSION = 8192 /* Don't like being much larger than human */
};
BV_DEFINE(bv_player, MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS);
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.425
diff -u -r1.425 stdinhand.c
--- server/stdinhand.c 30 Jun 2005 20:38:42 -0000 1.425
+++ server/stdinhand.c 5 Jul 2005 07:43:40 -0000
@@ -679,10 +679,10 @@
| H_REVOLUTION,
/* novice */ H_RATES | H_TARGETS | H_HUTS | H_NOPLANES
| H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
- | H_DIPLOMACY | H_REVOLUTION,
+ | H_DIPLOMACY | H_REVOLUTION | H_EXPANSION,
/* easy */ H_RATES | H_TARGETS | H_HUTS | H_NOPLANES
| H_DIPLOMAT | H_LIMITEDHUTS | H_DEFENSIVE
- | H_REVOLUTION,
+ | H_REVOLUTION | H_EXPANSION,
H_NONE,
/* medium */ H_RATES | H_TARGETS | H_HUTS | H_DIPLOMAT,
H_NONE,
|
|