Log On
     
 





WFA AS A SERVICE

By {wf}shadowspawn

This was adapted, changed, totally ripped apart and reconstructed from some documentation I found on how to run a ftp server app, originally by Michael K. Shannon of NETView Communications, Inc.
and Rob Beckers.
Their original writings are so far gone that it would be hard to find their original words, but I liked their design of a 'how-to' document that I used their structure.


Alot of comments I just added because, well, they make sense.

Abstract: During initial network testing it often comes to question how to properly monitor network performance, reliability, and load balancing before a connection gets turned into production in the most efficient and cost-productive manner. During our experience we have found that hardcore gamers will often play on a game server 24 hours a day, seven days a week, from peer nodes and clusters spread throughout the globe. Build a solid game server that is respectable, and the old adage comes true:
 'build it and they will come'. As long as the
base network and server is functioning within specifications, we can recommend further steps to upgrade and/or perform maintenance at points of connectivity that require it. This requires time to build the gaming base and server capacity to handle draw loads of constant 2k/s connections to fully 'saturate the pipes' and troubleshoot packet logs, routing paths or filters.

We use Weapons Factory Quake2 wf4.25 dedicated server or Weapons Factory Arena (Quake3) configuration in this kind of a situation. We use Quake to allow users to access to their gaming dreams for combating other individuals regardless of time zone. Our WF server has to be available 7 days per week, 24 hours per day. Although some may maintain that Linux exhibits more stability and performance gains than Mac or win32, the base win32 at idle with no services running except network, operational and/or administrative gateway launches is extremely fast doing what it has to do. You have a optimized server, stop everything but what is needed to interact, install the service and logoff and you have a stronghold 99% dedicated resource configuration to do nothing but Quake code executions and keep escapists entertained. Utilizing several freely available gaming tools such as PingTool, one may monitor packet reliability at a whim.

I have a custom application that will do this automatically using a GUI, however it is not thoroughly 'idiot' tested and will wrack havoc on a machine if used improperly due to the OS level changes it makes to the registry. This is a cry out to developers, btw.

NOTE WinNT 4.0 Users: Although the graphics utilized within this tutorial is based on a W2K install, these installation instructions work exactly the same for WinNT40 and Win2K. I have confirmed this and if you follow the instructions, log in as the Administrator (Not just with admin privy.), check your paths and spelling, and it'll work fine. Microsoft's WinNT RESKIT includes a very useful utility that allows WinNT users to convert most Desktop applications into a SERVICE application. This basically means that you can run quake2 or quake3 behind the scenes i.e. it doesn't depend on a specific user to log on even if it's the CEO snooping around. 

 

Another real benefit is that a SERVICE application will re-activate itself after the WinNT PC looses power and re-boots itself. Great for running mission critical game servers in an unattended mode, also great for getting useful connectivity logs by extracting 'key' words in the player-entered interactivity logs such as 'lag', p-jack, and other terms discussed in the analysis section.

 

The needed resource kit programs are available for free from Microsoft's FTP site at ftp://ftp.microsoft.com/bussys/winnt/winnt-public/reskit/nt35/i386/. This link points to the NT3.5 resource kit, but all SRVANY related programs will also work under NT3.51, NT4 and W2K.


The WinNT RESKIT's SRVANY kit includes 3 files: SRVANY.EXE, SRVANY.WRI, and INSTSRV.EXE. Here are the steps required to make all this work. It's actually quite easy, just a little tricky. If you have already been wrestling with this implementation and it's not working for you here is the most common problem: Make sure that the setting in the SERVICES APPLET (from the control panel) for your SRVANY Service name is set for LOG ON AS SERVICE and the Allow Service to Interact with Desktop is checked. (Both apply to the Quake2 installation, Other installations may vary).


Here are the steps to a first time installation:

Note: The following presumes that an installation of quake3 dedicated server is already been installed and tested for functionality, and d:\ is your root.

Step 1: Create a directory under your root and call it SRVANY and copy these three files, SRVANY.EXE, SRVANY.WRI, and INSTSRV.EXE into the SRVANY directory.

 
Step 2: Go to the DOS Command prompt and navigate to the SRVANY Directory. At the command prompt TYPE: INSTSRV quake3  d:\srvany\srvany.exe . Notice the second element on the command line quake3. This is the of the service that you will create. Later, you will go to the SERVICE applet in the CONTROL CENTER and will access the service by this name. Cool. In par with Inetinfo. More later.

 


