Complete.Org: Mailing Lists: Archives: freeciv-dev: April 1999:
Re: [Freeciv-Dev] barbarian AI
Home

Re: [Freeciv-Dev] barbarian AI

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Falk Hueffner <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] barbarian AI
From: Nicolas Brunel <brunel@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 29 Apr 1999 02:56:49 +0000 (GMT)


On 28 Apr 1999, Falk Hueffner wrote:

> Hello,
> 
> I have resumed working on the barbarian stuff, and I do now wonder how 
> to handle the barbarian leader.
> 
> Its behaviour should be: move towards/onto any friendly unit; if
> there's none, flee.
> 
> The first part is relatively simple, although a problem is that the
> barbarian leader might move first onto a Legion, which then moves away 
> in the same turn leaving the leader undefended. Because of the weird
> list code, I don't know how to move it to the end of the list.
What you can do is when the barbarians units with their leader are
attaching move the leader only one case. If they use the same also
to decide where to go, there will be no problems.
> 
> Another problem is fleeing. I thought the AI would likely have a
> notion of the "secureness" of the tiles to move vulnerable units
> around, but there doesn't seem to be such a thing. Anybody knows a
> good fleeing algorithm? I'm sure I can reuse some code, I just can't
> find it...

For pacman, if (dx,dy) is the move to eat Packman (-dx,-dy) is the move to
flee from Packman. You can calculate the centre of gravity of the
surrounding towns. The leader will try to go farther and farther from this
centre. You can also consider units. You can consisdere as weight 
1/ditance(centre,leader) .

Best regards,


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