Command line parameters: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
mNo edit summary
(added Creating the json files from a map exchange string)
Line 1: Line 1:
__TOC__
Command line parameters can be used to set settings in the command line before the game launches, this is useful mainly for advanced users or server hosts. This page pertains to version 0.17.67.
Command line parameters can be used to set settings in the command line before the game launches, this is useful mainly for advanced users or server hosts. This page pertains to version 0.17.67.


Line 302: Line 304:
"C:\Program Files\Factorio\bin\x64\Factorio.exe" --generate-map-preview preview-seed123.png --map-gen-settings map-gen-settings.json --map-gen-seed 123
"C:\Program Files\Factorio\bin\x64\Factorio.exe" --generate-map-preview preview-seed123.png --map-gen-settings map-gen-settings.json --map-gen-seed 123
</pre>
</pre>
==== Creating the JSON files from a map exchange string ====
It can be useful to create the initial JSON files from a known map exchange string instead of creating them from scratch. To convert the map exchange string to JSON, open the game and run the following command with your map exchange string:
/c game.write_file('map.txt', game.table_to_json(game.parse_map_exchange_string(<your exchange string here>)))
Then open the script_output folder in the [[user data directory]] and open map.txt - it will look like this:
{"map_settings":{ ...<MAP_SETTINGS> ... },"map_gen_settings":{ ...<MAP_GEN_SETTINGS>... }}
Copy the { ...<MAP_SETTINGS> ... } section and create the new file called 'map-settings.json' in the desired location, copy the { ...<MAP_GEN_SETTINGS> ... } section and create the new file called 'map-gen-settings.json' in the desired location.


== See also ==
== See also ==
* [[Console]]
* [[Console]]

Revision as of 12:48, 30 October 2019

Command line parameters can be used to set settings in the command line before the game launches, this is useful mainly for advanced users or server hosts. This page pertains to version 0.17.67.

General options
-h, --help display help
--version show version information
-v, --verbose enable verbose logging
-c, --config PATH config file to use
--no-log-rotation don't rotate log file
--mod-directory PATH Mod directory to use
--check-unused-prototype-data Print a warning for all prototype values that were not accessed.
--executable-path PATH Override autodetected __PATH__executable. Usually not needed except on very weird systems.
Running options
-s, --map2scenario arg map to scenario conversion
-m, --scenario2map arg scenario to map conversion
--apply-update arg immediately apply update package
--create FILE create a new map
--map-gen-settings FILE Map generation settings for use with --create, --start-server-load-scenario or --generate-map-preview. See data/map-gen-settings.example.json
--map-gen-seed SEED Map generation seed for use with --create, --start-server-load-scenario or --generate-map-preview. Will override seed specified in map gen settings
--map-gen-seed-max SEED Map generation seed for use with --generate-map-preview to generate multiple previews using every second seed in the interval from map-gen-seed to map-gen-seed-max.
--map-settings FILE Map settings for use with --create or --start-server-load-scenario. See data/base/prototypes/map-settings.lua
--preset arg Name of the map generation preset to be used.
--enable-runtime-autoplace-modification Allows changing autoplace specifications runtime in non-multiplayer non-replay enabled games for debug purposes.
--generate-map-preview PATH Generate preview images of the map; PATH should name a PNG file or end with a '/' or '\' to indicate a directory.
--generate-map-preview-random COUNT Number of maps to generate with a random seed using --generate-map-preview.
--generate-tile-properties-csv CSVFILE Generate tile properties into a CSV file; can be used with --generate-map-preview
--map-preview-size SCALE Size (in pixels) of map preview (default: 1024)
--map-preview-scale SCALE Scale (meters per pixel) of map preview (default: 1)
--map-preview-offset X,Y Offset of the center of the map, in meters (default: 0,0)
--noise-outputs TAG,TAG... Indicate which variables of noise program to output
--slope-shading SHADEAMOUNT Apply elevation shading to map preview
--slope-shade-property SHADEPROP Property to apply slope shading to (default: elevation)
--report-quantities PROTOTYPE,... When generating map preview, report approximate quantities of the named entity prototypes
--threads THREADCOUNT Number of threads to use when generating map previews
--disable-migration-window Disables the gui that is shown when opening a save with migrated content
--start-server FILE start a multiplayer server
--start-server-load-scenario [MOD/]NAME start a multiplayer server and load the specified scenario. The scenario is looked for inside the given mod. If no mod is given, it is looked for in the top-level scenarios directory.
--start-server-load-latest start a multiplayer server and load the latest available save
--until-tick TICK run a save until given map tick
--benchmark FILE load save and run benchmark
--benchmark-ticks N number of ticks for benchmarking. Default is 1000
--benchmark-runs N how often the number of ticks will be run, map will reload after each run. Default is 1
--benchmark-verbose timings comma separated list of Update timings to output each tick. "all", "timestamp" as well as all other values seen in the debug show-time-usage view's Update section are allowed here. An empty string disabled verbose benchmarking.
--output-perf-stats FILE path of file to which rendering performance statistics measurements should be saved. Special tags {api}, {hw}, {time} and {tag} will be replaced.
--mp-connect ADDRESS start factorio and connect to address
--heavy run the game in heavy mode
--load-game FILE start Factorio and load a game in singleplayer
--benchmark-graphics FILE load save and run it with graphics for benchmark-ticks number of ticks as normal game would
--benchmark-frame FILE load save and benchmark graphics rendering of single frame (prepare + render) without updating the game
--force-opengl use OpenGL for rendering
--force-d3d use Direct3D for rendering
--d3d-adapter ID adapter which should be used to initialized Direct3D
--d3d-feature-level override feature level (11, 10.1, 10)
--dxgi-blit-model force Blit presentation mode
--debug-graphics enables debugging layer for graphics API. If DirectX is used DirectX SDK needs to be installed for this to work.
--fullscreen BOOL start game in windowed mode (saved to configuration)
--max-texture-size N "maximal size of texture that the game can use (saved to configuration). Should be power of two greater than 2048
--graphics-quality arg accepted values: normal, low, very-low
--video-memory-usage arg accepted values: all, high, medium, low
--force-graphics-preset arg accepted values: very-low, low, mac-with-low-ram, medium-with-low-vram, medium, high, very-high, extreme
--gfx-safe-mode resets some graphics settings to values that should work on most configurations
--low-vram sprites that are not put into sprite atlases won't be allocated as texture objects
--shader enable/disable shader postprocessing (saved to configuration)
--disable-audio Disable audio. Mainly for faster startup during development.
--disable-prototype-history Disables tracking which mod created/changed what prototype. Mainly for faster startup during development.
--window-size arg Desired window resolution. For example "1680x1050". Or "maximized"
--single-thread-loading Disables loading of sprites in multiple threads.
Server options
--port N network port to use
--bind ADDRESS[:PORT] IP address (and optionally port) to bind to
--rcon-port N Port to use for RCON
--rcon-password PASSWORD Password for RCON
--server-settings FILE Path to file with server settings. See data/server-settings.example.json
--use-server-whitelist BOOL If the whitelist should be used.
--server-whitelist FILE Path to file with server whitelist.
--server-banlist FILE Path to file with server banlist.
--server-adminlist FILE Path to file with server adminlist.
--console-log FILE Path to file where a copy of the server's log will be stored
--server-id FILE Path where server ID will be stored or read from

