NEOTOKYO Guide

WINE Neotokyo Server Guide for NEOTOKYO°

WINE Neotokyo Server Guide

Overview

How to run a Neotokyo server under Linux using WINE.

Requirements & Recommendations

The Windows version of the Source Dedicated Server (SRCDS) can be run with a fairly limited Linux install: Although the SRCDS console runs in X, a complete X environment is not required and all administration can be accomplished without a GUI (from your native console interface).

Items below tagged with the <(d)> should ideally be downloaded from your Linux distribution’s repositories using whatever package manager you are comfortable with — NOT directly from the links I am providing.

Requirements
  • SteamCMD (Linux)
  • WINE[www.winehq.org] 1.4 or newer <(d)>
  • Xvfb[en.wikipedia.org] <(d)>

The last item is not required if you already have a complete X environment that you intend to use (by way of VNC or whatever).

Recommendations
  • Vrcon[files.repeatoffender.net]
  • rubycon[github.com]
  • SRCDS Guardian[pastebin.com] – Remove all instances of the “&” (ampersand) character from this file before using.
  • Tofrodos[www.thefreecountry.com] <(d)>
  • x11vnc[www.karlrunge.com] <(d)> or the VNC server of your choice.
  • Fluxbox[fluxbox.org] <(d)> or whatever window manager[en.wikipedia.org] you prefer, but lighter is better.

Install Neotokyo and SRCDS

  1. Download and install SteamCMD for Linux using the Valve wiki page linked above.
  2. Decide where you want to install your Neotokyo server and create that directory. For the purposes of this guide, the Neotokyo server install directory will be: /your/install/directory/here
  3. Start SteamCMD and enter the following:
    @sSteamCmdForcePlatformType windows login anonymous force_install_dir /your/install/directory/here app_update 313600 validate quit

Configure, Start and Stop

  1. Edit the server.cfg in /your/install/directory/here/NeotokyoSource/cfg/
  2. Run wine winecfg to generate a WINE bottle (only needs to be done once).
  3. Use your server’s actual IP in place of 10.10.10.10 below and change whatever other flags you want:
    cd /your/install/directory/here/ Xvfb :1 -screen 0 800x600x8 & export DISPLAY=:1 wine start srcds.exe -console -game NeotokyoSource +ip 10.10.10.10 -port 27015 +maxplayers 32 +exec server.cfg +map nt_dawn_ctg

  4. Give it a few seconds and check your Steam server browser or the server logs under NeotokyoSource/logs
  5. To shut it down:
    pkill srcds.exe pkill wine pkill Xvfb

Enhancements

VNC

Because the Windows CUI version of SRCDS is not fully compatible with WINE (does not work with wineconsole[www.winehq.org]) it will still be running in X rather than your native console. Should you be running Xvfb and need to reach the actual SRCDS console (rather than using rcon) for troubleshooting or other purposes, VNC[en.wikipedia.org] is one way of doing that. For security, run the VNC server on localhost and connect to it via an SSH tunnel.

Starting VNC:

x11vnc -quiet -display :1 -bg -nopw -listen localhost -forever -autoport 5900 &

SSH tunnel (run on your local machine):

ssh -fNL localhost:50900:localhost:5900 [email protected]

This can also be accomplished with PuTTY and other SSH clients.

Then connect to localhost:50900 with your VNC client.

rubycon

This utility can be used to access rcon directly from your native shell (bash, etc.) allowing you to simplify or automate virtually any server task. Here’s a script that uses rubycon to monitor SRCDS for lock-ups (something SRCDS Guardian doesn’t do):

#!/bin/bash # See ~/.config/rubycon/rubycon.yml sn=servername # SRCDS install directory prefix=/your/install/directory/here # The user running SRCDS uzr=username check_errorstatus () { errorstatus=$(rubycon list $sn &> /dev/null ; echo $?) } while : do sleep 5m check_errorstatus if [ “$errorstatus” -gt “0” ]; then sleep 1m check_errorstatus if [ “$errorstatus” -gt “0” ]; then echo -e “n`date` — Server hang detected! Killing SRCDS now…n” 1>>$prefix/ntwatch.log pkill -9 -u $uzr srcds.exe fi fi done

SRCDS Guardian

Command:

wine start cmd /k SRCDS Guardian 3.bat

See warning in the first section of this guide.

An interesting fact about the WINE v1.4 cmd implementation: Anything non-Windows gets passed back to the shell. This is useful if you want a shell script to fire every time SRCDS is automatically restarted, as you can simply edit SRCDS Guardian like so:

::Start the actual server /usr/local/bin/example.sh start /wait %runcmd%

Newer versions of WINE have eliminated this feature, but you can still accomplish the same thing by using the start command with the /unix flag:

::Start the actual server start /unix /usr/local/bin/example.sh start /wait %runcmd%

SourceMod

You will (of course) need to run SourceMod for Windows, which means that if you wish to compile plugins locally it will need to be done under WINE. Happily, WINE has better support for the Pawn compiler than it does for SRCDS so you can use wineconsole for this. Create a batch file in your SourceMod scripting directory named go.bat:

@ECHO OFF spcomp.exe %1 pause

Then create a shell script named go.sh and make it executable:

#!/bin/bash wineconsole –backend=curses go.bat $1

To compile a plugin named example.sp: ./go.sh example.sp

Troubleshooting

If you are experiencing poor performance (50% CPU use with an empty server) try this older version of SRCDS: [link]

For other issues, use these steps in order:

  1. Google any errors you get.
  2. See the Troubleshooting section of Rain’s guide and follow the instructions there:
    [link]
SteamSolo.com