Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10308) PATCH: New startpos option and rational control
Home

[Freeciv-Dev] (PR#10308) PATCH: New startpos option and rational control

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10308) PATCH: New startpos option and rational control of generators
From: "Marcelo Burda" <mburda@xxxxxxxxx>
Date: Fri, 24 Sep 2004 14:06:53 -0700
Reply-to: rt@xxxxxxxxxxx

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

This first part include a prototype of server option to control the 
new start pos code. i think use map.generator to choice the generator 
1) random one (old gen1) 
2) pseudo-fractal one (old gen 5) 
3) isle based ones (old gen 2 - 4) 
 
this last need to be rewrited or remplaced to gen-terr 
 
to do control over the start pos i create a new option 
 
map.startpos 
 
where  
0: the generator default 
1: one player per isle when posible 
2: 2 player per isle when posible 
3: all player in some isle when posible. 
 
generator can be optimized to see map.startpos and do best maps for 
hopes of players. old genr 2-4 are suitched with this option 
 
this is more rational than the old system. and this second option will 
used by new generator code to do the hope of players. 
 
Marcelo 
diff -ruN -Xfreeciv/diff_ignore freeciv/common/map.c freeciv_/common/map.c
--- freeciv/common/map.c        2004-09-20 18:42:30.000000000 +0200
+++ freeciv_/common/map.c       2004-09-24 16:47:47.000000000 +0200
@@ -200,6 +200,7 @@
   map.wetness               = MAP_DEFAULT_WETNESS;
   map.steepness             = MAP_DEFAULT_STEEPNESS;
   map.generator             = MAP_DEFAULT_GENERATOR;
+  map.startpos              = MAP_DEFAULT_STARTPOS;
   map.tinyisles             = MAP_DEFAULT_TINYISLES;
   map.separatepoles         = MAP_DEFAULT_SEPARATE_POLES;
   map.alltemperate          = MAP_DEFAULT_ALLTEMPERATE;
diff -ruN -Xfreeciv/diff_ignore freeciv/common/map.h freeciv_/common/map.h
--- freeciv/common/map.h        2004-09-20 18:42:30.000000000 +0200
+++ freeciv_/common/map.h       2004-09-24 16:47:41.000000000 +0200
@@ -164,6 +164,7 @@
   int huts;
   int landpercent;
   int generator;
+  int startpos;
   bool tinyisles;
   bool separatepoles;
   bool alltemperate;
@@ -646,7 +647,11 @@
 
 #define MAP_DEFAULT_GENERATOR    1
 #define MAP_MIN_GENERATOR        1
-#define MAP_MAX_GENERATOR        5
+#define MAP_MAX_GENERATOR        3
+
+#define MAP_DEFAULT_STARTPOS     0
+#define MAP_MIN_STARTPOS         0
+#define MAP_MAX_STARTPOS         3
 
 #define MAP_DEFAULT_TINYISLES    FALSE
 #define MAP_MIN_TINYISLES        FALSE
Les fichiers binaires freeciv/manual/civmanual et freeciv_/manual/civmanual 
sont différents.
diff -ruN -Xfreeciv/diff_ignore freeciv/server/generator/height_map.c 
freeciv_/server/generator/height_map.c
--- freeciv/server/generator/height_map.c       2004-09-22 08:39:28.000000000 
+0200
+++ freeciv_/server/generator/height_map.c      2004-09-24 21:43:29.000000000 
+0200
@@ -156,7 +156,7 @@
 
   All X and Y values used in this function are in native coordinates.
 **************************************************************************/
