From: Erik V. <eri...@hc...> - 2005-03-06 21:34:25
|
All agreed, except one minor point: > I've been thinking about the game-save and game requirements, > and it seems > to me > that these are best served by a single solution: All the > user's funtional > input, > e.g. "Fred buys a B&O share", "PRR lays a #9 on H14/ew" > should be saved in a > replayable log. This log could be held in memory Why not written to a file immediately? Granted that Windows does not crash that often these days, but why take the risk? > until the > user decides to > save > the game. This log could then be passed to the next player in > a PBEM game, > or just > used to reload a saved state after closing the program. > > Advantages are: > > - PBEM and local user game saves solved by the same code. > - No need to overload implementation code with state save/load code. > - Easy debugging: "I did the following (log attached), and > the program did > the wrong thing." > - Easy testing: Once you've debugged the previous case, you > can replay the > game, and see > that the code works properly. Whole test suites and > regression tests can > be built from this. > - If everyone in a PBEM game mails the log after their turn > to everyone > else, cheating becomes > impossible, since if you alter the log, any other player > can diff your > version against their > last one, and see what change you've made. > > I would, of course, strongly favour using an XML format for > saving this > data. Like: <action actor_type="company" actor="PRR"> <tile_lay tile="9" location="H14" orientation="SW"> </action> etc.? Erik. |