Sunday, July 14, 2013

Pioneers - Map editor, .game files location, and folder permissions

Pioneers is a game based on the Settlers of Catan, with multiplayer support and a map editor. However, the instructions for creating/saving/using your own maps is a bit lacking


Map editing and permissions

Default .game maps are stored in /usr/local/share/games/pioneers/ (in Ubuntu 10.04 at least), so this is where I put custom maps for the longest time. However, you must have su permissions to do this, which is kind of inconvenient. You have to either run the editor with sudo, or copy the map file with sudo. The first option works the best, but neither are options for users who don't have permissions.

Per this discussion post: http://sourceforge.net/p/pio/discussion/15657/thread/5200c3a0/, one option is to put maps in "$XDG_DATA_HOME/pioneers (default: $HOME/.local/share/pioneers)". A user folder, sweet!

Only problem is, this environment variable is not defined by default in Ubuntu. This post helped me to get it working: http://crunchbang.org/forums/viewtopic.php?id=15021, and this is what I ended up doing:

Edit config file:
gedit ~/.config/user-dirs.dirs
Add line to define environment variable, then save file:
XDG_DATA_HOME="$HOME/.local/share"
Edit your .profile file:
gedit ~/.profile
Add this block of code at the end, then save file:
if [ -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs ]; then
  . ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs
  export XDG_DATA_HOME
fi

Create the folder in your user directory. Open a Terminal window (Application > Accessories > Terminal), and type:
mkdir -p ~/.local/share/pioneers
Log out / restart for changes to take effect.

When you go to save a map, I think it will take you directly to the folder. If not, you can make a link in Nautilus (the file browser). Open it up, make sure the location bar is visible (View > Location Bar), then press Ctrl + L (or Go > Location), type ~/.local/share and press Enter. Drag the pioneers folder from the right pane into the left pane at the bottom of the list.

Now, standard users can edit and save custom maps, and they show up when running a server. Tiiight.


* NOTE on v14.1 - Map editor does not save the game's title

This is just a minor note, but in v14.1 the pioneers-editor does not save the title/name of the game if edited from the Comments tab. It can, however, be set from the File > Change Title menu. Or you can edit the .game file with a text editor and manually enter the title. This has been already submitted as a bug, and fixed: http://sourceforge.net/p/pio/bugs/277/, just waiting for a new version of the game to be released.