Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: flying AI (PR#1162)
Home

[Freeciv-Dev] Re: flying AI (PR#1162)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Petr Baudis <pasky@xxxxxxxxxxx>
Cc: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: flying AI (PR#1162)
From: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Date: Sat, 29 Dec 2001 02:07:12 -0800 (PST)

--- 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


[Prev in Thread] Current Thread [Next in Thread]