[freeciv-ai] (PR#6148) Building defensive improvements
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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.
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.
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
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
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.
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.
|[Prev in Thread]
||[Next in Thread]|
- [freeciv-ai] (PR#6148) Building defensive improvements,
Gregory Berkolaiko <=