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 09:13:55 -0700
Reply-to: rt@xxxxxxxxxxxxxx

--On Thursday, July 03, 2003 01:07:17 -0700 "ue80@xxxxxxxxxxxxxxxxxxxxx" 
<ue80@xxxxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, Jul 02, 2003 at 03:17:40PM -0700, Jason Short wrote:
>>
>> [rfalke - Wed Mar 26 14:03:11 2003]:
>>
>> > We won't need such a long list like the URL above. Lets try to start
>> > one:
>> >
>> > This list is by no means complete and also doesn't reflect the current
>> > behavior.
>> >
>> > > Is making it a true turn based game a priority then? As i understand
>> > > it, making it one would eliminate a variety of problems...
>> >
>> > Formalizing the new-turn activities is a priority. Removing/disabling
>> > the real time aspects during a turn isn't afaik.
>>
>> I mentioned earlier in this discussion that there are different types of
>> dependencies in the end-of-turn actions.  I'd like to add that since
>> inter-civilization dependencies are definitely possible (even without
>> gen-impr the obsoletion of wonders is such a dependency) I think rather
>> than doing all events in order for each civilization, we should do all
>> events in strict order.
>>
>> You've given a pretty full list of events.  But I hope we may be able to
>> divide these up into categories so that each category has no conflicting
>> dependencies.  The order could then be something like:
>>
>> * Pre-turn events
>>   - savegame
>>   - gameover check
>
> Should be before the new round starts.

You mean at the end of the previous round?

>> * Game events
>>   - pollution
>
> should be made after citygrowth

Hmm, I suppose.

>>   - fallout
>>   - barbarians
>
> new barbarians should be placed in the same phase where other new units
> are created.

Why does that matter?  The barbarians can't move yet.

>>   - spaceships (?)
>
> should be pre-turn before gameover check.

OK.

>>   - reputation
>> * City update
>>   - city stock (food+production)
>>   - rapture update
>>   - city growth (rapture/granary check)
>
> Thats the biggest problem.
>
> I think the cities should produce all (shields, trade ...) and after
> that the different checks:
>
> growth, tradeoutput, production
>
> new buildings/techs have no effect for the old round

I agree.  But in this case shouldn't pollution be calculated before growth 
as well?

>> * Tech update
>>   - research addition
>
>>   - great library check, etc
>
> Lets change it in wonder check
>
> before the research:
>   wonders have the full effect for the old round
>
> after the research:
>   wonders would have no effect although the player is counting the
> effect. (happiness problems because obsoletion)
>   great lib would get techs which had no time to spread over the world

I agree, Great Library should be done before tech checks.  This means if a 
civ researches a tech the Library can't acquire it until the next turn.

But wonders should probably all be put in the same place, so that they 
obsolete in the same way.  So they should be their own group, *before* tech 
calculations.  That means if Leonardo's is obsoleted on a turn, you still 
get an upgrade that turn.

>> * Upkeep update
>>   - tax income
>
> Income after growth? The city was size the hole last round and now you
> get taxes for size 2?

OK.

>>   - "potential gold" calculation
>>   - improvement upkeep (up to potential gold amount)
>>   - unit upkeep (up to potential gold amount)
>>   - building sales (as needed)
>
> When we have gold upkeep for units we have to disband units too.
> (why don't give autodisbanded units in cities shields when disbanding
> them?)

Yes.  This follows the idea introduced by the gold-upkeep patch for doing 
the calculations:

* First find out how much "potential gold" we could have by selling 
buildings.
* Then calculate upkeep.  You can get negative if you want, up to the 
potential gold that you have.  Anything more means you have to disband.
* Finally sell off buildings as needed to get back to a non-negative amount 
of cash.

But there's also the question: would you sell off a building rather than 
disband a unit?

If you disband a unit you should get sheilds, just as selling a building 
gives you gold.  But I think you should only be able to do this if you are 
able to pay the upkeep for this turn.

>> * Production update
>>   - Upgrade production
>>   - Build units/buildings
>
> Should new build buildings have effect for the old round or not?

No.  This is why we need to calculate the production and trade earlier, 
then  complete the production down here.

>> * Unit update
>>   - Leonardo
>
> Is a wonder should be done in the wonderphase think before the new techs
> are ready.

OK.

>>   - Heal units
>>   - Away-from-base checks:
>>     - Destroy out-of-fuel planes
>>     - Decrease helicopter HP
>>     - Destroy trireme
>
> Should be done at the end of the last round, (lighthouse effect)

OK.  So now we have end-of-turn and beginning-of-turn events.  The only 
difference being that end-of-turn events (gameover, fuel use) are not 
called at the beginning of the game.

>> * Reset events:
>>   - Reset movement points
>>   - Refuel planes
>>   - Reset unit flags (moved, paradropped, ...)
>>   - Reset city flags (did_sell, ...)
>>   - Reset city values (city production)
>>   - Reset research values
>
> ok

There's another problem in the current code with saving and reloading.  It 
seems to me a turn often passes when you do this.  I'm not quite sure why 
this happens, I think it's because GOTO execution is done in the wrong 
place.  In general:

* The AI should move before players do.
* Current-round AI gotos should also be executed before players move (this 
is not currently the case).
* New-round gotos should be executed before anyone moves.

So this leaves me with:

* Pre-turn actions:
  - Save game.
  - Goto execution (for this round).
  - AI turns.
  - More goto execution (for the AI, this round).

* Move phase.

* Post-turn events
  - Unit checks.
    - Planes use fuel, may crash.
    - Decrease helicopter HP
    - Destroy trireme
  - Spacechip arrival check
  - Dead player check.
  - Gameover check
* Game events
  - pollution (before growth)
  - fallout (?)
  - global warming/cooling
  - barbarians (placement only)
  - reputation (?)
* City update 1 (before tech update/growth)
  - city stock (food+production)
  - rapture update
* Upkeep update (before tech update/growth)
  - tax income
  - "potential gold" calculation
  - improvement upkeep (up to potential gold amount, then sell)
  - unit upkeep (up to potential gold amount, then disband)
  - building sales (as needed)
* Wonders (before tech update)
  - Great Library
  - Leonardo's
* Tech update
  - research addition
* City update 2 (after tech update)
  - Upgrade production
  - Build units/buildings
  - city growth (rapture/granary check)
* Unit update
  - Heal units
* Reset events:
  - Reset movement points
  - Refuel planes
  - Reset unit flags (moved, paradropped, ...)
  - Reset city flags (did_sell, ...)
  - Reset city values (city production)
  - Reset research values
  - Reset player turn_done

But this still isn't rigorous.  For a current list of activities see 
end_turn and begin_turn in srv_main.c.

jason




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