Skip to content

Civilization Attributes

Complete reference of all attributes available on CivHandle.

Core Attributes

AttributeTypeR/WDescription
idintRCivilization ID (read-only)
namestrRWCivilization name
tech_tree_effect_idintRWEffect applied at game start
team_bonus_effect_idintRWEffect for team bonus
icon_setintRWIcon set used (building/unit graphics)
player_typeintRWPlayer type value

Usage

python
civ = workspace.civ_manager.get(1)

# Read
print(f"ID: {civ.id}")
print(f"Name: {civ.name}")
print(f"Tech Tree Effect: {civ.tech_tree_effect_id}")

# Write
civ.name = "Custom Britons"
civ.tech_tree_effect_id = 500
civ.icon_set = 1

Effect Linking

Tech Tree Effect

The tech_tree_effect_id points to an effect that applies at game start. This is how civilization bonuses work.

python
# Create a civ bonus effect
bonus = workspace.effect_manager.add_new("Britons Bonus")
bonus.add_command.attribute_modifier_add(a=4, b=12, c=-1, d=1)  # +1 range archers

# Link to civ
britons = workspace.civ_manager.get(1)
britons.tech_tree_effect_id = bonus.id

Team Bonus Effect

The team_bonus_effect_id points to an effect that applies to all allies.

python
# Create team bonus effect
team_bonus = workspace.effect_manager.add_new("Britons Team Bonus")
team_bonus.add_command.attribute_modifier_add(a=87, b=12, c=-1, d=2)  # +2 range archery

# Link to civ
britons.team_bonus_effect_id = team_bonus.id

Standard Civilization IDs

IDCivilization
0Gaia
1Britons
2Franks
3Goths
4Teutons
5Japanese
6Chinese
7Byzantines
8Persians
9Saracens
10Turks
11Vikings
12Mongols
13Celts
14Spanish
15Aztecs
16Mayans
17Huns
18Koreans
19Italians
20Indians
21Incas
22Magyars
23Slavs
24Portuguese
25Ethiopians
26Malians
27Berbers
28Khmer
29Malay
30Burmese
31Vietnamese
...(DE civs continue)

Resource Attributes

Resources are accessed via the resource accessor or resources list.

Using ResourceAccessor

python
civ = workspace.civ_manager.get(1)

# Get by index
food = civ.resource[0]
wood = civ.resource[1]
stone = civ.resource[2]
gold = civ.resource[3]

# Set by index
civ.resource[0] = 500  # 500 food
civ.resource[3] = 200  # 200 gold

# Using methods
food = civ.resource.get(0)
civ.resource.set(0, 500)

Common Resource Indices

IndexResource
0Food
1Wood
2Stone
3Gold
4Population Headroom
5Conversion Range
6Current Age
7Relics Captured
11Current Population
32Bonus Population Cap

See Datasets for full resource list.


Direct Resources Access

For bulk operations, access the raw resources list:

python
# Get all resources
all_res = civ.resources  # List[float]

# Iterate
for i, value in enumerate(all_res[:10]):
    print(f"Resource {i}: {value}")

Note: Modifying this list directly affects the civ.


Units Attribute

Each civ has its own units list:

python
# Direct access (not recommended)
units = civ.units

# Better: Use UnitManager with civ_ids
archer = workspace.unit_manager.get(4, civ_ids=[1])

Example: Configure Custom Civ

python
# Clone Britons
custom = workspace.civ_manager.copy(1)
custom.name = "Elite Britons"

# Create custom tech tree effect
bonus = workspace.effect_manager.add_new("Elite Britons Bonus")
bonus.add_command.attribute_modifier_multiply(a=-1, b=0, c=-1, d=1.1)  # +10% HP all
custom.tech_tree_effect_id = bonus.id

# Set starting resources
custom.resource[0] = 300  # Food
custom.resource[1] = 300  # Wood
custom.resource[2] = 200  # Stone
custom.resource[3] = 200  # Gold

print(f"Created custom civ at ID: {custom.id}")

Released under the MIT License.