Starting a Server

From wiki
Jump to: navigation, search

The following explains how to start a server and connect to it. Currently, there is no way to start a multiplayer server in-game, nor is there a way to limit a server to just Steam friends.

The developers have stated that they're looking into Steam for multiplayer networking - but this may be some time coming, as they have a very long list of things to do!

For reference, the default port for Staxel is 38465.

If you're looking to start a server, please make sure you read all relevant sections before you start!

Steam Networking

If you're just looking to play with your friends, and you have no need for a dedicated server, this is the section for you. As of Sapling 1.1.37, Steam Networking has been introduced.

  1. If you're hosting:
    • Create a world in single-player
    • In the main menu, click on "Multiplayer", and then "Play With Friends"
    • Select the world that you'd like to play on
    • Invite your friends to play with you using the Steam Overlay, or the friends list - just right-click them in your list and select "Invite to Game".
  2. If you're playing on someone else's world, either:
    • Ask them to invite you to their game
    • Right-click them in your friends list and click "Join Game"

That's all there is to it!

Windows

Staxel is designed with Windows in mind, and this is the easiest platform to host a server on.

If you're inexperienced with server hosting, this is the best option for you.

Requirements

  • A copy of Staxel, either on Steam or the Standalone version
  • The ability to forward a port on your router (this is preferred)

If you're unable to forward ports, you may also use Hamachi. This is detailed towards the end of the Windows section.

Starting the server with Steam

Note: If you're using SteamCMD, skip to the next section.

Starting the server with Steam on Windows is very simple:

  1. Open up steam and find Staxel in your library
  2. Double-click on Staxel or click the play button
  3. Select "Dedicated Server" and click the play button

If you want to play Staxel at the same time, press the "Start game client with Steam" button now. This will open a copy of Staxel for you to play on.

For a list of settings and what they do, please see the Server Configuration section.

Starting the server without Steam

Starting the server with the Standalone version of Staxel is very simple:

  1. Open up the Staxel launcher
  2. Click on the "Server" button

If you want to play Staxel at the same time, press the "Start game client" button now. This will open a copy of Staxel for you to play on.

For a list of settings and what they do, please see the Server Configuration section.

Starting the server with the command-line

If you're working remotely, don't have a screen, or just don't want to use your mouse, you can also start the server from the command-line.

This is a more advanced technique - if you're not confident with your skills on the command-line, it's recommended that you choose one of the first two methods.

  1. Open up a copy of Powershell, or the Windows command prompt (cmd)
  2. Use cd to find your way to wherever you have Staxel installed
  3. Once you've found Staxel's install folder, cd into the bin folder
  4. Run Staxel.Server.exe and the server will start in the command-prompt

Please note: This method will not allow you to configure the server with the Server Wizard. Details on how to configure your server this way can be found in the Server Configuration section.

Installing the server using SteamCMD

If you have a dedicated Windows server, you can simply install and use Steam as you would at home. However, if you'd rather not run Steam all the time, you may prefer to work with SteamCMD instead.

This is a more advanced technique - if you're not confident with your skills on the command-line, it's recommended that you choose one of the first two methods. In fact, if you don't specifically need SteamCMD, please don't use it.

SteamCMD is a command-line application, which allows you to download and install games and game servers from Steam. If you're planning to do this, you may prefer to set up a separate Steam account with only Staxel on it, as you're going to have to save the password to your Steam account on the server if you want to make updates quicker.

Note: This guide assumes that you're installing SteamCMD to C:\steam\steamcmd and storing your games in C:\steam\games. If this isn't the case, remember to modify the paths below!

In short, here's what you'll need to do:

  1. Download a copy of SteamCMD to your computer and extract it
  2. Set up a couple of scripts to make your life easier
  3. Update and login with SteamCMD
  4. Download Staxel
  5. Run the server using the methods explained previously

