Author Topic: DB/Save game improvements  (Read 2253 times)

0 Members and 1 Guest are viewing this topic.

Offline Bughunter (OP)

  • Bug Moderators
  • Rear Admiral
  • ***
  • Posts: 929
  • Thanked: 132 times
  • Discord Username: Bughunter
DB/Save game improvements
« on: May 01, 2020, 02:48:35 AM »
The game use one database with everything in it including all savegames. I propose to instead do the following:

Use AuroraDB as the template from which data is copied for every new game you start.
Every game has its own db placed under a folder like /SaveGames/Gamename.db

This would improve db performance by getting rid of all "where GameId=" and instead use a connection to the db you load. Especially it would get rid of inefficient deletes when saving as you can rename the previous save xxBackup.db and write a new one. Or not rename saves at all but add a timestamp to the name instead.

You could also place a game version string in saved db:s and have the game refuse to load incompatible ones to save yourself some bug reports from that.
 
The following users thanked this post: Zhatelier, Cosinus

Offline Zhatelier

  • Chief Petty Officer
  • ***
  • Posts: 46
  • Thanked: 19 times
Re: DB/Save game improvements
« Reply #1 on: May 01, 2020, 02:58:43 AM »
This would also make sharing individual saves a bit easier, be that a custom setting or a challenging situation that you want to share with the community, but it's probably not as trivial thing to implement as it might sound.
 

Offline Bughunter (OP)

  • Bug Moderators
  • Rear Admiral
  • ***
  • Posts: 929
  • Thanked: 132 times
  • Discord Username: Bughunter
Re: DB/Save game improvements
« Reply #2 on: May 01, 2020, 03:08:36 AM »
I can only assume what the code structure looks like. I think it would require editing almost every db query, but pretty much the same change everywhere so still something that would hopefully not take too long to do. Since the database is now only touched on save/load in C# it should make the change a lot easier.

And yes it would make it easy sharing saves and also decrease save file size.
 

Offline Father Tim

  • Vice Admiral
  • **********
  • Posts: 2162
  • Thanked: 531 times
Re: DB/Save game improvements
« Reply #3 on: May 01, 2020, 10:15:05 PM »
I'm not sure it would be either of those things (or, at most, a tiny improvement per player at the cost of massive work to Steve).

It is assumed (perhaps that's our fault for not advertising it better) that you will only run one game of Aurora at a teim per database.  If you want two games, make two spearate DBs and manually rename the one you're not using.  If you want to 'share your save' then rename the database to "Bughunters_Awesome_Setup.db" before doing so, and the folks who want to try it can back up their own game (by renaming to "whatever.db") and then load yours.

Personally, I wouldn't ever want to run multiple games off the same DB.  Not only as a legacy of old Aurora (where advancing time for any game advanced time for all games) but simply because bugs and crashes are common enough that I wouldn't want to risk all my games simultaneously.

Multiple games on one DB is like leaving a trailer attached to your car at all times.  It may make some things more convenient, but it is still pointless extra risk.