Skip to main content
This guide covers how to incorporate custom assets and icons into your Civilization VII mods using the TypeScript Modding Tools.

Overview of Assets in Civilization VII

Assets are the visual elements of your mod, including icons, portraits, textures, and other graphical resources. Properly importing and referencing these assets is crucial for creating polished and professional-looking mods. The TypeScript Modding Tools provide a streamlined workflow for importing and using custom assets.

Importing Assets

The first step in using custom assets is importing them into your mod. This is done using the ImportFileBuilder class:

Common Asset Types

Different game elements require different types of assets. Here’s how to import various common asset types:

Referencing Assets in Game Elements

After importing assets, you need to reference them in your game elements. Here’s how to do that for different elements:

Understanding File Paths

When referencing assets, you need to use the correct file path format:
The path format breaks down as:
  • fs://game/ - Prefix for game assets
  • ${mod.id}/ - Your mod ID (creates a namespace)
  • ${assetName} - The name you specified when importing the asset

Asset Requirements and Best Practices

For the best results, follow these guidelines for your assets:
  1. File Formats: Use PNG for icons and JPEG for larger images
  2. Resolution:
    • Civilization icons: 256x256 pixels
    • Unit icons: 128x128 pixels
    • Leader portraits: 512x768 pixels
    • Building icons: 128x128 pixels
  3. Transparency: Use transparency (alpha channel) for icons that should not be rectangular
  4. Naming Convention: Use descriptive, lowercase names with underscores
  5. Organization: Keep assets in an organized folder structure

Age-Specific Assets

For mods that span multiple ages, you can import age-specific assets:

Importing Other Asset Types

Besides icons, you can import other asset types:

Troubleshooting Asset Issues

If you encounter issues with your assets, check these common problems:
  1. Incorrect File Path: Verify that the path to your asset file is correct
  2. Missing Asset File: Ensure the asset file exists at the specified location
  3. Unsupported Format: Check that you’re using a supported file format
  4. Wrong Action Group: Ensure the asset’s action group matches where it’s used
  5. Naming Conflict: Make sure asset names don’t conflict with existing game assets
  6. File Size Too Large: Overly large assets may cause performance issues

Complete Example: Creating a Mod with Custom Assets

Here’s a complete example of a mod that uses custom assets:

Conclusion

Assets and icons are essential elements that bring your mod to life visually. By following the guidelines in this guide, you can create professional-looking mods with custom assets that enhance the player experience. Remember to keep asset files organized and use consistent naming conventions to make your mod development process smoother.