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

[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: Sat, 5 Apr 2003 17:03:56 +0000 (GMT)

On Sat, 5 Apr 2003, Gregory Berkolaiko wrote:
> > > We make a big map for U to go to all coastal towns T(i)
> >
> > What if there are no coastal towns? In this case I suggest we make a
> > temporary pick up point in the closest ocean adjacent tile to U.
> The problem with such pick-up points is that they cannot build boat (this
> is the problem with Raimar's proposal too).

Yes, but in any fully functional ferry system, actually building another
boat should be a fall-back. The primary goal is to find a ferry somewhere
and send it there.

> > We don't need to WAG it. If there is a boat waiting at T(i), waiting time
> > is zero. If there is a boat headed back to T(i), it should know how long
> > it takes to get there (we should store time-to-goto-target in
> > punit->go->time), which becomes waiting time. If there is no boat waiting
> > or on its way, we can cycle through all ferries that are idle, and find
> > the one which takes the least turns to go to T(i), and this becomes our
> At this point the search time becomes exponential as we need to construct
> sub-pf-map for each ferry to estimate time to T(i).

An idle ferry is by definition in a city. Let's cache pf-maps for all
cities. That will come in handy for a lot of purposes. We're going to do
the calculations anyway in the danger code, so why not just store them.

We need this (look for idle ferries in other cities) to get optimal ferry
code. Take the situation: We have city A on continent 1 and city B on
continent 2. A an B are very close. A has a settler that needs a ferry and
B has an idle ferry.

The only other way to solve this situation is to start ferry production in
A, then when we manage B, notice that we could replace this production
with ourselves, and then go there. This, however, is a much less optimal
solution, since we'd screw up with production in A, or maybe choose
another and suboptimal solution for our settler (like never building it in
the first place).

> Is there any way settler code can be put in before ferries?They would
> make a better testing ground than diplomats, I think.


The new settlers code requires ferrying to replace the existing code. I
have the old and new code working alongside each other (using
'experimental'), so I could always put it in as a testbed for ferrying if
the other maintainers don't object to that. If that is an acceptable way
of proceeding, I'll fix up that code and post it for review.

> > > 2. Making sure that a boat is builtunless thecity has something really 
> > > urgent
> > > to do.For this, I think, we need a system of urgency categories for a 
> > > build.
> > > I suggest: 1 - normal, 2 - boat, 3 - civil urgency (aka unrest), 4 - 
> > > military
> > > urgency.
> >
> > I suggest we just snatch production after we've considered defenders. It
> Even so, there are "urgent" and "not urgent" defenders.Now, there is no
> clean way to tell between the too, you use rather circumstantial evidence.
> One extra field in the choice struct will do the job.

It would be nice to improve this code, but it is not necessary at the
moment. We already abort want considerations if we find that a defender is
wanted urgently, and if we do the ferry want consideration after that, and
abort if ferry want is urgent, then we've done the job.

> > > Future expansions:
> > > 1. The boat does not have tobe built in Geneva.It can be put in a "global
> > > queue" with the note that it is needed in Geneva and then "global 
> > > advisor" will
> > > assign it to a nearby coastal city.
> >
> > This is nice, but not very important. Usually we will walk to the city
> > best suited to build our ship.
> Then I don't understand what you mean by AI build lists...

A city build list (like a worklist), so if you are building a temple or
something critical, we can schedule our ferry as the next production. This
way we avoid flip-flopping production. But this isn't very important for a
first implementation of ferries.

  - Per

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