bugFreeciv - Bugs: bug #19540, AI failing to cope with...

 
 
Show feedback again

bug #19540: AI failing to cope with Shield2Gold?

Submitted by:  Jacob Nevins <jtn>
Submitted on:  Sun 11 Mar 2012 03:27:24 PM UTC  
 
Category: aiSeverity: 3 - Normal
Priority: 5 - NormalStatus: None
Assigned to: NoneOpen/Closed: Open
Release: Operating System: None
Planned Release: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

(Jump to the original submission Jump to the original submission)

Sat 31 Mar 2012 06:53:07 AM UTC, comment #8:

Oh, I forgot to say I saved the game with official freeciv v2.3.1, and all turns until the savegame where played in AI mode.

David Fernandez <bardo>
Sat 31 Mar 2012 06:45:19 AM UTC, comment #7:

There was a bug in previous freeciv version that caused different AI behavior with each different gold_upkeep_style: bug #16413. Since it was fixed I can't differentiate which style is being used based on AI behavior. I mainly use gold_upkeep_style = 2 for my tests.

I understand it might be a waste of time to revise the code without a reproducible case. I have catched a savegame with the problem I try to point, even when I'm not sure if related to shield2gold or not.

I upload the modpack civ2-3 (the version shared in cazfi's web), with the only change to give shield2gold to workers and settlers. If you load the savegame, toggle AI mode, and then set timeout 10, the Kosovars are going to lose a worker and a city wall due to low funds, even when the taxes are set to 60%. If taxes were set to 80% (maximum under Republic) the bankrupt would be avoided.

I see similar cases often while I watch AI games with gold upkeep, and I would say those bankrupts stopped when I replaced shield2gold by uk_gold, but I'm not sure, and I do not know how to verify it.

(file #15479, file #15480)

David Fernandez <bardo>
Wed 28 Mar 2012 09:24:18 PM UTC, comment #6:

I've been reading the source code to understand how unit gold upkeep is handled. I saw no obvious explanation why upkeep by uk_gold and by Shield2Gold would cause different AI behavior. Anyway, everything is controlled by gold_upkeep_style, so what upkeep style you have seen the problems with?

Marko Lindqvist <cazfi>
Project Administrator
Mon 12 Mar 2012 02:45:22 AM UTC, comment #5:

I think previous example could be hard to implement...
Maybe it is easier something like this:

David Fernandez <bardo>
Sun 11 Mar 2012 07:45:43 PM UTC, comment #4:

The example was not showed in previous post...

Note when I say "Another disadvantage is that you can not set diferent upkeep types for each unit", I mean if the upkeep is being switched from shield to gold by using uk_gold and Upkeep_Factor rule.

David Fernandez <bardo>
Sun 11 Mar 2012 07:36:28 PM UTC, comment #3:

In my tests, I notice an improvement in the economic management of the AI when I replace Shield2gold by uk_gold, but it is hard to know for sure without watching the code.

I agree the UI is a disadvantage because all units appear with upkeep = 1 gold + 1 shield, but Shield2gold is also confusing because it simply shows upkeep = 1 shield, and a text warning that it could change to gold under certain circunstances.

Another disadvantage is that you can not set diferent upkeep types for each unit. With Shield2gold it is possible, for example, to support the workers/settler with shields and the military units with gold. But it is also a limited feature because the units will be the same for every government.

If it were possible to use the unit name or unit flags as requisite for some of these effects: Unit_Upkeep_Free_Per_City or Upkeep_Factor, I guess Shield2Gold would not be needed, and there would be much more freedom to design governments with diferent upkeep rules. For example:

David Fernandez <bardo>
Sun 11 Mar 2012 03:30:41 PM UTC, comment #2:

I was reminded by this by a suspicious comment in utype_upkeep_cost():

Jacob Nevins <jtn>
Project Administrator
Sun 11 Mar 2012 03:30:04 PM UTC, comment #1:

(A disadvantage of using the base upkeeps in this way is that the built-in help won't handle it very well, and it's hard to see how it could be upgraded to.)

Jacob Nevins <jtn>
Project Administrator
Sun 11 Mar 2012 03:27:24 PM UTC, original submission:

David Fernandez (bardo) writes in bug #17726 (comment 11):

I have been testing the AI with gold upkeep for some time (I find it very important to enjoy this game), and I always thought that the AI does not notice when his economy is breaking due to amount of units supported by gold. When I use Shield2Gold rule, I see continually AIs that lose his buildings and units due to low funds, when they could have avoided it by just increasing a bit the tax rates. I have not checked the code, but it looks like if AI is someway blind to bankrupt caused by Shield2Gold units.

As cazfi pointed, it is possible to get a similar behavior (units changing from shield to gold upkeep under certain governments), by using "uk_shield, uk_gold and effects Unit_Upkeep_Free_Per_City and Upkeep_Factor", instead of Shield2Gold.

And my surprise was that the AI seems to manage perfectly the economy with units supported by gold when I use uk_gold instead of Shield2Gold.
I'd suggest to some coder to verify that units with uk_shield and Shield2Gold are taken into account by the AI the same way than units with uk_gold.

Jacob Nevins <jtn>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #15479:  shield2gold_civ2-3.zip added by bardo (62kB - application/zip)
file #15480:  shield2gold_kosovar.sav.bz2 added by bardo (59kB - application/x-bzip2)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cazfi (Posted a comment)
  • -unavailable- added by bardo (Posted a comment)
  • -unavailable- added by jtn (Submitted the item)
  • -unavailable- added by jtn
  •  

    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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 31 Mar 2012 06:45:19 AM UTCbardoAttached File-=>Added shield2gold_civ2-3.zip, #15479
      Attached File-=>Added shield2gold_kosovar.sav.bz2, #15480
    Sun 11 Mar 2012 03:27:24 PM UTCjtnCarbon-Copy-=>Added bardo
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup