- You have already run the preprocessor to properly format the data
- (Optional) competency with SQLite SQL and Windows batch
Commonwealth Cartography's database exists as an SQLite database file. SQLite allows us to have a locally hosted, offline database file. This means there are no hosting requirements for Commonwealth Cartography to function, and end users can use it offline.
Using SQLite, a single batch file creates the empty database structure, then instructs SQLite to populate the empty tables with the preprocessed data. After this further SQL generates several more tables based off existing data (For example, pre-computing min/max coords of cells as they cannot change), removes escaped characters, shrinks the database, indexes it, and generates a summary report.
The game version string is baked into the database. If you have Fallout 4 installed in the default Steam location, you may enable automatic game version detection by downloading sigcheck.exe
from Sysinternals and placing it in the database folder - if so, the game version string will be automatically gathered from Fallout4.exe
.
Otherwise, before running build_database.bat
, ensure the correct game version string is stored in gameVersion.csv
.
Sometimes the version of the exe will differ from the version given in-game. The recommended rule is that the version in-game (bottom-right of settings menu) trumps the version of the exe. Where this is the case, you must call the batch script with the override
argument. This prevents sigcheck from modifying gameVersion.csv
and instead trusts the value you should have entered into the file previously.
Before we can build the database, we need a copy of the sqlite tools windows binary, called sqlite3.exe. This is distributed at the SQLite downloads page. Under 'Precompiled Binaries for Windows' find the sqlite-tools zip.
Once you have placed that exe in the \Database\
folder, you can execute build_database.bat
and after confirming the correct game version, the script will carry out all the steps required to build the database.
Once finished, the script will automatically move the db file to the data folder for the Commonwealth Cartography GUI at \CommonwealthCartography\data\
.
You will notice a txt file in \Database\
called summary.txt
. This file is generated when the database is built and is intentionally source controlled.
Using git to visualize how the file changed, this report essentially acts as a canary for the reliability of data in the database, and allows us to quickly identify if anything has gone significantly wrong anywhere along the stage of exporting - as any wildly different values would indicate a problem.
Checking this report should be a key step in updating the database for a new game version. While we would expect the values to change, any large changes, or empty fields should immediately signify an error.
You should now have successfully extracted and assembled the Commonwealth Cartography database. You may optionally want to extract the map marker icons, or also optionally, render the background images. Otherwise you can move on to development of the actual end-user GUI program, Commonwealth Cartography.