patchFreeciv - Patches: patch #3697, When city growth is blocked, AI...

 
 
Show feedback again

patch #3697: When city growth is blocked, AI shouldn't give any value to food surplus

Submitted by:  Marko Lindqvist <cazfi>
Submitted on:  Wed 13 Feb 2013 02:17:56 AM UTC  
 
Category: aiPriority: 5 - Normal
Status: DonePrivacy: Public
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Closed
Planned Release: 2.6.0

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 09 Apr 2014 09:04:20 PM UTC, SVN revision 24752:

When AI cannot grow due to aqueduct size limit and already has full foodbox,
prefer shield production over food production that would make no difference whatsoever.

Patch by Emmet Hikory

See patch #3697

(Browse SVN revision 24752)

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 23 Mar 2014 05:12:35 AM UTC, comment #4:

Excellent catch: I hadn't considered the possibility that a ruleset might require an improvement for cities to grow beyond size 1: I didn't actually test what would happen: code inspection led me to believe it would set the value from the -1 entry in an array, which is unlikely to be a useful value, if something doesn't spew an array bounds error. Updated patch attached hardcoding granary size to 0 for size 0 cities (either there isn't such a thing as a size 0 city, or the rats eat all the stored grain when nobody lives there). Also added the space: I've clearly been reading non-freeciv code more than freeciv code lately :)

(file #20421)

Emmet Hikory <persia>
Project Member
Sun 23 Mar 2014 02:26:37 AM UTC, comment #3:

- "if(" -> "if ("
- If ruleset has aqueduct_size = 1, and thus cities of size 1 can end here:
extra_food += pcity->food_stock -
city_granary_size(city_size_get(pcity) - 1);
What does city_granary_size(1 - 1) do?

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Thu 20 Mar 2014 03:47:38 AM UTC, comment #2:

Patch rebased against r24699

(file #20391)

Emmet Hikory <persia>
Project Member
Wed 24 Apr 2013 04:30:08 AM UTC, comment #1:

Attached is a patch that seems to work for me. Note that the increase in appeal for the improvements is essential here: early revisions of the patch didn't include that, with the result that when the granary was full, the AI deprioritised food, and then happily decided it didn't need that Aqueduct/Sewer System so much after all, with the result that cities ended up capped at size 8. It still sometimes builds other things in preference to the EFT_SIZE_ADJ improvement, but it gets around to it after what seems a reasonable time, making me think the adjustment factor isn't horridly imbalanced. It may be that we don't need to always rearrange workers with a full granary as if it was an emergency, but not doing so seemed to cause long delays in the AI deciding to actually use more production during my testing.

(file #17823)

Emmet Hikory <persia>
Project Member
Wed 13 Feb 2013 02:17:56 AM UTC, original submission:

Noticed size 8 AI city building Aqueduct. It had still arranged workers for food surplus (that went to waste) and not for shields (which would speed Aqueduct building).

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by persia (Updated the item)
  • -unavailable- added by cazfi (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed 09 Apr 2014 09:04:35 PM UTCcazfiStatusReady For Test=>Done
      Open/ClosedOpen=>Closed
    Wed 26 Mar 2014 11:04:53 PM UTCcazfiStatusNone=>Ready For Test
      Assigned toNone=>cazfi
      Planned Release=>2.6.0
    Sun 23 Mar 2014 05:12:35 AM UTCpersiaAttached File-=>Added reduce-food-interest-with-full-granary+size1aqueduct.patch, #20421
    Thu 20 Mar 2014 03:47:37 AM UTCpersiaAttached File-=>Added reduce-food-interest-with-full-granary+rebase.patch, #20391
    Wed 24 Apr 2013 04:30:08 AM UTCpersiaAttached File-=>Added reduce-food-interest-with-full-granary.patch, #17823
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup