[Freeciv-Dev] [bug #21641] When gold_upkeep_style = 2, building upkeep not taken into account for taxes

2014-02-19 Thread David Fernandez
Follow-up Comment #3, bug #21641 (project freeciv):

Oh, yes, it is exactly the same bug, I didn't see it.

I understand what you say, and I think mostly the same: if the only difference
comes when the player runs out of money, then gold upkeep styles are not
really needed.
However, for some reason, they affect the AI behavior, and that is the reason
why I use them in my rulesets.

I have not read the AI code much, but from my experience, the AI seems to take
into acount the expenses of a city when it comes time to decide to build
another improvement, and the AI seems balanced when the only expense of the
cities is the gold upkeep of buildings.
However, when we introduce units with gold upkeep in a ruleset (and default
gold_upkeep_style = 0), then the expenses of the cities are increased by these
units, and the AI seems to build less improvements in the cities, but nothing
stops them from creating more units (that I know), and at the end the AI is
not very challenging (too much units that they can not support due to lack of
developed cities).

When I use gold_upkeep_style = 1, the amount of units do not seem to affect
the construction of buildings in AI cities, and the result are AI cities more
similar to rulesets where there are no units with gold upkeep.

Then, there was this gold_upkeep_style = 2, where AI seems to build
improvements as if there were no tomorrow. It is a bug, but in some rulesets
where buildings are really important, the AI was much more challenging this
way.

My guess is that someone introduced those gold_upkeep_style as a workaround to
avoid redesigning the AI behavior to take into account properly the units with
gold upkeep, and it is a solution good enough to me.

But again, I do not know the code, and I might be wrong.
I'll try to test this patch #2863, I'm curious to verify if gold_upkeep_style
= 2 still affect the AI behavior once fixed.

___

Reply to this item at:

  http://gna.org/bugs/?21641

___
  Mensaje enviado vía/por Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [bug #21641] When gold_upkeep_style = 2, building upkeep not taken into account for taxes

2014-02-11 Thread David Fernandez
URL:
  http://gna.org/bugs/?21641

 Summary: When gold_upkeep_style = 2, building upkeep not
taken into account for taxes 
 Project: Freeciv
Submitted by: bardo
Submitted on: mié 12 feb 2014 06:26:21 UTC
Category: ai
Severity: 3 - Normal
Priority: 5 - Normal
  Status: None
 Assigned to: None
Originator Email: 
 Open/Closed: Open
 Release: all
 Discussion Lock: Any
Operating System: None
 Planned Release: 

___

Details:

When gold_upkeep_style = 2, AI does not take into account the upkeep of
Buildings when they decide the tax rates.

I knew there was something wrong with gold_upkeep_style for long time, but I
was unable to debug the code until now, and finally I found the exact cause.

Related code in aihand.c:


  /* Find total trade surplus and gold expenses */
  city_list_iterate(pplayer-cities, pcity) {
if (NULL != trade) {
  *trade += pcity-surplus[O_TRADE];
}

if (NULL != expenses) {
  *expenses += pcity-usage[O_GOLD];
}

if (NULL != income) {
  *income += pcity-surplus[O_GOLD];
}
  } city_list_iterate_end;

  if (game.info.gold_upkeep_style  0) {
/* Account for units with gold upkeep paid for by the nation.
 * (game.info.gold_upkeep_style = 1  2) */
unit_list_iterate(pplayer-units, punit) {
  *expenses += punit-upkeep[O_GOLD];
} unit_list_iterate_end;
  }
}


Latest time that I reported this bug, someone added the part to sum the
expenses due to upkeep of units, but we forgot to sum the upkeep of buildings
for game.info.gold_upkeep_style = 2, because in this case they are not
included in city expenses.

You can verify by watching the value of variable expenses in game. I do not
know the code enough to create a patch.




___

Reply to this item at:

  http://gna.org/bugs/?21641

___
  Mensaje enviado vía/por Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] [bug #21641] When gold_upkeep_style = 2, building upkeep not taken into account for taxes

2014-02-11 Thread David Fernandez
Follow-up Comment #1, bug #21641 (project freeciv):

After many autogames watching the AI with different gold_upkeep_style, I
suspect there is a similar bug that affect the decission to build improvements
by AI, but I'm not sure and I do not know this part of the code.

When there are units with gold upkeep, I have noticed that the AI seems to
build less improvements if gold_upkeep_style = 0, where upkeep of units is
taken into account by each city.
While rulesets with gold_upkeep_style = 1 behaves similar to classic rules,
where the only upkeep paid by each city is due to buildings.
Then, it was this buggy gold_upkeep_style = 2 where AI seems to build more
improvements, but it was alwasy losing them due to bankrupt.

If the code was right, I suppose it should be immposible to notice any AI
difference.
In the other hand, the only reason why I used different gold_upkeep_style in
my rulesets was because they affected the AI behavior, so I'm not sure if this
part was intended or not.

___

Reply to this item at:

  http://gna.org/bugs/?21641

___
  Mensaje enviado vía/por Gna!
  http://gna.org/


___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev