In game database wisdom (or don't be a noob like me)

robk

Warlord
Joined
Sep 8, 2006
Messages
210
Location
Santa Monica, CA
I was playing around with the in game database file today and I wasted a few hours on a problem that was entirely my fault.

When a new game starts, the Civ5SavedGameDatabase.db file will be overwritten with a new, stock database file that contains one table and no data. It appears that the first file is deleted and then replaced with a new data file. However, because I was debugging things, I kept a connection open to that file in my SQLite manager app in between starting new games. Because of this, when a new game started, it wasn't able to delete the cached file and then drop in the empty one. So, I was seeing data from older games showing up in brand new ones. It confused me like this -> :crazyeye:

Even further (doofier?), after I killed my SQLite manager app since I realized that could be a problem, I created a connection to the database in the "Main State" context of the FireTuner to count rows to see if I could get the file to reset. That kept an open file handle on the database file since that context doesn't disappear in between games. I didn't realize we could do that but it's kinda neat to know.

Anyway ... lesson here is to close your SQLite client in between game starts to let the game clear out that file.
 
I was playing around with the in game database file today and I wasted a few hours on a problem that was entirely my fault.

When a new game starts, the Civ5SavedGameDatabase.db file will be overwritten with a new, stock database file that contains one table and no data. It appears that the first file is deleted and then replaced with a new data file. However, because I was debugging things, I kept a connection open to that file in my SQLite manager app in between starting new games. Because of this, when a new game started, it wasn't able to delete the cached file and then drop in the empty one. So, I was seeing data from older games showing up in brand new ones. It confused me like this -> :crazyeye:

Even further (doofier?), after I killed my SQLite manager app since I realized that could be a problem, I created a connection to the database in the "Main State" context of the FireTuner to count rows to see if I could get the file to reset. That kept an open file handle on the database file since that context doesn't disappear in between games. I didn't realize we could do that but it's kinda neat to know.

Anyway ... lesson here is to close your SQLite client in between game starts to let the game clear out that file.

Thanks for the heads-up. I hadn't needed any saved data for the Zombie Apocalypse mod, but the recent change to perform actions at end-of-turn (or actually at the start of the next players turn) instead of during each combat means that if I save out after completing a turn and reload the game, pending actions are lost. Time to look at the save database stuff then...
 
Back
Top Bottom