Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] Re: (PR#11144) 7 science points expected but only 6 receiv
Home

[Freeciv-Dev] Re: (PR#11144) 7 science points expected but only 6 receiv

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: saywhat@xxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#11144) 7 science points expected but only 6 received
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 26 Nov 2004 01:15:59 -0800
Reply-to: rt@xxxxxxxxxxx

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

Jason Short wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=11144 >
> 
> 2:   1 bulbs from Boston
> 2: Counting 1 bulbs for Harry S. Truman brings us to 1.
> 2:   1 bulbs from New York
> 2: Counting 1 bulbs for Harry S. Truman brings us to 2.
> 2:   4 bulbs from Washington
> 2: Counting 4 bulbs for Harry S. Truman brings us to 6.
> 
> So New York, which had +2 science listed during the previous turn and
> has +2 science listed during the next turn, only provides 1 science.

Originally the tiles used were (3,1), (3,3), and (3,4).  The tiles that 
are ACTUALLY used are (3,1), (1,3) and (3,4).  (Plus the city center of 
course.)

The city isn't under CMA, isn't AI-controlled, doesn't grow in size, and 
doesn't have any of its worked tiles covered (even temporarily). 
Nonetheless workers are auto-arranged by the server at the end of the 
turn prior to calculation of the surpluses.  This means not only does 
the trade drop from 5 to 4 (decreasing science from 2 to 1) but the 
production is increased from 4 to 6 (which is easily verified).

With CMA enabled the CMA will take action at the start of the next turn 
to return the city to its original state.  Thus you get the "phantom" 
bug of having 1 less science and 2 more production that you should be 
getting.  Without CMA you see the actual bug which is the seemingly 
spurious rearrangement.

I believe the rearrangement happens because of the enemy settler unit 
which moves from (4,2) to (4,3).  This causes tile (4,2) to become 
available which triggers a rearrangement.

Now, the first question is: should this trigger a rearrangement at all? 
  Tile (4,2) is a useless desert yet making it available causes a 
completely unrelated tile to be moved.  This will happen any time any 
enemy unit moves through our territory, making manual control of cities 
almost impossible and giving conflicts between the server and 
client-side CM.  I think the rule should be that unless user-specified 
server-side CM is enabled for the city (which is not implemented yet), 
rearrangements of existing tiles should never be done (new workers may 
be placed when a city grows or when an existing worker is forced to 
move, but should not cause existing workers to be moved).  The attached 
patch makes this change (and fixes the bug shown in this savegame)...but 
whether it's a good one is up for discussion.

However there are deeper problems with this system (related and 
unrelated to this specific problem).

1.  If nobody bothers to manage workers by hand then why do we have 
worker placement?  The CMA is just a workaround to the problem that the 
game is more fun without such micro-management.  The only answer is that 
the whole method of worker placement is flawed.  A system like MoM/MoO2 
uses is likely to give better results, and I believe is possible to 
implement without doing anything too ugly or breaking our existing rules.

2.  The rearrangement comes as a result of a player move, but because AI 
players are handled as part of the player end-turn, there is no 
opportunity for the client-side CMA to take effect.  If it were a human 
player moving the settlers, the rearrangement wouldn't be a problem 
because the CMA settings would still take effect again before the end of 
the turn.

3.  It is ridiculous for the server to arrange workers only for the 
client to change them back.  Yet as we've seen it is impossible for the 
client to arrange the workers in this situation.  The only solution here 
is that the client must not do arrangement itself, but should send the 
parameters for arrangement to the server.

-jason

Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.276.2.4
diff -u -r1.276.2.4 citytools.c
--- server/citytools.c  23 Nov 2004 17:44:27 -0000      1.276.2.4
+++ server/citytools.c  26 Nov 2004 09:14:23 -0000
@@ -2042,7 +2042,6 @@
   case C_TILE_UNAVAILABLE:
     if (is_available) {
       server_set_tile_city(pcity, city_x, city_y, C_TILE_EMPTY);
-      result = TRUE;
     }
     break;
 

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