Complete.Org: Mailing Lists: Archives: freeciv-ai: September 2003:
[freeciv-ai] (PR#6148) Building defensive improvements
Home

[freeciv-ai] (PR#6148) Building defensive improvements

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [freeciv-ai] (PR#6148) Building defensive improvements
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Fri, 12 Sep 2003 05:24:13 -0700
Reply-to: rt@xxxxxxxxxxxxxx

First of all, building defensive improvement (DI) should be decided in
one place.  Preferably in the same place which will decide on building
of defensive units.  This will bring transperency.  

Secondly, we need a good algorithm and not a set of WAG triggers.

This is what I concocted overnight.

=====================================================================
Qualitative approach:
Input: Best enemy attacker (BA), best present defender (BD)


If the BD is inadequate (will lose to the BA), 
1. cycle through all defender types available and select those which
will win against the BA
2. cycle through all DI available and select those, which will make the
BD win against the BA
3. choose the cheapest among the above
4. if none were selected in 1 and 2, choose the best among them
5(optional). set the tech want for the better/cheaper of yet unavailable
units / DIs.


=====================================================================

Quantitative approach:
Input: Total strength of enemies threatening us (subdivided into
classes), total strength of present defenders, urgency.

If total strength of defenders is less than the total strength of the
attackers:
1. cycle through all defender types available and calculate the defence
increase incr_d they will bring; also calculate the cost (cost_d).
2. cycle through all DI available and calculate the defense increase
incr_i and the cost cost_i.
3. Select all of the above which have their incr bigger than a given
threshold.
4. Among the selected in 3, choose the one with the best incr/cost ratio.
5. If none were selected in 3, choose the one with the biggest incr.
6(optional). Set the tech wants.

Suggestions: 
1. the threshold in 3 can be selected taking into account urgency, i.e.
the time until the expected attack.  If attack is expected next turn, it
should be set so we get total defence on par with the total attack.

2. Most improvements affect only some attackers (but all defenders).  So
we need to know the total attack strength of the subclass of enemies
affected by the improvement.  incr_i can be set to the amount by which
their total attack strength will be effectively decreased by the
improvement (e.g. a wall effectively decrease the attack strength of
non-igwall land units by 3; or by 9 if we use quadratic strength).

======================================================================

I think the best would be to combine the two approaches, using
qualitative first and if the BD is adequate or if it gets to step 4,
then using the quntitative.  I don't think the defense should set
"want", it should be overriding everything else, perhaps depending on
the urgency.  If both BD is adequate and our total strength is better,
then we have no need for the defenders.

G.


[Prev in Thread] Current Thread [Next in Thread]
  • [freeciv-ai] (PR#6148) Building defensive improvements, Gregory Berkolaiko <=