Complete.Org: Mailing Lists: Archives: freeciv-ai: September 2003:
[freeciv-ai] Re: (PR#6199) even huger fstk/ksw/paw/ferry cleanup
Home

[freeciv-ai] Re: (PR#6199) even huger fstk/ksw/paw/ferry cleanup

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [freeciv-ai] Re: (PR#6199) even huger fstk/ksw/paw/ferry cleanup
From: "Gregory Berkolaiko" <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Mon, 29 Sep 2003 07:15:13 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Sun, 28 Sep 2003, Per I. Mathisen wrote:

> By my measurements, it gets 50% slower than current cvs. That is
> acceptable as a temporary, short-term solution, IMHO. In the long run I
> think we both agree fstk should be replaced entirely by rampage + hunt +
> army code, which will be more efficient.
> 
> Let's clean up fstk now without doing a lot of fancy solutions, and then
> go from there to a better system.

I disagree.  We might as well do it more or less properly now, it's only 
fstk that would be affected, but
1. The code would be reused in new AI settlers looking to settle overseas
2. The code could be reused for army handling, looking for targets to send 
armies to.
3. The code could even be reused for ai_gothere.

I will describe the path-finding below, but first I want to advertise it a 
little bit.  It's for finding paths to locations on other continents 
assuming our (land) unit is in a port or on a ferry.  It will find 
beachheads automatically and the best ones at that (not just 95% best).  
It will be possible to read off exact time to destintation off this map.

We construct a map of paths going over water and then over land by using a 
mixed move_cost function.  Unfortunately, the move rates of this pseudo 
unit over land and over sea are different.  So we will record the move 
costs over sea in extra_cost and over land in normal cost.

TB-callback:
do not attack units on sea squares

EC-callback:
on sea squares return 
  SINGLE_MOVE * PF_TURN_FACTOR / ferry_move_rate
otherwise 0
/* The rescaling is to make get_total_CC compare the cost properly,
 * 1 turn of ferry == 1 turn over land */

cost-callback:
move to land
  return normal cost
move sea to sea
  return 0
move land to sea
  return INFINITY


then to estimate turns to destination use
pos.turns + pos.total_EC / PF_TURN_FACTOR


In fact, it all looks so simple I will do it for rampage off the boat.

G.





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