wesnoth program command-line arguments

Having trouble with the game? Report issues and get help here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this section, you must read the following topic:
Post Reply
spir
Posts: 97
Joined: September 15th, 2009, 9:31 am
Contact:

wesnoth program command-line arguments

Post by spir » October 4th, 2009, 6:38 am

Well, everything is in the title, I guess.
I am unable to find a reference to the command-line args for the wesnoth program itself -- not that I haven't tried hard ;-), both on the wiki and the forum, but a search with "command-line" in it always brings topics about the ":" command mode, and only that.

A pointer to a wiki page on the topic would be best.

Actually, what I really look for is to know whether there is a way to run wesnoth in a kind of "autoplay" mode, passing it a (stand-alone) scenario file as argument, eg:

Code: Select all

wesnoth --autoplay=test.cfg
In this case, wesnoth would play the scenario like if a user had manually selected it (must be a scenario with only AI controlers, or else wesnoth plays it with AIs on all sides whatever the "controler=*" key specifies).
This would be great for testing/perfecting/balancing all kinds of UMC; game evolutions, too. It would even allow collecting & processing statistics when run from a script, if ever wesnoth feeds back with result data (eg written into a file).
Denis
life is strange

various stuff about BfW (rules, stats, alternatives) and WML (parser, semantic schema, evolution)

User avatar
Zarel
Posts: 700
Joined: July 15th, 2009, 8:24 am
Location: Minnesota, USA
Contact:

Re: wesnoth program command-line arguments

Post by Zarel » October 4th, 2009, 7:48 am

You realize that you can get help for the command-line arguments of any software by using ./Wesnoth --help, right?

Here's the help for 1.7.5:

Code: Select all

isoleucine:~ zarel$ /Applications/Wesnoth.app/Contents/MacOS/Wesnoth --help
Battle for Wesnoth v1.7.5
Started on Sun Oct  4 02:47:01 2009

usage: /Applications/Wesnoth.app/Contents/MacOS/Wesnoth [<options>] [<data-directory>]
Available options:
  --bpp <number>               sets BitsPerPixel value. Example: --bpp 32
  -c, --campaign               goes directly to the campaign selection menu.
  --config-dir <name>          sets the path of the user config directory to
                               $HOME/<name> or My Documents\My Games\<name> for windows.
  --config-path                prints the path of the user config directory and
                               exits.
  -d, --debug                  enables additional command mode options in-game.
  --dummy-locales              enables dummy locales for switching to non-system
                               locales.
  -e, --editor [<file>]        starts the in-game map editor directly. If <file>
                               is specified, equivalent to -e --load <file>.
  --fps                        displays the number of frames per second the
                               game is currently running at, in a corner of
                               the screen.
  -f, --fullscreen             runs the game in full screen mode.
  --gunzip <infile>.gz         decompresses a file (<infile>.gz) in gzip format
                               and stores it without the .gz suffix.
                               <infile>.gz will be removed.
  --gzip <infile>              compresses a file (<infile>) in gzip format,
                               stores it as <infile>.gz and removes <infile>.
  -h, --help                   prints this message and exits.
  -l, --load <file>            loads the save <file> from the standard save
                               game directory.
                               When launching the map editor via -e, the map
                               <file> is loaded, relative to the current
                               directory. If it is a directory, the editor
                               will start with a load map dialog opened there.
  --log-<level>=<domain1>,<domain2>,...
                               sets the severity level of the log domains.
                               'all' can be used to match any log domain.
                               Available levels: error, warning, info, debug.
                               By default the 'error' level is used.
  --logdomains                 lists defined log domains and exits.
  --max-fps                    the maximum fps the game tries to run at. Values
                               should be between 1 and 1000, the default is 50.
  -m, --multiplayer            starts a multiplayer game. There are additional
                               options that can be used as explained below:
    --ai_config<number>=value  selects a configuration file to load for this side.
    --algorithm<number>=value  selects a non-standard algorithm to be used by
                               the AI controller for this side.
    --controller<number>=value selects the controller for this side.
    --era=value                selects the era to be played in by its id.
    --exit-at-end              exit Wesnoth at the end of the scenario.
    --nogui                    runs the game without the GUI. Must appear before
                               --multiplayer to have the desired effect.
    --parm<number>=name:value  sets additional parameters for this side.
    --scenario=value           selects a multiplayer scenario. The default
                               scenario is "multiplayer_The_Freelands".
    --side<number>=value       selects a faction of the current era for this
                               side by id.
    --turns=value              sets the number of turns. The default is "50".
  --no-delay                   runs the game without any delays.
  --nocache                    disables caching of game data.
  --nomusic                    runs the game without music.
  --nosound                    runs the game without sounds and music.
  --no-srng                    disable server-side RNG support (will cause OOS
                               errors unless every player uses it)
  --path                       prints the path to the data directory and exits.
  -r, --resolution XxY         sets the screen resolution. Example: -r 800x600
  --rng-seed <number>          seeds the random number generator with number
                               Example: --rng-seed 0
  --smallgui                   allows to use screen resolutions down to 800x480
                               and resizes a few interface elements.
  --screenshot <map> <output>  Saves a screenshot of <map> to <output> without
                               initializing a screen. Editor must be compiled
                               in for this to work.
  -s, --server [<host>]        connects to the host if specified
                               or to the first host in your preferences.
  -t, --test                   runs the game in a small test scenario.
  --validcache                 assumes that the cache is valid. (dangerous)
  -v, --version                prints the game's version number and exits.
  -w, --windowed               runs the game in windowed mode.
  --with-replay                replays the file loaded with the --load option.

  --new-storyscreens           enables the new Pango-based storyscreen rendering;
                               it is incomplete and potentially unstable, thus
                               disabled by default.
  --new-widgets                there is a new WIP widget toolkit this switch
                               enables the new toolkit (VERY EXPERIMENTAL don't
                               file bug reports since most are known).
                               Parts of the library are deemed stable and will
                               work without this switch.
