Command line parameters: Difference between revisions
(Separate arg type from arg name) |
(helpers) |
||
Line 430: | Line 430: | ||
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: | 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 | /c helpers.write_file('map.txt', helpers.table_to_json(helpers.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: | Then open the script_output folder in the [[user data directory]] and open map.txt - it will look like this: |
Revision as of 19:17, 21 October 2024
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.
-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. Note for mod authors: If an entry is unused and is a table that contains the key/value pair 'ignore' with the value 'true' then the entire entry is ignored. | |
--executable-path | PATH | Override autodetected __PATH__executable. Usually not needed except on very weird systems. |
-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. |
--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. |
--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 | |
--instrument-mod | Name of a mod to enable Instrument Mode | |
--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. Timings are returned in nanoseconds. |
--benchmark-sanitize | only output the final benchmark results | |
--benchmark-ignore-paused | leaves the game paused if it was paused when saved. By default the game is unpaused when a benchmark starts. | |
--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. |
--dump-data | dumps data.raw as JSON to the script output folder and exits. | |
--dump-icon-sprites | dumps all icon sprites as png files to the script output folder and exits. | |
--dump-prototype-locale | dumps all prototypes name and description (if they have a valid value) to the script output folder and exits. | |
--mp-connect | ADDRESS | start factorio and connect to address |
--password | PASSWORD | the password to use when using mp-connect (if any) |
--heavy | run the game in heavy mode if singleplayer with graphics (heavy mode is related to investigating desyncs, see Desynchronization#Using_heavy_mode_command) | |
--load-game | FILE | start Factorio and load a game in singleplayer |
--load-scenario | [MOD/]NAME | start Factorio and load the specified scenario in singleplayer. The scenario is looked for inside the given mod. If no mod is given, it is looked for in the top-level scenarios directory. |
--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 (windows only) | |
--force-d3d | use Direct3D for rendering (windows only) | |
--d3d-adapter | ID | adapter which should be used to initialized Direct3D (windows only) |
--d3d-feature-level | override feature level (11, 10.1, 10) (windows only) | |
--dxgi-blit-model | force Blit presentation mode (windows only) | |
--audio-driver | default = sdl = SDL's WASAPI driver (windows)/SDL's PulseAudio or ALSA driver (linux)/SDL's CoreAudio driver (mac); allegro = Allegro's DirectSound8 driver (windows)/Allegro's PulseAudio, ALSA or OSS driver (linux)/Allegro's OpenAL driver (mac); allegro-via-sdl = Allegro mixer with SDL's WASAPI driver (windows)/not supported (linux + mac) | |
--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: high, normal, low, very-low. low and very-low are deprecated and are migrated to normal. |
--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. | |
--window-size | arg | Desired window resolution. For example "1680x1050". Or "maximized" |
--single-thread-loading | Disables loading of sprites in multiple threads. | |
--cache-sprite-atlas | BOOL | Enable/disable sprite atlas cache. |
--nogamepad | Disable gamepad(controller) support |
--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-bind | ADDRESS:PORT | IP address and 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-authserver-bans | BOOL | Verify that connecting players are not banned from multiplayer and inform Factorio.com about ban/unban commands. |
--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 |
Boolean options
Parameters shown above with a BOOL option must be formatted as [parameter]=true
or [parameter]=false
. For example,
--fullscreen=false
will start the game in windowed (not fullscreen) mode.
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 helpers.write_file('map.txt', helpers.table_to_json(helpers.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 into a new file called 'map-settings.json' in the desired location. Copy the { ...<MAP_GEN_SETTINGS> ... } section section into a new file called 'map-gen-settings.json' in the desired location.