[Freeciv-Dev] Re: flying AI (PR#1162)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- Petr Baudis <pasky@xxxxxxxxxxx> wrote:
> First, original version, so that we can find similiarity with the above:
>
> else {
> b0 = (b * a - (f + (acity ? acity->ai.f : 0)) * d) * g *
> SHIELD_WEIGHTING / (a + g * d);
> if (acity && b * acity->ai.a * acity->ai.a > acity->ai.f * d)
> b0 -= (b * acity->ai.a * acity->ai.a - acity->ai.f * d) *
> g * SHIELD_WEIGHTING / (acity->ai.a * acity->ai.a
> + g * d);
> }
> if (b0 > 0) {
> b0 -= l * SHIELD_WEIGHTING;
> b0 -= c * (unhap ? SHIELD_WEIGHTING + 2 * TRADE_WEIGHTING :
> SHIELD_WEIGHTING);
> }
>
> and a bit more coder-friendly version:
>
> } else {
> desire = (value * attack - (build_cost + (acity ? acity->ai.f : 0)) *
> resist) * protect * SHIELD_WEIGHTING /
> (attack + protect * resist);
>
> if (acity && value * acity->ai.a * acity->ai.a > acity->ai.f *
> resist)
> desire -= (value * acity->ai.a * acity->ai.a - acity->ai.f *
> resist) *
> protect * SHIELD_WEIGHTING / (acity->ai.a * acity->ai.a +
> protect * resist);
> }
>
> if (desire > 0) {
> desire -= tech_cost * SHIELD_WEIGHTING;
> desire -= move_cost * (unhap ? SHIELD_WEIGHTING + 2 * TRADE_WEIGHTING
> : SHIELD_WEIGHTING);
> }
>
Initial comments:
Desire is used to calculate the desirability of building a unit. It considers
units not yet available, using the trade weighting, shield weighting to decide
the cost of acquiring the techs needed to produce the unit. It also takes into
account the amount of shields needed to build the unit.
The total attack power of a unit, and its total defense power are also taken
into consideration. (Someone better define attack power and defense power
at some point). This may unfortunately lead to units like mech infantry, with
equal attack and defence power being weighted ahead of units like howitzers,
with awesome attack power, but crap defense. This is bad because normally units
good at offense do not have to defend, and units good at attacking are not
normally defenders.
__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com
- [Freeciv-Dev] Re: flying AI (PR#1162), (continued)
- [Freeciv-Dev] Re: flying AI (PR#1162), Raahul Kumar, 2001/12/29
- [Freeciv-Dev] Re: flying AI (PR#1162), Petr Baudis, 2001/12/29
- [Freeciv-Dev] Re: flying AI (PR#1162), Raahul Kumar, 2001/12/29
- [Freeciv-Dev] Re: flying AI (PR#1162), Petr Baudis, 2001/12/29
- [Freeciv-Dev] Re: flying AI (PR#1162), Ross W. Wetmore, 2001/12/30
- [Freeciv-Dev] Re: flying AI (PR#1162), Raahul Kumar, 2001/12/30
- [Freeciv-Dev] Re: flying AI (PR#1162), Ross W. Wetmore, 2001/12/30
- [Freeciv-Dev] Re: flying AI (PR#1162), Raahul Kumar, 2001/12/30
- [Freeciv-Dev] Re: flying AI (PR#1162),
Raahul Kumar <=
- [Freeciv-Dev] Re: flying AI (PR#1162), Petr Baudis, 2001/12/29
|
|