Multiplayer

 --start-server SAVE

Will start a Headless (Dedicated) server, with no GUI.

 --mp-connect ADDRESS

ADDRESS is the IP:port of the remote host. Port is optional. Examples:

 ./factorio --mp-connect 192.168.1.101
 ./factorio --mp-connect 192.168.1.101:2345

As above, port can be specified by placing the port number after a colon in the address.

Creating a map from custom settings

Sometimes it's useful to create a new game with map and/or map generator settings stored in a JSON file rather than going through the in-game map settings screen. One reason is that by editing the settings directly it is possible to set settings outside the range normally available from the GUI.

To do this, Factorio is run from the command-line, and a JSON file containing the map generator settings and a JSON file containing map settings (if customizing them) are needed.

Example for custom generator settings:

{
    "terrain_segmentation": 0.5,
    "water": "2",
    "width": 0,
    "height": 0,
    "starting_area": "normal",
    "peaceful_mode": false,
    "autoplace_controls":
    {
        "coal": {"frequency": 1, "size": 2, "richness": 0.5},
        "copper-ore": {"frequency": "low", "size": "normal", "richness": "high"},
        "crude-oil": {"frequency": "normal", "size": "normal", "richness": "normal"},
        "enemy-base": {"frequency": "normal", "size": "normal", "richness": "normal"},
        "iron-ore": {"frequency": "normal", "size": "normal", "richness": "normal"},
        "stone": {"frequency": "normal", "size": 0, "richness": "normal"},
        "uranium-ore": {"frequency": "normal", "size": "none", "richness": "normal"}
    },

    "cliff_settings":
    {
        "name": "cliff",                
        "cliff_elevation_0": 30,        
        "cliff_elevation_interval": 20, 
        "richness": 1                   
    },

    "property_expression_names":
    {
        "elevation": "0_16-elevation",
        "temperature": "35"
    },
    
    "seed": null
}

Note that this is the same format as MapGenSettings that are modifiable from Lua. Everything in the file is optional.

Creating a custom save:

"C:\Program Files\Factorio\bin\x64\Factorio.exe" --create stuff-seed123.zip --map-gen-settings map-gen-settings.json --map-gen-seed 123

Generating a map preview:

"C:\Program Files\Factorio\bin\x64\Factorio.exe" --generate-map-preview preview-seed123.png --map-gen-settings map-gen-settings.json --map-gen-seed 123

Creating the JSON files from a map exchange string

It can be useful to create the initial JSON files from a known map exchange string instead of creating them from scratch. To convert the map exchange string to JSON, open the game and run the following command with your map exchange string:

/c game.write_file('map.txt', game.table_to_json(game.parse_map_exchange_string(<your exchange string here>)))

Then open the script_output folder in the user data directory and open map.txt - it will look like this:

{"map_settings":{ ...<MAP_SETTINGS> ... },"map_gen_settings":{ ...<MAP_GEN_SETTINGS>... }}

Copy the { ...<MAP_SETTINGS> ... } section and create the new file called 'map-settings.json' in the desired location, copy the { ...<MAP_GEN_SETTINGS> ... } section and create the new file called 'map-gen-settings.json' in the desired location.

See also