Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] Re: (PR#9610) autosettler "territory" and danger maps
Home

[Freeciv-Dev] Re: (PR#9610) autosettler "territory" and danger maps

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#9610) autosettler "territory" and danger maps
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Thu, 5 Aug 2004 23:30:14 -0700
Reply-to: rt@xxxxxxxxxxx

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

On Thu, 5 Aug 2004, Jason Short wrote:
> > Here is my preliminary idea for a "movemap":
> >
> > A mapsize array of struct {
> > struct unit_list 1_turn_reach;
> > struct unit_list 2_turn_reach;
> > } movemap;
>
> There must be one such array for each player, since each player has
> different vision. Note that human players use this as well (human
> autosettlers avoid dangerous positions) and this is hard-core cheating.

Yes. But - if we could ignore alternating movement mode - we could
actually get away with one such array for all players, since we can do the
vision check on iterations instead of in the insertion routine. We could
put the vision check in an iterator macro, for that matter.

> > Setting up the cache will consume some CPU, and has to be recalculated
> > each turn for each player, but will not cost much more CPU than a
> > pf-converted city danger code, I think. The city danger code will have
> > to (well, should) do these calculations anyway.
>
> Calculated once per turn per player?

The problem here is that the AI moves in the beginning of the turn, and
changes production in the end. So, for simultaneous movement, to get an
accurate movemap we would have to update it twice each turn.

However, we can save lots of CPU this way:
 - Simultaneous movement mode: Calculate once for all players only on turn
start. Calculate once for all players on turn end.
 - Alternating movement model: Calculate for the current player in the
start of each phase.

  - Per




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