Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] Re: barbarians on the poles (PR#6183)
Home

[Freeciv-Dev] Re: barbarians on the poles (PR#6183)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: barbarians on the poles (PR#6183)
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 1 Oct 2003 18:59:48 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Gregory Berkolaiko wrote:
> On Mon, 29 Sep 2003, Jason Short wrote:

> I think it's a good solid design.  It can also be used in mapgen, but then 
> the signature of the filter should be changed to, say, 
>       filter(int, int, void *)
> to be able to get more data.  This can be done when the mapgen starters 
> patch gets updated though.

I think the existence and design of rand_map_pos_filtered is solid, but 
I'm very unhappy with its use for barbarian summoning.

Currently every tile has an equal chance of being summoned on.  If one 
tile becomes invalid for sommoning, this does not change the probability 
of any other tile being summoned on.  Under this patch, when a summon 
succeeds it ALWAYS succeeds.  This means more barbarians showing up 
early, and probably (I haven't tested) means more, concentrated 
barbarians once the whole globe (minus a few positions) is tamed.

When viewed in this light, it seems clear to me that an attempted 
summons on a bad-terrain tile shouldn't be treated any differently than 
any other summoning method.  The probability of summoning on one tile 
shouldn't change when a different tile is transformed.

This method also has the advantage of being robust.  If all tiles are 
tundra and glacier, then there will just be no successful summoning.

Patch attached.

jason

Index: server/barbarian.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/barbarian.c,v
retrieving revision 1.68
diff -u -r1.68 barbarian.c
--- server/barbarian.c  2003/09/19 14:14:45     1.68
+++ server/barbarian.c  2003/10/02 01:58:49
@@ -328,10 +328,18 @@
   struct city *pc;
   struct player *barbarians, *victim;
 
+  /* We attempt the summons on a particular, random position.  If this is
+   * an invalid position then the summons simply fails this time.  This means
+   * that a particular tile's chance of being summoned on is independent of
+   * all the other tiles on the map - which is essential for balanced
+   * gameplay. */
+  rand_map_pos(&x, &y);
+
   /* No uprising on North or South Pole */
-  do {
-    rand_map_pos(&x, &y);
-  } while (y == 0 || y == map.ysize - 1);
+  if (map_get_terrain(x, y) == T_TUNDRA
+      || map_get_terrain(x, y) == T_ARCTIC) {
+    return;
+  }
 
   if (!(pc = dist_nearest_city(NULL, x, y, TRUE, FALSE))) {
     /* any city */

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