How to Run a public server

Need help seting up a server, or have a question on how to run one? This is the place.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

How to Run a public server

Post by JeffM »

Ok, so you want to run a server.

First things to ask yourself:

Are you ready to run a public server?
Do you have the bandwidth and computer speed/time to run a server?
Do you have the required computer knowledge to set up a server?
Do you have the time and/or administrators to properly maintain the server?

Running a public server is not a trivial task. It will take a significant amount of bandwidth, and dedicated computer time to run a server. At the current time (2/7/05) there are over 120 servers and over 200 players. The current ratio is about 1 server per 2 players. How will your server be different then these? What will draw people to your server rather than the others? These are all questions you should ask yourself.

The most popular public servers are on high speed internet connections, strongly administered, and use fun and exciting maps. While a 100 shot 'uber death' server may sound like a blast right now, the joy will wear off fast.

Bandwidth wise bzflag uses about 5kb per second per player. The more players that you have the more bandwidth you need. Public servers should always be on dedicated high speed internet connections, with large amounts of "upstream" or "sending" bandwidth. The server's job is to send data out to all the clients. The amount of data the server receives from other clients is a smaller percentage then the data it sends. The general idea is that a server multiplies any data sent to it, by sending it to every other player...so on a 5 player game, every message a player sends in, is sent out by the server 4 more times.

In general internet connections can be broken into the following categories

Dialup
This is a connection over a regular phone line using a regular old modem.
Dialup connections are limited to 3-4k per second transfer, which is very, very slow.
In general you do NOT want to run a server on this type of connection. You will be able to barely support a single player.

DSL (Digital Subscriber Line)
Most DSL systems these days are fast enough to run small servers of 4 - 6 players. DSL connections always have 2 speeds, one is the "downstream" and one is the "upstream". The downstream is almost always higher. The bigger your upstream is, the more players you can run.

Cable (Cable Modem)
Cable modems can offer a large amount of bandwidth, with some caveats. Cable modems are shared bandwidth. This means that you are not the only one using it. This can make your bandwidth fluctuate greatly, and this is usually bad for servers. Most new cable modems are "locked" at 128k upstream bandwidth. This will limit you to 3-5 players. Also a number of cable providers do not allow servers for home use, and may have systems that would block a game server.

T1 or larger dedicated connection
This is almost always a corporate class internet connection. They almost always have the same speeds both upstream and downstream. These connections make the best servers that can host the most people. They also are the most expensive. BZFlag requires direct access to the computer that is hosting a server, so no, you can't run a server on your ISP's web host, even though they have a very very fast connection.

The last thing to think about in your networking set up is, do you have a firewall or router?
The server will need a direct port to the internet to listen for new players. Most systems these days have a firewall installed, or are behind a router, or internet sharing system. These systems will block all unknown incoming signals in an attempt to protect your computer. In the game's case you WANT the bzflag traffic to come in so you can host the game. For Firewalls this means opening up a hole in the firewall on the PORT you wish bzflag to use for your server. On a router, or internet sharing system, this means setting up a STATIC ROUTE (or PORT FORWARD), that tells the router not only what packets to let in, but what computer on your network to sent them to. The best way to find out how to do this is to read the manual and documentation on your router/firewall. You'll also need to know the administrative password to your router or firewall, so if you don't have access to it, you can forget about it. The default port for bzflag is 5154. This is the best port to start with.

The next thing to do is to decide how you want to run the server, and under what OS. The best public servers are online 24/7. This means they run on computers that are not restarted, and are generally not used for other intensive tasks. The most popular Operating System for servers is Linux. It offers great remote administration abilities, runs well on cheap hardware, and has a good uptime history. A few servers are running on Windows. Having less remote abilities, and a less stable uptime record means you may have to spend more time managing the server. Windows servers generally need to be restarted more frequently. The server will run on any OS that bzflag supports. Some OSs are more stable then others. A Linux server is generally going to be better than a Windows 95 server.

If you have got this far and are set to run a server, welcome to the world of hosting.