The point here is that since you are creating a name, you can call it anything you want. If everything went well, you should see this message here (click to display screen if you haven't figured out why it's so small already). If you do not get this Message, review everything that you did so far. Make sure that the SRVANY.EXE and the INSTSRV.EXE are in the directory that you specify. Also in this example I have the SRVANY.EXE in my command path since I use it so regularly, so the first time you MUST execute this in your SRVANY directory. This won't work if the administrator account is renamed. Rename it back, then afterwards call it what you will.

 

Yes, I know it's quake3wf2 but it's the only capture i could do.

Step 3: Exit the DOS COMMAND Console, fasten your seat belt and fire up the REGEDT32.EXE. This is dangerous territory. One false move and you can kill your WinNT. Don't let it put you off though, just be careful. Don't mess with other stuff while you're in there for this particular mission. This is the core of your operating system. Well, not actually the core, but the core's roadmap.


Step 4: Open up the HKEY_LOCAL_MACHINE window and double-click on the SYSTEM branch. The branch opens up and you should see the CurrentControlSet branch. Double-click on that one and the Services branch should appear. Double-click on the Services branch and a long list of branches is displayed. Careful, now you are in the snake pit.


Step 5: Scroll down until you find the name of the service that you created. It would be quake3wf if that's the name you chose earlier. OK, so far so good. Double-click on quake3wf and leave this highlighted. Move the cursor up to the EDIT menu bar and Click on Add Key...


Step 6: The Add Key dialog box is displayed. In the "Key Name" text box type: Parameters 
You don't have to enter anything in the "Class" text box. Press OK.


Step 7: Highlight the Parameters Key and bring your cursor to the EDIT menu bar again and click on the Add Value choice.


Step 8: In the Value Name text box type in: Application. From the Data Type list box choose: REG_SZ Now press OK.

 


Step9: The String Editor Dialog box will open up. Enter the full path to the Quake2 executable. In my case its D:\
quake3\quake3.exe
Press OK and get outta there.


Step 10: Highlight the Parameters Key and bring your cursor to the EDIT menu bar again and click on the Add Value choice to add another key. In the Value Name text box type in: AppParameters
From the Data Type list box choose: REG_SZ and press OK

 

Step 11: When the String Editor dialog box opens up add the options you need. In this example they are the +set and +exec options specified in the batch file that is included in the server file. With WFA, look for the properties for the shortcut that launches the dedicated server and copy whatever appears after the executable. For Quake2WF, copy the same information out of the included batch file.

My quake2 example
+set dedicated 1 +set game wf +set gamedir C:\Program Files\quake2\wf +set ctf 1 +exec "shadow.cfg"

My stock WFA example
+set dedicated 2 +set fs_game wfa +set g_gametype 4 +set sv_pure 1 +exec wfa-server.cfg


Step 12: Highlight the Parameters Key and once again bring your cursor to the EDIT menu bar again and click on the Add Value choice to add another key. In the Value Name text box type in: AppDirectory
From the Data Type list box choose: REG_SZ and press OK


Step 13: When the String Editor dialog box opens up add the directory path of the quake2.exe file. Using my example it would be D:\quake3. This is usually where mistakes happen, so make sure you enter the same directory as the exe. Otherwise you will probably start in 'demo' mode.

 

Close it all up and exit the REGEDT32 program. Now you can breathe easy again. The worst is over. Move to the Control Panel, friendly and familiar territory.

Step 14: Open up the SERVICE Applet (In this case the service snap-in within compmgmt.msc, with NT4.0 open the Services applet in the Control Panel) and scroll to the quake3wf line and double click on it. A dialog box opens up. Choose the Startup Type: Automatic (for unattended operation, this will allow Quake3 to be active when there is no one logged on). Allow Service to Interact with Desktop in the Log On As: section. Further on, this can be troublesome as a start-up service unless you want to see the ugly command dialog box show up, but for now check it. After you have this working, who wants to see that anyway? After implementation and testing you can change the desktop interaction settings for optimal performance, see EOF. After you get this working, Telnet/Rcon access is recommended, so learn it thoroughly and you will have no problems.


 

 


Step 15:(Final Step) Press OK, and choose Close in the Services applet. You're done. You can test your setup by shutting down the machine properly and re-booting. Quake2 will be active before you even log on. Try to access the Quake2 Server now from another machine before you log on. Once the log on is complete, the Quake2 service along with all your configurations will be active..

