Binding Related Entities
One of the most powerful features of the TypeScript Modding Tools is the ability to bind related entities together, simplifying the creation of cohesive mod components that work together seamlessly.Understanding Entity Binding
Binding allows you to create relationships between different game elements without manually managing references. For example, when binding a unit to a civilization:- The unit is automatically associated with the civilization
- The civilization automatically gains access to the unit
- Cross-references are maintained correctly in the generated XML
Basic Binding Example
Binding Multiple Entities
You can bind multiple entities in a single operation:Chain Binding
You can create chains of bindings for more complex relationships:Age-Specific Content
Civilization VII’s Age system allows for different versions of game elements across different time periods. The TypeScript Modding Tools provide robust support for creating age-specific content.Creating Age-Specific Elements
The key to creating age-specific content is using the appropriateactionGroupBundle when creating elements:
Managing Age Transitions
To properly manage age transitions, you need to ensure that:- Each age version uses the same type identifier
- Each version is assigned to the correct age using
actionGroupBundle - Changes between ages are balanced and appropriate
Age-Specific Civilizations
You can create civilizations that change their abilities across different ages:Working with Multiple Files
For larger mods, organizing your code across multiple files improves maintainability and allows for better collaboration.Project Structure Example
A typical organized mod project might have this structure:Component Files
Each component can be defined in its own file: src/civilizations/dacia.ts:Main Build File
The main build file imports and combines all components: build.ts:Benefits of Multi-File Organization
This approach offers several advantages:- Modularity: Each component is self-contained and can be developed independently
- Reusability: Components can be easily reused across different mods
- Maintenance: Easier to find and fix issues in smaller files
- Collaboration: Different team members can work on different files without conflicts
- Testing: Individual components can be tested in isolation
Manually Configuring Nodes
For maximum control, you can directly work with XML nodes instead of using the higher-level builders.Working with Low-Level Node API
The low-level node API gives you direct access to the XML structure:When to Use the Low-Level API
Consider using the low-level node API in these situations:- When you need to create structures not supported by the builders
- When you’re implementing experimental features
- When working with custom database tables
- When you need precise control over the XML structure