Complete.Org: Mailing Lists: Archives: freeciv-ai: October 2003: [freeciv-ai] (PR#6567) AI has too many boats.

# [freeciv-ai] (PR#6567) AI has too many boats.

[Top] [All Lists]

 To: undisclosed-recipients: ; Subject: [freeciv-ai] (PR#6567) AI has too many boats. From: "Gregory Berkolaiko" Date: Sun, 19 Oct 2003 06:43:01 -0700 Reply-to: rt@xxxxxxxxxxxxxx

```A long email.

I did some experimenting with the passenger/ferry numbers computed by
aidata module.  Here is a typical printout line:

2: Patrick: Boats 14(14)/15, waiting psngrs: 1(1)

14 is the number of boats with FERRY_AVAILABLE set (first 14 is what is
given by ai->stats.available_boats, the second is the result of explicit
counting, I had to do some tuning to get these numbers to agree).  15 is
the total number of boats.

The number of waiting passengers is somewhat deceiving, due to the
structure of the code.  To cut the long story short, one of the "free"
boats is actually paddling away to pick up the "waiting" passanger.

Thus the total number of completely idle boats is 14-1 = 13.  Out of 15.
I repeat, this is typical.  And the number of boats is increasing too!

The root of all evil is the current system of boat building.
If a city wants to build a unit which wants to go to another continent
to settle/fight, it will normally build a boat first.

There are two problems caused by this:
1. Too many boats are built.
2. Inland cities will never consider a unit for overseas jobs because it
knows it cannot build a ferry for it.

We can solve problem 1 by a simple check for the number of idle boats.

Solving problem 2 is more tricky.  We can just go ahead and build a unit
inland for an overseas job and hope that a boat would turn up and
ai_gothere will get us where we want.  This will be the case if there
are enough boats.  But if there are many inland cities and only one
coastal city which for some reason prefers coinage to overseas warfare
and therefore doesn't build boats of its own accord, we are stuck.
Because there is no mechanism for building more boats when they are needed.

Once we come up with such mechanism, we might as well scrap the old
model altogether.  Just build units and when they _really_ (not
virtually) want to go somewhere, build boats for them.

Which leads to another question: what should the units do while the
boats are bult for them.  It concerns mostly settlers -- they are
expensive and can do something useful while waiting.  But we must be
careful to make sure that while they are doing good things like
irrigation, they continue lobbying for more boats.