Game Settings
The game setting is specified in the default_settings.yaml
file under the civrealm folder. To overwrite a setting, you can do either of the following:
- Directly change the value in the
default_settings.yaml
file. Or - Use the
--setting
argument. For example, to set the maximum number of turns to 5 for a quick test, you can use the following command:
The details of the game setting are as follows:
Basic Settings for Game Play
Argument | Default value | Description |
---|---|---|
username | myagent | The user name used to log in the game. Spaces and underscores are not allowed. |
max_turns | 1000 | The maximum number of turns per game. The game will end after the turn number reaches this limit. |
host | localhost | The URL that hosts the game. |
client_port | 6001 | The port to be connected by the client. Used in the single-thread mode. For parallel running, the client port is chosen from available ports. |
multiplayer_game | True | Whether to start a multiplayer game or single-player game. |
hotseat_game | False | Whether to use the hotseat mode in a single-player game. |
wait_for_observer | False | Whether to wait for an observer to join before starting the game. If set to True, the game will not start until a user observes the game through the browser. |
server_timeout | 30 | The duration in seconds before considering the server as timed out. In pytest, we automatically set it to be 5 in conftest.py. |
wait_for_timeout | 10000 | Sometimes we perform an invalid action and cannot receive the response to wait_for_packs. We wait for wait_for_timeout seconds and clear the wait_for_packs to prevent the process from sticking. |
begin_turn_timeout | 30 | Sometimes, the server is stuck for unknown reasons and will not return a begin_turn packet. We wait for begin_turn_timeout seconds before we close the environment. This configuration should be carefully set when playing with human or AI agents because they may take more than 60 seconds for each of their turns. In those cases, the server will send a begin_turn packet only after they finish their turns. |
pytest | False | Whether in pytest mode. In pytest, we automatically set it as True in conftest.py. |
score_window | 10 | The number of episode scores maintained in the ParallelTensorEnv. |
aifill | 4 | The number of AI players to be initialized when a game starts. |
maxplayers | 10 | The maximum number of players allowed to join a game. |
self_play | True | Whether to start multiple clients for self-play. When it is true, the following clients will add an increasing index to their username for login to the same game. Note that when running pytest, we automatically set this as False. By doing so, different tests connecting to the same port will raise an exception and force one test to re-select a random new port. |
minp | 1 | The minimum number of players needed for starting a game. |
allowtake | HAhadOo | Decides whether one can take control/observe a player. Please check the details of this setting in the Freeciv instruction. |
autotoggle | disabled | Whether to allow an AI to control a player when the previous player disconnects. |
endvictory | enabled | Whether to end the game when some players succeed under victory conditions. Options: enabled, disabled. |
victories | SPACERACE|ALLIED | Victory condition options: SPACERACE|ALLIED|CULTURE. If a certain victory condition is not set, the calculation logic for that victory condition will be skipped. |
openchatbox | enabled | Whether to open the chatbox in the web interface. Options: enabled, disabled. |
ruleset | classic | The ruleset to be used. |
runner_type | parallel | The type of runner. |
Settings for parallel running
Argument | Default value | Description |
---|---|---|
batch_size_run | 5 | Number of environments running simultaneously to sample experience. |
epoch_num | 1 | Number of epochs to run. Each epoch runs batch_size_run environments. |
port_start | 6300 | The port used by the first environment; other parallel environments use ports following this port. |
Settings for debug
Argument | Default value | Description |
---|---|---|
record_action_and_observation | False | Records the game state and available actions at every step. Warning: generates many log files if True. Turned off by default. |
take_screenshot | False | Take screenshots during playing. wait_for_observer flag should be set to True if enabling screenshots. You can execute the 'update_javascript_for_clean_screenshot' command first for generating cleaner screenshots. Warning: generates many log files if True. Turned off by default. |
global_view_screenshot | True | Global view screenshot. |
sleep_time_after_turn | 0.0 | The sleep time after each turn. |
headless | False | The headless mode for the browser when take_screenshot is true. |
window_size_x | null | The window size (width) for screenshot. |
window_size_y | null | The window size (height) for screenshot. |
get_webpage_image | null | Get webpage image data by locating elements by ID on the web page. wait_for_observer flag should be set to 'True' if enabling screenshots. Options include, but are not limited to: ['cities_tab', 'tech_tab', 'players_tab', 'civ_tab', 'map_tab']. |
autosave | True | If true, auto save the game at the beginning of every turn. The save will be deleted at the end of that turn unless the program finds issues in that turn. |
interrupt_save | False | If true, will save the game when using KeyboardInterrupt. Note that when using this, autosave should be disabled. Otherwise, the game will be saved at the beginning of every turn and cannot be saved again when using KeyboardInterrupt. |
password | civrealm | Password used to log in to the Freeciv-web account. |
load_game | The name of the saved game to be loaded. | |
randomly_generate_seeds | True | Whether to use randomly generated seeds for running games. If True, the following random seeds (mapseed, gameseed, agentseed) are ignored. |
mapseed | 88 | The seed for generating a map. The same seed leads to the same map. |
gameseed | 1729 | The seed for fixing the behavior of random outputs. |
agentseed | 1729 | The seed for fixing the action sequence when the game/map is fixed. |
tensor_debug | False | Whether to print debug information for tensor env. |
logging_path | null | The path to the directory that stores the log files. Use null for the default path 'civrealm/logs'. |