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: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: [RFC] Ferry code
From: Ross Wetmore <rwetmore@xxxxxxxxxxxx>
Date: Sun, 06 Apr 2003 10:51:36 -0400

Several suggestions:

1)  Don't confuse the situation by mixing build boat and travel by boat.
    If you need boats, then increase the want for boats and the locations
where they are most useful. It is stupid to build a boat for a single
ferry operation - boats need to be built for longer term reasons, and boat
building suppressed if you have enough even if there is a given ferry
operation that needs to wait for a free boat.

2)  Book boat travel on an efficiency basis. Find the nearest boat and
    have the unit an boat meet up as with bodyguarding, but perhaps taking
advantage of cities for boading and unloading efficiencies. If a boat is
already booked but the current request is en-route or closer, then switch
the booking or divert it to make multiple pickups and drop offs on a
closest goes first basis. In general penalize stalling boat movement or
undue diversion/backtracking to pickup passengers, but don't necessarily
block it. A boat that follows a "ferry-route" picking up and dropping off
units along the way is the optimal goal.

3)  Guard the boat and/or route with naval units if there is a danger
    factor. Don't decrease efficiency of the transport operation to
minimize losses, but protect or factor the danger into go/no-go for the
entire operation to preserve both the boat and units.

Summary, don't micromanage the boat pickup and dropoff but let it happen
under tactical, i.e. immediate situational rules. Micromanaging end-to-end
single boat operations is both less efficient and more dangerous as you
are liable to land single units too be easily be picked off, rather than
armies that have a fighting chance to survive until the next trip can
bring reinforcements. Micromanaging except in limited one (maybe two) turn
tactical situations is in general a very poor strategy for any actions.


Gregory Berkolaiko wrote:
I thought lots about the ferry code (no, really!) and here is the outline of my

Setup: unit U on continent 1 wants to move to Z on continent 2.

We make a big map for U to go to all coastal towns T(i) on 1 where it will spend
approx N(i) turns waiting, then from each town we calculate paths to all coast
tiles of continent 2, from all coastal tiles we calculate all paths to Z.  This
calculation is not much costlier than normal map for one unit btw!

As an ingredient we will need these numbers N(i) which I think we should just
WAGuess (maybe taking into account boats which are "registered" at that city and
the production output of the city).

Once a route has been decided (say, U will walk to Geneva from which it will
sail to  Paris from which it will walk to London), U sets London to be it's
ultimate dest and Geneva to be it's waypoint.
U contacts Geneva and attempts to book a boat.  If Geneva can find a boat, B, U
will be told of B's ID and B will be ordered to go to Geneva and will be told of
U's ID.  Thereafter, each turn both U and B will check if the other is still in
existence and still on their way to Geneva, otherwise they will be "released".

If Geneva cannot find a boat, it will make a mental note of "need a boat for U".
 Thereafter, each turn Geneva will check if U is still alive and on the way to
Geneva.  If this is the case, Geneva will try to build set the boat as the
production for this turn.  Otherwise, the note will be deleted.

There are two points where present code might not be ready for this:
1. Making sure that once a unit is on the way somewhere, it will not suddenly
change it's mind and go exploring instead.  Per, what's the situation now?
2. Making sure that a boat is built unless the city 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

Future expansions:
1. The boat does not have to be 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.
2. Once B and U are in liaison, they can agree on another more convenient pickup
location.  Raahul is working on it ;)
3. We can keep a tab on how busy each port has been and how long were the
delays.  This can be fedback to (a) numbers N(i) and (b) free boats to tell them
to go to busy ports looking for an odd job.


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