FreeCol / freecol

FreeCol: FreeCol is a turn-based strategy game based on the old game Colonization, and similar to Civilization. The objective of the game is to create an independent nation.
GNU General Public License v2.0
589 stars 173 forks source link

[IN PROGRESS] Implement SQLite as a replacement for XML-based storage in saving game data #133

Open Dimakl opened 1 year ago

Dimakl commented 1 year ago

This pull request introduces SQLite as a solution for storing and managing game data, replacing the current XML-based file structure. The outdated method of storing files locally and serializing game parameters into an XML file no longer meets the requirements for a robust and secure storage mechanism. In addition, document-oriented storage is not the optimal solution for a project with multiple users since similar fields are present across XML files belonging to different players.

By replacing XML storage with SQLite, the following benefits can be achieved:

  1. Enhanced data security: Using SQLite ensures that the game data cannot be easily tampered with or deleted by users.
  2. Persistent storage between gameplay sessions: Players can save their progress and continue their games at any time.
  3. Efficient data access and retrieval during gameplay: SQLite provides fast and efficient database operations, leading to improved performance.
  4. Easy modification of game parameters and adding new game features: The new database structure allows developers to provide updates and add game features effortlessly.
  5. Multiplayer game support: A unified database contributes to efficient data management in multiplayer game modes.

The proposed changes include implementation and tests for the FreeColSQLWriter and FreeColSQLReader classes, which handle writing and reading game data to and from the SQLite database, respectively. The new classes cover various game components such as game state, player data, and tile data. This pull request serves as the foundation for further enhancement in game data management and the introduction of more features that rely on database functionality.