<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39845 >

William Allen Simpson wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=39845 >
> Per I. Mathisen wrote:
>> I would suggest that before you change it, at least post the design
>> you have come up with here for discussion.

I have to agree with per that changing the borders system is an 
unfortunately tricky problem.  Having consistent/realistic/logical/fair 
behavior in all cases may not really even be possible - I know that civ3 
and smac had just as many if not more border "goofs" than our current 

Specifically, one of your complaints is that the current system is 
context-based.  But the reason for this is that having tiles change 
hands between peaceful nations is majorly problematic when peace 
treaties are designed to prevent invasions.  Having cities or fortresses 
change hands based on cultural influence (or whatever you call the 
engine behind border generation) is militarily or socially imbalancing.

In general I don't see a problem with context-based borders - if nothing 
else it makes backward-compatibility easier when border algorithms are 
changed since the old border setup will always be factored in when 
things change.  That said, the current border system is certainly not 
perfect itself (as I said a "perfect" system is likely impossible.)

> That's what this RFE thread is for....  In pseudo-code:
> iterate players
>    iterate cities
>      set cultural influence (probably game.turn - turn_built)
>      iterate circle
>        determine distance factors
>        if factor(this) > factor(existing->source)
>          replace owner and source

You have to be careful that the order of player iteration doesn't 
matter.  If "set cultural influence" is an actual step that must be done 
for all players before any reassigning is done.  Also in turn-based mode 
it should be done separately for each player during (at the start of?) 
their turn.

A triple-loop is also rather tedious (possibly too slow with a very 
large number of old cities in the game).  A simpler loop is possible if 
we make border assignment context-based and impose the restraint that 
borders can expand only one tile per turn.

iterate all tiles
   iterate adjacent tiles
     look at the owner source
   mark tile for reassignment based on the highest factor
iterate all tiles
   assign/reassign tile as marked

The hard question is what to do to a unit/fortress/city when the tile 
under it gets reassigned.  This part will end up being more coding 
(though less argument) than the borders changes themselves.

As a side note, I do think context-dependent borders are more stable 
than context-independent ones.  For instance with the above algorithm if 
the factor (culture) formula was changed when you loaded an old game you 
would find that borders changed to match the new formula, but did so 
over several turns.


Freeciv-dev mailing list

Reply via email to