From c4c1ebbf49cfe9c67d600cbb1f183625f2db0356 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Wed, 25 Dec 2019 01:52:35 -0500 Subject: [PATCH 01/25] insert example files to use for starting the template --- 0.17/files/create-settings.sh | 0 0.17/files/map-gen-settings-template.json | 89 ++++++++++++++++++ 0.17/files/map-settings-template.json | 108 ++++++++++++++++++++++ 0.17/files/server-settings-template.json | 54 +++++++++++ 4 files changed, 251 insertions(+) create mode 100644 0.17/files/create-settings.sh create mode 100644 0.17/files/map-gen-settings-template.json create mode 100644 0.17/files/map-settings-template.json create mode 100644 0.17/files/server-settings-template.json diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh new file mode 100644 index 00000000..e69de29b diff --git a/0.17/files/map-gen-settings-template.json b/0.17/files/map-gen-settings-template.json new file mode 100644 index 00000000..ccdf3eec --- /dev/null +++ b/0.17/files/map-gen-settings-template.json @@ -0,0 +1,89 @@ +{ + "_terrain_segmentation_comment": "Inverse of map scale", + "terrain_segmentation": 1, + "_water_comment": [ + "Multiplier for water 'coverage' - higher increases the water level.", + "Water level = 10 * log2(this value)" + ], + "water": 1, + "_comment_width+height": "Width and height of map, in tiles; 0 means infinite", + "width": 0, + "height": 0, + "_starting_area_comment": "Multiplier for 'biter free zone radius'", + "starting_area": 1, + "peaceful_mode": false, + "autoplace_controls": { + "coal": { + "frequency": 1, + "size": 1, + "richness": 1 + }, + "stone": { + "frequency": 1, + "size": 1, + "richness": 1 + }, + "copper-ore": { + "frequency": 1, + "size": 1, + "richness": 1 + }, + "iron-ore": { + "frequency": 1, + "size": 1, + "richness": 1 + }, + "uranium-ore": { + "frequency": 1, + "size": 1, + "richness": 1 + }, + "crude-oil": { + "frequency": 1, + "size": 1, + "richness": 1 + }, + "trees": { + "frequency": 1, + "size": 1, + "richness": 1 + }, + "enemy-base": { + "frequency": 1, + "size": 1, + "richness": 1 + } + }, + "cliff_settings": { + "_name_comment": "Name of the cliff prototype", + "name": "cliff", + "_cliff_elevation_0_comment": "Elevation of first row of cliffs", + "cliff_elevation_0": 10, + "_cliff_elevation_interval_comment": "Elevation difference between successive rows of cliffs", + "cliff_elevation_interval": 10, + "_richness_comment": "Multiplier for cliff continuity; 0 will result in no cliffs, 10 will make all cliff rows completely solid", + "richness": 1 + }, + "_property_expression_names_comment": [ + "Overrides for property value generators", + "Elevation influences water and cliff placement.", + "Leave it blank to get 'normal' terrain.", + "Use '0_16-elevation' to reproduce terrain from 0.16.", + "Use '0_17-island' to get an island." + ], + "property_expression_names": { + "elevation": "0_17-island", + "control-setting:aux:bias": "0.300000", + "control-setting:aux:frequency:multiplier": "1.333333", + "control-setting:moisture:bias": "0.100000", + "control-setting:moisture:frequency:multiplier": "0.500000" + }, + "starting_points": [ + { + "x": 1000, + "y": 2000 + } + ], + "_seed_comment": "Use null for a random seed, number for a specific seed.", + "seed": null +} \ No newline at end of file diff --git a/0.17/files/map-settings-template.json b/0.17/files/map-settings-template.json new file mode 100644 index 00000000..ff53f3b9 --- /dev/null +++ b/0.17/files/map-settings-template.json @@ -0,0 +1,108 @@ +{ + "difficulty_settings": { + "recipe_difficulty": 0, + "technology_difficulty": 0, + "technology_price_multiplier": 1, + "research_queue_setting": "after-victory" + }, + "pollution": { + "enabled": true, + "_comment_min_to_diffuse_1": "these are values for 60 ticks (1 simulated second)", + "_comment_min_to_diffuse_2": "amount that is diffused to neighboring chunk", + "diffusion_ratio": 0.02, + "min_to_diffuse": 15, + "ageing": 1, + "expected_max_per_chunk": 150, + "min_to_show_per_chunk": 50, + "min_pollution_to_damage_trees": 60, + "pollution_with_max_forest_damage": 150, + "pollution_per_tree_damage": 50, + "pollution_restored_per_tree_damage": 10, + "max_pollution_to_restore_trees": 20, + "enemy_attack_pollution_consumption_modifier": 1 + }, + "enemy_evolution": { + "enabled": true, + "time_factor": 0.000004, + "destroy_factor": 0.002, + "pollution_factor": 0.0000009 + }, + "enemy_expansion": { + "enabled": true, + "min_base_spacing": 3, + "max_expansion_distance": 7, + "friendly_base_influence_radius": 2, + "enemy_building_influence_radius": 2, + "building_coefficient": 0.1, + "other_base_coefficient": 2.0, + "neighbouring_chunk_coefficient": 0.5, + "neighbouring_base_chunk_coefficient": 0.4, + "max_colliding_tiles_coefficient": 0.9, + "settler_group_min_size": 5, + "settler_group_max_size": 20, + "min_expansion_cooldown": 14400, + "max_expansion_cooldown": 216000 + }, + "unit_group": { + "min_group_gathering_time": 3600, + "max_group_gathering_time": 36000, + "max_wait_time_for_late_members": 7200, + "max_group_radius": 30.0, + "min_group_radius": 5.0, + "max_member_speedup_when_behind": 1.4, + "max_member_slowdown_when_ahead": 0.6, + "max_group_slowdown_factor": 0.3, + "max_group_member_fallback_factor": 3, + "member_disown_distance": 10, + "tick_tolerance_when_member_arrives": 60, + "max_gathering_unit_groups": 30, + "max_unit_group_size": 200 + }, + "steering": { + "default": { + "radius": 1.2, + "separation_force": 0.005, + "separation_factor": 1.2, + "force_unit_fuzzy_goto_behavior": false + }, + "moving": { + "radius": 3, + "separation_force": 0.01, + "separation_factor": 3, + "force_unit_fuzzy_goto_behavior": false + } + }, + "path_finder": { + "fwd2bwd_ratio": 5, + "goal_pressure_ratio": 2, + "max_steps_worked_per_tick": 100, + "max_work_done_per_tick": 8000, + "use_path_cache": true, + "short_cache_size": 5, + "long_cache_size": 25, + "short_cache_min_cacheable_distance": 10, + "short_cache_min_algo_steps_to_cache": 50, + "long_cache_min_cacheable_distance": 30, + "cache_max_connect_to_cache_steps_multiplier": 100, + "cache_accept_path_start_distance_ratio": 0.2, + "cache_accept_path_end_distance_ratio": 0.15, + "negative_cache_accept_path_start_distance_ratio": 0.3, + "negative_cache_accept_path_end_distance_ratio": 0.3, + "cache_path_start_distance_rating_multiplier": 10, + "cache_path_end_distance_rating_multiplier": 20, + "stale_enemy_with_same_destination_collision_penalty": 30, + "ignore_moving_enemy_collision_distance": 5, + "enemy_with_different_destination_collision_penalty": 30, + "general_entity_collision_penalty": 10, + "general_entity_subsequent_collision_penalty": 3, + "extended_collision_penalty": 3, + "max_clients_to_accept_any_new_request": 10, + "max_clients_to_accept_short_new_request": 100, + "direct_distance_to_consider_short_request": 100, + "short_request_max_steps": 1000, + "short_request_ratio": 0.5, + "min_steps_to_check_path_find_termination": 2000, + "start_to_goal_cost_multiplier_to_terminate_path_find": 500.0 + }, + "max_failed_behavior_count": 3 +} \ No newline at end of file diff --git a/0.17/files/server-settings-template.json b/0.17/files/server-settings-template.json new file mode 100644 index 00000000..2ff26581 --- /dev/null +++ b/0.17/files/server-settings-template.json @@ -0,0 +1,54 @@ +{ + "name": "Name of the game as it will appear in the game listing", + "description": "Description of the game that will appear in the listing", + "tags": [ + "game", + "tags" + ], + "_comment_max_players": "Maximum number of players allowed, admins can join even a full server. 0 means unlimited.", + "max_players": 0, + "_comment_visibility": [ + "public: Game will be published on the official Factorio matching server", + "lan: Game will be broadcast on LAN" + ], + "visibility": { + "public": true, + "lan": true + }, + "_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public", + "username": "", + "password": "", + "_comment_token": "Authentication token. May be used instead of 'password' above.", + "token": "", + "game_password": "", + "_comment_require_user_verification": "When set to true, the server will only allow clients that have a valid Factorio.com account", + "require_user_verification": true, + "_comment_max_upload_in_kilobytes_per_second": "optional, default value is 0. 0 means unlimited.", + "max_upload_in_kilobytes_per_second": 0, + "_comment_max_upload_slots": "optional, default value is 5. 0 means unlimited.", + "max_upload_slots": 5, + "_comment_minimum_latency_in_ticks": "optional one tick is 16ms in default speed, default value is 0. 0 means no minimum.", + "minimum_latency_in_ticks": 0, + "_comment_ignore_player_limit_for_returning_players": "Players that played on this map already can join even when the max player limit was reached.", + "ignore_player_limit_for_returning_players": false, + "_comment_allow_commands": "possible values are, true, false and admins-only", + "allow_commands": "admins-only", + "_comment_autosave_interval": "Autosave interval in minutes", + "autosave_interval": 10, + "_comment_autosave_slots": "server autosave slots, it is cycled through when the server autosaves.", + "autosave_slots": 5, + "_comment_afk_autokick_interval": "How many minutes until someone is kicked when doing nothing, 0 for never.", + "afk_autokick_interval": 0, + "_comment_auto_pause": "Whether should the server be paused when no players are present.", + "auto_pause": true, + "only_admins_can_pause_the_game": true, + "_comment_autosave_only_on_server": "Whether autosaves should be saved only on server or also on all connected clients. Default is true.", + "autosave_only_on_server": true, + "_comment_non_blocking_saving": "Highly experimental feature, enable only at your own risk of losing your saves. On UNIX systems, server will fork itself to create an autosave. Autosaving on connected Windows clients will be disabled regardless of autosave_only_on_server option.", + "non_blocking_saving": false, + "_comment_segment_sizes": "Long network messages are split into segments that are sent over multiple ticks. Their size depends on the number of peers currently connected. Increasing the segment size will increase upload bandwidth requirement for the server and download bandwidth requirement for clients. This setting only affects server outbound messages. Changing these settings can have a negative impact on connection stability for some clients.", + "minimum_segment_size": 25, + "minimum_segment_size_peer_count": 20, + "maximum_segment_size": 100, + "maximum_segment_size_peer_count": 10 +} \ No newline at end of file From 80eb02fc4d3a4dd444ca08128237599ff8ed2f68 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Wed, 25 Dec 2019 16:27:44 -0500 Subject: [PATCH 02/25] Added UpdateTemplate Function --- 0.17/files/create-settings.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index e69de29b..9dc333c5 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -0,0 +1,34 @@ +#! /bin/bash + + + + +# updateTemplate +# Template String +# Default Value +# New Value +# +updateTemplate () { + echo Template Value $1 + echo Default Value $2 + echo Environment Variable $3 + echo file $TEMPLATE_FILE + + val=${!3} + echo val: $val + + if [ -z "$val" ] + then + echo "\$val is empty" + sed -i 's/$1/$2/g' $TEMPLATE_FILE + echo replacing $1 with default $2 + else + echo "\$val is NOT empty" + echo replacing $1 with $val + sed -i 's/$1/$val/g' $TEMPLATE_FILE + fi + +} +ENVIRONMENT_VAL=123 +TEMPLATE_FILE=map-settings-template.json +updateTemplate template default ENVIRONMENT_VAL2 \ No newline at end of file From c0498cb2d3a1584ebc57707cad601d79ff1b7aae Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Wed, 25 Dec 2019 17:56:39 -0500 Subject: [PATCH 03/25] ServerSettings in bash done. --- 0.17/files/create-settings.sh | 124 +++++++++++++++++++++++++++++----- 1 file changed, 108 insertions(+), 16 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index 9dc333c5..f3f739e1 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -3,32 +3,124 @@ -# updateTemplate # Template String # Default Value -# New Value -# +# ENvironment Variable String updateTemplate () { - echo Template Value $1 - echo Default Value $2 - echo Environment Variable $3 - echo file $TEMPLATE_FILE - + #get the value from the environment varaible and put it in val val=${!3} - echo val: $val + #Test if there was a value that was set. if [ -z "$val" ] then - echo "\$val is empty" + #replace the value in the template file with the default value sed -i 's/$1/$2/g' $TEMPLATE_FILE - echo replacing $1 with default $2 else - echo "\$val is NOT empty" - echo replacing $1 with $val + #Replace the value in the template file with the value in the environment Variable sed -i 's/$1/$val/g' $TEMPLATE_FILE fi } -ENVIRONMENT_VAL=123 -TEMPLATE_FILE=map-settings-template.json -updateTemplate template default ENVIRONMENT_VAL2 \ No newline at end of file + +# Template String +# Default Value +# ENvironment Variable String +updateTemplateBool (){ + #get the value from the environment varaible and put it in val + val=${!3} + #Test if there was a value that was set to true or false + if [[ ${val} =~ ^(true)|(false)$ ]] + then + #replace the value in the template file with the argument + sed -i 's/$1/$val/g' $TEMPLATE_FILE + else + #Replace the value in the template file with the default + sed -i 's/$1/$2/g' $TEMPLATE_FILE + fi +} + +# Template String +# Default Value +# ENvironment Variable String +updateTemplateNumber (){ + #get the value from the environment varaible and put it in val + val=${!3} + #Test if there was a value that was set to true or false + if [[ ${val} =~ ^[0-9]+$ ]] + then + #replace the value in the template file with the argument + sed -i 's/$1/$val/g' $TEMPLATE_FILE + else + #Replace the value in the template file with the default + sed -i 's/$1/$2/g' $TEMPLATE_FILE + fi +} + +# Template String +# ENvironment Variable String +updateTemplateEmptyDefault(){ + #get the value from the environment varaible and put it in val + val=${!2} + + #Test if there was a value that was set. + if [ -z "$val" ] + then + #replace the value in the template file with the default value + sed -i 's/$1//g' $TEMPLATE_FILE + else + #Replace the value in the template file with the value in the environment Variable + sed -i 's/$1/$val/g' $TEMPLATE_FILE + fi +} + +mapSettings () { + echo Creating map generation settings file + TEMPLATE_FILE=map-settings-template.json + +} + + +mapGenSettings () { + echo Creating map settings file + TEMPLATE_FILE=map-gen-settings-template.json +} + + +serverSettings(){ + echo Creating server settings file + TEMPLATE_FILE=server-settings-template.json + updateTemplate templateServerName "my-server" TEMPLATE_SERVER_NAME + updateTemplate templateServerDescription "my-server" TEMPLATE_SERVER_DESCRIPTION + updateTemplate templateServerTage '"kubernetes","docker"' TEMPLATE_SERVER_TAGS + updateTemplateNumber templateServerMaxPlayers 0 TEMPLATE_SERVER_MAX_PLAYERS + updateTemplateBool templateServerPulicVisibility true TEMPLATE_SERVER_PUBLIC_VISIBILITY + updateTemplateBool templateServerLanVisibility true TEMPLATE_SERVER_LAN_VISIBILITY + updateTemplateEmptyDefault templateServerUsername TEMPLATE_SERVER_USERNAME + updateTemplateEmptyDefault templateServerPassword TEMPLATE_SERVER_PASSWORD + updateTemplateEmptyDefault templateServerGameToken TEMPLATE_SERVER_TOKEN + updateTemplate templateServerGamePassword "password" TEMPLATE_SERVER_GAME_PASSWORD + updateTemplateBool templateServerRequireUserVerification true TEMPLATE_SERVER_REQUIRE_USER_VERIFICATION + updateTemplateNumber templateServerMaxUpload 0 TEMPLATE_SERVER_MAX_UPLOAD + updateTemplateNumber templateServerMaxUploadSlots 5 TEMPLATE_SERVER_MAX_UPLOAD_SLOTS + updateTemplateNumber templateServerMinimumLatenctInTicks 0 TEMPLATE_SERVER_MIN_LATENCY_TICKS + updateTemplateBool templateServerIgnorePlayerLimitForReturningPlayers false TEMPLATE_SERVER_IGNORE_LIMIT_FOR_RETURNING + updateTemplate templateServerAllowCommands "admins-only" TEMPLATE_SERVER_ALLOW_COMMANDS + updateTemplateNumber templateServerAutosaveInterval 5 TEMPLATE_SERVER_AUTOSAVE_INTERVAL + updateTemplateNumber templateServerAutosaveSlots 3 TEMPLATE_SERVER_AUTOSAVE_SLOTS + updateTemplateNumber templateServerAFKAutokickInterval 0 TEMPLATE_SERVER_AFK_KICK_INTERVAL + updateTemplateBool templateServerAutoPause true TEMPLATE_SERVER_AUTOPAUSE + updateTemplateBool templateServerOnlyAdminsPause true TEMPLATE_SERVER_ADMIN_ONLY_PAUSE + updateTemplateBool templateServerAutosaveOnlyOnServer true TEMPLATE_SERVER_SERVER_ONLY_AUTOSAVE + updateTemplateBool templateServerNonblockingSaving false TEMPLATE_SERVER_NONBLOCKING_SAVE + updateTemplateNumber templateServerMinSegmentSize 25 TEMPLATE_SERVER_MIN_SEGMENT_SIZE + updateTemplateNumber templateServerMinSegmentSizePeer 20 TEMPLATE_SERVER_MIN_SEGMENT_SIZE_PEER + updateTemplateNumber templateServerMaxSegmentSize 100 TEMPLATE_SERVER_MAX_SEGMENT_SIZE + updateTemplateNumber templateServerMaxSegmentSizePeer 10 TEMPLATE_SERVER_MAX_SEGMENT_SIZE_PEER +} + + +mapSettings +mapGenSettings +serverSettings + + From 7c3971e7c30e20d52d5308495bfd3bdfdf26a803 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Wed, 25 Dec 2019 18:24:49 -0500 Subject: [PATCH 04/25] update quotes to prevent globing, and allow for expansion --- 0.17/files/create-settings.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index f3f739e1..8b72a23c 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -14,10 +14,10 @@ updateTemplate () { if [ -z "$val" ] then #replace the value in the template file with the default value - sed -i 's/$1/$2/g' $TEMPLATE_FILE + sed -i "s/$1/$2/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the value in the environment Variable - sed -i 's/$1/$val/g' $TEMPLATE_FILE + sed -i "s/$1/$val/g" "$TEMPLATE_FILE" fi } @@ -32,10 +32,10 @@ updateTemplateBool (){ if [[ ${val} =~ ^(true)|(false)$ ]] then #replace the value in the template file with the argument - sed -i 's/$1/$val/g' $TEMPLATE_FILE + sed -i "s/$1/$val/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the default - sed -i 's/$1/$2/g' $TEMPLATE_FILE + sed -i "s/$1/$2/g" "$TEMPLATE_FILE" fi } @@ -49,10 +49,10 @@ updateTemplateNumber (){ if [[ ${val} =~ ^[0-9]+$ ]] then #replace the value in the template file with the argument - sed -i 's/$1/$val/g' $TEMPLATE_FILE + sed -i "s/$1/$val/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the default - sed -i 's/$1/$2/g' $TEMPLATE_FILE + sed -i "s/$1/$2/g" "$TEMPLATE_FILE" fi } @@ -66,10 +66,10 @@ updateTemplateEmptyDefault(){ if [ -z "$val" ] then #replace the value in the template file with the default value - sed -i 's/$1//g' $TEMPLATE_FILE + sed -i "s/$1//g" "$TEMPLATE_FILE" else #Replace the value in the template file with the value in the environment Variable - sed -i 's/$1/$val/g' $TEMPLATE_FILE + sed -i "s/$1/$val/g" "$TEMPLATE_FILE" fi } @@ -98,7 +98,7 @@ serverSettings(){ updateTemplateEmptyDefault templateServerUsername TEMPLATE_SERVER_USERNAME updateTemplateEmptyDefault templateServerPassword TEMPLATE_SERVER_PASSWORD updateTemplateEmptyDefault templateServerGameToken TEMPLATE_SERVER_TOKEN - updateTemplate templateServerGamePassword "password" TEMPLATE_SERVER_GAME_PASSWORD + updateTemplateEmptyDefault templateServerGamePassword TEMPLATE_SERVER_GAME_PASSWORD updateTemplateBool templateServerRequireUserVerification true TEMPLATE_SERVER_REQUIRE_USER_VERIFICATION updateTemplateNumber templateServerMaxUpload 0 TEMPLATE_SERVER_MAX_UPLOAD updateTemplateNumber templateServerMaxUploadSlots 5 TEMPLATE_SERVER_MAX_UPLOAD_SLOTS From 01425f3bc64045187b1ccfa381c272d2e068fa8c Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 18:55:08 -0500 Subject: [PATCH 05/25] replace values with template keys --- 0.17/files/create-settings.sh | 128 +++++++++++++---------- 0.17/files/server-settings-template.json | 75 +++++-------- 2 files changed, 100 insertions(+), 103 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index 8b72a23c..1f1d3d6b 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -1,20 +1,21 @@ #! /bin/bash - - - -# Template String -# Default Value -# ENvironment Variable String +# updateTemplate +# +# replaces the template string with either the default, or +# the value in the passed in environment variable. +# +# $1 Template String: The value that is replaced in the template. +# $2 Environment Variable String: the environment variable that is checked for a value. +# $3 Default Value: The default value used if the environment variable is empty or invalid. updateTemplate () { #get the value from the environment varaible and put it in val - val=${!3} - + val=${!2} #Test if there was a value that was set. - if [ -z "$val" ] + if [[ -z "$val" ]] then #replace the value in the template file with the default value - sed -i "s/$1/$2/g" "$TEMPLATE_FILE" + sed -i "s/$1/$3/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the value in the environment Variable sed -i "s/$1/$val/g" "$TEMPLATE_FILE" @@ -22,12 +23,18 @@ updateTemplate () { } -# Template String -# Default Value -# ENvironment Variable String +# updateTemplateBool +# +# replaces the template string with either the default, or +# the value in the passed in environment variable. +# if the value in the variable is not 'true' or 'false', the default is used. +# +# $1 Template String: The value that is replaced in the template. +# $2 Environment Variable String: the environment variable that is checked for a value. +# $3 Default Value: The default value used if the environment variable is empty or invalid. updateTemplateBool (){ #get the value from the environment varaible and put it in val - val=${!3} + val=${!2} #Test if there was a value that was set to true or false if [[ ${val} =~ ^(true)|(false)$ ]] then @@ -35,16 +42,22 @@ updateTemplateBool (){ sed -i "s/$1/$val/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the default - sed -i "s/$1/$2/g" "$TEMPLATE_FILE" + sed -i "s/$1/$3/g" "$TEMPLATE_FILE" fi } -# Template String -# Default Value -# ENvironment Variable String +# updateTemplateNumber +# +# replaces the template string with either the default, or +# the value in the passed in environment variable. +# if the value in the variable is not anumber, the default is used. +# +# $1 Template String: The value that is replaced in the template. +# $2 Environment Variable String: the environment variable that is checked for a value. +# $3 Default Value: The default value used if the environment variable is empty or invalid. updateTemplateNumber (){ #get the value from the environment varaible and put it in val - val=${!3} + val=${!2} #Test if there was a value that was set to true or false if [[ ${val} =~ ^[0-9]+$ ]] then @@ -52,18 +65,23 @@ updateTemplateNumber (){ sed -i "s/$1/$val/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the default - sed -i "s/$1/$2/g" "$TEMPLATE_FILE" + sed -i "s/$1/$3/g" "$TEMPLATE_FILE" fi } -# Template String -# ENvironment Variable String +# updateTemplateEmptyDefault +# +# replaces the template string with either an empty string, or +# the value in the passed in environment variable. +# +# $1 Template String: The value that is replaced in the template. +# $2 Environment Variable String: the environment variable that is checked for a value updateTemplateEmptyDefault(){ #get the value from the environment varaible and put it in val val=${!2} #Test if there was a value that was set. - if [ -z "$val" ] + if [[ -z "$val" ]] then #replace the value in the template file with the default value sed -i "s/$1//g" "$TEMPLATE_FILE" @@ -73,54 +91,54 @@ updateTemplateEmptyDefault(){ fi } +#Using the template, generate a map-settings.json file mapSettings () { echo Creating map generation settings file TEMPLATE_FILE=map-settings-template.json } - +#Using the template, generate a map-gen-settings.json file mapGenSettings () { echo Creating map settings file TEMPLATE_FILE=map-gen-settings-template.json } - +#Using the template, generate a server-settings.json file. serverSettings(){ echo Creating server settings file TEMPLATE_FILE=server-settings-template.json - updateTemplate templateServerName "my-server" TEMPLATE_SERVER_NAME - updateTemplate templateServerDescription "my-server" TEMPLATE_SERVER_DESCRIPTION - updateTemplate templateServerTage '"kubernetes","docker"' TEMPLATE_SERVER_TAGS - updateTemplateNumber templateServerMaxPlayers 0 TEMPLATE_SERVER_MAX_PLAYERS - updateTemplateBool templateServerPulicVisibility true TEMPLATE_SERVER_PUBLIC_VISIBILITY - updateTemplateBool templateServerLanVisibility true TEMPLATE_SERVER_LAN_VISIBILITY - updateTemplateEmptyDefault templateServerUsername TEMPLATE_SERVER_USERNAME - updateTemplateEmptyDefault templateServerPassword TEMPLATE_SERVER_PASSWORD - updateTemplateEmptyDefault templateServerGameToken TEMPLATE_SERVER_TOKEN - updateTemplateEmptyDefault templateServerGamePassword TEMPLATE_SERVER_GAME_PASSWORD - updateTemplateBool templateServerRequireUserVerification true TEMPLATE_SERVER_REQUIRE_USER_VERIFICATION - updateTemplateNumber templateServerMaxUpload 0 TEMPLATE_SERVER_MAX_UPLOAD - updateTemplateNumber templateServerMaxUploadSlots 5 TEMPLATE_SERVER_MAX_UPLOAD_SLOTS - updateTemplateNumber templateServerMinimumLatenctInTicks 0 TEMPLATE_SERVER_MIN_LATENCY_TICKS - updateTemplateBool templateServerIgnorePlayerLimitForReturningPlayers false TEMPLATE_SERVER_IGNORE_LIMIT_FOR_RETURNING - updateTemplate templateServerAllowCommands "admins-only" TEMPLATE_SERVER_ALLOW_COMMANDS - updateTemplateNumber templateServerAutosaveInterval 5 TEMPLATE_SERVER_AUTOSAVE_INTERVAL - updateTemplateNumber templateServerAutosaveSlots 3 TEMPLATE_SERVER_AUTOSAVE_SLOTS - updateTemplateNumber templateServerAFKAutokickInterval 0 TEMPLATE_SERVER_AFK_KICK_INTERVAL - updateTemplateBool templateServerAutoPause true TEMPLATE_SERVER_AUTOPAUSE - updateTemplateBool templateServerOnlyAdminsPause true TEMPLATE_SERVER_ADMIN_ONLY_PAUSE - updateTemplateBool templateServerAutosaveOnlyOnServer true TEMPLATE_SERVER_SERVER_ONLY_AUTOSAVE - updateTemplateBool templateServerNonblockingSaving false TEMPLATE_SERVER_NONBLOCKING_SAVE - updateTemplateNumber templateServerMinSegmentSize 25 TEMPLATE_SERVER_MIN_SEGMENT_SIZE - updateTemplateNumber templateServerMinSegmentSizePeer 20 TEMPLATE_SERVER_MIN_SEGMENT_SIZE_PEER - updateTemplateNumber templateServerMaxSegmentSize 100 TEMPLATE_SERVER_MAX_SEGMENT_SIZE - updateTemplateNumber templateServerMaxSegmentSizePeer 10 TEMPLATE_SERVER_MAX_SEGMENT_SIZE_PEER -} + updateTemplate templateServerName TEMPLATE_SERVER_NAME "my-server" + updateTemplate templateServerDescription TEMPLATE_SERVER_DESCRIPTION "my-server" + updateTemplate templateServerTags TEMPLATE_SERVER_TAGS '"kubernetes","docker"' + updateTemplateNumber templateServerMaxPlayers TEMPLATE_SERVER_MAX_PLAYERS 0 + updateTemplateBool templateServerPulicVisibility TEMPLATE_SERVER_PUBLIC_VISIBILITY true + updateTemplateBool templateServerLanVisibility TEMPLATE_SERVER_LAN_VISIBILITY true + updateTemplateEmptyDefault templateServerUsername TEMPLATE_SERVER_USERNAME + updateTemplateEmptyDefault templateServerPassword TEMPLATE_SERVER_PASSWORD + updateTemplateEmptyDefault templateServerGameToken TEMPLATE_SERVER_TOKEN + updateTemplateEmptyDefault templateServerGamePassword TEMPLATE_SERVER_GAME_PASSWORD + updateTemplateBool templateServerRequireUserVerification TEMPLATE_SERVER_REQUIRE_USER_VERIFICATION true + updateTemplateNumber templateServerMaxUpload TEMPLATE_SERVER_MAX_UPLOAD 0 + updateTemplateNumber templateServerMaxUploadSlots TEMPLATE_SERVER_MAX_UPLOAD_SLOTS 5 + updateTemplateNumber templateServerMinimumLatenctInTicks TEMPLATE_SERVER_MIN_LATENCY_TICKS 0 + updateTemplateBool templateServerIgnoreLimitForReturning TEMPLATE_SERVER_IGNORE_LIMIT_FOR_RETURNING false + updateTemplate templateServerAllowCommands TEMPLATE_SERVER_ALLOW_COMMANDS "admins-only" + updateTemplateNumber templateServerAutosaveInterval TEMPLATE_SERVER_AUTOSAVE_INTERVAL 5 + updateTemplateNumber templateServerAutosaveSlots TEMPLATE_SERVER_AUTOSAVE_SLOTS 3 + updateTemplateNumber templateServerAFKAutokickInterval TEMPLATE_SERVER_AFK_KICK_INTERVAL 0 + updateTemplateBool templateServerAutoPause TEMPLATE_SERVER_AUTOPAUSE true + updateTemplateBool templateServerOnlyAdminsPause TEMPLATE_SERVER_ADMIN_ONLY_PAUSE true + updateTemplateBool templateServerAutosaveOnlyOnServer TEMPLATE_SERVER_SERVER_ONLY_AUTOSAVE true + updateTemplateBool templateServerNonblockingSaving TEMPLATE_SERVER_NONBLOCKING_SAVE false + updateTemplateNumber templateServerMinSegmentSize TEMPLATE_SERVER_MIN_SEGMENT_SIZE 25 + updateTemplateNumber templateServerMinSegmentSizePeer TEMPLATE_SERVER_MIN_SEGMENT_SIZE_PEER 20 + updateTemplateNumber templateServerMaxSegmentSize TEMPLATE_SERVER_MAX_SEGMENT_SIZE 100 + updateTemplateNumber templateServerMaxSegmentSizePeer TEMPLATE_SERVER_MAX_SEGMENT_SIZE_PEER 10 +} +#call the functions to generate the files from the templates. mapSettings mapGenSettings serverSettings - - diff --git a/0.17/files/server-settings-template.json b/0.17/files/server-settings-template.json index 2ff26581..4f3a61a9 100644 --- a/0.17/files/server-settings-template.json +++ b/0.17/files/server-settings-template.json @@ -1,54 +1,33 @@ { - "name": "Name of the game as it will appear in the game listing", - "description": "Description of the game that will appear in the listing", + "name": "templateServerName", + "description": "templateServerDescription", "tags": [ - "game", - "tags" - ], - "_comment_max_players": "Maximum number of players allowed, admins can join even a full server. 0 means unlimited.", - "max_players": 0, - "_comment_visibility": [ - "public: Game will be published on the official Factorio matching server", - "lan: Game will be broadcast on LAN" + templateServerTags ], + "max_players": templateServerMaxPlayers, "visibility": { - "public": true, - "lan": true + "public": templateServerPulicVisibility, + "lan": templateServerLanVisibility }, - "_comment_credentials": "Your factorio.com login credentials. Required for games with visibility public", - "username": "", - "password": "", - "_comment_token": "Authentication token. May be used instead of 'password' above.", - "token": "", - "game_password": "", - "_comment_require_user_verification": "When set to true, the server will only allow clients that have a valid Factorio.com account", - "require_user_verification": true, - "_comment_max_upload_in_kilobytes_per_second": "optional, default value is 0. 0 means unlimited.", - "max_upload_in_kilobytes_per_second": 0, - "_comment_max_upload_slots": "optional, default value is 5. 0 means unlimited.", - "max_upload_slots": 5, - "_comment_minimum_latency_in_ticks": "optional one tick is 16ms in default speed, default value is 0. 0 means no minimum.", - "minimum_latency_in_ticks": 0, - "_comment_ignore_player_limit_for_returning_players": "Players that played on this map already can join even when the max player limit was reached.", - "ignore_player_limit_for_returning_players": false, - "_comment_allow_commands": "possible values are, true, false and admins-only", - "allow_commands": "admins-only", - "_comment_autosave_interval": "Autosave interval in minutes", - "autosave_interval": 10, - "_comment_autosave_slots": "server autosave slots, it is cycled through when the server autosaves.", - "autosave_slots": 5, - "_comment_afk_autokick_interval": "How many minutes until someone is kicked when doing nothing, 0 for never.", - "afk_autokick_interval": 0, - "_comment_auto_pause": "Whether should the server be paused when no players are present.", - "auto_pause": true, - "only_admins_can_pause_the_game": true, - "_comment_autosave_only_on_server": "Whether autosaves should be saved only on server or also on all connected clients. Default is true.", - "autosave_only_on_server": true, - "_comment_non_blocking_saving": "Highly experimental feature, enable only at your own risk of losing your saves. On UNIX systems, server will fork itself to create an autosave. Autosaving on connected Windows clients will be disabled regardless of autosave_only_on_server option.", - "non_blocking_saving": false, - "_comment_segment_sizes": "Long network messages are split into segments that are sent over multiple ticks. Their size depends on the number of peers currently connected. Increasing the segment size will increase upload bandwidth requirement for the server and download bandwidth requirement for clients. This setting only affects server outbound messages. Changing these settings can have a negative impact on connection stability for some clients.", - "minimum_segment_size": 25, - "minimum_segment_size_peer_count": 20, - "maximum_segment_size": 100, - "maximum_segment_size_peer_count": 10 + "username": "templateServerUsername", + "password": "templateServerPassword", + "token": "templateServerGameToken", + "game_password": "templateServerGamePassword", + "require_user_verification": templateServerRequireUserVerification, + "max_upload_in_kilobytes_per_second": templateServerMaxUpload, + "max_upload_slots": templateServerMaxUploadSlots, + "minimum_latency_in_ticks": templateServerMinimumLatenctInTicks, + "ignore_player_limit_for_returning_players": templateServerIgnoreLimitForReturning, + "allow_commands": "templateServerAllowCommands", + "autosave_interval": templateServerAutosaveInterval, + "autosave_slots": templateServerAutosaveSlots, + "afk_autokick_interval": templateServerAFKAutokickInterval, + "auto_pause": templateServerAutoPause, + "only_admins_can_pause_the_game": templateServerOnlyAdminsPause, + "autosave_only_on_server": templateServerAutosaveOnlyOnServer, + "non_blocking_saving": templateServerNonblockingSaving, + "minimum_segment_size": templateServerMinSegmentSize, + "minimum_segment_size_peer_count": templateServerMinSegmentSizePeer, + "maximum_segment_size": templateServerMaxSegmentSize, + "maximum_segment_size_peer_count": templateServerMaxSegmentSizePeer } \ No newline at end of file From 69951630b436adcdfa27d37099b8b34d3e8fd77b Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 18:57:30 -0500 Subject: [PATCH 06/25] Change template keys with substrings --- 0.17/files/create-settings.sh | 6 +++--- 0.17/files/server-settings-template.json | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index 1f1d3d6b..49095e91 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -120,7 +120,7 @@ serverSettings(){ updateTemplateEmptyDefault templateServerGameToken TEMPLATE_SERVER_TOKEN updateTemplateEmptyDefault templateServerGamePassword TEMPLATE_SERVER_GAME_PASSWORD updateTemplateBool templateServerRequireUserVerification TEMPLATE_SERVER_REQUIRE_USER_VERIFICATION true - updateTemplateNumber templateServerMaxUpload TEMPLATE_SERVER_MAX_UPLOAD 0 + updateTemplateNumber templateServerMaxUploadCount TEMPLATE_SERVER_MAX_UPLOAD 0 updateTemplateNumber templateServerMaxUploadSlots TEMPLATE_SERVER_MAX_UPLOAD_SLOTS 5 updateTemplateNumber templateServerMinimumLatenctInTicks TEMPLATE_SERVER_MIN_LATENCY_TICKS 0 updateTemplateBool templateServerIgnoreLimitForReturning TEMPLATE_SERVER_IGNORE_LIMIT_FOR_RETURNING false @@ -132,9 +132,9 @@ serverSettings(){ updateTemplateBool templateServerOnlyAdminsPause TEMPLATE_SERVER_ADMIN_ONLY_PAUSE true updateTemplateBool templateServerAutosaveOnlyOnServer TEMPLATE_SERVER_SERVER_ONLY_AUTOSAVE true updateTemplateBool templateServerNonblockingSaving TEMPLATE_SERVER_NONBLOCKING_SAVE false - updateTemplateNumber templateServerMinSegmentSize TEMPLATE_SERVER_MIN_SEGMENT_SIZE 25 + updateTemplateNumber templateServerMinSegmentSizeCount TEMPLATE_SERVER_MIN_SEGMENT_SIZE 25 updateTemplateNumber templateServerMinSegmentSizePeer TEMPLATE_SERVER_MIN_SEGMENT_SIZE_PEER 20 - updateTemplateNumber templateServerMaxSegmentSize TEMPLATE_SERVER_MAX_SEGMENT_SIZE 100 + updateTemplateNumber templateServerMaxSegmentSizeCount TEMPLATE_SERVER_MAX_SEGMENT_SIZE 100 updateTemplateNumber templateServerMaxSegmentSizePeer TEMPLATE_SERVER_MAX_SEGMENT_SIZE_PEER 10 } diff --git a/0.17/files/server-settings-template.json b/0.17/files/server-settings-template.json index 4f3a61a9..7f120a9e 100644 --- a/0.17/files/server-settings-template.json +++ b/0.17/files/server-settings-template.json @@ -14,7 +14,7 @@ "token": "templateServerGameToken", "game_password": "templateServerGamePassword", "require_user_verification": templateServerRequireUserVerification, - "max_upload_in_kilobytes_per_second": templateServerMaxUpload, + "max_upload_in_kilobytes_per_second": templateServerMaxUploadCount, "max_upload_slots": templateServerMaxUploadSlots, "minimum_latency_in_ticks": templateServerMinimumLatenctInTicks, "ignore_player_limit_for_returning_players": templateServerIgnoreLimitForReturning, @@ -26,8 +26,8 @@ "only_admins_can_pause_the_game": templateServerOnlyAdminsPause, "autosave_only_on_server": templateServerAutosaveOnlyOnServer, "non_blocking_saving": templateServerNonblockingSaving, - "minimum_segment_size": templateServerMinSegmentSize, + "minimum_segment_size": templateServerMinSegmentSizeCount, "minimum_segment_size_peer_count": templateServerMinSegmentSizePeer, - "maximum_segment_size": templateServerMaxSegmentSize, + "maximum_segment_size": templateServerMaxSegmentSizeCount, "maximum_segment_size_peer_count": templateServerMaxSegmentSizePeer } \ No newline at end of file From 8393065c7f3ce1b3357e04c144a3aa9e67c1feca Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 19:00:30 -0500 Subject: [PATCH 07/25] add newline to end of server settings template --- 0.17/files/server-settings-template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0.17/files/server-settings-template.json b/0.17/files/server-settings-template.json index 7f120a9e..458d5587 100644 --- a/0.17/files/server-settings-template.json +++ b/0.17/files/server-settings-template.json @@ -30,4 +30,4 @@ "minimum_segment_size_peer_count": templateServerMinSegmentSizePeer, "maximum_segment_size": templateServerMaxSegmentSizeCount, "maximum_segment_size_peer_count": templateServerMaxSegmentSizePeer -} \ No newline at end of file +} From bd44ae649bd58b92119abd93f59e64291ce2221a Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 19:57:03 -0500 Subject: [PATCH 08/25] Complete Shell Map Gen Settings --- 0.17/files/create-settings.sh | 69 ++++++++++++++++++++--- 0.17/files/map-gen-settings-template.json | 19 ------- 2 files changed, 62 insertions(+), 26 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index 49095e91..a95e2764 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -59,7 +59,7 @@ updateTemplateNumber (){ #get the value from the environment varaible and put it in val val=${!2} #Test if there was a value that was set to true or false - if [[ ${val} =~ ^[0-9]+$ ]] + if [[ ${val} =~ ^[0-9]+\.?[0-9]*$ ]] then #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" @@ -69,14 +69,14 @@ updateTemplateNumber (){ fi } -# updateTemplateEmptyDefault +# updateTemplateEmpty # # replaces the template string with either an empty string, or # the value in the passed in environment variable. # # $1 Template String: The value that is replaced in the template. # $2 Environment Variable String: the environment variable that is checked for a value -updateTemplateEmptyDefault(){ +updateTemplateEmpty(){ #get the value from the environment varaible and put it in val val=${!2} @@ -102,6 +102,61 @@ mapSettings () { mapGenSettings () { echo Creating map settings file TEMPLATE_FILE=map-gen-settings-template.json + + updateTemplateNumber templateGenTerrainSegmentation TEMPLATE_GEN_TERRAIN_SEGMENTATION 1 + updateTemplateNumber templateGenTerrainWater TEMPLATE_GEN_TERRAIN_WATER 1 + updateTemplateNumber templateGenMapWidth TEMPLATE_GEN_MAP_WIDTH 0 + updateTemplateNumber templateGenMapHeight TEMPLATE_GEN_MAP_HEIGHT 0 + updateTemplateNumber templateGenMapStartingArea TEMPLATE_GEN_MAP_STARTING_AREA 1 + updateTemplateBool templateGenPeacefullMode TEMPLATE_GEN_PEACEFULL_MODE false + #coal + updateTemplateNumber templateGenCoalRichness TEMPLATE_GEN_COAL_RICHNESS 1 + updateTemplateNumber templateGenCoalSize TEMPLATE_GEN_COAL_SIZE 1 + updateTemplateNumber templateGenCoalFrequency TEMPLATE_GEN_COAL_FREQUENCY 1 + #stone + updateTemplateNumber templateGenstoneRichness TEMPLATE_GEN_STONE_RICHNESS 1 + updateTemplateNumber templateGenstoneSize TEMPLATE_GEN_STONE_SIZE 1 + updateTemplateNumber templateGenstoneFrequency TEMPLATE_GEN_STONE_FREQUENCY 1 + #Copper + updateTemplateNumber templateGenCopperRichness TEMPLATE_GEN_COPPER_RICHNESS 1 + updateTemplateNumber templateGenCopperSize TEMPLATE_GEN_COPPER_SIZE 1 + updateTemplateNumber templateGenCopperFrequency TEMPLATE_GEN_COPPER_FREQUENCY 1 + #Iron + updateTemplateNumber templateGenIronRichness TEMPLATE_GEN_IRON_RICHNESS 1 + updateTemplateNumber templateGenIronSize TEMPLATE_GEN_IRON_SIZE 1 + updateTemplateNumber templateGenIronFrequency TEMPLATE_GEN_IRON_FREQUENCY 1 + #Uranium + updateTemplateNumber templateGenUraniumRichness TEMPLATE_GEN_URANIUM_RICHNESS 1 + updateTemplateNumber templateGenUraniumSize TEMPLATE_GEN_URANIUM_SIZE 1 + updateTemplateNumber templateGenUraniumFrequency TEMPLATE_GEN_URANIUM_FREQUENCY 1 + #Crude + updateTemplateNumber templateGenCrudeRichness TEMPLATE_GEN_CRUDE_RICHNESS 1 + updateTemplateNumber templateGenCrudeSize TEMPLATE_GEN_CRUDE_SIZE 1 + updateTemplateNumber templateGenCrudeFrequency TEMPLATE_GEN_CRUDE_FREQUENCY 1 + #Trees + updateTemplateNumber templateGenTreesRichness TEMPLATE_GEN_TREES_RICHNESS 1 + updateTemplateNumber templateGenTreesSize TEMPLATE_GEN_TREES_SIZE 1 + updateTemplateNumber templateGenTreesFrequency TEMPLATE_GEN_TREES_FREQUENCY 1 + #Biters + updateTemplateNumber templateGenBiterRichness TEMPLATE_GEN_BITER_RICHNESS 1 + updateTemplateNumber templateGenBiterSize TEMPLATE_GEN_BITER_SIZE 1 + updateTemplateNumber templateGenBiterFrequency TEMPLATE_GEN_BITER_FREQUENCY 1 + #cliffs + updateTemplate templateGenCliffName TEMPLATE_GEN_CLIFF_NAME cliff + updateTemplateNumber templateGenCliffElevationZero TEMPLATE_GEN_CLIFF_ELEVATION_ZERO 10 + updateTemplateNumber templateGenCliffElevationInterval TEMPLATE_GEN_CLIFF_ELEVATION_INTERVAL 10 + updateTemplateNumber templateGenCliffRichness TEMPLATE_GEN_CLIFF_RICHNESS 1 + #expression Names + updateTemplate templateGenExpressionElevation TEMPLATE_GEN_EXPRESSION_ELEVATION 0_17-island + updateTemplateNumber templateGenAuxBias TEMPLATE_GEN_AUX_BIAS "0.300000" + updateTemplateNumber templateGenAuxMultiplier TEMPLATE_GEN_AUX_MULTIPLIER "1.333333" + updateTemplateNumber templateGenMoistureBias TEMPLATE_GEN_MOISTURE_BIAS "0.100000" + updateTemplateNumber templateGenMoistureMultiplier TEMPLATE_GEN_MOISTURE_MULTIPLIER "0.500000" + #Starting Point + updateTemplateNumber templateGenStartingPointX TEMPLATE_GEN_STARTING_POINT_X 1000 + updateTemplateNumber templateGenStartingPointY TEMPLATE_GEN_STARTING_POINT_Y 2000 + #seed + updateTemplateNumber templateGenMapSeed TEMPLATE_GEN_MAP_SEED null } #Using the template, generate a server-settings.json file. @@ -115,10 +170,10 @@ serverSettings(){ updateTemplateNumber templateServerMaxPlayers TEMPLATE_SERVER_MAX_PLAYERS 0 updateTemplateBool templateServerPulicVisibility TEMPLATE_SERVER_PUBLIC_VISIBILITY true updateTemplateBool templateServerLanVisibility TEMPLATE_SERVER_LAN_VISIBILITY true - updateTemplateEmptyDefault templateServerUsername TEMPLATE_SERVER_USERNAME - updateTemplateEmptyDefault templateServerPassword TEMPLATE_SERVER_PASSWORD - updateTemplateEmptyDefault templateServerGameToken TEMPLATE_SERVER_TOKEN - updateTemplateEmptyDefault templateServerGamePassword TEMPLATE_SERVER_GAME_PASSWORD + updateTemplateEmpty templateServerUsername TEMPLATE_SERVER_USERNAME + updateTemplateEmpty templateServerPassword TEMPLATE_SERVER_PASSWORD + updateTemplateEmpty templateServerGameToken TEMPLATE_SERVER_TOKEN + updateTemplateEmpty templateServerGamePassword TEMPLATE_SERVER_GAME_PASSWORD updateTemplateBool templateServerRequireUserVerification TEMPLATE_SERVER_REQUIRE_USER_VERIFICATION true updateTemplateNumber templateServerMaxUploadCount TEMPLATE_SERVER_MAX_UPLOAD 0 updateTemplateNumber templateServerMaxUploadSlots TEMPLATE_SERVER_MAX_UPLOAD_SLOTS 5 diff --git a/0.17/files/map-gen-settings-template.json b/0.17/files/map-gen-settings-template.json index ccdf3eec..1da8b58f 100644 --- a/0.17/files/map-gen-settings-template.json +++ b/0.17/files/map-gen-settings-template.json @@ -1,15 +1,8 @@ { - "_terrain_segmentation_comment": "Inverse of map scale", "terrain_segmentation": 1, - "_water_comment": [ - "Multiplier for water 'coverage' - higher increases the water level.", - "Water level = 10 * log2(this value)" - ], "water": 1, - "_comment_width+height": "Width and height of map, in tiles; 0 means infinite", "width": 0, "height": 0, - "_starting_area_comment": "Multiplier for 'biter free zone radius'", "starting_area": 1, "peaceful_mode": false, "autoplace_controls": { @@ -55,22 +48,11 @@ } }, "cliff_settings": { - "_name_comment": "Name of the cliff prototype", "name": "cliff", - "_cliff_elevation_0_comment": "Elevation of first row of cliffs", "cliff_elevation_0": 10, - "_cliff_elevation_interval_comment": "Elevation difference between successive rows of cliffs", "cliff_elevation_interval": 10, - "_richness_comment": "Multiplier for cliff continuity; 0 will result in no cliffs, 10 will make all cliff rows completely solid", "richness": 1 }, - "_property_expression_names_comment": [ - "Overrides for property value generators", - "Elevation influences water and cliff placement.", - "Leave it blank to get 'normal' terrain.", - "Use '0_16-elevation' to reproduce terrain from 0.16.", - "Use '0_17-island' to get an island." - ], "property_expression_names": { "elevation": "0_17-island", "control-setting:aux:bias": "0.300000", @@ -84,6 +66,5 @@ "y": 2000 } ], - "_seed_comment": "Use null for a random seed, number for a specific seed.", "seed": null } \ No newline at end of file From bddbd4afd6a785e98b1211433d7695969c8be019 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 20:03:18 -0500 Subject: [PATCH 09/25] add quotes to quoted areas. --- 0.17/files/create-settings.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index a95e2764..7df5b02d 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -142,12 +142,12 @@ mapGenSettings () { updateTemplateNumber templateGenBiterSize TEMPLATE_GEN_BITER_SIZE 1 updateTemplateNumber templateGenBiterFrequency TEMPLATE_GEN_BITER_FREQUENCY 1 #cliffs - updateTemplate templateGenCliffName TEMPLATE_GEN_CLIFF_NAME cliff + updateTemplate templateGenCliffName TEMPLATE_GEN_CLIFF_NAME "cliff" updateTemplateNumber templateGenCliffElevationZero TEMPLATE_GEN_CLIFF_ELEVATION_ZERO 10 updateTemplateNumber templateGenCliffElevationInterval TEMPLATE_GEN_CLIFF_ELEVATION_INTERVAL 10 updateTemplateNumber templateGenCliffRichness TEMPLATE_GEN_CLIFF_RICHNESS 1 #expression Names - updateTemplate templateGenExpressionElevation TEMPLATE_GEN_EXPRESSION_ELEVATION 0_17-island + updateTemplate templateGenExpressionElevation TEMPLATE_GEN_EXPRESSION_ELEVATION "0_17-island" updateTemplateNumber templateGenAuxBias TEMPLATE_GEN_AUX_BIAS "0.300000" updateTemplateNumber templateGenAuxMultiplier TEMPLATE_GEN_AUX_MULTIPLIER "1.333333" updateTemplateNumber templateGenMoistureBias TEMPLATE_GEN_MOISTURE_BIAS "0.100000" From b39b141bce6c90125a2164a4c515df9b161f0e21 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 20:10:14 -0500 Subject: [PATCH 10/25] replace map gen template values with sed keys --- 0.17/files/create-settings.sh | 6 +- 0.17/files/map-gen-settings-template.json | 84 +++++++++++------------ 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index 7df5b02d..20df6067 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -114,9 +114,9 @@ mapGenSettings () { updateTemplateNumber templateGenCoalSize TEMPLATE_GEN_COAL_SIZE 1 updateTemplateNumber templateGenCoalFrequency TEMPLATE_GEN_COAL_FREQUENCY 1 #stone - updateTemplateNumber templateGenstoneRichness TEMPLATE_GEN_STONE_RICHNESS 1 - updateTemplateNumber templateGenstoneSize TEMPLATE_GEN_STONE_SIZE 1 - updateTemplateNumber templateGenstoneFrequency TEMPLATE_GEN_STONE_FREQUENCY 1 + updateTemplateNumber templateGenStoneRichness TEMPLATE_GEN_STONE_RICHNESS 1 + updateTemplateNumber templateGenStoneSize TEMPLATE_GEN_STONE_SIZE 1 + updateTemplateNumber templateGenStoneFrequency TEMPLATE_GEN_STONE_FREQUENCY 1 #Copper updateTemplateNumber templateGenCopperRichness TEMPLATE_GEN_COPPER_RICHNESS 1 updateTemplateNumber templateGenCopperSize TEMPLATE_GEN_COPPER_SIZE 1 diff --git a/0.17/files/map-gen-settings-template.json b/0.17/files/map-gen-settings-template.json index 1da8b58f..61ab992d 100644 --- a/0.17/files/map-gen-settings-template.json +++ b/0.17/files/map-gen-settings-template.json @@ -1,70 +1,70 @@ { - "terrain_segmentation": 1, - "water": 1, - "width": 0, - "height": 0, - "starting_area": 1, - "peaceful_mode": false, + "terrain_segmentation": templateGenTerrainSegmentation, + "water": templateGenTerrainWater, + "width": templateGenMapWidth, + "height": templateGenMapHeight, + "starting_area": templateGenMapStartingArea, + "peaceful_mode": templateGenPeacefullMode, "autoplace_controls": { "coal": { - "frequency": 1, - "size": 1, - "richness": 1 + "frequency": templateGenCoalFrequency, + "size": templateGenCoalSize, + "richness": templateGenCoalRichness }, "stone": { - "frequency": 1, - "size": 1, - "richness": 1 + "frequency": templateGenStoneFrequency, + "size": templateGenStoneSize, + "richness": templateGenStoneRichness }, "copper-ore": { - "frequency": 1, - "size": 1, - "richness": 1 + "frequency": templateGenCopperFrequency, + "size": templateGenCopperSize, + "richness": templateGenCopperRichness }, "iron-ore": { - "frequency": 1, - "size": 1, - "richness": 1 + "frequency": templateGenIronFrequency, + "size": templateGenIronSize, + "richness": templateGenIronRichness }, "uranium-ore": { - "frequency": 1, - "size": 1, - "richness": 1 + "frequency": templateGenUraniumFrequency, + "size": templateGenUraniumSize, + "richness": templateGenUraniumRichness }, "crude-oil": { - "frequency": 1, - "size": 1, - "richness": 1 + "frequency": templateGenCrudeFrequency, + "size": templateGenCrudeSize, + "richness": templateGenCrudeRichness }, "trees": { - "frequency": 1, - "size": 1, - "richness": 1 + "frequency": templateGenTreesFrequency, + "size": templateGenTreesSize, + "richness": templateGenTreesRichness }, "enemy-base": { - "frequency": 1, - "size": 1, - "richness": 1 + "frequency": templateGenBiterFrequency, + "size": templateGenBiterSize, + "richness": templateGenBiterRichness } }, "cliff_settings": { - "name": "cliff", - "cliff_elevation_0": 10, - "cliff_elevation_interval": 10, - "richness": 1 + "name": "templateGenCliffName", + "cliff_elevation_0": templateGenCliffElevationZero, + "cliff_elevation_interval": templateGenCliffElevationInterval, + "richness": templateGenCliffRichness }, "property_expression_names": { - "elevation": "0_17-island", - "control-setting:aux:bias": "0.300000", - "control-setting:aux:frequency:multiplier": "1.333333", - "control-setting:moisture:bias": "0.100000", - "control-setting:moisture:frequency:multiplier": "0.500000" + "elevation": "templateGenExpressionElevation", + "control-setting:aux:bias": "templateGenAuxBias", + "control-setting:aux:frequency:multiplier": "templateGenAuxMultiplier", + "control-setting:moisture:bias": "templateGenMoistureBias", + "control-setting:moisture:frequency:multiplier": "templateGenMoistureMultiplier" }, "starting_points": [ { - "x": 1000, - "y": 2000 + "x": templateGenStartingPointX, + "y": templateGenStartingPointY } ], - "seed": null + "seed": templateGenMapSeed } \ No newline at end of file From 319683b32f1225f027c5dadd896e7889212139d7 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 20:11:17 -0500 Subject: [PATCH 11/25] add extra space --- 0.17/files/map-gen-settings-template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0.17/files/map-gen-settings-template.json b/0.17/files/map-gen-settings-template.json index 61ab992d..bbcd297b 100644 --- a/0.17/files/map-gen-settings-template.json +++ b/0.17/files/map-gen-settings-template.json @@ -67,4 +67,4 @@ } ], "seed": templateGenMapSeed -} \ No newline at end of file +} From c5cb7b14c14af594aef54afa21d2078aa9eae538 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 20:47:20 -0500 Subject: [PATCH 12/25] Completed script for map settings --- 0.17/files/create-settings.sh | 38 +++++++++++++++++++++++++++ 0.17/files/map-settings-template.json | 2 -- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index 20df6067..b3f1424e 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -96,6 +96,44 @@ mapSettings () { echo Creating map generation settings file TEMPLATE_FILE=map-settings-template.json + updateTemplateNumber templateMapDifficultyRecipe TEMPLATE_MAP_DIFFICULTY_RECIPE 0 + updateTemplateNumber templateMapDifficultyTechnology TEMPLATE_MAP_DIFFICULTY_TECHNOLOGY 0 + updateTemplateNumber templateMapDifficultyTechPrice TEMPLATE_MAP_DIFFICULTY_TECH_PRICE 1 + updateTemplate templateMapDifficultyResearchQueue TEMPLATE_MAP_DIFFICULTY_RESEARCH_QUEUE "after-victory" + updateTemplateBool templateMapPollutionEnabled TEMPLATE_MAP_POLLUTION_ENABLED true + updateTemplateNumber templateMapPollutionDiffusionRatio TEMPLATE_MAP_POLLUTION_DIFFUSION_RATIO 0.02 + updateTemplateNumber templateMapPollutionMinToDefuse TEMPLATE_MAP_POLLUTION_MIN_TO_DEFUSE 15 + updateTemplateNumber templateMapPollutionAgeing TEMPLATE_MAP_POLLUTION_AGEING 1 + updateTemplateNumber templateMapPollutionExpectedMaxPerChunk TEMPLATE_MAP_POLLUTION_EXPECTED_MAX_PER_CHUNK 150 + updateTemplateNumber templateMapPollutionMinToShowPerChunk TEMPLATE_MAP_POLLUTION_MIN_TO_SHOW_PER_CHUNK 50 + updateTemplateNumber templateMapPollutionMinToDamageTrees TEMPLATE_MAP_POLLUTION_MIN_TO_DAMAGE_TREES 60 + updateTemplateNumber templateMapPollutionMaxForrestDamage TEMPLATE_MAP_POLLUTION_MAX_FORREST_DAMMAGE 150 + updateTemplateNumber templateMapPollutionPerTreeDamage TEMPLATE_MAP_POLLUTION_PER_TREE_DAMAGE 50 + updateTemplateNumber templateMapPollutionRestoredPerTreeDamage TEMPLATE_MAP_POLLUTION_RESTORED_PER_TREE_DAMAGE 10 + updateTemplateNumber templateMapPollutionMaxToRestoreTrees TEMPLATE_MAP_POLLUTION_MAX_TO_RESTORE_TREES 20 + updateTemplateNumber templateMapPollutionBiterAttackModifier TEMPLATE_MAP_POLLUTION_BITER_ATTACK_MODIFIER 1 + updateTemplateBool templateMapEvolutionEnabled TEMPLATE_MAP_EVOLUTION_ENABLED true + updateTemplateNumber templateMapEvolutionTimeFactor TEMPLATE_MAP_EVOLUTION_TIME_FACTOR 0.000004 + updateTemplateNumber templateMapEvolutionDestroyFactor TEMPLATE_MAP_EVOLUTION_DESTROY_FACTOR 0.002 + updateTemplateNumber templateMapEvolutionPolutionFactor TEMPLATE_MAP_EVOLUTION_POLUTION_FACTOR 0.0000009 + updateTemplateBool templateMapExpansionEnabled TEMPLATE_MAP_EXPANSION_ENABLED true + updateTemplateNumber templateMapExpansionMinBaseSpacing TEMPLATE_MAP_EXPANSION_MIN_BASE_SPACING 3 + updateTemplateNumber templateMapExpansionMaxExpansionDistance TEMPLATE_MAP_EXPANSION_MAX_EXPANSION_DISTANCE 7 + updateTemplateNumber templateMapExpansionFriendlyBaseRadius TEMPLATE_MAP_EXPANSION_FRIENDLY_BASE_RADIUS 2 + updateTemplateNumber templateMapExpansionBiterBaseRadius TEMPLATE_MAP_EXPANSION_BITER_BASE_RADIUS 2 + updateTemplateNumber templateMapExpansionBuildingCff TEMPLATE_MAP_EXPANSION_BUILDING_CFF 0.1 + updateTemplateNumber templateMapExpansionOtherBaseCff TEMPLATE_MAP_EXPANSION_OTHER_BASE_CFF 2.0 + updateTemplateNumber templateMapExpansionNeighbourChunkCff TEMPLATE_MAP_EXPANSION_NEIGHBOUR_CHUNK_CFF 0.5 + updateTemplateNumber templateMapExpansionNeighbourBaseChunkCff TEMPLATE_MAP_EXPANSION_NEIGHBOUR_BASE_CHUNK_CFF 0.4 + updateTemplateNumber templateMapExpansionMaxCollidingTilesCff TEMPLATE_MAP_EXPANSION_MAX_COLLIDING_TILES_CFF 0.9 + updateTemplateNumber templateMapExpansionSettlerGroupMin TEMPLATE_MAP_EXPANSION_SETTLER_GROUP_MIN 5 + updateTemplateNumber templateMapExpansionSettlerGroupMax TEMPLATE_MAP_EXPANSION_SETTLER_GROUP_MAX 20 + updateTemplateNumber templateMapExpansionMinCooldown TEMPLATE_MAP_EXPANSION_MIN_COOLDOWN 14400 + updateTemplateNumber templateMapExpansionMaxCooldown TEMPLATE_MAP_EXPANSION_MAX_COOLDOWN 216000 + + #unit_group, Steering, Path_finder, and max_failed_behavior_count settings not included at this time + #as they are likely very optimized by the developers; + } #Using the template, generate a map-gen-settings.json file diff --git a/0.17/files/map-settings-template.json b/0.17/files/map-settings-template.json index ff53f3b9..89847845 100644 --- a/0.17/files/map-settings-template.json +++ b/0.17/files/map-settings-template.json @@ -7,8 +7,6 @@ }, "pollution": { "enabled": true, - "_comment_min_to_diffuse_1": "these are values for 60 ticks (1 simulated second)", - "_comment_min_to_diffuse_2": "amount that is diffused to neighboring chunk", "diffusion_ratio": 0.02, "min_to_diffuse": 15, "ageing": 1, From 26bc0374b7f5538894c086e2d6cc996f19e24713 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 20:51:17 -0500 Subject: [PATCH 13/25] update template --- 0.17/files/create-settings.sh | 4 +- 0.17/files/map-settings-template.json | 68 +++++++++++++-------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index b3f1424e..08666344 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -107,7 +107,7 @@ mapSettings () { updateTemplateNumber templateMapPollutionExpectedMaxPerChunk TEMPLATE_MAP_POLLUTION_EXPECTED_MAX_PER_CHUNK 150 updateTemplateNumber templateMapPollutionMinToShowPerChunk TEMPLATE_MAP_POLLUTION_MIN_TO_SHOW_PER_CHUNK 50 updateTemplateNumber templateMapPollutionMinToDamageTrees TEMPLATE_MAP_POLLUTION_MIN_TO_DAMAGE_TREES 60 - updateTemplateNumber templateMapPollutionMaxForrestDamage TEMPLATE_MAP_POLLUTION_MAX_FORREST_DAMMAGE 150 + updateTemplateNumber templateMapPollutionMaxForestDamage TEMPLATE_MAP_POLLUTION_MAX_FOREST_DAMMAGE 150 updateTemplateNumber templateMapPollutionPerTreeDamage TEMPLATE_MAP_POLLUTION_PER_TREE_DAMAGE 50 updateTemplateNumber templateMapPollutionRestoredPerTreeDamage TEMPLATE_MAP_POLLUTION_RESTORED_PER_TREE_DAMAGE 10 updateTemplateNumber templateMapPollutionMaxToRestoreTrees TEMPLATE_MAP_POLLUTION_MAX_TO_RESTORE_TREES 20 @@ -115,7 +115,7 @@ mapSettings () { updateTemplateBool templateMapEvolutionEnabled TEMPLATE_MAP_EVOLUTION_ENABLED true updateTemplateNumber templateMapEvolutionTimeFactor TEMPLATE_MAP_EVOLUTION_TIME_FACTOR 0.000004 updateTemplateNumber templateMapEvolutionDestroyFactor TEMPLATE_MAP_EVOLUTION_DESTROY_FACTOR 0.002 - updateTemplateNumber templateMapEvolutionPolutionFactor TEMPLATE_MAP_EVOLUTION_POLUTION_FACTOR 0.0000009 + updateTemplateNumber templateMapEvolutionPollutionFactor TEMPLATE_MAP_EVOLUTION_POLLUTION_FACTOR 0.0000009 updateTemplateBool templateMapExpansionEnabled TEMPLATE_MAP_EXPANSION_ENABLED true updateTemplateNumber templateMapExpansionMinBaseSpacing TEMPLATE_MAP_EXPANSION_MIN_BASE_SPACING 3 updateTemplateNumber templateMapExpansionMaxExpansionDistance TEMPLATE_MAP_EXPANSION_MAX_EXPANSION_DISTANCE 7 diff --git a/0.17/files/map-settings-template.json b/0.17/files/map-settings-template.json index 89847845..2c465976 100644 --- a/0.17/files/map-settings-template.json +++ b/0.17/files/map-settings-template.json @@ -1,45 +1,45 @@ { "difficulty_settings": { - "recipe_difficulty": 0, - "technology_difficulty": 0, - "technology_price_multiplier": 1, - "research_queue_setting": "after-victory" + "recipe_difficulty": templateMapDifficultyRecipe, + "technology_difficulty": templateMapDifficultyTechnology, + "technology_price_multiplier": templateMapDifficultyTechPrice, + "research_queue_setting": "templateMapDifficultyResearchQueue" }, "pollution": { - "enabled": true, - "diffusion_ratio": 0.02, - "min_to_diffuse": 15, - "ageing": 1, - "expected_max_per_chunk": 150, - "min_to_show_per_chunk": 50, - "min_pollution_to_damage_trees": 60, - "pollution_with_max_forest_damage": 150, - "pollution_per_tree_damage": 50, - "pollution_restored_per_tree_damage": 10, - "max_pollution_to_restore_trees": 20, - "enemy_attack_pollution_consumption_modifier": 1 + "enabled": templateMapPollutionEnabled, + "diffusion_ratio": templateMapPollutionDiffusionRatio, + "min_to_diffuse": templateMapPollutionMinToDefuse, + "ageing": templateMapPollutionAgeing, + "expected_max_per_chunk": templateMapPollutionExpectedMaxPerChunk, + "min_to_show_per_chunk": templateMapPollutionMinToShowPerChunk, + "min_pollution_to_damage_trees": templateMapPollutionMinToDamageTrees, + "pollution_with_max_forest_damage": templateMapPollutionMaxForestDamage, + "pollution_per_tree_damage": templateMapPollutionPerTreeDamage, + "pollution_restored_per_tree_damage": templateMapPollutionRestoredPerTreeDamage, + "max_pollution_to_restore_trees": templateMapPollutionMaxToRestoreTrees, + "enemy_attack_pollution_consumption_modifier": templateMapPollutionBiterAttackModifier }, "enemy_evolution": { - "enabled": true, - "time_factor": 0.000004, - "destroy_factor": 0.002, - "pollution_factor": 0.0000009 + "enabled": templateMapEvolutionEnabled, + "time_factor": templateMapEvolutionTimeFactor, + "destroy_factor": templateMapEvolutionDestroyFactor, + "pollution_factor": templateMapEvolutionPollutionFactor }, "enemy_expansion": { - "enabled": true, - "min_base_spacing": 3, - "max_expansion_distance": 7, - "friendly_base_influence_radius": 2, - "enemy_building_influence_radius": 2, - "building_coefficient": 0.1, - "other_base_coefficient": 2.0, - "neighbouring_chunk_coefficient": 0.5, - "neighbouring_base_chunk_coefficient": 0.4, - "max_colliding_tiles_coefficient": 0.9, - "settler_group_min_size": 5, - "settler_group_max_size": 20, - "min_expansion_cooldown": 14400, - "max_expansion_cooldown": 216000 + "enabled": templateMapExpansionEnabled, + "min_base_spacing": templateMapExpansionMinBaseSpacing, + "max_expansion_distance": templateMapExpansionMaxExpansionDistance, + "friendly_base_influence_radius": templateMapExpansionFriendlyBaseRadius, + "enemy_building_influence_radius": templateMapExpansionBiterBaseRadius, + "building_coefficient": templateMapExpansionBuildingCff, + "other_base_coefficient": templateMapExpansionOtherBaseCff, + "neighbouring_chunk_coefficient": templateMapExpansionNeighbourChunkCff, + "neighbouring_base_chunk_coefficient": templateMapExpansionNeighbourBaseChunkCff, + "max_colliding_tiles_coefficient": templateMapExpansionMaxCollidingTilesCff, + "settler_group_min_size": templateMapExpansionSettlerGroupMin, + "settler_group_max_size": templateMapExpansionSettlerGroupMax, + "min_expansion_cooldown": templateMapExpansionMinCooldown, + "max_expansion_cooldown": templateMapExpansionMaxCooldown }, "unit_group": { "min_group_gathering_time": 3600, From 37c03e53229bc45870111aa54e7b3fe7526f773c Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 20:51:47 -0500 Subject: [PATCH 14/25] add newline at end of template --- 0.17/files/map-settings-template.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0.17/files/map-settings-template.json b/0.17/files/map-settings-template.json index 2c465976..6903c922 100644 --- a/0.17/files/map-settings-template.json +++ b/0.17/files/map-settings-template.json @@ -103,4 +103,4 @@ "start_to_goal_cost_multiplier_to_terminate_path_find": 500.0 }, "max_failed_behavior_count": 3 -} \ No newline at end of file +} From 65b34a6827fe706177cf89c5fa37aea9583f9331 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 20:53:26 -0500 Subject: [PATCH 15/25] remove shebang space. --- 0.17/files/create-settings.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index 08666344..8b3b1319 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/bash # updateTemplate # From bd18cbaefeecdb59953b3ed40ad9d7bef06c6a7c Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 21:04:19 -0500 Subject: [PATCH 16/25] move settigns file generation from docker-entrypoint.sh and create-settings.sh --- 0.17/files/create-settings.sh | 25 +++++++++++++++++++++---- 0.17/files/docker-entrypoint.sh | 14 ++------------ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index 8b3b1319..dd632269 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -231,7 +231,24 @@ serverSettings(){ updateTemplateNumber templateServerMaxSegmentSizePeer TEMPLATE_SERVER_MAX_SEGMENT_SIZE_PEER 10 } -#call the functions to generate the files from the templates. -mapSettings -mapGenSettings -serverSettings + +#call the functions to generate and copy the files from the templates. +if [[ ! -f $CONFIG/server-settings.json ]]; then + # Copy default settings if server-settings.json doesn't exist + serverSettings + cp ./server-settings-template.json "$CONFIG/server-settings.json" +fi + +if [[ ! -f $CONFIG/map-gen-settings.json ]]; then + mapGenSettings + cp ./map-gen-settings-template.json "$CONFIG/map-gen-settings.json" +fi + +if [[ ! -f $CONFIG/map-settings.json ]]; then + mapSettings + cp ./map-settings-template.json "$CONFIG/map-settings.json" +fi + + + + diff --git a/0.17/files/docker-entrypoint.sh b/0.17/files/docker-entrypoint.sh index 65089350..f5dbb4ba 100755 --- a/0.17/files/docker-entrypoint.sh +++ b/0.17/files/docker-entrypoint.sh @@ -18,18 +18,8 @@ if [[ ! -f $CONFIG/rconpw ]]; then pwgen 15 1 >"$CONFIG/rconpw" fi -if [[ ! -f $CONFIG/server-settings.json ]]; then - # Copy default settings if server-settings.json doesn't exist - cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" -fi - -if [[ ! -f $CONFIG/map-gen-settings.json ]]; then - cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" -fi - -if [[ ! -f $CONFIG/map-settings.json ]]; then - cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" -fi +#call the script to create the settings from the template settings json files. +./create-settings.sh NRTMPSAVES=$( find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 | wc -l ) if [[ $NRTMPSAVES -gt 0 ]]; then From e9dc37b2a0f8d9ae87f24755b2ff5e579306d642 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 21:15:45 -0500 Subject: [PATCH 17/25] Add environment Variable to enable settings file generation --- 0.17/files/docker-entrypoint.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/0.17/files/docker-entrypoint.sh b/0.17/files/docker-entrypoint.sh index f5dbb4ba..92d0f6ec 100755 --- a/0.17/files/docker-entrypoint.sh +++ b/0.17/files/docker-entrypoint.sh @@ -19,7 +19,22 @@ if [[ ! -f $CONFIG/rconpw ]]; then fi #call the script to create the settings from the template settings json files. -./create-settings.sh +if [[ $GENERATE_SETTINGS_FILES ]]; then + ./create-settings.sh +else + if [[ ! -f $CONFIG/server-settings.json ]]; then + # Copy default settings if server-settings.json doesn't exist + cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" + fi + + if [[ ! -f $CONFIG/map-gen-settings.json ]]; then + cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" + fi + + if [[ ! -f $CONFIG/map-settings.json ]]; then + cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" + fi +fi NRTMPSAVES=$( find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 | wc -l ) if [[ $NRTMPSAVES -gt 0 ]]; then From 2dedaabfdb792674e1951340802325db409434b1 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Thu, 26 Dec 2019 23:49:40 -0500 Subject: [PATCH 18/25] add table of options to the readme, and several options to controll prcess --- 0.17/files/create-settings.sh | 59 ++++++++++++---- README.md | 125 ++++++++++++++++++++++++++++++++++ 2 files changed, 170 insertions(+), 14 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index dd632269..b8d3b346 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -18,6 +18,9 @@ updateTemplate () { sed -i "s/$1/$3/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the value in the environment Variable + if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + echo Setting $1 to $val in $TEMPLATE_FILE + fi sed -i "s/$1/$val/g" "$TEMPLATE_FILE" fi @@ -40,6 +43,9 @@ updateTemplateBool (){ then #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" + if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + echo Setting $1 to $val in $TEMPLATE_FILE + fi else #Replace the value in the template file with the default sed -i "s/$1/$3/g" "$TEMPLATE_FILE" @@ -63,6 +69,9 @@ updateTemplateNumber (){ then #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" + if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + echo Setting $1 to $val in $TEMPLATE_FILE + fi else #Replace the value in the template file with the default sed -i "s/$1/$3/g" "$TEMPLATE_FILE" @@ -88,6 +97,9 @@ updateTemplateEmpty(){ else #Replace the value in the template file with the value in the environment Variable sed -i "s/$1/$val/g" "$TEMPLATE_FILE" + if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + echo Setting $1 to $val in $TEMPLATE_FILE + fi fi } @@ -185,7 +197,7 @@ mapGenSettings () { updateTemplateNumber templateGenCliffElevationInterval TEMPLATE_GEN_CLIFF_ELEVATION_INTERVAL 10 updateTemplateNumber templateGenCliffRichness TEMPLATE_GEN_CLIFF_RICHNESS 1 #expression Names - updateTemplate templateGenExpressionElevation TEMPLATE_GEN_EXPRESSION_ELEVATION "0_17-island" + updateTemplateEmpty templateGenExpressionElevation TEMPLATE_GEN_EXPRESSION_ELEVATION updateTemplateNumber templateGenAuxBias TEMPLATE_GEN_AUX_BIAS "0.300000" updateTemplateNumber templateGenAuxMultiplier TEMPLATE_GEN_AUX_MULTIPLIER "1.333333" updateTemplateNumber templateGenMoistureBias TEMPLATE_GEN_MOISTURE_BIAS "0.100000" @@ -204,7 +216,7 @@ serverSettings(){ updateTemplate templateServerName TEMPLATE_SERVER_NAME "my-server" updateTemplate templateServerDescription TEMPLATE_SERVER_DESCRIPTION "my-server" - updateTemplate templateServerTags TEMPLATE_SERVER_TAGS '"kubernetes","docker"' + updateTemplate templateServerTags TEMPLATE_SERVER_TAGS '"factorio","docker"' updateTemplateNumber templateServerMaxPlayers TEMPLATE_SERVER_MAX_PLAYERS 0 updateTemplateBool templateServerPulicVisibility TEMPLATE_SERVER_PUBLIC_VISIBILITY true updateTemplateBool templateServerLanVisibility TEMPLATE_SERVER_LAN_VISIBILITY true @@ -232,23 +244,42 @@ serverSettings(){ } -#call the functions to generate and copy the files from the templates. -if [[ ! -f $CONFIG/server-settings.json ]]; then - # Copy default settings if server-settings.json doesn't exist - serverSettings - cp ./server-settings-template.json "$CONFIG/server-settings.json" -fi -if [[ ! -f $CONFIG/map-gen-settings.json ]]; then +if [[ $FORCE_GENERATE_SETTINGS_FILES ]] +then + #generate new files, regardless of if a file already exists. + serverSettings + mapSettings mapGenSettings + rm -f "$CONFIG/server-settings.json" + rm -f "$CONFIG/map-gen-settings.json" + rm -f "$CONFIG/map-settings.json" + cp ./server-settings-template.json "$CONFIG/server-settings.json" cp ./map-gen-settings-template.json "$CONFIG/map-gen-settings.json" -fi - -if [[ ! -f $CONFIG/map-settings.json ]]; then - mapSettings cp ./map-settings-template.json "$CONFIG/map-settings.json" -fi +else + #call the functions to generate and copy the files from the templates. + if [[ ! -f $CONFIG/server-settings.json ]] + then + # generate settings if server-settings.json doesn't exist + serverSettings + cp ./server-settings-template.json "$CONFIG/server-settings.json" + fi + + if [[ ! -f $CONFIG/map-gen-settings.json ]] + then + mapGenSettings + cp ./map-gen-settings-template.json "$CONFIG/map-gen-settings.json" + fi + if [[ ! -f $CONFIG/map-settings.json ]] + then + mapSettings + cp ./map-settings-template.json "$CONFIG/map-settings.json" + fi + + +fi diff --git a/README.md b/README.md index 09b51f81..c2eefa3a 100644 --- a/README.md +++ b/README.md @@ -245,6 +245,130 @@ The `server-settings.json` file may then contain the variable references like th "description": "${INSTANCE_DESC}", ``` +### configuration file generation + +It is possible, by setting GENERATE_SETTINGS_FILES to true, to generate the server-settings.json, map-gen-settings.json and some of map-settings.json files based on environment variables. The tables below describe the different variables avaliable. + + +### Environment Variables + +|Variable |default |description| +|---------------------------------------------------|:---------------------:|-----------| +|__**META VARIABLES**__ | |variables used for configuration of the container itself, or used in the scripts to determine functionality. | +|SAVE_NAME | |the name of the game save| +|ENABLE_SERVER_LOAD_LATEST |true || +|ENABLE_GENERATE_NEW_MAP_SAVE |false || +|GENERATE_SETTINGS_FILES |false |if 'true', the server settings files will be generated based on the environment variables or defaults. Otherwise, tbe files will be copied from the files in /opt/factorio/data| +|GENERATE_SETTINGS_FILES_DEBUG |false |if 'true', any variables that are set will output when used in the settings files generation.| +|FORCE_GENERATE_SETTINGS_FILES |false |If 'true', the settings files will be generated from the environment variables, regardless of if the files exist already.| +|__**SERVER SETTINGS**__ | |server-settings.json| +|TEMPLATE_SERVER_NAME |my-server |Name of the game as it will appear in the game listing| +|TEMPLATE_SERVER_DESCRIPTION |my-server |Description of the game that will appear in the listing| +|TEMPLATE_SERVER_TAGS |"factorio","docker" |Game tags| +|TEMPLATE_SERVER_MAX_PLAYERS |0 |Maximum number of players allowed, admins can join even a full server. 0 means unlimited.| +|TEMPLATE_SERVER_PUBLIC_VISIBILITY |true |Game will be published on the official Factorio matching server| +|TEMPLATE_SERVER_LAN_VISIBILITY |true |Game will be broadcast on LAN| +|TEMPLATE_SERVER_USERNAME | |Your factorio.com login Username. Required for games with visibility public| +|TEMPLATE_SERVER_PASSWORD | |Your factorio.com login Password. Required for games with visibility public| +|TEMPLATE_SERVER_TOKEN | |Authentication token. May be used instead of 'password' above.| +|TEMPLATE_SERVER_GAME_PASSWORD | |The password that the server | +|TEMPLATE_SERVER_REQUIRE_USER_VERIFICATION |true |When set to true, the server will only allow clients that have a valid Factorio.com account| +|TEMPLATE_SERVER_MAX_UPLOAD |0 |Default value is 0. 0 means unlimited. Value is in Kilobytes per second.| +|TEMPLATE_SERVER_MAX_UPLOAD_SLOTS |5 |Default value is 5. 0 means unlimited.| +|TEMPLATE_SERVER_MIN_LATENCY_TICKS |0 |One tick is 16ms in default speed, default value is 0. 0 means no minimum.| +|TEMPLATE_SERVER_IGNORE_LIMIT_FOR_RETURNING |false |Players that played on this map already can join even when the max player limit was reached.| +|TEMPLATE_SERVER_ALLOW_COMMANDS |admins-only |The ability for commands to be used on the server. Possible values are, true, false and admins-only| +|TEMPLATE_SERVER_AUTOSAVE_INTERVAL |5 |Autosave interval in minutes| +|TEMPLATE_SERVER_AUTOSAVE_SLOTS |3 |Server autosave slots, it is cycled through when the server autosaves.| +|TEMPLATE_SERVER_AFK_KICK_INTERVAL |0 |How many minutes until someone is kicked when doing nothing, 0 for never.| +|TEMPLATE_SERVER_AUTOPAUSE |true |Whether should the server be paused when no players are present.| +|TEMPLATE_SERVER_ADMIN_ONLY_PAUSE |true |Whether only admins can pause the game.| +|TEMPLATE_SERVER_SERVER_ONLY_AUTOSAVE |true |Whether autosaves should be saved only on server or also on all connected clients. | +|TEMPLATE_SERVER_NONBLOCKING_SAVE |false |Highly experimental feature, enable only at your own risk of losing your saves. On UNIX systems, server will fork itself to create an autosave. Autosaving on connected Windows clients will be disabled regardless of autosave_only_on_server option.| +|TEMPLATE_SERVER_MIN_SEGMENT_SIZE |25 || +|TEMPLATE_SERVER_MIN_SEGMENT_SIZE_PEER |20 || +|TEMPLATE_SERVER_MAX_SEGMENT_SIZE |100 || +|TEMPLATE_SERVER_MAX_SEGMENT_SIZE_PEER |10 || +|__**MAP GEN SETTINGS**__ | |map-gen-settings.json| +|TEMPLATE_GEN_TERRAIN_SEGMENTATION |1 |Inverse of map scale| +|TEMPLATE_GEN_TERRAIN_WATER |1 |Multiplier for water 'coverage' - higher increases the water level. Water level = 10 * log2(this value)| +|TEMPLATE_GEN_MAP_WIDTH |0 |Width of map, in tiles; 0 means infinite.| +|TEMPLATE_GEN_MAP_HEIGHT |0 |Height of map, in tiles; 0 means infinite.| +|TEMPLATE_GEN_MAP_STARTING_AREA |1 |Multiplier for 'biter free zone radius'| +|TEMPLATE_GEN_PEACEFULL_MODE |false || +|TEMPLATE_GEN_COAL_RICHNESS |1 || +|TEMPLATE_GEN_COAL_SIZE |1 || +|TEMPLATE_GEN_COAL_FREQUENCY |1 || +|TEMPLATE_GEN_STONE_RICHNESS |1 || +|TEMPLATE_GEN_STONE_SIZE |1 || +|TEMPLATE_GEN_STONE_FREQUENCY |1 || +|TEMPLATE_GEN_COPPER_RICHNESS |1 || +|TEMPLATE_GEN_COPPER_SIZE |1 || +|TEMPLATE_GEN_COPPER_FREQUENCY |1 || +|TEMPLATE_GEN_IRON_RICHNESS |1 || +|TEMPLATE_GEN_IRON_SIZE |1 || +|TEMPLATE_GEN_IRON_FREQUENCY |1 || +|TEMPLATE_GEN_URANIUM_RICHNESS |1 || +|TEMPLATE_GEN_URANIUM_SIZE |1 || +|TEMPLATE_GEN_URANIUM_FREQUENCY |1 || +|TEMPLATE_GEN_CRUDE_RICHNESS |1 || +|TEMPLATE_GEN_CRUDE_SIZE |1 || +|TEMPLATE_GEN_CRUDE_FREQUENCY |1 || +|TEMPLATE_GEN_TREES_RICHNESS |1 || +|TEMPLATE_GEN_TREES_SIZE |1 || +|TEMPLATE_GEN_TREES_FREQUENCY |1 || +|TEMPLATE_GEN_BITER_RICHNESS |1 || +|TEMPLATE_GEN_BITER_SIZE |1 || +|TEMPLATE_GEN_BITER_FREQUENCY |1 || +|TEMPLATE_GEN_CLIFF_NAME |cliff |Name of the cliff prototype.| +|TEMPLATE_GEN_CLIFF_ELEVATION_ZERO |10 |Elevation of first row of cliffs.| +|TEMPLATE_GEN_CLIFF_ELEVATION_INTERVAL |10 |Elevation difference between successive rows of cliffs.| +|TEMPLATE_GEN_CLIFF_RICHNESS |1 |Multiplier for cliff continuity; 0 will result in no cliffs, 10 will make all cliff rows completely solid.| +|TEMPLATE_GEN_EXPRESSION_ELEVATION | |Overrides for property value generators. Elevation influences water and cliff placement. Leave it blank to get 'normal' terrain. Use '0_16-elevation' to reproduce terrain from 0.16. Use '0_17-island' to get an island.| +|TEMPLATE_GEN_AUX_BIAS |0.300000 || +|TEMPLATE_GEN_AUX_MULTIPLIER |1.333333 || +|TEMPLATE_GEN_MOISTURE_BIAS |0.100000 || +|TEMPLATE_GEN_MOISTURE_MULTIPLIER |0.500000 || +|TEMPLATE_GEN_STARTING_POINT_X |1000 || +|TEMPLATE_GEN_STARTING_POINT_Y |2000 || +|TEMPLATE_GEN_MAP_SEED |null |Use null for a random seed, number for a specific seed.| +|__**MAP SETTINGS**__ | |map-settings.json| +|TEMPLATE_MAP_DIFFICULTY_RECIPE |0 || +|TEMPLATE_MAP_DIFFICULTY_TECHNOLOGY |0 || +|TEMPLATE_MAP_DIFFICULTY_TECH_PRICE |1 || +|TEMPLATE_MAP_DIFFICULTY_RESEARCH_QUEUE |after-victory || +|TEMPLATE_MAP_POLLUTION_ENABLED |true || +|TEMPLATE_MAP_POLLUTION_DIFFUSION_RATIO |0.02 || +|TEMPLATE_MAP_POLLUTION_MIN_TO_DEFUSE |15 | amount that is diffused to neighboring chunk (these are values for 60 ticks (1 simulated second)).| +|TEMPLATE_MAP_POLLUTION_AGEING |1 || +|TEMPLATE_MAP_POLLUTION_EXPECTED_MAX_PER_CHUNK |150 || +|TEMPLATE_MAP_POLLUTION_MIN_TO_SHOW_PER_CHUNK |50 || +|TEMPLATE_MAP_POLLUTION_MIN_TO_DAMAGE_TREES |60 || +|TEMPLATE_MAP_POLLUTION_MAX_FOREST_DAMMAGE |150 || +|TEMPLATE_MAP_POLLUTION_PER_TREE_DAMAGE |50 || +|TEMPLATE_MAP_POLLUTION_RESTORED_PER_TREE_DAMAGE |10 || +|TEMPLATE_MAP_POLLUTION_MAX_TO_RESTORE_TREES |20 || +|TEMPLATE_MAP_POLLUTION_BITER_ATTACK_MODIFIER |1 || +|TEMPLATE_MAP_EVOLUTION_ENABLED |true || +|TEMPLATE_MAP_EVOLUTION_TIME_FACTOR |0.000004 || +|TEMPLATE_MAP_EVOLUTION_DESTROY_FACTOR |0.002 || +|TEMPLATE_MAP_EVOLUTION_POLLUTION_FACTOR |0.0000009 || +|TEMPLATE_MAP_EXPANSION_ENABLED |true || +|TEMPLATE_MAP_EXPANSION_MIN_BASE_SPACING |3 || +|TEMPLATE_MAP_EXPANSION_MAX_EXPANSION_DISTANCE |7 || +|TEMPLATE_MAP_EXPANSION_FRIENDLY_BASE_RADIUS |2 || +|TEMPLATE_MAP_EXPANSION_BITER_BASE_RADIUS |2 || +|TEMPLATE_MAP_EXPANSION_BUILDING_CFF |0.1 || +|TEMPLATE_MAP_EXPANSION_OTHER_BASE_CFF |2.0 || +|TEMPLATE_MAP_EXPANSION_NEIGHBOUR_CHUNK_CFF |0.5 || +|TEMPLATE_MAP_EXPANSION_NEIGHBOUR_BASE_CHUNK_CFF |0.4 || +|TEMPLATE_MAP_EXPANSION_MAX_COLLIDING_TILES_CFF |0.9 || +|TEMPLATE_MAP_EXPANSION_SETTLER_GROUP_MIN |5 || +|TEMPLATE_MAP_EXPANSION_SETTLER_GROUP_MAX |20 || +|TEMPLATE_MAP_EXPANSION_MIN_COOLDOWN |14400 || +|TEMPLATE_MAP_EXPANSION_MAX_COOLDOWN |216000 || + + ## Container Details The philosophy is to [keep it simple](http://wiki.c2.com/?KeepItSimple). @@ -381,3 +505,4 @@ Use the `PORT` environment variable to start the server on the a different port, * [bplein](https://github.com/bplein/docker_factorio_server) - Coded scenario support * [jaredledvina](https://github.com/jaredledvina/docker_factorio_server) - Contributed version updates * [carlbennett](https://github.com/carlbennett) - Contributed version updates and bugfixes +* [deef0000dragon1](https://github.com/deef0000dragon1) - Contributed Environment Variable based settings file generation. From b59f73b6ec7b36341312e05d06e8655f22d063d9 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Fri, 27 Dec 2019 11:32:06 -0500 Subject: [PATCH 19/25] add backing up old settings files --- 0.17/files/create-settings.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index b8d3b346..c29cc74c 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -247,13 +247,29 @@ serverSettings(){ if [[ $FORCE_GENERATE_SETTINGS_FILES ]] then - #generate new files, regardless of if a file already exists. + + #backup old files using timestamp. + if [[ ! -f $CONFIG/server-settings.json ]] + then + mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json".`date +%Y.%m.%d.%H.%M.%S` + fi + + if [[ ! -f $CONFIG/map-gen-settings.json ]] + then + mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json".`date +%Y.%m.%d.%H.%M.%S` + fi + + if [[ ! -f $CONFIG/map-settings.json ]] + then + mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json".`date +%Y.%m.%d.%H.%M.%S` + fi + + #generate new files. serverSettings mapSettings mapGenSettings - rm -f "$CONFIG/server-settings.json" - rm -f "$CONFIG/map-gen-settings.json" - rm -f "$CONFIG/map-settings.json" + + #move new files into place cp ./server-settings-template.json "$CONFIG/server-settings.json" cp ./map-gen-settings-template.json "$CONFIG/map-gen-settings.json" cp ./map-settings-template.json "$CONFIG/map-settings.json" From c7e3a8e01366a2bc7530a11d0aac4bd162677afc Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Fri, 24 Jan 2020 16:26:04 -0500 Subject: [PATCH 20/25] add env_vars files to 0.18 folder --- 0.18/files/create-settings.sh | 301 ++++++++++++++++++++++ 0.18/files/docker-entrypoint.sh | 25 +- 0.18/files/map-gen-settings-template.json | 70 +++++ 0.18/files/map-settings-template.json | 106 ++++++++ 0.18/files/server-settings-template.json | 33 +++ 5 files changed, 525 insertions(+), 10 deletions(-) create mode 100644 0.18/files/create-settings.sh create mode 100644 0.18/files/map-gen-settings-template.json create mode 100644 0.18/files/map-settings-template.json create mode 100644 0.18/files/server-settings-template.json diff --git a/0.18/files/create-settings.sh b/0.18/files/create-settings.sh new file mode 100644 index 00000000..c29cc74c --- /dev/null +++ b/0.18/files/create-settings.sh @@ -0,0 +1,301 @@ +#!/bin/bash + +# updateTemplate +# +# replaces the template string with either the default, or +# the value in the passed in environment variable. +# +# $1 Template String: The value that is replaced in the template. +# $2 Environment Variable String: the environment variable that is checked for a value. +# $3 Default Value: The default value used if the environment variable is empty or invalid. +updateTemplate () { + #get the value from the environment varaible and put it in val + val=${!2} + #Test if there was a value that was set. + if [[ -z "$val" ]] + then + #replace the value in the template file with the default value + sed -i "s/$1/$3/g" "$TEMPLATE_FILE" + else + #Replace the value in the template file with the value in the environment Variable + if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + echo Setting $1 to $val in $TEMPLATE_FILE + fi + sed -i "s/$1/$val/g" "$TEMPLATE_FILE" + fi + +} + +# updateTemplateBool +# +# replaces the template string with either the default, or +# the value in the passed in environment variable. +# if the value in the variable is not 'true' or 'false', the default is used. +# +# $1 Template String: The value that is replaced in the template. +# $2 Environment Variable String: the environment variable that is checked for a value. +# $3 Default Value: The default value used if the environment variable is empty or invalid. +updateTemplateBool (){ + #get the value from the environment varaible and put it in val + val=${!2} + #Test if there was a value that was set to true or false + if [[ ${val} =~ ^(true)|(false)$ ]] + then + #replace the value in the template file with the argument + sed -i "s/$1/$val/g" "$TEMPLATE_FILE" + if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + echo Setting $1 to $val in $TEMPLATE_FILE + fi + else + #Replace the value in the template file with the default + sed -i "s/$1/$3/g" "$TEMPLATE_FILE" + fi +} + +# updateTemplateNumber +# +# replaces the template string with either the default, or +# the value in the passed in environment variable. +# if the value in the variable is not anumber, the default is used. +# +# $1 Template String: The value that is replaced in the template. +# $2 Environment Variable String: the environment variable that is checked for a value. +# $3 Default Value: The default value used if the environment variable is empty or invalid. +updateTemplateNumber (){ + #get the value from the environment varaible and put it in val + val=${!2} + #Test if there was a value that was set to true or false + if [[ ${val} =~ ^[0-9]+\.?[0-9]*$ ]] + then + #replace the value in the template file with the argument + sed -i "s/$1/$val/g" "$TEMPLATE_FILE" + if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + echo Setting $1 to $val in $TEMPLATE_FILE + fi + else + #Replace the value in the template file with the default + sed -i "s/$1/$3/g" "$TEMPLATE_FILE" + fi +} + +# updateTemplateEmpty +# +# replaces the template string with either an empty string, or +# the value in the passed in environment variable. +# +# $1 Template String: The value that is replaced in the template. +# $2 Environment Variable String: the environment variable that is checked for a value +updateTemplateEmpty(){ + #get the value from the environment varaible and put it in val + val=${!2} + + #Test if there was a value that was set. + if [[ -z "$val" ]] + then + #replace the value in the template file with the default value + sed -i "s/$1//g" "$TEMPLATE_FILE" + else + #Replace the value in the template file with the value in the environment Variable + sed -i "s/$1/$val/g" "$TEMPLATE_FILE" + if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + echo Setting $1 to $val in $TEMPLATE_FILE + fi + fi +} + +#Using the template, generate a map-settings.json file +mapSettings () { + echo Creating map generation settings file + TEMPLATE_FILE=map-settings-template.json + + updateTemplateNumber templateMapDifficultyRecipe TEMPLATE_MAP_DIFFICULTY_RECIPE 0 + updateTemplateNumber templateMapDifficultyTechnology TEMPLATE_MAP_DIFFICULTY_TECHNOLOGY 0 + updateTemplateNumber templateMapDifficultyTechPrice TEMPLATE_MAP_DIFFICULTY_TECH_PRICE 1 + updateTemplate templateMapDifficultyResearchQueue TEMPLATE_MAP_DIFFICULTY_RESEARCH_QUEUE "after-victory" + updateTemplateBool templateMapPollutionEnabled TEMPLATE_MAP_POLLUTION_ENABLED true + updateTemplateNumber templateMapPollutionDiffusionRatio TEMPLATE_MAP_POLLUTION_DIFFUSION_RATIO 0.02 + updateTemplateNumber templateMapPollutionMinToDefuse TEMPLATE_MAP_POLLUTION_MIN_TO_DEFUSE 15 + updateTemplateNumber templateMapPollutionAgeing TEMPLATE_MAP_POLLUTION_AGEING 1 + updateTemplateNumber templateMapPollutionExpectedMaxPerChunk TEMPLATE_MAP_POLLUTION_EXPECTED_MAX_PER_CHUNK 150 + updateTemplateNumber templateMapPollutionMinToShowPerChunk TEMPLATE_MAP_POLLUTION_MIN_TO_SHOW_PER_CHUNK 50 + updateTemplateNumber templateMapPollutionMinToDamageTrees TEMPLATE_MAP_POLLUTION_MIN_TO_DAMAGE_TREES 60 + updateTemplateNumber templateMapPollutionMaxForestDamage TEMPLATE_MAP_POLLUTION_MAX_FOREST_DAMMAGE 150 + updateTemplateNumber templateMapPollutionPerTreeDamage TEMPLATE_MAP_POLLUTION_PER_TREE_DAMAGE 50 + updateTemplateNumber templateMapPollutionRestoredPerTreeDamage TEMPLATE_MAP_POLLUTION_RESTORED_PER_TREE_DAMAGE 10 + updateTemplateNumber templateMapPollutionMaxToRestoreTrees TEMPLATE_MAP_POLLUTION_MAX_TO_RESTORE_TREES 20 + updateTemplateNumber templateMapPollutionBiterAttackModifier TEMPLATE_MAP_POLLUTION_BITER_ATTACK_MODIFIER 1 + updateTemplateBool templateMapEvolutionEnabled TEMPLATE_MAP_EVOLUTION_ENABLED true + updateTemplateNumber templateMapEvolutionTimeFactor TEMPLATE_MAP_EVOLUTION_TIME_FACTOR 0.000004 + updateTemplateNumber templateMapEvolutionDestroyFactor TEMPLATE_MAP_EVOLUTION_DESTROY_FACTOR 0.002 + updateTemplateNumber templateMapEvolutionPollutionFactor TEMPLATE_MAP_EVOLUTION_POLLUTION_FACTOR 0.0000009 + updateTemplateBool templateMapExpansionEnabled TEMPLATE_MAP_EXPANSION_ENABLED true + updateTemplateNumber templateMapExpansionMinBaseSpacing TEMPLATE_MAP_EXPANSION_MIN_BASE_SPACING 3 + updateTemplateNumber templateMapExpansionMaxExpansionDistance TEMPLATE_MAP_EXPANSION_MAX_EXPANSION_DISTANCE 7 + updateTemplateNumber templateMapExpansionFriendlyBaseRadius TEMPLATE_MAP_EXPANSION_FRIENDLY_BASE_RADIUS 2 + updateTemplateNumber templateMapExpansionBiterBaseRadius TEMPLATE_MAP_EXPANSION_BITER_BASE_RADIUS 2 + updateTemplateNumber templateMapExpansionBuildingCff TEMPLATE_MAP_EXPANSION_BUILDING_CFF 0.1 + updateTemplateNumber templateMapExpansionOtherBaseCff TEMPLATE_MAP_EXPANSION_OTHER_BASE_CFF 2.0 + updateTemplateNumber templateMapExpansionNeighbourChunkCff TEMPLATE_MAP_EXPANSION_NEIGHBOUR_CHUNK_CFF 0.5 + updateTemplateNumber templateMapExpansionNeighbourBaseChunkCff TEMPLATE_MAP_EXPANSION_NEIGHBOUR_BASE_CHUNK_CFF 0.4 + updateTemplateNumber templateMapExpansionMaxCollidingTilesCff TEMPLATE_MAP_EXPANSION_MAX_COLLIDING_TILES_CFF 0.9 + updateTemplateNumber templateMapExpansionSettlerGroupMin TEMPLATE_MAP_EXPANSION_SETTLER_GROUP_MIN 5 + updateTemplateNumber templateMapExpansionSettlerGroupMax TEMPLATE_MAP_EXPANSION_SETTLER_GROUP_MAX 20 + updateTemplateNumber templateMapExpansionMinCooldown TEMPLATE_MAP_EXPANSION_MIN_COOLDOWN 14400 + updateTemplateNumber templateMapExpansionMaxCooldown TEMPLATE_MAP_EXPANSION_MAX_COOLDOWN 216000 + + #unit_group, Steering, Path_finder, and max_failed_behavior_count settings not included at this time + #as they are likely very optimized by the developers; + +} + +#Using the template, generate a map-gen-settings.json file +mapGenSettings () { + echo Creating map settings file + TEMPLATE_FILE=map-gen-settings-template.json + + updateTemplateNumber templateGenTerrainSegmentation TEMPLATE_GEN_TERRAIN_SEGMENTATION 1 + updateTemplateNumber templateGenTerrainWater TEMPLATE_GEN_TERRAIN_WATER 1 + updateTemplateNumber templateGenMapWidth TEMPLATE_GEN_MAP_WIDTH 0 + updateTemplateNumber templateGenMapHeight TEMPLATE_GEN_MAP_HEIGHT 0 + updateTemplateNumber templateGenMapStartingArea TEMPLATE_GEN_MAP_STARTING_AREA 1 + updateTemplateBool templateGenPeacefullMode TEMPLATE_GEN_PEACEFULL_MODE false + #coal + updateTemplateNumber templateGenCoalRichness TEMPLATE_GEN_COAL_RICHNESS 1 + updateTemplateNumber templateGenCoalSize TEMPLATE_GEN_COAL_SIZE 1 + updateTemplateNumber templateGenCoalFrequency TEMPLATE_GEN_COAL_FREQUENCY 1 + #stone + updateTemplateNumber templateGenStoneRichness TEMPLATE_GEN_STONE_RICHNESS 1 + updateTemplateNumber templateGenStoneSize TEMPLATE_GEN_STONE_SIZE 1 + updateTemplateNumber templateGenStoneFrequency TEMPLATE_GEN_STONE_FREQUENCY 1 + #Copper + updateTemplateNumber templateGenCopperRichness TEMPLATE_GEN_COPPER_RICHNESS 1 + updateTemplateNumber templateGenCopperSize TEMPLATE_GEN_COPPER_SIZE 1 + updateTemplateNumber templateGenCopperFrequency TEMPLATE_GEN_COPPER_FREQUENCY 1 + #Iron + updateTemplateNumber templateGenIronRichness TEMPLATE_GEN_IRON_RICHNESS 1 + updateTemplateNumber templateGenIronSize TEMPLATE_GEN_IRON_SIZE 1 + updateTemplateNumber templateGenIronFrequency TEMPLATE_GEN_IRON_FREQUENCY 1 + #Uranium + updateTemplateNumber templateGenUraniumRichness TEMPLATE_GEN_URANIUM_RICHNESS 1 + updateTemplateNumber templateGenUraniumSize TEMPLATE_GEN_URANIUM_SIZE 1 + updateTemplateNumber templateGenUraniumFrequency TEMPLATE_GEN_URANIUM_FREQUENCY 1 + #Crude + updateTemplateNumber templateGenCrudeRichness TEMPLATE_GEN_CRUDE_RICHNESS 1 + updateTemplateNumber templateGenCrudeSize TEMPLATE_GEN_CRUDE_SIZE 1 + updateTemplateNumber templateGenCrudeFrequency TEMPLATE_GEN_CRUDE_FREQUENCY 1 + #Trees + updateTemplateNumber templateGenTreesRichness TEMPLATE_GEN_TREES_RICHNESS 1 + updateTemplateNumber templateGenTreesSize TEMPLATE_GEN_TREES_SIZE 1 + updateTemplateNumber templateGenTreesFrequency TEMPLATE_GEN_TREES_FREQUENCY 1 + #Biters + updateTemplateNumber templateGenBiterRichness TEMPLATE_GEN_BITER_RICHNESS 1 + updateTemplateNumber templateGenBiterSize TEMPLATE_GEN_BITER_SIZE 1 + updateTemplateNumber templateGenBiterFrequency TEMPLATE_GEN_BITER_FREQUENCY 1 + #cliffs + updateTemplate templateGenCliffName TEMPLATE_GEN_CLIFF_NAME "cliff" + updateTemplateNumber templateGenCliffElevationZero TEMPLATE_GEN_CLIFF_ELEVATION_ZERO 10 + updateTemplateNumber templateGenCliffElevationInterval TEMPLATE_GEN_CLIFF_ELEVATION_INTERVAL 10 + updateTemplateNumber templateGenCliffRichness TEMPLATE_GEN_CLIFF_RICHNESS 1 + #expression Names + updateTemplateEmpty templateGenExpressionElevation TEMPLATE_GEN_EXPRESSION_ELEVATION + updateTemplateNumber templateGenAuxBias TEMPLATE_GEN_AUX_BIAS "0.300000" + updateTemplateNumber templateGenAuxMultiplier TEMPLATE_GEN_AUX_MULTIPLIER "1.333333" + updateTemplateNumber templateGenMoistureBias TEMPLATE_GEN_MOISTURE_BIAS "0.100000" + updateTemplateNumber templateGenMoistureMultiplier TEMPLATE_GEN_MOISTURE_MULTIPLIER "0.500000" + #Starting Point + updateTemplateNumber templateGenStartingPointX TEMPLATE_GEN_STARTING_POINT_X 1000 + updateTemplateNumber templateGenStartingPointY TEMPLATE_GEN_STARTING_POINT_Y 2000 + #seed + updateTemplateNumber templateGenMapSeed TEMPLATE_GEN_MAP_SEED null +} + +#Using the template, generate a server-settings.json file. +serverSettings(){ + echo Creating server settings file + TEMPLATE_FILE=server-settings-template.json + + updateTemplate templateServerName TEMPLATE_SERVER_NAME "my-server" + updateTemplate templateServerDescription TEMPLATE_SERVER_DESCRIPTION "my-server" + updateTemplate templateServerTags TEMPLATE_SERVER_TAGS '"factorio","docker"' + updateTemplateNumber templateServerMaxPlayers TEMPLATE_SERVER_MAX_PLAYERS 0 + updateTemplateBool templateServerPulicVisibility TEMPLATE_SERVER_PUBLIC_VISIBILITY true + updateTemplateBool templateServerLanVisibility TEMPLATE_SERVER_LAN_VISIBILITY true + updateTemplateEmpty templateServerUsername TEMPLATE_SERVER_USERNAME + updateTemplateEmpty templateServerPassword TEMPLATE_SERVER_PASSWORD + updateTemplateEmpty templateServerGameToken TEMPLATE_SERVER_TOKEN + updateTemplateEmpty templateServerGamePassword TEMPLATE_SERVER_GAME_PASSWORD + updateTemplateBool templateServerRequireUserVerification TEMPLATE_SERVER_REQUIRE_USER_VERIFICATION true + updateTemplateNumber templateServerMaxUploadCount TEMPLATE_SERVER_MAX_UPLOAD 0 + updateTemplateNumber templateServerMaxUploadSlots TEMPLATE_SERVER_MAX_UPLOAD_SLOTS 5 + updateTemplateNumber templateServerMinimumLatenctInTicks TEMPLATE_SERVER_MIN_LATENCY_TICKS 0 + updateTemplateBool templateServerIgnoreLimitForReturning TEMPLATE_SERVER_IGNORE_LIMIT_FOR_RETURNING false + updateTemplate templateServerAllowCommands TEMPLATE_SERVER_ALLOW_COMMANDS "admins-only" + updateTemplateNumber templateServerAutosaveInterval TEMPLATE_SERVER_AUTOSAVE_INTERVAL 5 + updateTemplateNumber templateServerAutosaveSlots TEMPLATE_SERVER_AUTOSAVE_SLOTS 3 + updateTemplateNumber templateServerAFKAutokickInterval TEMPLATE_SERVER_AFK_KICK_INTERVAL 0 + updateTemplateBool templateServerAutoPause TEMPLATE_SERVER_AUTOPAUSE true + updateTemplateBool templateServerOnlyAdminsPause TEMPLATE_SERVER_ADMIN_ONLY_PAUSE true + updateTemplateBool templateServerAutosaveOnlyOnServer TEMPLATE_SERVER_SERVER_ONLY_AUTOSAVE true + updateTemplateBool templateServerNonblockingSaving TEMPLATE_SERVER_NONBLOCKING_SAVE false + updateTemplateNumber templateServerMinSegmentSizeCount TEMPLATE_SERVER_MIN_SEGMENT_SIZE 25 + updateTemplateNumber templateServerMinSegmentSizePeer TEMPLATE_SERVER_MIN_SEGMENT_SIZE_PEER 20 + updateTemplateNumber templateServerMaxSegmentSizeCount TEMPLATE_SERVER_MAX_SEGMENT_SIZE 100 + updateTemplateNumber templateServerMaxSegmentSizePeer TEMPLATE_SERVER_MAX_SEGMENT_SIZE_PEER 10 +} + + + +if [[ $FORCE_GENERATE_SETTINGS_FILES ]] +then + + #backup old files using timestamp. + if [[ ! -f $CONFIG/server-settings.json ]] + then + mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json".`date +%Y.%m.%d.%H.%M.%S` + fi + + if [[ ! -f $CONFIG/map-gen-settings.json ]] + then + mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json".`date +%Y.%m.%d.%H.%M.%S` + fi + + if [[ ! -f $CONFIG/map-settings.json ]] + then + mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json".`date +%Y.%m.%d.%H.%M.%S` + fi + + #generate new files. + serverSettings + mapSettings + mapGenSettings + + #move new files into place + cp ./server-settings-template.json "$CONFIG/server-settings.json" + cp ./map-gen-settings-template.json "$CONFIG/map-gen-settings.json" + cp ./map-settings-template.json "$CONFIG/map-settings.json" +else + #call the functions to generate and copy the files from the templates. + if [[ ! -f $CONFIG/server-settings.json ]] + then + # generate settings if server-settings.json doesn't exist + serverSettings + cp ./server-settings-template.json "$CONFIG/server-settings.json" + fi + + if [[ ! -f $CONFIG/map-gen-settings.json ]] + then + mapGenSettings + cp ./map-gen-settings-template.json "$CONFIG/map-gen-settings.json" + fi + + if [[ ! -f $CONFIG/map-settings.json ]] + then + mapSettings + cp ./map-settings-template.json "$CONFIG/map-settings.json" + fi + + +fi + + + diff --git a/0.18/files/docker-entrypoint.sh b/0.18/files/docker-entrypoint.sh index 65089350..92d0f6ec 100755 --- a/0.18/files/docker-entrypoint.sh +++ b/0.18/files/docker-entrypoint.sh @@ -18,18 +18,23 @@ if [[ ! -f $CONFIG/rconpw ]]; then pwgen 15 1 >"$CONFIG/rconpw" fi -if [[ ! -f $CONFIG/server-settings.json ]]; then - # Copy default settings if server-settings.json doesn't exist - cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" -fi +#call the script to create the settings from the template settings json files. +if [[ $GENERATE_SETTINGS_FILES ]]; then + ./create-settings.sh +else + if [[ ! -f $CONFIG/server-settings.json ]]; then + # Copy default settings if server-settings.json doesn't exist + cp /opt/factorio/data/server-settings.example.json "$CONFIG/server-settings.json" + fi -if [[ ! -f $CONFIG/map-gen-settings.json ]]; then - cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" -fi + if [[ ! -f $CONFIG/map-gen-settings.json ]]; then + cp /opt/factorio/data/map-gen-settings.example.json "$CONFIG/map-gen-settings.json" + fi -if [[ ! -f $CONFIG/map-settings.json ]]; then - cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" -fi + if [[ ! -f $CONFIG/map-settings.json ]]; then + cp /opt/factorio/data/map-settings.example.json "$CONFIG/map-settings.json" + fi +fi NRTMPSAVES=$( find -L "$SAVES" -iname \*.tmp.zip -mindepth 1 | wc -l ) if [[ $NRTMPSAVES -gt 0 ]]; then diff --git a/0.18/files/map-gen-settings-template.json b/0.18/files/map-gen-settings-template.json new file mode 100644 index 00000000..bbcd297b --- /dev/null +++ b/0.18/files/map-gen-settings-template.json @@ -0,0 +1,70 @@ +{ + "terrain_segmentation": templateGenTerrainSegmentation, + "water": templateGenTerrainWater, + "width": templateGenMapWidth, + "height": templateGenMapHeight, + "starting_area": templateGenMapStartingArea, + "peaceful_mode": templateGenPeacefullMode, + "autoplace_controls": { + "coal": { + "frequency": templateGenCoalFrequency, + "size": templateGenCoalSize, + "richness": templateGenCoalRichness + }, + "stone": { + "frequency": templateGenStoneFrequency, + "size": templateGenStoneSize, + "richness": templateGenStoneRichness + }, + "copper-ore": { + "frequency": templateGenCopperFrequency, + "size": templateGenCopperSize, + "richness": templateGenCopperRichness + }, + "iron-ore": { + "frequency": templateGenIronFrequency, + "size": templateGenIronSize, + "richness": templateGenIronRichness + }, + "uranium-ore": { + "frequency": templateGenUraniumFrequency, + "size": templateGenUraniumSize, + "richness": templateGenUraniumRichness + }, + "crude-oil": { + "frequency": templateGenCrudeFrequency, + "size": templateGenCrudeSize, + "richness": templateGenCrudeRichness + }, + "trees": { + "frequency": templateGenTreesFrequency, + "size": templateGenTreesSize, + "richness": templateGenTreesRichness + }, + "enemy-base": { + "frequency": templateGenBiterFrequency, + "size": templateGenBiterSize, + "richness": templateGenBiterRichness + } + }, + "cliff_settings": { + "name": "templateGenCliffName", + "cliff_elevation_0": templateGenCliffElevationZero, + "cliff_elevation_interval": templateGenCliffElevationInterval, + "richness": templateGenCliffRichness + }, + "property_expression_names": { + "elevation": "templateGenExpressionElevation", + "control-setting:aux:bias": "templateGenAuxBias", + "control-setting:aux:frequency:multiplier": "templateGenAuxMultiplier", + "control-setting:moisture:bias": "templateGenMoistureBias", + "control-setting:moisture:frequency:multiplier": "templateGenMoistureMultiplier" + }, + "starting_points": [ + { + "x": templateGenStartingPointX, + "y": templateGenStartingPointY + } + ], + "seed": templateGenMapSeed +} diff --git a/0.18/files/map-settings-template.json b/0.18/files/map-settings-template.json new file mode 100644 index 00000000..6903c922 --- /dev/null +++ b/0.18/files/map-settings-template.json @@ -0,0 +1,106 @@ +{ + "difficulty_settings": { + "recipe_difficulty": templateMapDifficultyRecipe, + "technology_difficulty": templateMapDifficultyTechnology, + "technology_price_multiplier": templateMapDifficultyTechPrice, + "research_queue_setting": "templateMapDifficultyResearchQueue" + }, + "pollution": { + "enabled": templateMapPollutionEnabled, + "diffusion_ratio": templateMapPollutionDiffusionRatio, + "min_to_diffuse": templateMapPollutionMinToDefuse, + "ageing": templateMapPollutionAgeing, + "expected_max_per_chunk": templateMapPollutionExpectedMaxPerChunk, + "min_to_show_per_chunk": templateMapPollutionMinToShowPerChunk, + "min_pollution_to_damage_trees": templateMapPollutionMinToDamageTrees, + "pollution_with_max_forest_damage": templateMapPollutionMaxForestDamage, + "pollution_per_tree_damage": templateMapPollutionPerTreeDamage, + "pollution_restored_per_tree_damage": templateMapPollutionRestoredPerTreeDamage, + "max_pollution_to_restore_trees": templateMapPollutionMaxToRestoreTrees, + "enemy_attack_pollution_consumption_modifier": templateMapPollutionBiterAttackModifier + }, + "enemy_evolution": { + "enabled": templateMapEvolutionEnabled, + "time_factor": templateMapEvolutionTimeFactor, + "destroy_factor": templateMapEvolutionDestroyFactor, + "pollution_factor": templateMapEvolutionPollutionFactor + }, + "enemy_expansion": { + "enabled": templateMapExpansionEnabled, + "min_base_spacing": templateMapExpansionMinBaseSpacing, + "max_expansion_distance": templateMapExpansionMaxExpansionDistance, + "friendly_base_influence_radius": templateMapExpansionFriendlyBaseRadius, + "enemy_building_influence_radius": templateMapExpansionBiterBaseRadius, + "building_coefficient": templateMapExpansionBuildingCff, + "other_base_coefficient": templateMapExpansionOtherBaseCff, + "neighbouring_chunk_coefficient": templateMapExpansionNeighbourChunkCff, + "neighbouring_base_chunk_coefficient": templateMapExpansionNeighbourBaseChunkCff, + "max_colliding_tiles_coefficient": templateMapExpansionMaxCollidingTilesCff, + "settler_group_min_size": templateMapExpansionSettlerGroupMin, + "settler_group_max_size": templateMapExpansionSettlerGroupMax, + "min_expansion_cooldown": templateMapExpansionMinCooldown, + "max_expansion_cooldown": templateMapExpansionMaxCooldown + }, + "unit_group": { + "min_group_gathering_time": 3600, + "max_group_gathering_time": 36000, + "max_wait_time_for_late_members": 7200, + "max_group_radius": 30.0, + "min_group_radius": 5.0, + "max_member_speedup_when_behind": 1.4, + "max_member_slowdown_when_ahead": 0.6, + "max_group_slowdown_factor": 0.3, + "max_group_member_fallback_factor": 3, + "member_disown_distance": 10, + "tick_tolerance_when_member_arrives": 60, + "max_gathering_unit_groups": 30, + "max_unit_group_size": 200 + }, + "steering": { + "default": { + "radius": 1.2, + "separation_force": 0.005, + "separation_factor": 1.2, + "force_unit_fuzzy_goto_behavior": false + }, + "moving": { + "radius": 3, + "separation_force": 0.01, + "separation_factor": 3, + "force_unit_fuzzy_goto_behavior": false + } + }, + "path_finder": { + "fwd2bwd_ratio": 5, + "goal_pressure_ratio": 2, + "max_steps_worked_per_tick": 100, + "max_work_done_per_tick": 8000, + "use_path_cache": true, + "short_cache_size": 5, + "long_cache_size": 25, + "short_cache_min_cacheable_distance": 10, + "short_cache_min_algo_steps_to_cache": 50, + "long_cache_min_cacheable_distance": 30, + "cache_max_connect_to_cache_steps_multiplier": 100, + "cache_accept_path_start_distance_ratio": 0.2, + "cache_accept_path_end_distance_ratio": 0.15, + "negative_cache_accept_path_start_distance_ratio": 0.3, + "negative_cache_accept_path_end_distance_ratio": 0.3, + "cache_path_start_distance_rating_multiplier": 10, + "cache_path_end_distance_rating_multiplier": 20, + "stale_enemy_with_same_destination_collision_penalty": 30, + "ignore_moving_enemy_collision_distance": 5, + "enemy_with_different_destination_collision_penalty": 30, + "general_entity_collision_penalty": 10, + "general_entity_subsequent_collision_penalty": 3, + "extended_collision_penalty": 3, + "max_clients_to_accept_any_new_request": 10, + "max_clients_to_accept_short_new_request": 100, + "direct_distance_to_consider_short_request": 100, + "short_request_max_steps": 1000, + "short_request_ratio": 0.5, + "min_steps_to_check_path_find_termination": 2000, + "start_to_goal_cost_multiplier_to_terminate_path_find": 500.0 + }, + "max_failed_behavior_count": 3 +} diff --git a/0.18/files/server-settings-template.json b/0.18/files/server-settings-template.json new file mode 100644 index 00000000..458d5587 --- /dev/null +++ b/0.18/files/server-settings-template.json @@ -0,0 +1,33 @@ +{ + "name": "templateServerName", + "description": "templateServerDescription", + "tags": [ + templateServerTags + ], + "max_players": templateServerMaxPlayers, + "visibility": { + "public": templateServerPulicVisibility, + "lan": templateServerLanVisibility + }, + "username": "templateServerUsername", + "password": "templateServerPassword", + "token": "templateServerGameToken", + "game_password": "templateServerGamePassword", + "require_user_verification": templateServerRequireUserVerification, + "max_upload_in_kilobytes_per_second": templateServerMaxUploadCount, + "max_upload_slots": templateServerMaxUploadSlots, + "minimum_latency_in_ticks": templateServerMinimumLatenctInTicks, + "ignore_player_limit_for_returning_players": templateServerIgnoreLimitForReturning, + "allow_commands": "templateServerAllowCommands", + "autosave_interval": templateServerAutosaveInterval, + "autosave_slots": templateServerAutosaveSlots, + "afk_autokick_interval": templateServerAFKAutokickInterval, + "auto_pause": templateServerAutoPause, + "only_admins_can_pause_the_game": templateServerOnlyAdminsPause, + "autosave_only_on_server": templateServerAutosaveOnlyOnServer, + "non_blocking_saving": templateServerNonblockingSaving, + "minimum_segment_size": templateServerMinSegmentSizeCount, + "minimum_segment_size_peer_count": templateServerMinSegmentSizePeer, + "maximum_segment_size": templateServerMaxSegmentSizeCount, + "maximum_segment_size_peer_count": templateServerMaxSegmentSizePeer +} From 8ec768867640acc6962e9013cd276dddbc475484 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Fri, 24 Jan 2020 16:35:16 -0500 Subject: [PATCH 21/25] update to prevent globbing and word splitting --- 0.17/files/create-settings.sh | 14 +++++++------- 0.18/files/create-settings.sh | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index c29cc74c..ab201586 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -19,7 +19,7 @@ updateTemplate () { else #Replace the value in the template file with the value in the environment Variable if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then - echo Setting $1 to $val in $TEMPLATE_FILE + echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi sed -i "s/$1/$val/g" "$TEMPLATE_FILE" fi @@ -44,7 +44,7 @@ updateTemplateBool (){ #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then - echo Setting $1 to $val in $TEMPLATE_FILE + echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi else #Replace the value in the template file with the default @@ -70,7 +70,7 @@ updateTemplateNumber (){ #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then - echo Setting $1 to $val in $TEMPLATE_FILE + echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi else #Replace the value in the template file with the default @@ -98,7 +98,7 @@ updateTemplateEmpty(){ #Replace the value in the template file with the value in the environment Variable sed -i "s/$1/$val/g" "$TEMPLATE_FILE" if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then - echo Setting $1 to $val in $TEMPLATE_FILE + echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi fi } @@ -251,17 +251,17 @@ then #backup old files using timestamp. if [[ ! -f $CONFIG/server-settings.json ]] then - mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json".`date +%Y.%m.%d.%H.%M.%S` + mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" fi if [[ ! -f $CONFIG/map-gen-settings.json ]] then - mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json".`date +%Y.%m.%d.%H.%M.%S` + mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" fi if [[ ! -f $CONFIG/map-settings.json ]] then - mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json".`date +%Y.%m.%d.%H.%M.%S` + mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" fi #generate new files. diff --git a/0.18/files/create-settings.sh b/0.18/files/create-settings.sh index c29cc74c..ab201586 100644 --- a/0.18/files/create-settings.sh +++ b/0.18/files/create-settings.sh @@ -19,7 +19,7 @@ updateTemplate () { else #Replace the value in the template file with the value in the environment Variable if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then - echo Setting $1 to $val in $TEMPLATE_FILE + echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi sed -i "s/$1/$val/g" "$TEMPLATE_FILE" fi @@ -44,7 +44,7 @@ updateTemplateBool (){ #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then - echo Setting $1 to $val in $TEMPLATE_FILE + echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi else #Replace the value in the template file with the default @@ -70,7 +70,7 @@ updateTemplateNumber (){ #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then - echo Setting $1 to $val in $TEMPLATE_FILE + echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi else #Replace the value in the template file with the default @@ -98,7 +98,7 @@ updateTemplateEmpty(){ #Replace the value in the template file with the value in the environment Variable sed -i "s/$1/$val/g" "$TEMPLATE_FILE" if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then - echo Setting $1 to $val in $TEMPLATE_FILE + echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi fi } @@ -251,17 +251,17 @@ then #backup old files using timestamp. if [[ ! -f $CONFIG/server-settings.json ]] then - mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json".`date +%Y.%m.%d.%H.%M.%S` + mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" fi if [[ ! -f $CONFIG/map-gen-settings.json ]] then - mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json".`date +%Y.%m.%d.%H.%M.%S` + mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" fi if [[ ! -f $CONFIG/map-settings.json ]] then - mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json".`date +%Y.%m.%d.%H.%M.%S` + mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" fi #generate new files. From fdc575823482f6c8650a0130cadd311454709aa2 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Fri, 24 Jan 2020 16:39:15 -0500 Subject: [PATCH 22/25] remove unnecessary quotes --- 0.17/files/create-settings.sh | 6 +++--- 0.18/files/create-settings.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index ab201586..b80c0de8 100644 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -251,17 +251,17 @@ then #backup old files using timestamp. if [[ ! -f $CONFIG/server-settings.json ]] then - mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" + mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi if [[ ! -f $CONFIG/map-gen-settings.json ]] then - mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" + mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi if [[ ! -f $CONFIG/map-settings.json ]] then - mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" + mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi #generate new files. diff --git a/0.18/files/create-settings.sh b/0.18/files/create-settings.sh index ab201586..b80c0de8 100644 --- a/0.18/files/create-settings.sh +++ b/0.18/files/create-settings.sh @@ -251,17 +251,17 @@ then #backup old files using timestamp. if [[ ! -f $CONFIG/server-settings.json ]] then - mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" + mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi if [[ ! -f $CONFIG/map-gen-settings.json ]] then - mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" + mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi if [[ ! -f $CONFIG/map-settings.json ]] then - mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json"."$(date +%Y.%m.%d.%H.%M.%S)" + mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi #generate new files. From 3adce845b8285a613a823ec431511a98fb889ead Mon Sep 17 00:00:00 2001 From: deef Date: Mon, 27 Jan 2020 22:40:30 -0500 Subject: [PATCH 23/25] make create-settings executable --- 0.17/files/create-settings.sh | 0 0.18/files/create-settings.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 0.17/files/create-settings.sh mode change 100644 => 100755 0.18/files/create-settings.sh diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh old mode 100644 new mode 100755 diff --git a/0.18/files/create-settings.sh b/0.18/files/create-settings.sh old mode 100644 new mode 100755 From 4cf70cda6cff7f7caf7bf4aeeee0a1f5b05e01b9 Mon Sep 17 00:00:00 2001 From: deef Date: Mon, 27 Jan 2020 23:11:57 -0500 Subject: [PATCH 24/25] Fix Unset Variable Error --- 0.17/files/create-settings.sh | 8 ++++---- 0.17/files/docker-entrypoint.sh | 2 +- 0.18/files/create-settings.sh | 10 +++++----- 0.18/files/docker-entrypoint.sh | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/0.17/files/create-settings.sh b/0.17/files/create-settings.sh index b80c0de8..9ce37bba 100755 --- a/0.17/files/create-settings.sh +++ b/0.17/files/create-settings.sh @@ -18,7 +18,7 @@ updateTemplate () { sed -i "s/$1/$3/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the value in the environment Variable - if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + if [[ ${GENERATE_SETTINGS_FILES_DEBUG:-} ]]; then echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi sed -i "s/$1/$val/g" "$TEMPLATE_FILE" @@ -43,7 +43,7 @@ updateTemplateBool (){ then #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" - if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + if [[ ${GENERATE_SETTINGS_FILES_DEBUG:-} ]]; then echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi else @@ -69,7 +69,7 @@ updateTemplateNumber (){ then #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" - if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + if [[ ${GENERATE_SETTINGS_FILES_DEBUG:-} ]]; then echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi else @@ -245,7 +245,7 @@ serverSettings(){ -if [[ $FORCE_GENERATE_SETTINGS_FILES ]] +if [[ ${FORCE_GENERATE_SETTINGS_FILES:-} ]] then #backup old files using timestamp. diff --git a/0.17/files/docker-entrypoint.sh b/0.17/files/docker-entrypoint.sh index 92d0f6ec..9125f908 100755 --- a/0.17/files/docker-entrypoint.sh +++ b/0.17/files/docker-entrypoint.sh @@ -19,7 +19,7 @@ if [[ ! -f $CONFIG/rconpw ]]; then fi #call the script to create the settings from the template settings json files. -if [[ $GENERATE_SETTINGS_FILES ]]; then +if [[ ${GENERATE_SETTINGS_FILES:-} ]]; then ./create-settings.sh else if [[ ! -f $CONFIG/server-settings.json ]]; then diff --git a/0.18/files/create-settings.sh b/0.18/files/create-settings.sh index b80c0de8..5abfdedb 100755 --- a/0.18/files/create-settings.sh +++ b/0.18/files/create-settings.sh @@ -18,7 +18,7 @@ updateTemplate () { sed -i "s/$1/$3/g" "$TEMPLATE_FILE" else #Replace the value in the template file with the value in the environment Variable - if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + if [[ ${GENERATE_SETTINGS_FILES_DEBUG:-} ]]; then echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi sed -i "s/$1/$val/g" "$TEMPLATE_FILE" @@ -43,7 +43,7 @@ updateTemplateBool (){ then #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" - if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + if [[ ${GENERATE_SETTINGS_FILES_DEBUG:-} ]]; then echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi else @@ -69,7 +69,7 @@ updateTemplateNumber (){ then #replace the value in the template file with the argument sed -i "s/$1/$val/g" "$TEMPLATE_FILE" - if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + if [[ ${GENERATE_SETTINGS_FILES_DEBUG:-} ]]; then echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi else @@ -97,7 +97,7 @@ updateTemplateEmpty(){ else #Replace the value in the template file with the value in the environment Variable sed -i "s/$1/$val/g" "$TEMPLATE_FILE" - if [[ $GENERATE_SETTINGS_FILES_DEBUG ]]; then + if [[ ${GENERATE_SETTINGS_FILES_DEBUG:-} ]]; then echo Setting "$1" to "$val" in "$TEMPLATE_FILE" fi fi @@ -245,7 +245,7 @@ serverSettings(){ -if [[ $FORCE_GENERATE_SETTINGS_FILES ]] +if [[ ${FORCE_GENERATE_SETTINGS_FILES:-} ]] then #backup old files using timestamp. diff --git a/0.18/files/docker-entrypoint.sh b/0.18/files/docker-entrypoint.sh index 92d0f6ec..9125f908 100755 --- a/0.18/files/docker-entrypoint.sh +++ b/0.18/files/docker-entrypoint.sh @@ -19,7 +19,7 @@ if [[ ! -f $CONFIG/rconpw ]]; then fi #call the script to create the settings from the template settings json files. -if [[ $GENERATE_SETTINGS_FILES ]]; then +if [[ ${GENERATE_SETTINGS_FILES:-} ]]; then ./create-settings.sh else if [[ ! -f $CONFIG/server-settings.json ]]; then From 6a2eee0536fef5b5bd4f3fd20d497b51f9568299 Mon Sep 17 00:00:00 2001 From: Jeffrey Koehler Date: Sat, 29 Feb 2020 00:42:58 -0500 Subject: [PATCH 25/25] Fix to allow for new 0.18 settings, and to properly check for settings files --- 0.18/files/create-settings.sh | 6 +++--- 0.18/files/map-settings-template.json | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/0.18/files/create-settings.sh b/0.18/files/create-settings.sh index 5abfdedb..fcb4b2a6 100755 --- a/0.18/files/create-settings.sh +++ b/0.18/files/create-settings.sh @@ -249,17 +249,17 @@ if [[ ${FORCE_GENERATE_SETTINGS_FILES:-} ]] then #backup old files using timestamp. - if [[ ! -f $CONFIG/server-settings.json ]] + if [[ -f $CONFIG/server-settings.json ]] then mv "$CONFIG/server-settings.json" "$CONFIG/server-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi - if [[ ! -f $CONFIG/map-gen-settings.json ]] + if [[ -f $CONFIG/map-gen-settings.json ]] then mv "$CONFIG/map-gen-settings.json" "$CONFIG/map-gen-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi - if [[ ! -f $CONFIG/map-settings.json ]] + if [[ -f $CONFIG/map-settings.json ]] then mv "$CONFIG/map-settings.json" "$CONFIG/map-settings.json.$(date +%Y.%m.%d.%H.%M.%S)" fi diff --git a/0.18/files/map-settings-template.json b/0.18/files/map-settings-template.json index 6903c922..003cb83c 100644 --- a/0.18/files/map-settings-template.json +++ b/0.18/files/map-settings-template.json @@ -100,7 +100,9 @@ "short_request_max_steps": 1000, "short_request_ratio": 0.5, "min_steps_to_check_path_find_termination": 2000, - "start_to_goal_cost_multiplier_to_terminate_path_find": 500.0 + "start_to_goal_cost_multiplier_to_terminate_path_find": 500.0, + "overload_levels": [0, 100, 500], + "overload_multipliers": [2, 3, 4] }, "max_failed_behavior_count": 3 }