Complete.Org: Mailing Lists: Archives: freeciv-ai: April 2003:
[freeciv-ai] Re: [RFC] Ferry code
Home

[freeciv-ai] Re: [RFC] Ferry code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv AI development <freeciv-ai@xxxxxxxxxxx>
Subject: [freeciv-ai] Re: [RFC] Ferry code
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sun, 6 Apr 2003 07:41:08 +0000 (GMT)

On Sun, 6 Apr 2003, Gregory Berkolaiko wrote:
> > If for U you consider every boat B(i) (i: [0,n)), then you can pick the
> > optimal boat to get you where you want to go.This is an O(n)
> > operation, but probably no worse than having to look at every city on
> > your continent.
>
> Come to think of it, not much worse...

If we cache the pf map for all ferries, we can just overlay this pf map
onto the pf map of U and get the result. A bit more memory heavy than my
transportmap idea, but avoids the constant recalculations.

> > Problem 1: How do you define optimal?Is the only consideration how
> > long it takes U to get to its destination?Or do you consider how much
> > of B(i)'s time you're taking up?

Both.

> > If B(i) can ferry other units while U is on the way, is this better?

No, I don't actually think it is much better. One ferry should carry one
unit and its bodyguard, IMHO. That way losses due to attacks won't be
catastrophic.

> > Problem 2: How do you get multiple units onto a boat? If B(i) knows
> > it's ferrying U, how does U2 go about employing the boat to carry it as
> > well?

For non-military units (that are presumably out of danger areas while
ferrying), we can check all ferries on its way to U's continent and meant
to go to U's destination continent, as well as all idle ferries, for
purposes of finding a ferry. Then this ferry will wait for all
punit->ai.ferryboat == ferry->id units have boarded before going on
dropoff. Then we make a path with a waypoint for each dropoff point. But
this can be done later. I am not sure the optimization will be enough to
warrant the added complexity, though.

  - Per



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