If you need more detailed instructions:

  1. Download SteamCMD from this link and extract steamcmd.exe to C:\steam\steamcmd.
  2. Add C:\steam to your system's PATH
    • Open This PC (or My Computer on earlier versions of Windows)
    • Right-click a blank section of the window and select Properties
    • Select Advanced System Settings, and then select the Advanced tab in the window that appears
    • Click the Environment Variables button, select the PATH entry in the System Variables section, and hit Edit
      • On newer versions of Windows: Hit the Add button, type C:\steam into the box it gives you and click OK
      • On older versions of Windows: Add the following text to the value: ;C:\steam and click OK - don't forget the semicolon!
    • Click OK and close the windows you just opened
  3. Create a file named steam.bat in C:\steam and insert the contents of this file
  4. Open a command prompt or Powershell, type steam and hit enter - this will download Steam and you will be presented with a Steam> prompt
  5. Use login account_name password to log into your Steam account - follow the instructions given to authenticate with Steam Guard or 2-factor as necessary
  6. Type quit and hit enter to close SteamCMD
  7. Create a file named update_staxel.bat in C:\steam and insert the contents of this file
  8. Replace ACCOUNT_NAME and PASSWORD in the file with your Steam account name and password
  9. Go back to your command prompt or Powershell window, type update_staxel and hit enter - this will download and install Staxel in C:\steam\games\staxel
  10. Open C:\steam\games\staxel\_CommonRedist and install each of the requirements - if you're not planning to actually run the game, then you will not need to install DirectX, but do install everything else
  11. Once these are all installed, you're ready to go - See Starting the server without Steam or Starting the server with the command-line for information on running the server
  12. If you want to update the server at any point, simply stop it and run update_staxel in a command prompt or Powershell again

Hamachi

Please note: Hamachi does impact the performance of your network, and may result in lag for your players. Please only use it as a last resort.

Many thanks to Edy Nelson for writing the original guide for this

If you're planning to do this, make sure your server is not set to Public mode.

  1. Install Hamachi from this page, and make sure anyone that wants to play also installs it
  2. Open a network, or "VPN tunnel"
  3. Give your friends the name of the network, and the password if you set one
  4. Set up your server as explained in the above sections
  5. Give your friends the IPv4 address assigned to you by Hamachi
    • You can right-click your name in Hamachi and click on "Copy IPv4 Address"
  6. Have your friends connect to the address you just sent them

Hamachi can be quite temperamental - it may be advantageous to use something more complicated (for example, Zero Tier One) if you have problems with it.

Linux

While the Staxel server does not have official Linux support, it is possible to at least get the server to run on Linux.

Please note: This is an unsupported setup. There may be stability issues. Additionally, the server will run slower than it would under Windows.

This is only recommended for advanced users!

This guide assumes that you're using Arch Linux, and that you know what you're doing - however, the instructions should also work for other Linux distributions.

Requirements

  1. The wine package (on Arch, this is in the Multilib repository)
  2. The wine-mono package
  3. A decently fast machine - the server is quite intensive on CPU, and Wine only makes things slower
  4. If you're using Steam directly, you may want to use winetricks to install it

Setting up your environment

It's recommended that you run the server in 64-bit mode. While you will see some warnings about 32-bit libraries not working correctly, things should function just fine.

This guide assumes that you're using the default WINEPREFIX (which is ~/.wine) and that you are not forcing it into 32-bit mode with the WINEARCH environment variable.

  1. Open a terminal - this guide assumes you're using bash as your shell, so adapt the commands as needed if you're not
  2. Run wine cfg - this will set up your Wine prefix and open the configuration tool, which you can close once it appears

Installing Staxel with Steam

  1. Install Steam using Wine - you can do this using winetricks, which has Steam under the "Install an application" section
  2. Open Steam and install Staxel in the usual way
  3. Move to the Starting the server section

Installing the Standalone version of Staxel

  1. Outside of wine, download your Standalone copy of Staxel
  2. Copy it to a folder within ~/.wine/drive_c/
  3. Use Wine to install Staxel, you can use winefile to do this
  4. Start up the Staxel launcher and make sure it's up to date
  5. Move to the Starting the server section

Installing Staxel with SteamCMD

