Complete.Org: Mailing Lists: Archives: freeciv-dev: January 1999:
Re: [Freeciv-Dev] mapgen++
Home

Re: [Freeciv-Dev] mapgen++

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: schaefer@xxxxxxxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] mapgen++
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sat, 30 Jan 1999 23:13:29 +1100

Peter Schaefer wrote:
> 
> Attached: diff for changed mapgen;
> Added a mapgen 3 compatibility mode as requested by popular demand;
> Added map 4 ('early carnage') generator.
> Adds grass parameter.
> 
> The diff versus stdinhand.c may cause some work, 
> as diff is not versus cvs, and that file has changed.

> Content-Type: application/x-gzip; name="mapgen40.diff.gz"

Comments:

> +++ oldcvs/server/gamehand.c    Thu Jan 21 19:05:08 1999

> +      map.grasssize = secfile_lookup_int(file, "map.grasssize");

Gr! More savefile incompatibility!  But this one is easy easy:
use secfile_lookup_int_default() !

> +++ oldcvs/server/mapgen.c      Thu Jan 21 22:59:40 1999

> -#include <map.h>
> -#include <game.h>
> -#include <shared.h>
> +#include "log.h"
> +#include "map.h"
> +#include "game.h"
> +#include "shared.h"

Hmm, I don't know that we've changed to this system yet...

> -      flog(LOG_DEBUG,"starters on isle %i", k);
> +      flog(LOG_DEBUG,"%i ",k);

The above unfixes a fix made in cvs; please don't!

> -    if (map.generator == 3 ){
> +    if (map.generator == 4 )
> +      mapgenerator4();
> +    if (map.generator == 3 )
>        mapgenerator3();
> -    } else if( map.generator == 2 ){
> +    if( map.generator == 2 )
>        mapgenerator2();
> -    } else {
> +    if( map.generator == 1 )
>        mapgenerator1();
> -    }

I gather that this is because if we can't do a given map.generator,
that generator will set map.generator to a new value and so we
fall back?  A comment to that effect would be nice.

>  /**************************************************************************
> + readjust terrain counts so that it makes sense for mapgen 1, 2, 3 and 4
> + idea: input is the number of terrain
> + mapgen 1 needs custom parameters, 
> + mapgen 2 and 3 and 4 use percents, currently.
> + Ultimately, I hope all parameters below will be weights,
> + with the defaults set to a percentage;
> + Placing deserts and swamps may cause some problems.
> +**************************************************************************/
> +void adjust_terrain_param(){
> +  int total;
> +
> +  /* there is a bug somewhere involving the city cache( find_city_by_id(pplay
er ,0) returns -1 ),
> +     maybe the packets, or the memory allocated around it */
> +  /* happens with mapgen 1, too */
> +

Huh?  What are you doing looking for cities as part of mapgen??


> +  if(map.generator==1){
> +    /*map.riverlength*= 10; */
> +    /*I leave this out, people will get too upset 
> +      if they have to change all their scripts */
> +    return;
> +  }
> +
> +  map.riverlength/= 10;/* left in */
> +

> +  total = map.riverlength + map.mountains
> +    + map.deserts + map.forestsize 
> +    + map.swampsize + map.grasssize
> +    + map.deserts;
> +
> +  if(total>100){
> +    map.riverlength= map.riverlength*100/total;
> +    map.mountains= map.mountains*100/total;
> +    map.forestsize= map.forestsize*100/total;
> +    map.swampsize= map.swampsize*100/total;
> +    map.deserts= map.deserts*100/total;
> +
> +    total = map.grasssize+ map.riverlength + map.mountains
> +    + map.deserts + map.forestsize 
> +    + map.swampsize + 0
> +    + map.deserts;
> +
> +    map.grasssize= 100 - total;
> +  }
> +}

I'm not too comfortable with all this.  Doesn't it mean that
if a player sets some map parameters, then during mapgen those
parameters will be altered, and the values saved in the savefile,
and displayed to the client, will actually _not_ be the values
used, or even values which will reproduce the same results?
I don't like that.

Also, doesn't this mean that if you have different sets of
parameters, with all map values (those above) scaled up or
down by the same multiplier, that you will get the same 
map effects?  That is, there is redundancy in the parameters? 

> --- ../freeciv-1.7.2/server/stdinhand.c Tue Dec 22 15:16:59 1998
> +++ oldcvs/server/stdinhand.c   Thu Jan 21 19:46:17 1999

> -  { "specials", "This number donates a percentage chance that a square is 
> special.",
> +  { "specials", "This number donates a promille chance that a square is 
> special.",
>      &map.riches, 0, 1,
>     MAP_MIN_RICHES, MAP_MAX_RICHES, MAP_DEFAULT_RICHES},

Please update to recent cvs, where the server option data struct
has changed, and give patches relative to that.  Thanks.
(And what does "promille" mean?)

> Content-Disposition: inline; filename="helpdata_txt.diff"

> +%% First draft 
> +%% by Peter Schaefer<schaefer@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
> +%% 1999-01-09.
> +# Map generator 1

I think the generator options should be documented in the
server options, so that the information is available to
the server operator, via "explain generator".  Part of the
purpose of the change in server option struct mentioned
above was to make better allowance for longer documentation
of server options.

(Also, I note that the provided helptext is out of date, 
eg, with respect to the grass parameter and mapgen 3 vs 4.)

Regards,
-- David



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