Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] (PR#4733) reloading a savegame should give identical resul
Home

[Freeciv-Dev] (PR#4733) reloading a savegame should give identical resul

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#4733) reloading a savegame should give identical results
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Aug 2003 11:11:18 -0700
Reply-to: rt@xxxxxxxxxxxxxx

This is a substantial problem.  The main thing to avoid is any spurious
recalculation that involves calls to myrand(), since this changes the
random number ordering and leads to completely different games.

One such culprit is shuffle_players.  When the game is saved during the
turn, the shuffle order should be saved also.

Unfortunately, there are many other culprits in begin_turn.  One is
ai_diplomacy_actions(), called directly from begin_turn.  Another is
ai_diplomacy_calculate(), called from ai_data_turn_init().  Likely there
are others.  Whatever values these functions are calculating should be
saved so that they do not have to be recalculated immediately when the
game reloads.

There's also a question of actions taken.  For instance
ai_diplomacy_actions() is called an extra time when the game is loaded;
IME this means your allies will almost always contact you when the game
is reloaded (even though they didn't contact you earlier in the turn). 
This is actually a gameplay issue, not just a debugging problem.

For the most part diplomacy actions should be done on a per-turn basis,
not a per-invocation basis.  This is the only way to get reproducable
results.  But I think this would mean splitting begin_turn() up into
init_turn() (which is always called) and begin_turn() (which isn't
called when the game is loaded).

jason



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