From: Erik V. <eri...@xs...> - 2011-03-17 12:15:17
|
> -----Oorspronkelijk bericht----- > Van: Erik Vos [mailto:eri...@xs...] > This should not be too difficult to do. The trigger would not be any button, > but just a change of who has the turn. > Every, say, 30 seconds Rails could check for new files, load these, and display > the results. A popup would signal your next turn. > > I'll try to write down a more detailed specification shortly. Here it is. 1. Autosave/load is activated by checking a menu option. Steps 2 and 3 apply only if this option has been activated. 2. Every time that an active player loses the turn, the following is done: 2a. A saved file is written to the default location (the first time the usual popup will ask for it) and with the usual filename: <prefix>_<timestamp>_<player>.rails. 2b. The name of this file is written into another (new) file, named <prefix>.last_rails. 2c. Rails goes into polling mode. (Ideally, all actions should be prohibited except Quit and perhaps some more). 3. In polling mode, Rails regularly reads the .last_rails file to check if the filename has changed. The interval is configurable (default 30 secs?). If a new filename is found: 3a. This file is read and processed in the same way as Reload does it. 3b. Rails checks if the player has got the turn. If so, polling mode is suspended, and normal operation resumes. Otherwise, polling mode continues. 4. When Rails is restarted for an ongoing game, the last saved file must be loaded manually. Autosave/load can only be activated after that. If the local player does not have the turn, Rails will enter polling mode at that point. Notes: 1. Normally, each game should use a separate directory. In theory it should be possible to run multiple games in one directory, if each game is given a unique <prefix> at the *first* save action, but this is not recommended. 2. Repeated reloading during polling mode ensures that actions by other players show up with a reasonable delay. 3. It does not matter if a saved file is missed because the interval is longer than the time between two saves by other players. Each saved file contains the whole game history. Comments welcome. Erik. |