Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] (PR#10511) infinite loop in creating starting positions
Home

[Freeciv-Dev] (PR#10511) infinite loop in creating starting positions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#10511) infinite loop in creating starting positions
From: "Marcelo Burda" <mburda@xxxxxxxxx>
Date: Fri, 22 Oct 2004 08:21:51 -0700
Reply-to: rt@xxxxxxxxxxx

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

> [jdorje - Wed Oct 13 18:49:42 2004]:
> 
> The infinite loop problem has been reported more often.  If you have a 
> high aifill (30) with a small map size (1) and low landmass (15), there 
> isn't enough room to place starting positions.
> 
> This patch improves that.  I'd be rather surprised if starting position 
> placement ever fails after this.  Of course you may end up with a game 
> that's not playable.  But at least you'll have learned your lesson, and 
> won't blame the game.  It should be applied to both branches.
> 
> Changes:
> 
> - When decreasing "dist", restart the placement from scratch.  This is 
> needed for fairness (the current method isn't fair), particularly when 
> we start dropping restrictions.  This change necessitates a 
> data->starters value.

not needed, any way dist can fall until 1!


> 
> - When decreasing "dist", it may be decreased to or below 0.  When this 
> happens the minimum distance doesn't actually drop any more, but instead 
> we start dropping restrictions.  Note there is a special case added to 
> prevent two starters from being on the same tile (otherwise with dist<=0 
> this would be possible).
> 
> * First we allow starting positions to be placed on huts.  This is easy 
> enough; we just remove the huts afterwards.  Unfortunately huts are 
> pretty rare so it doesn't help in most games.
> 

this si ok, any way if dispersion is not 0 unit can be droped anywhere,
this restriction can be droped from startpos code

> * Then we allow starting positions to be placed on any terrain. 
> Normally only grassland and plains are eligible; when the restriction is 
> dropped any non-ocean terrain is eligible.  This may include arctic, 
> except that polar continents generally aren't eligible if you have 
> separatepoles (see below).  In every case I've tested, dropping this 
> restriction allows placement to complete.
> 

Very Very bad!
i prefer a crash instead to begin a game on unsafe terrains!

> * Then we allow starting positions to be on any continent.  Normally the 
> number of starters per continent is set at the beginning, but when this 
> restriction is dropped players can be put on any continent.  Of course 
> this allows all land tiles to be eligible starters, and there are at 
> least 150 land tiles (landmass 15% with size 1000 tiles), so it should 
> never fail.  But the game will be unplayable because players will be all 
> over the poles.
> 
> For each dropped restriction an error message is sent.  If none of the 
> restriction-droppings helps we'll still end up with an error.  However I 
> changed this so it doesn't dump core (this is a user error not a code 
> error) but just does an exit().
> 
> Note several translatable strings are changed by this patch.
> 
> I know marcelo had some code to improve starting positions.  But those 
> patches are 10x larger than this and probably shouldn't be committed to 
> the stable branch.  This patch addresses only this one very serious
problem.
> 
> jason
> 
> 

the solution to this problem are 2

*find the bug if any! ;-)

*restart assing_start pos until get the right number of start pos (3 times)

*if this fail restart mapgen with a randseed++ with a message log until
 good end. 

my patched code get this problem very rarely now but this still present
then this as to be fixed!

Marcelo


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