The program you need to run is called "BZFS" (or bzfs.exe on Windows), this stands for BZFlag Server. The program comes with every source release, and the Windows and Mac binary releases. Some Linux binary packages may not contain it, so you may need to download a separate "server" package (for debian-based distros in particular, bzflag-server is necessary). BZFS is a command line application, so it takes its parameters from a terminal (or "dos box" for you old school windows users).

Linux users should be very used to the command prompt. If you use Linux and are not, then you should probably learn a bit more about how your OS works.

On windows NT/2000/XP you can get to the command prompt by going to the START menu, choosing RUN, then type in CMD, then hit the OK button. This will bring up a black box with a command prompt in it. If you're running an older windows version, type COMMAND instead of CMD; you'll get a similar but less flexible command prompt.

On OSX you can bring up a terminal by going to the applications folder, then the Utilities folder, then choosing the "terminal" application. This will give you a UNIX type terminal shell.

Once you have a terminal up you need to "change directories" to the location where your bzfs is. This is done on all OSs with the "cd" command. But before you can do the cd command you need to know where the server is on your hard disk.

for Windows the default folder is

Code: Select all

	C:\Program Files\BZFlag2.0.0

for Linux the default directory is

Code: Select all

	/usr/local/bin/ (if you installed from source)
               or
	/usr/bin/       (if you installed from an RPM)
	       or
	/usr/games/     (most debian based distributions)
If one doesn't work, try the others.

for Mac OS X the default directory is usually

Code: Select all

	/Applications/BZFlag 2.0.10.app/Contents/osx/
If you installed bzflag in a different directory or have a difrent version then you will need to modify the path to fit.

So to change to the bzflag directory you would execute the cd command followed by the directory you wish to change to.
On windows this would look like this;

Code: Select all

	cd C:\Program Files\BZFlag2.0.0\
*note* if you are on windows, and your command prompt started with a drive letter other then C, you will what to change to the C drive as well as doing the CD command. Just type "C:" then hit enter on the command prompt to do so (without the ").

Now you are ready to start your server. The BZFS server takes a large number of command line options that tell it what type of game to host. These options control things such as the number and types of flags that are in the game, if jumping is allowed, if the server is to be public or private, and almost all other aspects of the game. A full list of the bzfs command options is located here on the bzfs manual page.

There are two ways to give bzfs these options. One is directly on the command line, and the other is via a configuration file. The config file is the preferred method of running a server, since it saves the server options in a file so you don't have to retype them every time you start the server. The game does not come with a config, so you will need to create a config file. The config is simply a text file that you can name anything you want.

Open up your favorite text editor (for example, notepad on windows), and create a text file with the following sample config. This document will use this config for all of it's steps. At the end of the document there will be a section on adding and changing options, so don't worry if you don't like these settings, this is just to help you get started

Code: Select all

	# tell the game to be public, and what text to use in the description field in the public list
	-public "YOUR_NAME_HEREs simple tutorial server"

	# allow for 4 shots at a time per tank
	-ms 4
	
	# allow jumping
	-j

	# allow teleporters
	-t

	# allow ricochet
	+r

	# add 1 shockwave flag
	+f SW

	# add 2 super bullet flags
	+f SB{2}

	# add a GM flag
	+f GM

	# add 3 stealth flags
	+f ST{3}

	# add in some debug logging flags to show status and any errors
	-d
	-d
	-d
Save this file under the name myconfig.txt in your bzflag install directory.

Now what this will do is start a public game, with 4 shots, jumping, teleporters, on a random map, with rico, and some super flags.

Start the server by executing the server from the command line:

Code: Select all

	bzfs -conf myconfig.txt
If all has gone well you should see the startup text for a server. If there are any errors, recheck your config, and your directories to make sure you have them all correct.

Now don't close that terminal. The running server is tied to that terminal, we'll go over how to detach them later.

Start a copy of the bzflag client and join your new server. If everything has gone well then you should be able to join and play on your server. Ask some friends to join to make sure your server is public. Visit http://my.bzflag.org/db/?action=LIST and verify that your server is listed.

If your server is not listed as public, or if outside people can't get to your server, then you need to make sure you have opened up a hole in your FIREWALL (if you have one), or set a PORT FORWARD for port 5154. No players can come from outside until you do this.

That's it, you have a server. All other server options will follow the exact same process, you just change the options in the config and run it.


Additional reading on the subject can be found at the following URLs
BZFlag online help page: http://www.bzflag.org/wiki/GettingHelp
BZFlag online manual pages: http://my.bzflag.org/bzfman.cgi
www.sleepycows.org very nice VISUAL tutorial, for Windows XP
http://shellshock.bzflag.bz/ dutchrais BZFlag info and help site.


Common Questions and Problems:

How do I password protect my server?
add -password SOME_PASS_WORD to your config file, then in game you can use the /password command to register as an administrator.

On Linux, how can I make it so I can close the terminal?
The best way is to run bzfs in a screen session. If you have screen installed, just run screen, start bzfs, then hit CTRL + A + D to detach. You can then close the terminal and bzfs will still run. To get back to the running server, just run screen again with the -r parameter ( screen -r ) and you will reattach to the session.

How do I use a map file?
add -world "SOME_MAP_FILE" to your config with the full path to your map file (e.g. "C:\BZMaps\Map.bzw" If your map is a CTF map, then make sure you also have -c in your config to make it a CTF game, and also -fb if your map has bases that have thickness.


Authors
sid6.7
JeffM2501
DTRemenak
Last edited by JeffM on Thu Aug 14, 2008 12:45 am, edited 4 times in total.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

Please comment/question/correct as needed..

thanks.
ImageJeffM
User avatar
Sir Lance-A-Lot
Private First Class
Private First Class
Posts: 503
Joined: Tue Jun 29, 2004 12:49 am
Location: Amongst my Computers
Contact:

Post by Sir Lance-A-Lot »

wow...amazing....great job Jeff ;)
Image
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

sid6.7 started it, I just cleaned it up and put more steps in it, and DTR checked it over and make sure it was all correct.
ImageJeffM
User avatar
spldart
Lieutenant
Lieutenant
Posts: 212
Joined: Tue Feb 22, 2005 4:08 am
Location: Wandering around, Tx

Post by spldart »

Sir Lance-A-Lot wrote:wow...amazing....great job Jeff ;)
x2 :D

