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

[freeciv-ai] [RFC] Ferry code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] [RFC] Ferry code
From: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Fri, 4 Apr 2003 23:23:35 +0100

I thought lots about the ferry code (no, really!) and here is the outline of my
proposal.

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
urgency.

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.

G.


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