If you're working on a "headless" machine - for example, a machine without a screen of it own, or a remote machine that you connect to with SSH - this is the method you want.

  1. Install SteamCMD using your package manager (On arch, it's available from the AUR)
  2. Open a terminal and run sudo steamcmd +quit (use su -c "steamcmd +quit" if you don't have sudo set up)
    • We do this to update SteamCMD, only root is able to do this
  3. Run steamcmd +login ACCOUNT_NAME PASSWORD +quit to login to your Steam account
    • Replace ACCOUNT_NAME and PASSWORD with your Steam login username and password
  4. Create a file named update_staxel.sh and insert the contents of this file
  5. Run chmod +x update_staxel.sh to mark the script you just made as executable
  6. Run ./update_staxel.sh and SteamCMD will download and install Staxel in C:\staxel on your Wine drive
  7. Run wine cmd and then run cd C:\staxel\_CommonRedist to move to Staxel's requirements
  8. Install the Visual C Redistributable with vcredist\2013\vcredist_x64.exe /install /quiet /norestart
  9. Install XNA with msiexec /quiet /i XNA\4.0\xnafx40_redist.msi
  10. Do not install DirectX or DotNet - Installing the latter will completely break your install
  11. Use CTRL + C to exit your cmd session
  12. Move to the Starting the server section

Starting the server

  1. Take note of where you installed Staxel
    • If you installed with Steam as detailed above, it will be in C:\Program Files (x86)\Steam\steamapps\common\Staxel on your Wine drive
    • If you installed the Standalone version of Staxel, by default it installs to C:\Users\YOUR_USERNAME\AppData\Local\Staxel.Launcher, where YOUR_USERNAME is your username on Linux
    • If you installed with SteamCMD as detailed above, it will be in C:\staxel on your Wine drive
  2. To run the server, use wine "path_to_staxel\bin\Staxel.Server.exe", replacing path_to_staxel with wherever you installed Staxel to
    • Remember, when you run things with Wine, you need to refer to them as they would be on Windows, not the direct path you'd use on Linux

Please note: This method will not allow you to configure the server with the Server Wizard. Details on how to configure your server this way can be found in the Server Configuration section.

Server Configuration

For reference, the default port for Staxel is 38465.

There are two ways to configure and run your server, and the one you end up with will depend on the server setup method you followed above.

Configuring with the Server Wizard

The Server Wizard is the recommended way to run a server on Windows. You will be presented with a window which offers a set of configuration options. Below is an explanation of each option:

  • Public: Enabling this will show your server on the public server list. If you don't want strangers joining your server, keep this disabled, or set a password
    • If you're using Hamachi or another virtual LAN solution, make sure this option is disabled, or players won't be able to connect
  • Creative Mode: You can enable or disable Creative Mode here. There are three options:
    • On will force Creative Mdoe to be turned on
    • Off will force Creative Mode to be turned off
    • Keep Server Setting will check the world for the last value of the Creative Mode setting, and use that
  • Server Name: The name of your server on the public server list - if you've turned off the Public option, this will be unavailable
  • Port: The port to listen for connections on - this defaults to 38465, and you shouldn't need to change it under normal circumstances
  • Player Limit: If you'd like to limit the number of players that can be connected at once, you can enter a number here
  • Password: If you want to prevent people from connecting without a password, you can enter that password here
  • Allow unauthenticated players: If you enable this, players that are playing the game in offline mode may connect to the server. This will be greyed out if the server is public. It's not recommended that you enable this as it can make your server insecure
  • Attempt automatic UPnP portforwarding: If your router supports UPnP port-forwarding, this option will attempt to save you some time and have the server forward the port automatically. Unfortunately, this won't work on a majority of routers
  • StorageName: Set this to the name of your world, and don't forget it! If you only ever intend to run a single world on your server, you can leave this blank

You can test your port forwarding settings by clicking the "Test Port" button and waiting for a moment. The box to the right of the button will contain the result of this test. If the test fails, then nobody will be able to connect to your server from machines not on your network!

Once you've verified that your port forwarding is working, take note of the "Your External Server Address" box. This contains the IP address that players can use to connect to your server - this IP will correspond with the IP of the machine you're running the server on.

Note: If you have a dynamic IP address, the address that players need to connect to will change. You can deal with that using a dynamic DNS service, such as no-ip.net. This will give you a domain name instead of an IP address - simply give that domain name to your players.

Those of you with a static IP address can use a domain name pointed to that address as normal.

Once you've finished configuring your server in the server wizard as shown above, you're ready to get started! Click the '"Start Server" button and the server will start up in a new window.

Configuring from the command-line

Configuring your server from the command-line requires you to supply a set of command-line arguments whenever you start up the server. They correspond with the settings found in the Server Wizard above, so look at that section for detailed information on what these settings do.

  • --creative=(false|true): Force Creative Mode to be turned on or off
  • --interface=0.0.0.0: If you need to listen on a specific interface, you can supply it here - Advanced users only!
  • --local=(false|true): Unknown at this time
  • --name=serverName: Set the server name, used when public mode is true
  • --password=password: Set a server password, used on connection
  • --playerlimit=4: Limit the number of players that can be online at once
  • --port=38465: Set the server port to listen for connections on
  • --public=(false|true): Disable or enable public mode
  • --storage=localStorageName: Set the name of the world to use here
  • --upnp=(false|true): Set whether to attempt to use UPnP Port Forwarding
  • --weakAuthentication=(false|true): Set whether to allow unauthenticated users to connect

Remember you do not have to supply every option - you can just supply what you need, and the rest will be defaulted.

Working with mods

Mods are available to use in multiplayer. If you're using mods, then you will also need to install them on the server - You can use the Staxel mod manager in the usual way to do this.

While mods may be downloaded from the server, only cosmetic mods may be obtained in this way at the moment. If you're using a mod that includes any code, you'll need to have each of your users install that mod themselves. Steam Workshop is great for this!

If you installed your server without Steam, you can try Steam Workshop Downloader for downloading Workshop mods.

Server Administration

When your server has been started, don't announce it right away - make sure you connect to the server before anyone else. The reason for this is that the first person to join the server becomes the administrator. Administrators are the only players to get access to Farm Fan's tutorial - everyone else is given a pet house and 750 petals to buy their own tools (once they also speak to Farm Fan).

Admin commands

Administrators also get access to a set of admin commands - note that any arguments in [square brackets] are optional and can be left out

  • /advanceTime amount (0.0-0.1) - Advance time
  • /ban username [reason] - Ban a user from your server
  • /cameraCapture camera_save_file_path - Unknown
  • /cameraCapture - Unknown
  • /cameraPlay [duration (0.0-1.0)] [loop (true/false)] [saved_camera_file_path] - Unknown
  • /cameraReset - Unknown
  • /cameraSave camera_save_file_path - Unknown
  • /cameraStop - Unknown
  • /changeMood increase/decrease (true/false) - Unknown, true/false seems to map to increase/decrease
  • /creative [username] [start_creative_mode (true/false)] - Enable creative mode for a player
  • /creativeMode [on (true/false)] - Enable or disable creative mode for the server
  • /currentTime - Get the current ingame time
  • /describeitem [username] - Unknown
  • /ditto [username] villager_NPC_code - Unknown
  • /doemote emote_name [use_look_at_entity (true/false)] - Emote!
  • /emote emote_name - Emote!
  • /enablecheats - Enable cheats - this will disable Steam achievements!
  • /entityInfo entity_id - Get information about an entity
  • /fly [username] [start_flying (true/false)] - Enable flight for a player
  • /Give all recipes [username] - Give all recipes to a player - TODO: Check syntax
  • /givepetals username amount - Spawn in some extra money for a player
  • /help [command_name] - Get a list of commands, or information about a specific command
  • /kick username - Kick a user from your server
  • /mute username [length_in_minutes (default: 60)] - Mute a player
  • /noclip [username] [start_noclip (true/false)] - Enable flight for a player and allow them to fly through the ground and other solid objects
  • /op username - Give someone else admin access, this will also allow them to do the tutorial with Farm Fan
  • /pe expression_atlas [display_time] - Unknown
  • /plantgrowth - Unknown
  • /playExpression expression_code [display_time] - Play an expression
  • /players - List online players
  • /position [username] - Get the position of a player
  • /qs [start_flying (true/false)] - Unknown
  • /quickStart [start_flying (true/false)] - Unknown
  • /reload - Unknown
  • /resetplayer - Unknown
  • /saveDesign filename - Unknown
  • /saveOutfit filename - Unknown
  • /seed - Get the world seed
  • /spawncoins [username] petal_amount - Spawn some money for a player
  • /spawnitem [username] item (kind/specification {}) - Spawn an item for a player
  • /spawnmaterial [username] material_name - Spawn an item for a player - use the material name from the asset manager
  • /spawntile [username] tile_code - Spawn a tile for a player - use the tile name from the asset manager
  • /stealpetals amount [remove (true/false)] - Unknown
  • /stopTime - Stop time
  • /teleport [username] location (\{0, 0, 0\}) - Teleport a player to a specific location
  • /tileAt [location (\{0, 0, 0\})] - Get information about a tile in a specific location
  • /tp player_1 player_2 Teleport player_1 to player_2
  • /unban username - Unban a user that you banned previously
  • /unmute username - Unmute a user that you muted previously
  • /weather type (sun, rain, snow, storm or weather code) - Change the weather

Stopping the server

When you're done with the server for now or just want to update it, simply press CTRL + C with the server terminal open. This will shut down the server. Please be patient, as the server will take a few moments to save everything!