Complete.Org: Mailing Lists: Archives: freeciv-ai: January 2005:
[freeciv-ai] Re: (PR#10694) AI Builds Doomed Ferries and Passengers

[freeciv-ai] Re: (PR#10694) AI Builds Doomed Ferries and Passengers

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [freeciv-ai] Re: (PR#10694) AI Builds Doomed Ferries and Passengers
From: "Benedict Adamson" <badamson@xxxxxxxxxxx>
Date: Tue, 4 Jan 2005 16:47:51 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: >

Per I. Mathisen wrote:
> aiguard_find_charge() : Why not use movemap here to avoid a costly pf
> iteration over the map? If two turn radius is not enough, movemap can be
> extended.

I've coded a change to movemap to give it a parametrised range, 
increased that range to 3 turns and changed aiguard_find_charge to use 
the movemap.

> assault_conquest_chance() : Doesn't this fall into the trap I fell into
> previously, in that I did not account for loss of hitpoints during combat?

I've coded a change that models this.

> Win chance is fine for one vs one combat, but for larger battles involving
> multiple units, you also want defenders that can hurt the enemy units, not
> just kill them.

I'm coding a change to model the effects of counter attacks by the 

> stack_cost(): all uses of this should use #define'd values

See the *_RAMPAGE_MENACE_WT_* constants in aiunit.c. Unfortunately, the 
stackcost call is nested rather deep in the rampage code, so there is 
quite some distance between the symbolic constants and the use of their 

> unit_list_has(): yes, speclist.h is the place for it

I've coded this change.

[And in a second message]
> Here is a savegame that shows the AI retrogressing and becoming less
> capable of defending itself. It used to be rather bad, but with the patch
> the biggest AI (b) will no longer attack, and will move its many units
> around seemingly by random. This is a huge savegame. Have patience  :) 

I'm not sure what I should be looking at here. I guess a lack of attacks 
is because too many units are sitting as defenders in cities. At one 
point, Bruntal has 199 (!) defenders. What seems to happen is that the 
addition of a defender does not reduce the danger rating of the city, so 
there is no feedback to prevent assignment of even more defenders. I 
think that is because of a combination of the pruning in 
assault_conquest_chance() with the lack of modelling of HP loss. The 
seemingly random rearrangements of units is a combination of the logic 
in aiguard_plan_cities, the use of movemap and the presence of rail 
roads. If there are many equivalent units the same number of turns 
travel from a city, which one will be picked is arbitrary, which can 
produce those peculiar rearrangements. The fix to this would be to 
replace the logic in aiguard_plan_cities to first freeze city defenders, 
then examine possible movements to see if they reduce the total danger.

Thanks for the comments. Once I've completed my current set of changes 
and done some testing, I'll post a new version of the patch.

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