コマンドラインからのサーバー起動

以前の記事では、TerrariaServer.exeを直接実行して、起動するやり方を載せました。
今回はコンフィグを指定してのサーバー作成方法です。

コンフィグ編集

まずはコンフィグファイルを設定しましょう。

  • Steamフォルダ内
(Steamインストールディレクトリ)\steamapps\common\terraria

にあります。
serverconfig.txtを開いてみましょう。

以下のようなものが表示されるかと思います。
文字化けしてる箇所は、気にせず。

#this is an example config file for TerrariaServer.exe
#use the command 'TerrariaServer.exe -config serverconfig.txt to use this configuration

#the following is a list of available command line parameters:

#-config <config file>				Specifies the configuration file to use.
#-port <port number>				Specifies the port to listen on.
#-players <number> / -maxplayers <number>	Sets the max number of players
#-pass <password> / -password <psawword>	Sets the server password
#-world <world file>				Load a world and automatically start the server.

#Set痴 the max number of players allowed on a server.  Value must be between 1 and 255
maxplayers=20

#Load a world and automatically start the server.
#world=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\world1.wld

#Set the port number
port=7777

#Set the server password
password=

#Set the message of the day
motd=Please don稚 cut the purple trees!

#Sets the folder where world files will be stored
#worldpath=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\
編集項目

『#』になっている箇所はコメントアウトです。

  • 人数設定
#Set痴 the max number of players allowed on a server.  Value must be between 1 and 255
maxplayers=(ゲームに参加する最大人数)
  • 読み込むワールドのファイルの場所
#Load a world and automatically start the server.
#world=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\world1.wld

↓のように編集。OSなどによって異なりますので、自身の環境に合わせてください。

#Load a world and automatically start the server.
world=C:\Users\(ユーザー名)\My Documents\My Games\Terraria\Worlds\world1.wld
  • TerrariaServerで使用するポート
#Set the port number
port=(自身の環境に合わせたポート)
  • サーバーパスワードの設定
#Set the server password
password=(設定したいパスワード)
  • MOTD(サーバーにログインした際に表示される文字列)の設定
#Set the message of the day
motd=サーバーに表示したい文字列。日本語でいけるかと思います。保存する際は、UTF8のほうがいいでしょう。
  • サーバーのMAPファイルをセーブする場所の設定
#Sets the folder where world files will be stored
#worldpath=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\

↓のように編集。

#Sets the folder where world files will be stored
worldpath=C:\Users\(ユーザー名)\My Documents\My Games\Terraria\Worlds\

基本的には読み込むMAPファイルと同じところがいいでしょう。

起動方法

デスクトップなどにテキストを新規作成し、以下のようなコマンドを書き、ファイル名を「TerrariaServer.bat」と設定しましょう。

rem Terrariaのインストールされているディレクトリへ移動する。
cd (Steamインストールディレクトリ)\steamapps\common\terraria

TerrariaServer.exe -config serverconfig.txt

起動してすぐMAPの読み込みが終わりましたら、起動完了です。
以上となります。