Civilization VII organizes game data in a relational database structure defined by schema files. These schemas outline the tables, columns, relationships, and constraints that govern all game elements. Understanding these schemas is essential for creating effective mods, as they define how data must be structured to be recognized and processed by the game.This document provides a comprehensive reference to the key database schemas that power Civilization VII. These schemas are defined in various .civdb and .sql files within the game’s installation, primarily in the base-standard module.
The core gameplay schema defines the fundamental game mechanics, entities, and relationships in Civilization VII.File Location: <GAME_RESOURCES>/Base/Assets/schema/gameplay/01_GameplaySchema.sqlThis schema serves as the foundation for all gameplay elements, establishing the data structures for civilizations, leaders, units, buildings, and core mechanics.
CREATE TABLE "Civilizations" ( "CivilizationType" TEXT NOT NULL, "Name" TEXT NOT NULL, "Adjective" TEXT NOT NULL, "Description" TEXT, "Icon" TEXT, "SortIndex" INTEGER, PRIMARY KEY("CivilizationType"));CREATE TABLE "CivilizationTraits" ( "CivilizationType" TEXT NOT NULL, "TraitType" TEXT NOT NULL, PRIMARY KEY("CivilizationType", "TraitType"), FOREIGN KEY("CivilizationType") REFERENCES Civilizations("CivilizationType"), FOREIGN KEY("TraitType") REFERENCES Traits("TraitType"));
These tables define civilizations and associate them with traits (abilities). When adding a new civilization, you’ll need to insert rows into both of these tables.
CREATE TABLE "Leaders" ( "LeaderType" TEXT NOT NULL, "Name" TEXT NOT NULL, "IsPlayable" BOOLEAN NOT NULL DEFAULT true, "Icon" TEXT, "SortIndex" INTEGER, PRIMARY KEY("LeaderType"));CREATE TABLE "LeaderTraits" ( "LeaderType" TEXT NOT NULL, "TraitType" TEXT NOT NULL, PRIMARY KEY("LeaderType", "TraitType"), FOREIGN KEY("LeaderType") REFERENCES Leaders("LeaderType"), FOREIGN KEY("TraitType") REFERENCES Traits("TraitType"));CREATE TABLE "CivilizationLeaders" ( "CivilizationType" TEXT NOT NULL, "LeaderType" TEXT NOT NULL, "Legacy" BOOLEAN DEFAULT false, PRIMARY KEY("CivilizationType", "LeaderType"), FOREIGN KEY("CivilizationType") REFERENCES Civilizations("CivilizationType"), FOREIGN KEY("LeaderType") REFERENCES Leaders("LeaderType"));
These tables define leaders, their traits, and which civilizations they can lead. The CivilizationLeaders table is crucial for connecting leaders to civilizations.
CREATE TABLE "Units" ( "UnitType" TEXT NOT NULL, "Name" TEXT NOT NULL, "Description" TEXT, "Domain" TEXT NOT NULL, "FormationClass" TEXT, "Cost" INTEGER, "Maintenance" INTEGER, "BaseMoves" INTEGER, "Combat" INTEGER, "RangedCombat" INTEGER, "Range" INTEGER, "PrereqTech" TEXT, "PrereqCivic" TEXT, "PrereqResource" TEXT, "PrereqDistrict" TEXT, "Upgrades" TEXT, "ReplacesUnitType" TEXT, "PromotionClass" TEXT, PRIMARY KEY("UnitType"));
This table defines the base attributes of units. Additional tables like UnitAbilities, UnitBuilds, and UnitUpgrades would extend this with more specific functionality.
CREATE TABLE "Buildings" ( "BuildingType" TEXT NOT NULL, "Name" TEXT NOT NULL, "Description" TEXT, "Cost" INTEGER, "Maintenance" INTEGER, "PrereqTech" TEXT, "PrereqCivic" TEXT, "PrereqDistrict" TEXT, "ReplacementBuildingType" TEXT, "IsWonder" BOOLEAN DEFAULT false, PRIMARY KEY("BuildingType"));CREATE TABLE "Districts" ( "DistrictType" TEXT NOT NULL, "Name" TEXT NOT NULL, "Description" TEXT, "Cost" INTEGER, "Maintenance" INTEGER, "PrereqTech" TEXT, "IsSpecialized" BOOLEAN DEFAULT false, PRIMARY KEY("DistrictType"));
These tables define buildings and districts (called Quarters in Civilization VII). Additional tables for adjacency bonuses, yields, and placement restrictions would extend these definitions.
The modding framework schema defines how mods are structured, discovered, loaded, and applied to the base game.File Location: <GAME_RESOURCES>/Base/Assets/schema/modding/schema-modding-10.sqlThis schema is crucial for understanding how to properly package and deploy mods in Civilization VII.
CREATE TABLE Mods( 'ModRowId' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'ScannedFileRowId' INTEGER NOT NULL, 'ModId' TEXT NOT NULL, 'Version' INTEGER NOT NULL, 'Disabled' BOOLEAN, FOREIGN KEY(ScannedFileRowId) REFERENCES ScannedFiles(ScannedFileRowId) ON DELETE CASCADE ON UPDATE CASCADE);CREATE TABLE ModProperties( 'ModRowId' INTEGER NOT NULL, 'Name' TEXT NOT NULL, 'Value' TEXT, PRIMARY KEY ('ModRowId', 'Name'), FOREIGN KEY ('ModRowId') REFERENCES Mods('ModRowId') ON DELETE CASCADE ON UPDATE CASCADE);CREATE TABLE ActionGroups( 'ActionGroupRowId' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'ModRowId' INTEGER NOT NULL, 'Id' TEXT NOT NULL, 'Scope' TEXT NOT NULL, 'CriteriaId' TEXT, FOREIGN KEY('ModRowId') REFERENCES Mods('ModRowId') ON DELETE CASCADE ON UPDATE CASCADE, UNIQUE('ModRowId', 'Id'));CREATE TABLE Actions( 'ActionRowId' INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 'ActionGroupRowId' INTEGER NOT NULL, 'ActionType' TEXT NOT NULL, FOREIGN KEY('ActionGroupRowId') REFERENCES ActionGroups('ActionGroupRowId') ON DELETE CASCADE ON UPDATE CASCADE);
These tables define how mods are tracked by the game, what properties they have, and what actions they perform. When you create a .modinfo file, you’re essentially providing information that will populate these tables.
The icon management schema defines how icons for various game elements are organized and displayed.File Location: <GAME_RESOURCES>/Base/Assets/schema/icons/IconManager.sqlIcons are a crucial visual component of the game, representing civilizations, units, buildings, and other elements.
CREATE TABLE 'Icons' ( 'ID' TEXT NOT NULL, 'Context' TEXT DEFAULT 'DEFAULT', PRIMARY KEY('ID','Context'), FOREIGN KEY('Context') REFERENCES IconContexts('Context'));CREATE TABLE 'IconDefinitions' ( 'ID' TEXT NOT NULL, 'Context' TEXT NOT NULL DEFAULT 'DEFAULT', 'IconSize' INTEGER NOT NULL DEFAULT 0, 'Path' Text NOT NULL, 'NeedsTinting' INTEGER DEFAULT 0, 'FitToContent' INTEGER DEFAULT 0, 'InteractiveTop' INTEGER, 'InteractiveRight' INTEGER, 'InteractiveBottom' INTEGER, 'InteractiveLeft' INTEGER, PRIMARY KEY('ID', 'Context', 'IconSize'), FOREIGN KEY('ID', 'Context') REFERENCES Icons ('ID', 'Context') ON DELETE CASCADE ON UPDATE CASCADE);
The Icons table defines unique identifiers for icons, while IconDefinitions specifies the visual representation at different sizes. When adding custom icons for a mod, you’ll need to reference these schemas to properly register your icons.
This schema defines the structure for map generation, terrain features, and the World Builder tool.File Location: <GAME_RESOURCES>/Base/Assets/schema/worldbuilder/schema-worldbuilder-map.sqlIt is particularly important for mods that create custom maps or scenarios.
CREATE TABLE "Map" ( "ID" TEXT NOT NULL, "Width" INTEGER, "Height" INTEGER, "TopLatitude" INTEGER, "BottomLatitude" INTEGER, "WrapX" BOOLEAN, "WrapY" BOOLEAN, "MapSizeType" TEXT, PRIMARY KEY(ID));CREATE TABLE "Plots" ( "ID" INTEGER NOT NULL, "TerrainType" TEXT NOT NULL, "BiomeType" TEXT, "ContinentType" TEXT, "Elevation" INTEGER, "IsImpassable" BOOLEAN, "Tag" INTEGER, PRIMARY KEY(ID));CREATE TABLE "Resources" ( "PlotID" INTEGER NOT NULL, "ResourceType" TEXT NOT NULL, "Amount" INTEGER, PRIMARY KEY(PlotID, ResourceType), FOREIGN KEY(PlotID) REFERENCES Plots(ID));CREATE TABLE "Features" ( "PlotID" INTEGER NOT NULL, "FeatureType" TEXT NOT NULL, PRIMARY KEY(PlotID, FeatureType), FOREIGN KEY(PlotID) REFERENCES Plots(ID));
These tables define the structure of maps, including the base geography (Plots), resources, and features. When creating custom maps or modifying map generation scripts, you’ll need to work with these structures.
The localization schema defines how text is stored and displayed in different languages.File Location: <GAME_RESOURCES>/Base/Assets/schema/loc/schema-loc-10.sql and <GAME_RESOURCES>/Base/Assets/schema/loc/schema-loc-20-languages.sqlProper localization is essential for mods to display text correctly to users in different languages.
CREATE TABLE "Languages" ( "Language" TEXT NOT NULL, "Name" TEXT NOT NULL, "DisplayOrder" INTEGER NOT NULL, PRIMARY KEY("Language"));CREATE TABLE "LocalizedText" ( "Tag" TEXT NOT NULL, "Language" TEXT NOT NULL, "Text" TEXT NOT NULL, PRIMARY KEY("Tag", "Language"), FOREIGN KEY("Language") REFERENCES Languages("Language"));
The Languages table defines supported languages, while LocalizedText stores the actual translated strings. When adding text for a mod, you’ll need to insert rows into the LocalizedText table.
The frontend schema defines game setup, user interface, and metagame features.File Location: <GAME_RESOURCES>/Base/Assets/schema/frontend/ (multiple files)Key files include:
<GAME_RESOURCES>/Base/Assets/schema/frontend/schema-frontend-10-setup-parameters.sql: Game setup parameters
Each Age module extends the base schemas with age-specific definitions. These are defined through the .civdb files in the base-standard module but implemented differently in each Age module.Age-specific schema elements include:
Units available in each Age
Buildings and Wonders specific to historical periods
The database schemas form the backbone of Civilization VII’s data structure. By understanding these schemas, you can create mods that properly integrate with the game’s systems and function correctly alongside other content.For practical implementation of these schemas, refer to the other documents in this modding documentation series, particularly the guides on creating civilizations, leaders, and modifying existing content.