Skip to content

Observation Details

During the initialization of the environment:

observations, info = env.reset(client_port=fc_args['client_port'])
and every step of the game:

observations, reward, terminated, truncated, info = env.step(action)
The environment provides essential information about the game state, with the most crucial details being observations and info.

Info

The info returned includes details about the current turn of the game and the actions available to the agent at this step. The dictionary "info['available_actions']" encompasses keys such as 'unit', 'city', 'dipl', 'gov', and 'tech', signifying the types of actors the agent can control. Within each actor type, sub-dictionaries exist, where the keys represent possible actions for the respective actor type, and the values are boolean indicators of action availability. Using this information, the agent can make informed decisions by selecting appropriate actions from the available set.

Observations

The observations returned reflects the game state in the current time step. It is a dictionary whose keys correspond to different aspects of the decision-making in the game. The keys of observations useful for training include:

  • map - Overview on the map, i.e., status (known, visible, etc.), terrain types and potential extras.
  • unit - Overview of the status (health, activity, moves left, etc.) of units. Using this key on observation (i.e., observations['unit']) will retrieve a dictionary whose keys are the indexes of units, and the content under each unit index is the status of the corresponding unit.
  • city - Overview of the status of cities (improvements, production, etc.). Using this key on observation (i.e., observations['city']) will retrieve a dictionary whose keys are the indexes of cities, and the content under each city index is the status of the corresponding city.
  • player - Overview of the status of players. Using this key on observation (i.e., observations['player']) will retrieve a dictionary whose keys are the indexes of players, and the content under each player index is the status of the corresponding player. The status of each player conveys information about multiple aspects, including diplomacy, government, and technology.

For additional details regarding the observations, kindly consult the tables provided below. It's important to note that information pertaining to diplomacy, government, and technology within the observations' 'player' data is described separately.

Note

There exist other keys besides the above keys. However, the information under those keys is irrelevant to training, so we do not describe them here.

Observations of Map

Fields Attributes Value domains Descriptions
Basic map Status [0, 2] Size: M * N
Type of terrain [0, 13]
Owner of tiles [0, 255]
Infrastructures 0 or 1 34 layers of size M * N
Output 6 layers of size M * N for 6 output types
Units and city on each tile Unit owner [0, 255] Size: M * N
City owner
Unit distribution 52 layers of size M * N for 52 unit types

Observations of Unit

Fields Attributes Value domains Descriptions
Common unit field X [0, M] X-coordinate
Y [0, N] Y-coordinate
Owner [0, 255] Player the unit belongs to
HP [0, 65535] Health point of the unit
Produce cost Cost needed to produce this type of unit
Veteran 0 or 1 Whether the unit is veteran
Can transport Whether the unit can transport other units
Unit type [0, 51] One of 52 unit types
Obsoleted by The unit type this unit can upgrade to
Attack strength [0, 65535] Affect the attack success rate
Defense strength
Firepower The damage of a successful attack
My unit field Unit ID [0, 32767] The ID of the unit
Moves left Actions the unit can take in this turn
Home city City that supports this unit
Upkeep shield Resources needed to support this unit
Upkeep gold
Upkeep food

Observations of City

General Attributes Value domains Descriptions
Common city field City name text The name of city
X [0, M] X-Coordinate
Y [0, N] Y-Coordinate
Owner [0, 255] Player this city belongs to
Size The size of this city
My city field City ID [0, 32767] The ID of the city
Food stock The food stock of the city
Shield stock The shield stock of the city
Granary size The granary size of the city
Buy cost Cost to buy the undergoing production
Turns to complete Number of turns to finish the current production
Luxury Resource outputs in each turn
Science
Food
Gold
Shield
Trade
Bulbs
City waste The waste of the city
City corruption The corruption of the city
City pollution The pollution of the city
Growth in text Number of turns for city population to grow
State [0, 2] City state: disorder, peace, etc.
Production kind [0, 1] Unit or building
Production value [0, 67] Unit or building type being produced
People angry [0, 127] Number of people of each mood
People unhappy
People content
People happy
Surplus food [-32768, 32767] The surplus of the resource
Surplus gold
Surplus shield
Surplus trade
Can build unit 0 or 1 Binary vectors corresponding to units or buildings
Can build building
Having Buildings
Last completion turn [0,32767] Turn Number when the city completed the last production

Observations of Diplomacy

General Attributes Values Descriptions
Common player field Player ID [0, 255] The ID of player
Team The ID of team
Name text The name of the player
Is alive 0 or 1 Whether the player is alive or not
Score [0, 65535] The score of the player
Turns alive How many turns the player has lived for
Nation [0, 559] The nation of the player
Embassy text text Describe if there are embassies between players
Love Describe players’ attitudes to others
My player field Mood 0 or 1 Peaceful or Combat
Diplomacy state [0, 6] A categorical vector of my diplomacy states with other players: armistice, war, ceasefire, etc.

Observations of Government

General Attributes Values Descriptions
Common government fields Government ID [0, 6] The ID of the government
Government name text The name of the government
My government fields Goal government [0, 6] The goal of revolution
Gold [0, 65535] Gold in treasury
Revolution finishes Number of turns for current revolution to complete
Science [0, 100] Government investment for each aspect. Sum to 100.
Tax
Luxury

Observations of Technology

General Attributes Values Descriptions
Common technology fields Research name text The name of research
Researching [0, 87] The technology being researched
Tech of each type 0 or 1 If each technology has been researched
My technology fields Bulbs researched [0, 65535] Accumulated technology bulbs
Tech upkeep Cost to keep current technologies
Science cost -
Researching cost -
Tech goal [0, 87] The long-term research goal
Techs researched Last researched technology