[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]
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
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.
do not attack units on sea squares
on sea squares return
SINGLE_MOVE * PF_TURN_FACTOR / ferry_move_rate
/* The rescaling is to make get_total_CC compare the cost properly,
* 1 turn of ferry == 1 turn over land */
move to land
return normal cost
move sea to sea
move land to sea
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.