Summary: Keep one defender in unthreatened cities
                 Project: Freeciv
            Submitted by: cazfi
            Submitted on: Wed 26 Jun 2013 12:00:02 PM EEST
                Category: ai
                Priority: 5 - Normal
                  Status: Ready For Test
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: 2.4.0, 2.5.0, 2.6.0



With my own ruleset AI is almosrt totally useless as it fails to defend its
cities. This is mainly due to the way it tries to use resources to defense
only when necessary - it does not prepare in advance. More often than not
(with my ruleset) it then fails to build the defenses when there suddenly is
the need.

There's many ways building (or actually: buying) may fail. If AI has run out
of money, it cannot buy the defender. It doesn't take veteran move bonus in
the account when checking if enemy may reach the city in one turn (=can
conquer empty city).

Attached patch does not try to be solution for the entire problem, but just
slight improvement to the AI behavior. When AI decides if unit, already
existing in city, should be kept in city as defender, it compares enemty
attack strength to current defense strength. Before this patch it assigned
defender only if attack strength was greater than defense strength. Patch
changes this so that unit is put to defense also when attack strenght and
defense strength are equal. The most important special case of this is when
both are 0 - there's no enemy near. With this change AI keeps one defender in
cities even when enemy has moved away. This does not affect building of
defenders, just the way they are kept in city that is no longer under threat.
Previously it was even possible to cause AI to buy new defender by approaching
its city, make defender to leave city by moving further away, repeat until AI
runs out of money.

I assume this to improve overall AI behavior even instandard rulesets, even if
the effect was more prominent in my own ruleset. Still, I would appreciate if
people tested and reported if AI seems to be weaker due to not using the units
to "more important" tasks than defending non-threatened cities.


File Attachments:

Date: Wed 26 Jun 2013 12:00:02 PM EEST  Name: Defend0Danger.patch  Size: 441B 
 By: cazfi



Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to