[freeciv-ai] Re: [Freeciv-Dev] Re: (PR#11995) Stupid AI Creates Tall Sta
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11995 >
Benedict Adamson wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=11995 >
> I wrote:
>>Unfortunately, the AI movement function, ai_unit_goto, uses a warmap
>>(via do_unit_goto) rather than PF
>>so I suggest rewriting
>>ai_unit_goto and have that change reviewed and committed before
>>implementing a fix to prevent tall stacks.
> Attached is the patch.
> * ai_unit_goto uses PF instead of Warmap
> * the ferry code uses an amphibious PF
> * the PF code uses an extra-cost callback to discourage creation of tall
That's quite a patch. The logic seems clear enough although I can't be
sure of the specifics. How much testing has this gotten?
One question I have (probably for after the patch goes in), is how are
the goto destinations obtained in the first place? What I mean is, the
logic now (and in your patch) is that we know where we want to go and we
create a PF map to get there. Creating the PF map is very expensive.
Probably this map was already created once in determining where to go,
and should be saved rather than created again.
> I tried to completely prevent tall stacks by creating an
> is_pos_dangerous callback function that marked all tiles with tall
> stacks as dangerous. I couldn't get it to work for amphibious movement
> with fast ferries (>3 tiles/turn). I suspect an overflow bug, or perhaps
> a bug in PF itself, but despite considerable effort I couldn't track it
> down. Perhaps someone else will have more luck.
It doesn't seem like that method would work. is_pos_dangerous is only
useful one or more turns in the future at which point the tall stack is
likely to have disbanded. I think it's only usefull to look at tall
stacks that would be created at the end of the current turn, rather than
trying to look ahead.
> The settler code could use the amphibious PF to consider settling cities
> overease that are not on the coast.
I think amphibious gotos need more documentation. Does this work for
units that are inside an island moving to another island, or only for
units that are already being ferried?