Like a typical noob I missed this thread and did a lot of 'search' ing these boards for alot of the info that was in just this one thread. That and having done some other hosting and network administrations got me muttled through it.

Best post of the whole board for getting started :!:
User avatar
Jormungandr
Private First Class
Private First Class
Posts: 11
Joined: Mon Jan 17, 2005 10:08 pm
Contact:

Minor, but importent...

Post by Jormungandr »

Good job guys, I wrote one of these a while back, but it only covered creating a server on *nix... I spotted this:

"bzfs -config myconfig.txt"

Its the last code statment, where you use the config file to start the server. You may want to specify "-conf" instead of "-config". Other then that, great job putting it together.

<NOTE> Im not sure if bzfs under Windows use -config, under linux "-conf" is used though.


Image
In life there are passengers and drivers... Drivers needed
User avatar
DTRemenak
General
General
Posts: 625
Joined: Thu Jan 16, 2003 4:54 am
Location: U.S.
Contact:

Post by DTRemenak »

Yes, -conf is correct, on all systems. The article has been corrected, thanks.
Hust
Private
Private
Posts: 3
Joined: Sun Apr 03, 2005 4:27 am

Post by Hust »

if it takes 5kb a second, then its taking memory away from your computer? and if so, do u ever get that back? my computer have 145 gig.
User avatar
JeffM
Staff Sergeant
Staff Sergeant
Posts: 5196
Joined: Fri Dec 13, 2002 4:11 am

Post by JeffM »

that's bandwith, not ram. It's K per second out the network line.
ImageJeffM
Guest

Post by Guest »

I read up to the Bit about BZFS and it was a big help. thanks.
/me goes to look up the monthly cost of a T1
1veedo
Private First Class
Private First Class
Posts: 184
Joined: Sat Feb 05, 2005 1:26 am
Location: usa

Post by 1veedo »

If I had T1, I'd be running a server company off my box. I'd probably go get another one, dedicated, and use my personal computer as a secondary resource.

