Specify scenario options from command-line

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

Post Reply
yieldthought
Posts: 6
Joined: February 15th, 2013, 10:03 pm

Specify scenario options from command-line

Post by yieldthought »

After a long break I'm coming back to Wesnoth to try my hand at making some interesting AIs with the new API. One of the things I want to do time and time again is run a scenario from the command-line with e.g. fog of war and scrolling disabled.

I've read the --help and the manpage and tried searching the forums but turned up blank. Is there a way to do this? I thought there was last time I was playing around with this. Am I overlooking something obvious?
mattsc
Inactive Developer
Posts: 1217
Joined: October 13th, 2010, 6:14 pm

Re: Specify scenario options from command-line

Post by mattsc »

If by scenario you mean a MP map/game, then yes, that's possible. Here's a sample command-line syntax:

Code: Select all

path_to_wesnoth_executable -m --controller 1:ai --controller 2:ai --parm 1:fog:no --parm 2:fog:no --parm 1:gold:100 --parm 2:gold:150 --parm 1:village_gold:2 --parm 2:village_gold:2 --ai-config 1:~add-ons/AI-demos/ais/ai_grunt-rush-Freelands-S1.cfg --side 1:Northerners --side 2:Rebels --nogui
I hope that that's reasonably self-explanatory, but let me know if you'd like more explanations. This command uses the Freelands map as the default, you can specify other maps with the --scenario option.

Note that until Wesnoth 1.11.1, the command-line MP code did not do a full setup of a game, so several parameters (e.g. gold, village_gold) did not have the correct default values when omitted, and saves (incl. replay saves) created from those games did not work. That has been fixed in trunk and will be in a released version once 1.11.2 comes out.

Welcome (back) and keep us up to date on your AI development. A bunch of us are very interested in that sort of thing.
yieldthought
Posts: 6
Joined: February 15th, 2013, 10:03 pm

Re: Specify scenario options from command-line

Post by yieldthought »

Thanks mattsc, that's exactly what I was looking for! If nobody minds I'll document some of those on a "testing AIs" wiki page soon. Also: I had wondered why initial gold was 0; thanks for taking the time to mention the bug and fixed version.

Writing Wesnoth AIs was the beginning of my love affair with python back before the vulnerabilities were spotted - my best was a scout-fighter brute force search that beat the Default AI of the day 98% of the time. It felt significantly weaker vs a human player though, which should be a note of caution to anyone else whe gets obsessed with AI vs AI battles!

Right now I'm putting together a nice way to test and visualize the performance of different AIs, will github it and post when there is something worth seeing.

It's good to be back :-)
Post Reply