Skip to content

Command line ​

Un-Banished is four programs. To play, you only need the first one, and at most one argument.

ProgramWhat it is for
unbanishedThe game. With options, it also runs without a window: for screenshots, tests and recordings.
unbanished-modsThe mod manager: turn mods on and off, set their order, then play.
unbanished-cliMods from Nexus Mods and banishedinfo.com, and the game's sounds as MP3 files.
unbanished-serverThe server that connects the players of a multiplayer game.

After cargo build --release, the programs are in target/release/. The examples below write unbanished; from the source folder, that is target/release/unbanished (on Windows, target\release\unbanished.exe).

Play ​

bash
unbanished                                 # find the game data by itself
unbanished "C:\Games\Steam\steamapps\common\Banished\WinData"   # Windows
unbanished ~/Games/Banished/WinData        # macOS or Linux

Without a folder, the game looks for WinData next to the program, then for game-data/original/WinData in the source folder (the copy that tools/extract-assets.sh makes). Your saves and settings are where Saves and settings says.

Vanilla: the original game only ​

bash
unbanished --vanilla

In the browser, add ?vanilla to the game's address. A vanilla run plays only the original game and its own mods (.pkm files). Everything Un-Banished adds is off for that run: there is no Multiplayer button, the Mods window has no Browse tabs for mod sites, and the probe, recordings and the video camera do nothing. Your settings, saves and mods stay as they are.

See which version you have ​

bash
unbanished --version                         # for example: Un-Banished 0.4.0-dd814cb

The Version section explains the number. Give it when you report a problem.

Pictures and runs without a window ​

--boot-capture FILE SECONDS starts the game without a window, runs it for SECONDS and saves the last frame as a PNG. It does not run in real time: 40 seconds of game take a few seconds. Options at a time @T (seconds from the start) click, type, move the camera or run commands, so you can script a whole visit to a town.

bash
# The main menu, 4.5 seconds after the start
unbanished --boot-capture menu.png 4.5

# A new game with the seed 1234: press New, then Ok, and look 16 seconds after the start
UNBANISHED_SEED=1234 unbanished --boot-capture new-town.png 16 \
  --press buttonNew@4.5 --press buttonOk@5

# One of your saves at speed 5, with the map window open, in a large picture
unbanished --boot-capture my-town.png 30 --capture-size 1920x1080 \
  --script "load save-game/Save83.sav@4.5" --script "speed 5@6" \
  --script "open Template/UtilityMap.rsc@25"

# A picture of a map, without starting a game
unbanished --capture map.png --view overview --seed 290 --terrain Valleys --size 0 --month 6

Runs without a window write saves and screenshots into your user folder. To keep them apart from your own, set UNBANISHED_USER_DIR and UNBANISHED_SETTINGS to a scratch folder, as in the next example. The game's README lists every option, and Recording videos makes films from these runs.

Ask the game questions: the probe ​

--probe "COMMAND@T" asks the running game a question at time T, or presses a button, and writes the answer as JSON. It finds buttons by their text. It can count the town's people, buildings and animals. The probe describes every command.

bash
UNBANISHED_USER_DIR=/tmp/ub UNBANISHED_SETTINGS=/tmp/ub/settings.txt UNBANISHED_SEED=1234 \
unbanished --boot-capture /tmp/last.png 20 \
  --probe "click text:New@4.5" --probe "click buttonOk@5" \
  --probe "town@16" --probe "citizens@16" --probe-out /tmp/answers.jsonl
cat /tmp/answers.jsonl
# {"command":"town","ok":{"name":"…","population":19,"adults":10,"children":9,"food":1800,…},"t":16.0}
# {"command":"citizens","ok":{"adults":10,"by_profession":{"laborer":10},…},"t":16.0}

In the browser, the same commands work in the developer console, as await unbanished.town().

Record a game and play it back ​

--record FILE records every command of the next game you load from a save: in the windowed game or in a run without a window. --replay plays the recording again from the same save and checks that the town comes out the same.

bash
unbanished --record my-game.rec              # play; the next game you load is recorded
unbanished --replay save-game/Save83.sav my-game.rec
# identical      (or the first moment where the town differs; the exit code is then 1)

Check that the browser and the desktop agree ​

bash
unbanished --sim-digest save-game/Save83.sav          # 200 seconds at speed 10, a checksum every second

It prints a checksum of the whole town at regular times. The browser version prints the same checksums for the same save (see CROSS-PLATFORM.md).

Mods from the command line ​

bash
unbanished-cli nexus search terrain                    # Nexus Mods: search
unbanished-cli nexus install 19 --to path/to/WinData   # install (needs your API key)
unbanished-cli banishedinfo list --sort downloads      # banishedinfo.com: no account needed
unbanished-cli banishedinfo install 34 --to path/to/WinData
unbanished-mods path/to/WinData                        # the mod manager, with a window

Without --to, mods go to game-data/original/WinData. See Mods and the CLI README.

Run a multiplayer relay ​

bash
unbanished-server                       # listens on 0.0.0.0:7780, the default
unbanished-server 127.0.0.1:7780        # only for games on this computer

Multiplayer explains how players connect to it, and the relay's README how to run it on a server.

Environment variables ​

Set these before the command, for example RUST_LOG=debug unbanished, or with set (Windows Command Prompt) or $env:NAME = "value" (PowerShell).

VariableEffect
UNBANISHED_USER_DIRThe folder that holds Save and Screenshots. The default is Documents/Banished.
UNBANISHED_SETTINGSThe settings file to use instead of your own.
UNBANISHED_SEEDFixes the random numbers of new games and of the menu, so two runs are the same.
UNBANISHED_MENU_SCENEShows this main-menu scene, 0 to 9, instead of a random one.
RUST_LOGHow much the log shows: error, warn, info (the default) or debug.
UNBANISHED_PROFILE1 logs slow frames and frame-time summaries; hitches only slow frames. In the browser, add ?profile to the address. See Performance.
UNBANISHED_THREADSHow many threads loading uses. The default is one for each CPU core; 1 loads on one thread.
UNBANISHED_NEXUS_API_KEYYour Nexus Mods API key (see Mods from Nexus Mods).

The game's README lists a few more, for tests.

Un-Banished 0.6.0-ab22835 is free software under the MIT or Apache-2.0 licence. It is not affiliated with or endorsed by Shining Rock Software.