Oh, and I'd have some bandwidth for a couple servers on BZFlag; of course ;)
1veedo (libcurl.so.2) I have version 3!
User avatar
BinarySpike
Corporal
Corporal
Posts: 735
Joined: Mon Mar 28, 2005 11:58 pm
Contact:

Small note!

Post by BinarySpike »

Note: if you have access to start an application on a webhosting company (like Freewebs or Freeservers) you can host it off that. My webhosting costs $30 a month to do that and $300 in damages... so if you have a security but and a hacker messes up your computer then... better get you wallet out. :|
1veedo
Private First Class
Private First Class
Posts: 184
Joined: Sat Feb 05, 2005 1:26 am
Location: usa

Post by 1veedo »

Wait, you mean that

http://members.freewebs.com/

Will host BZFlag servers? Can you tell me how?
My webhosting costs $30 a month to do that and $300 in damages
...and if something happens to thier server I'd haveto pay for it?
1veedo (libcurl.so.2) I have version 3!
User avatar
BinarySpike
Corporal
Corporal
Posts: 735
Joined: Mon Mar 28, 2005 11:58 pm
Contact:

*

Post by BinarySpike »

Freewebs was an example.
(it really can't host a BZ server)

www.macintoshdevelopers.net (my web hosting)
They have like an OC-4 connection (DSL,T1,T3,OC-1,OC-2,OC-4)
(i'm not sure about that though it could be OC-1)

It can, but it costs $30 a month, and $300 if a hacker messes with there server (damages).
(and you have to make a freeware game for mac)


Find a server that has a fast connection (check with you local ISP),
that has hosting services and ask them if you can run an application.

Then they'll get all "blah, blah, blah, blah" because they make BIG bucks
off people that want to host a network.

I don't know the normal costs but they'll have a monthly or anual fee.
and a damages fee for hackers, viruses, etc. etc.

The server will only be off-line when the servers are down (24/7).

BUT, this costs MUCH MONEY!!!!!!!!!
(just because of hackers and viruses :()
CrazyNorman
Private
Private
Posts: 4
Joined: Thu Mar 24, 2005 2:28 am

No-Ip

Post by CrazyNorman »

For those of you with dynamic IP addresses, No-ip.com is perfect. Last time I was running a server, I just gave up because whenever my ISP changed IP's, i'd need to edit/restart my server. This got really annoying. No-ip provides a client (Windows and Linux), which upon IP change modifies the IP a URL redirects to (a free url, provided by them). Its pretty cool, got me a short url, and it provides dynamic updates if my IP changes. This is wonderful for anyone on a dynamic IP.
1veedo
Private First Class
Private First Class
Posts: 184
Joined: Sat Feb 05, 2005 1:26 am
Location: usa

Post by 1veedo »

There is freeware that will do this for any service.

I use DynDNS but have acounts w/ no-ip as well. I scaned the domains for both and decided on "homelinux" which was offered by DynDNS. :lol-old:
1veedo (libcurl.so.2) I have version 3!
User avatar
Discovery
Private First Class
Private First Class
Posts: 179
Joined: Thu Dec 15, 2005 10:08 pm
Location: My Home

Post by Discovery »

SO much!!! I will try though....
SURRENDER!
1veedo
Private First Class
Private First Class
Posts: 184
Joined: Sat Feb 05, 2005 1:26 am
Location: usa

Post by 1veedo »

How much data transfer and disk space do you need to run bzflag? 5kb/user/second could add up.

I'm thinking about searching findmyhosting but I have no idea what to qualify hosts by.
1veedo (libcurl.so.2) I have version 3!
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

Post by Winny »

jeff,

I have a cable modem and on solarflare I can host 30 people (up to 40)

with almost no lag.

(my connection 6mbps down and 800k/s up)


might want to revise that player amount on your first post.
1veedo
Private First Class
Private First Class
Posts: 184
Joined: Sat Feb 05, 2005 1:26 am
Location: usa

Post by 1veedo »

Yeah, I've been looking at my bandwidth usage when my server gets full and 5kb per person doesn't add up. W/ 8 players and 2 observers it was averaging ~20. The peak is at 30 and it never goes higher. I'd say three (to be on the safe side) is a good estimate. (probably 2.5) Of course lag is more on the distance players are but obviously too many will slow it down.

But did you mean kB or kb. ISPs measure their speed in kilibits, not bytes. So that 3m downstream connection is actually .375 of a megabyte per second. 256 up is actually only 32 KB. So where X is actual amount of KB/person/second, this equation holds:

[upstream bandwidth] / (8x) = number of players.

PS: 800/8 = 100 / 3 is 33 Win Xp. /me wishes he had 800 uplink.

When I run giftd, though, sometimes I see my upstream usage reach 48KB. I don't know if it's just a flux in my ISP (it is cable) or if I usually get this much The most I can get in WV is 256.

I'm going to add players and test the 2.5/3 hypothesis (along w/ how much I get).
Last edited by 1veedo on Sat Dec 31, 2005 12:34 am, edited 2 times in total.
1veedo (libcurl.so.2) I have version 3!
User avatar
Winny
Grouchy
Grouchy
Posts: 2381
Joined: Wed Aug 24, 2005 12:27 am
Location: Ottawa eh?
Contact:

Post by Winny »

I know that that is kilobit


800k/s is a kilobit rating
1veedo
Private First Class
Private First Class
Posts: 184
Joined: Sat Feb 05, 2005 1:26 am
Location: usa

Post by 1veedo »

Ok, the verdict. I located a program called nethogs and modified the source to gather the average output. I even took the liberty of testing its results with dslreport's bandwidth tester. It was short 8 out of 206 which isn't very much.

The rseults came from
a) Upload on my server
b) Download on other people's servers.

What I found makes sense: Bandwidth usage per tank increases with the number of tanks -- more taks, more coordiants, chats, bullets, etc to send. The server does, however, peak. At 42arena it wend as low as .6 and as high as 3.5. It only peaks maybe once every three seconds but if there isn't enough bandwidth for it, this will cause lots of lag.

Very few people use no more than 1.5kB per tank.

6 tanks: 1.45075 (42arena.homelinux.com) 9kB
10 tanks: 1.54574 (cyfra.ws) very laggy 15kB
13 tanks: 3.2893 (louman.bzflag.bz) 43kB
17 tanks: 3.04189 (bzflag.blah.pl) 51kB
25 tanks: 7.51698 (204.56.5.208) laggy 187.5kB

Here are some stats from my server:

6 tanks: 8.17556 (1.46259/tank) High ~ 15
10 tanks: 19.827 (1.98 /tank) High ~ 26
12 tanks: 23.0425 (2/tank), very laggy 180 ~ 350 High ~ 29.8938

It just depends on how much is going on in the server. At 42arena there was a lot of action and at cyfra hardly anything was going on (the 42arena map seemed smaller). This is reflected in the 6/10 stats. The server will peak much higher than the average and this is (probably) what you should juge on. If you're using Linux get a superkaramba wiget. It isn't as accurate as nethops but it will give you a good idea about what I mean.
1veedo (libcurl.so.2) I have version 3!
User avatar
The Guardian
Private First Class
Private First Class
Posts: 85
Joined: Fri Jan 06, 2006 8:38 am
Location: Planet Earth

Post by The Guardian »

Can anyone give me an example in in a ".zip" file, with both the cofig file and map?

Thanks in advance,

Martin
cymon
Private First Class
Private First Class
Posts: 15
Joined: Thu Jan 12, 2006 9:15 pm

Post by cymon »

Well, I've got 250 KiloByte per second upload, so that should do it.

Here's an example .conf and map, made by CannonBallGuy. No zip.
Attachments
conf.txt
sample config. Rename to conf.conf
(12.76 KiB) Downloaded 483 times
map.bzw
(4.56 KiB) Downloaded 521 times
User avatar
The Guardian
Private First Class
Private First Class
Posts: 85
Joined: Fri Jan 06, 2006 8:38 am
Location: Planet Earth

Post by The Guardian »

Hi.

Thanks for the example. Now how do I play it on BZFlag?

Thanks,

Martin
Locked