Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2003:
[Freeciv-Dev] Re: (PR#725) Order of end/new-turn activities
Home

[Freeciv-Dev] Re: (PR#725) Order of end/new-turn activities

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ChrisK@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#725) Order of end/new-turn activities
From: "Jason Short" <jshort@xxxxxxxxxxxxxx>
Date: Thu, 3 Jul 2003 11:04:34 -0700
Reply-to: rt@xxxxxxxxxxxxxx

--On Thursday, July 03, 2003 09:30:46 -0700 "Per I. Mathisen" 
<per@xxxxxxxxxxx> wrote:

>
> On Thu, 3 Jul 2003, Jason Short wrote:
>> In general:
>>
>> * The AI should move before players do.
>
> I and Greg are agreed that the AI should move _after_ players on turn end,
> so that the AIs and their data can be properly encapsulated, and each AI
> complete all its tasks without interruption. This way we save memory that
> is otherwise spent storing data between AI sessions, or CPU recalculating
> it each time.
>
>> * Current-round AI gotos should also be executed before players move
>> (this is not currently the case).
>
> Why should AI get special treatment here?

Exactly - if a human player does GOTO, the goto is immediately executed. 
For the AI it should be as well, but apparently it isn't - so we get the 
oft-seen "enemy comes out of nowhere to capture my city" bug.

The AI can execute either before or after the humans, but it should be done 
so that the AI never gets to move twice in a row.  A simple implementation 
might be:

  - Execute current-turn GOTO
  - Player moves
  - AI moves (and GOTOs are executed)

but if the current-turn GOTO includes AI gotos, then the AI will get a 
chance to move twice in a row.  My suggestion was:

  - Execute current-turn GOTO
  - AI moves (and GOTOs are executed)
  - Player moves

which avoids this problem.

It is importante to maintain the turn-based nature of Freeciv for 
single-player mode.

jason




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