Proud creator of the :whistle: smiley | I prefer the CC-0 license.

spir
Posts: 97
Joined: September 15th, 2009, 9:31 am
Contact:

Re: wesnoth program command-line arguments

Post by spir » October 4th, 2009, 9:02 am

You realize that you can get help for the command-line arguments of any software by using ./Wesnoth --help, right?
Yep!
I asked for eg a wiki page, because I would need some clarification/explaination/example for a few of these switches. Especially (these are the ones I may need for the reason evoked in the first post above) some of the keys that go with --multiplayer and the --test switch.

Also, if someone knows about that, is there a way get summary statistics about a played (and finished) scenario?
Denis
life is strange

various stuff about BfW (rules, stats, alternatives) and WML (parser, semantic schema, evolution)

User avatar
Crab
Developer
Posts: 200
Joined: March 18th, 2009, 9:42 pm

Re: wesnoth program command-line arguments

Post by Crab » October 4th, 2009, 7:54 pm

what summary statistics are you interested in ?
If' you're looking for ai-vs-ai test results, try adding --log-debug=ai/testing switch. Also, note utils/ai_test/ai_test.py script (you might want to tweak the pipe buffer size and modify the data collection algorithm).
I used that script together with pgsql db and a php web frontend to see grouped (e.g. per faction, per map) ai-vs-ai stats (see aitest.wesnoth.org). Also, if there's a particular info you find useful to collect, tell me about it - it might be possible to modify wesnoth to output it.

User avatar
trickitiki
Posts: 4
Joined: May 31st, 2018, 3:14 pm

Re: wesnoth program command-line arguments

Post by trickitiki » June 6th, 2018, 9:44 am

I made text note about game args once. I just had saved "wesnoth --help" output into text file and then added some additional explanations (mostly examples) into it. So i'll copy those lines:

Code: Select all

  
  Some args:
  
  --controller arg                selects the controller for this side. <arg> 
                                  should have format side:value
                                  Example: --controller 1:ai --controller 2:null
                                  Default: local player (human)

  --log-error arg                 sets the severity level of the specified log 
                                  domain(s) to 'error'. <arg> should be given 
                                  as comma separated list of domains, wildcards
                                  are allowed. Example: --log-error=network,gui
                                  /*,engine/enemies

  --parm arg                      sets additional parameters for this side. 
                                  <arg> should have format side:name:value.
                                  Examples: 
                                  --parm 1:gold:333 => Set starting gold
                                  --parm 3:user_team_name:lolkas => Set name of side 3. (It does not create new team "lolkas", just change existing label)
                                  Possible param names (not tested yet): shroud,village_gold,canrecruit,fog

  --side arg                      selects a faction of the current era for this
                                  side by id. <arg> should have format 
                                  side:value.
                                  Example: --side 1:Earth_Ponies
                                  Default => random
_________________________________________________________________________________________
Some logdomains (see "wesnoth --logdomains" output for full list):

ai/ca/testing_ai_default	=> More thoughts of bots
ai/recruitment		=> Bots thoughts about recruitment
ai/testing 		=> Declaring bot agents at start, reporting the winner and moves count finally
config			=> Cfg files parsing
engine			=> Game events, such as passed/missed hit (user-readable)
replay 			=> Kinda inner events. Mostly not user-readable but reports some useful info, such as gold amount dynamics
__________________________________________________________________________________________
Avaiable maps (wesnoth/1.12/data/multiplayer/scenarios/*.cfg IDs): 

  [2 players]
multiplayer_elensefar_courtyard

  [3 players]
multiplayer_Island_of_the_Horatii
multiplayer_Alirok_Marsh

  [4 players]
multiplayer_Isars_Cross

  [5 players]
multiplayer_Forest_of_Fear

  [6 players]
multiplayer_Waterloo_Sunset
__________________________________________________________________________________________
Executing examples:

Test logs
wesnoth --log-info=ai/*,general,lobby > ~/Документы/weslog2.txt 2>&1

Do 12 attempts of 3 races bot FFA battle, output into file
wesnoth --nogui --exit-at-end --log-info=ai/testing,replay --multiplayer --multiplayer-repeat 12 --scenario multiplayer_Island_of_the_Horatii --era Hoof-and-Tail --side 1:Earth_Ponies --side 2:Pegasi_Ponies --side 3:Unicorn_Ponies --controller 1:ai --controller 2:ai --controller 3:ai > ~/Документы/wesnoth-bots-12.txt 2>&1

Post Reply