Hint: To stop the Quake2 Server,  stop the services. If you stop from the Services applet, any active connections will be dropped immediately without warning, NOT nice. But the only way to give warning is to rcon into the server, or start the service with the interactive desktop beforehand. Just try to be nice and not belligerent. 



Final Notes:
You may also follow the same steps to run additional servers to the OS, just enter different name(s) for the service(s) (ex:quake2wf, quake3wf
2, quake3qtf) and their respective startup configurations. 

I also must note that doing this in NT4 will peg the processes since the service(s) run real-time, and a simple logon/logoff can have undesirable effects to connected client performance. Below is a simple net graph utilizing Ping Tool with 4 clients connected each with an average ping of 120. The attached Ping Tool client reported an average rate of 38ms before console interaction. Basically it was a different subnet, same provider, 6 hops. The areas in pointed in red were console Logon/Logoff actions using the GUI Explorer. Albeit this happened over a span of 1 second, it is annoying nevertheless.

Logon:

 

Logoff:

 

And yes, by simply logging on and logging off with the explorer shell (with NT4) hogs allot of memory and processes. On most of our servers the shell is a command prompt (cmd.exe) instead of Explorer (explorer.exe), and you should learn command-line regardless.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

change the value of Shell from explorer.exe to cmd.exe. Hereafter if you need Explorer then just type it in at the cmd prompt.

Quake2.exe and quake3.exe were never really meant to be OS level applications. They will gladly take all the power available to it, even on dual processors, because of the design of the NT4 process kernel. To compare, the client only uses 50% at max with dual processors. That's allot of power reserved for one server application, and I am sure a router would drop before the total power or the server application could be realized.
But I digress.


Process management with NT is poor when compared to Linux, and the effects of one dedicated server will affect another. I only maxed out a server by using an old 4.x wf server dll bug and had some clients launch multiple turret grenades and sentries. Like 20 of the turrets and/or 10 sentries on a map will effect one server service, and the effect will spill over to the other services running. The solution is...

W2K: W2K Advanced Server is much better suited at balancing service loads during peak requirements, and adjusts the processor affinity accordingly. It basically dishes out what's needed when it's needed. Depending on the affinity of the task, or the process level, the server will not let more services suffer because one decides to behave badly.

Additionally, Quake3 on W2K will split processes and 'sleep' the application's threads when they are not used. This is part of the OS, and as of yet I haven't found the areas where this is managed. I am sure it will be available within the next Resource Kit o
r once someone discovers it in a knowledge base article.

The W2K Advanced Server has options to automatically restart a service if it stops responding. It also has the option to run a command-line app (such as BLAT) to notify the sysop of failures (Ex: send message to ICQ Email after the third failure, or run a batch file to run BLAT and then restart the service with a netstart, etc). NT4.0 Currently has no built-in restart, however some third party services will operate fine. When a
low-resource third-party program becomes available, this will be implemented.

Additionally, you can control the server easily with ASP... just remember it will take you to a new level of what is needed for permissions for the authentication and user rights, and how to properly apply them... not for the meek. This is how we beta tested the WFA mod plenty of times; the developers would upload the new code to the server, and simply open an authenticated web page (ie only) and press a few buttons; you can even use the file system object and change the target launch config; if you wanted to manage multiple ports on the same machine (or remote management station, etc) you can do whatever you want... without purchasing software or bothering to learn linux. :o

<%
DNSNetbiosName = "Gameserver"
%>
<html>
<header>
<title>Bounce <%DNSNetbiosName%>
</title>
</header>
<body>
<%
Set oService = GetObject("WinNT://" & DNSNetbiosName & "/Quake3wf")

If request.form("StartQ3WF")="Start" Then
oService.start
Response.write(DNSNetbiosName & " has been started")
End If
If request.form("StopQ3WF")="Stop" Then
oService.stop
Response.write(DNSNetbiosName & " has been stoped")
End If
Set oService=nothing
%>
<form method="POST" action="WFASERVICE.asp">
<p>DNS1 <input type="submit" value="Start" name="StartQ3WF">&nbsp; <input
type="submit" value="Stop" name="StopQ3WF"></p>
</form>
</body>
</html>

If you have any problems with the installation, here's a link to Microsoft's Knowledge Base to help you figure out what's wrong. http://support.microsoft.com/support/kb/articles/q152/4/60.asp