Overview
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.
Schema File Locations
The primary schema definitions can be found in:- Base Game Definition Schemas:
<GAME_RESOURCES>/Base/modules/base-standard/definitions/*.civdbfiles - Database System Schemas:
<GAME_RESOURCES>/Base/Assets/schema/directory (subdirectories for specific systems)
Core Gameplay Schema
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.sql
This schema serves as the foundation for all gameplay elements, establishing the data structures for civilizations, leaders, units, buildings, and core mechanics.
Key Table Structures
The core gameplay database includes hundreds of interrelated tables. Here are some of the most important ones for modders:Civilizations
Leaders
Units
Buildings and Quarters (Districts)
Modding Framework Schema
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.sql
This schema is crucial for understanding how to properly package and deploy mods in Civilization VII.
Key Table Structures
Action Types
The modding system supports different action types that can be triggered by mods:- UpdateDatabase: Adds or modifies data in the game database
- UpdateText: Updates or adds localized text
- ReplaceUIScript: Replaces a UI JavaScript file
- AddUserInterfaces: Adds custom UI components
- ImportFiles: Imports external files into the game
Icon Management Schema
The icon management schema defines how icons for various game elements are organized and displayed. File Location:<GAME_RESOURCES>/Base/Assets/schema/icons/IconManager.sql
Icons are a crucial visual component of the game, representing civilizations, units, buildings, and other elements.
Key Table Structures
World Builder Map Schema
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.sql
It is particularly important for mods that create custom maps or scenarios.
Key Table Structures
Localization Schema
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.sql
Proper localization is essential for mods to display text correctly to users in different languages.
Key Table Structures
Frontend Schema
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<GAME_RESOURCES>/Base/Assets/schema/frontend/schema-frontend-20-keybindings.sql: Keyboard controls<GAME_RESOURCES>/Base/Assets/schema/frontend/schema-frontend-30-hof.sql: Hall of Fame tracking<GAME_RESOURCES>/Base/Assets/schema/frontend/schema-frontend-50-setup-data.sql: Game setup data structures
Age-Specific Schema Elements
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
- Technologies and Civics for each era
- Civilizations belonging to specific Ages
Practical Schema Usage Examples
Adding a New Civilization
To add a new civilization, you need to work with multiple schema tables:Creating a Leader and Connecting to Civilization
Defining a Unique Unit
Important Schema Relationships
Understanding the relationships between key schema elements is crucial for effective modding:- Civilizations → Traits: Civilizations have unique abilities defined as traits
- Leaders → Traits: Leaders have their own unique abilities
- Civilizations ↔ Leaders: A many-to-many relationship via CivilizationLeaders
- Units → Civilizations: Unique units are tied to specific civilizations
- Buildings → Civilizations: Unique buildings are tied to specific civilizations
- Traits → Modifiers: Traits are implemented through modifier effects
- Icons → Game Elements: Visual representations are linked to game elements
Schema Versioning and Updates
The Civilization VII schema may evolve with game updates and patches. When creating mods:- Always check for the latest schema definitions in your installation
- Be aware that DLCs might extend or modify base schemas
- Structure your mods to be resilient to minor schema changes
- Test after game updates to ensure compatibility
Cross-References
- For implementation guidance, see Creating New Civilizations
- For file organization, see Civilization VII Modding Architecture
- For examples from existing content, see DLC and Community Mod Patterns