Complete.Org: Mailing Lists: Archives: freeciv-ai: September 2002:
[freeciv-ai] Re: Problems with unit_desirability()

[freeciv-ai] Re: Problems with unit_desirability()

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: Problems with unit_desirability()
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Mon, 2 Sep 2002 11:35:35 +0100 (BST)

On Sun, 1 Sep 2002, Per I. Mathisen wrote:

> On Sun, 1 Sep 2002, Gregory Berkolaiko wrote:
> > First of all, there is a bug in ai_unit_defence_desirability:
> >
> >     if (unit_types[i].move_type != LAND_MOVING
> >
> > should be
> >
> >     if (unit_types[i].move_type != SEA_MOVING
> Aaaargh. Yes. Thank you.

In your attached patch you duplicate your comment.  I think one is enough 

> > Now, I came across slightly strange situation when a Stealth Fighter is
> > selected as a city defender.
> Cool.
> > The problem mostly comes from
> >     desire += get_unit_type(i)->move_rate;
> > line in ai_unit_defence_desirability.
> Hmm... this should _really_ be divided by SINGLE_MOVE. How come I didn't

I don't think it should be there at all.  This code seems to be used in an 
emergency (or what AI perceives as an emergency) situation and the 
defender will be stationary.

However, if the long-range units are excluded and the rate is divided by 
3, it shouldn't be such a problem to have it there, if you really want.

> think of that. When we do this, there is no way a Stealthy can beat a mech
> inf just by +11 points.
> Mech inf: 30*1*6+3+6 = 189
> Stealth fighter: 20*2*4+8+14 = 182
> Apply amortize for 50 cost on mech and 80 cost on stealthy, and the winner
> is... wait a moment... we don't use amortize here! WTF! (See eg
> ai_choose_defender_limited() in aicity.c)
> (Note that if stealth fighter was a little better, it actually _would_ be
> the best defender in some situations, especially if we have high
> production.)

sounds a bit unorthodox, but it's true...

> The ai_unit_defence() function isn't the right place to remove air units
> from the run up, though. It should be eliminated in
> simple_ai_unit_type_iterate instead. Air units are definitely not simple
> units :)
> BTW, can you explain why update_simple_ai_types(void) rules out units with
> transport capacity of 8 or over??

That'd be carriers AFAIR

> I want move to be calculated in, even if divided by ten, just to be there
> as a break even factor. Same goes for attack, but even more so since
> defenders should really be attacking instead of just sitting there most of
> the time, and the AI often builds defenders as attackers...

Attack yes, I fully support attack.

> For now I've applied the attached patch. A better long-term solution is
> welcome.

Soon come.


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