Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2004:
[Freeciv-Dev] (PR#7230) patrolling tririemes may sink
Home

[Freeciv-Dev] (PR#7230) patrolling tririemes may sink

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#7230) patrolling tririemes may sink
From: "Jason Short" <jshort@xxxxxxxxxxxxxx>
Date: Sat, 10 Jan 2004 20:35:33 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7230 >

If a tririeme patrols around an island (for instance) it may wait and/or
cross certain dangerous positions.  If its patrol causes it to end up with
a different number of movement points than it started with, then on the
second time around it may end up ending its turn on a dangerous position,
and sinking.

This is a lesser problem for all units (both because of dangerous
positions and following optimal terrain paths), but mostly for tririemes. 
If positions are later labelled as being dangerous on certain "turns" then
there will be no way to guarantee correctness.

But as it is, there are several alternatives.

The simplest solution would be to guarantee that the unit always had the
same number of MP at start and end of the route.  This is accomplished
  if the unit starts with less-than-full MP
    wait at the beginning of the route
  else if the unit ends with less-than-full MP
    wait at the end of the route
this is guaranteed correct but isn't optimal.

A seemingly optimal solution is to repeat the complete circuit (with a
newly-found path) until the starting MP repeats.  But it is not guaranteed
(in fact, it's probably unlikely) that the MP at the start of the circuit
will ever be equal to the MP at the start of the _first_ circuit.

So I think the _actual_ optimal solution is to repeat the complete circuit
until the starting MP enters a cycle, then repeat only that part of the
route.  So if the MP at the start of the first cycle was 3, the MP at the
start of the second cycle was 2, the MP at the start of the third cycle
was 1, and the MP at the start of the fourth cycle was 2, then the route
would consist of three cycles with the last two of them repeating.  In
terms of orders, this would mean we'd have 120 (or something) orders with
the last 80 of them repeating.

If the above doesn't make sense to you, you may want to take some time to
think about it.  This scenario is not only possible: I suspect it is
likely.

The only drawbacks of this solution are that it may be a pain to code
(though no changes to PF will be necessary), and that the orders list may
end up being several times longer.

A final solution would be to have the client calculate the new route when
the current one finishes.  But this has the fairly substantial drawback of
requiring continued feedback from the client.

jason




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#7230) patrolling tririemes may sink, Jason Short <=