-void make_pseudofractal1_hmap(void)
+void make_pseudofractal1_hmap(int extra_div)
 {
   const bool xnowrap = !topo_has_flag(TF_WRAPX);
   const bool ynowrap = !topo_has_flag(TF_WRAPY);
@@ -165,8 +165,8 @@
    * How many blocks should the x and y directions be divided into
    * initially. 
    */
-  const int xdiv = 6;          
-  const int ydiv = 5;
+  const int xdiv = 5 + extra_div;              
+  const int ydiv = 5 + extra_div;
 
   int xdiv2 = xdiv + (xnowrap ? 1 : 0);
   int ydiv2 = ydiv + (ynowrap ? 1 : 0);
diff -ruN -Xfreeciv/diff_ignore freeciv/server/generator/height_map.h 
freeciv_/server/generator/height_map.h
--- freeciv/server/generator/height_map.h       2004-09-22 08:39:28.000000000 
+0200
+++ freeciv_/server/generator/height_map.h      2004-09-24 18:12:50.000000000 
+0200
@@ -38,6 +38,6 @@
 void normalize_hmap_poles(void);
 void renormalize_hmap_poles(void);
 void make_random_hmap(int smooth);
-void make_pseudofractal1_hmap(void);
+void make_pseudofractal1_hmap(int div);
 
 #endif  /* FC__HEIGHT__MAP_H */
diff -ruN -Xfreeciv/diff_ignore freeciv/server/generator/mapgen.c 
freeciv_/server/generator/mapgen.c
--- freeciv/server/generator/mapgen.c   2004-09-22 08:39:29.000000000 +0200
+++ freeciv_/server/generator/mapgen.c  2004-09-24 21:55:33.000000000 +0200
@@ -1016,24 +1016,29 @@
     adjust_terrain_param();
     /* if one mapgenerator fails, it will choose another mapgenerator */
     /* with a lower number to try again */
-    if (map.generator == 5 ) {
-      make_pseudofractal1_hmap();
-    }
-    if (map.generator == 4) {
-      mapgenerator4();
-    }
+    
     if (map.generator == 3) {
-      mapgenerator3();
+      if (map.startpos > 2 ) { /* any else 2 or 3 player per isle*/
+       mapgenerator4();
+      }
+      if (map.startpos == 1 ) { /* single player per isle */
+       mapgenerator3();
+      }
+      if (map.startpos == 0 ) { /* developer choice */
+       mapgenerator2();
+      }
     }
-    if (map.generator == 2) {
-      mapgenerator2();
+
+    if (map.generator == 2 ) {
+      make_pseudofractal1_hmap(1 + (map.startpos ? game.nplayers: 0));
     }
+
     if (map.generator == 1 ) {
-      make_random_hmap(1 + SQSIZE);
+      make_random_hmap(MAX(1, 1 + SQSIZE - (map.startpos ? game.nplayers / 4: 
0)));
     }
 
     /* if hmap only generator make anything else */
-    if (map.generator == 1 || map.generator == 5) {
+    if (map.generator == 1 || map.generator == 2) {
       make_land();
       free(height_map);
       height_map = NULL;
diff -ruN -Xfreeciv/diff_ignore freeciv/server/settings.c 
freeciv_/server/settings.c
--- freeciv/server/settings.c   2004-09-20 18:42:31.000000000 +0200
+++ freeciv_/server/settings.c  2004-09-24 16:47:35.000000000 +0200
@@ -259,21 +259,25 @@
   GEN_INT("generator", map.generator,
          SSET_MAP_GEN, SSET_GEOLOGY, SSET_VITAL,  SSET_TO_CLIENT,
          N_("Method used to generate map"),
-         N_("1 = standard, with random continents;\n\n"
-            "2 = equally sized large islands with one player each, and "
-            "twice that many smaller islands;\n\n"
-            "3 = equally sized large islands with one player each, and "
-            "a number of other islands of similar size;\n\n"
-            "4 = equally sized large islands with two players on every "
-            "island (or one with three players for an odd number of "
-            "players), and additional smaller islands;\n\n"
-            "5 = one or more large earthlike continents with some "
-            "scatter.\n\n"
-            "Note: values 2,3 and 4 generate \"fairer\" (but more boring) "
+         N_("1 = Full random height map based generator    (old gen1)  \n"
+            "2 = Pseudo-fractal height map based generator (old gen5)  \n"
+            "3 = Deprecated islands based map generator    (old gen2-4)\n"
+            "Note: generator 3 generate \"fairer\" (but more boring) "
             "maps.\n"
             "(Zero indicates a scenario map.)"), NULL,
          MAP_MIN_GENERATOR, MAP_MAX_GENERATOR, MAP_DEFAULT_GENERATOR)
 
+  GEN_INT("startpos", map.startpos,
+         SSET_MAP_GEN, SSET_GEOLOGY, SSET_VITAL,  SSET_TO_CLIENT,
+         N_("Method used to chice starts pos"),
+         N_("0 = Developper choice, default of the generator;\nn"
+            "1 = try to place one player per isle\n"
+            "2 = try to place 2 players per isle;\n"
+            "3 = try to place all player in some isle\n"
+          "Note: generators try to be optimzed for the choice of start pos \n"
+          "and to the number of players"), NULL,
+         MAP_MIN_STARTPOS, MAP_MAX_STARTPOS, MAP_DEFAULT_STARTPOS)
+
   GEN_BOOL("tinyisles", map.tinyisles,
           SSET_MAP_GEN, SSET_GEOLOGY, SSET_RARE, SSET_TO_CLIENT,
           N_("Presence of 1x1 islands"),

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10308) PATCH: New startpos option and rational control of generators, Marcelo Burda <=