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: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: Problems with unit_desirability()
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 1 Sep 2002 20:46:04 +0000 (GMT)

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.

> Now, I came across slightly strange situation when a Stealth Fighter is
> selected as a city defender.


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

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

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

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


"I don't see why people are so upset about cloning sheep. American
television networks have been doing that to their audiences for years."
-- Jello Biafra

Attachment: 1
Description: Text document

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