Introduction freely available open-source operating systems and packet sniffing tools. Then we look at existing research on daily and weekly player usage trends, trends in server-discovery probe traffic that hit your server whether people play or not, and note some techniques for mapping from IP addresses to geographical location. At the other end of the spectrum is the packet-by-packet patterns hidden in packet size distributions and inter-packet arrival times. In Online Game Traffic Patterns , we look at how to measure traffic patterns at millisecond timescales, and show how these patterns come about in First-Person Shooter (FPS) games the most demanding interactive games available. It is at this level that network operators need to carefully understand the load being put on their network in order to properly configure routers and links for minimal packet loss and jitter. We review how typical FPS packet size distributions are quite different in the client-to-server and server-to-client directions, and how server-to-client packet transmissions are structured as a function of the number of clients. Overall this chapter provides great insight into the burstiness that your network must support if you wish to avoid skewing the latency and jitter experienced by every player. Then in Future Directions , Mark Claypool provides general thoughts on some topics relating to the future of online multi-player games. We particularly focus on the use of wireless technologies, automatic configuration of Quality of Service without player intervention, hybrid client server architectures, cheaters, augmented reality, massively multi-player games, time-shifting games (where you can start and stop at anytime) and new approaches to server discovery. Finally, in Setting up online FPS game servers , we wrap up this book with a practical introduction to installing and starting your own FPS game servers on free, open-source platforms. In particular, we look at the basics of downloading, installing and starting both Wolfenstein Enemy Territory (a completely free team-play FPS game) and Valve s Half- Life 2 (a commercial FPS). In both cases, we discuss the use of Linux-based dedicated game servers, and provide some thoughts on running them under FreeBSD (both Linux and FreeBSD are free, open-source UNIX-like operating systems available for standard PC hardware). We hope you will find this book a source of interesting information and new ideas, whether you are a networking engineer interested in games or a game developer interested in gaining a better understanding of your game s interactions with the Internet. Grenville Armitage (author and editor)
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
Introduction A lot has happened since 1958 when William A. Hinginbotham used an oscilloscope to simulate a virtual game of tennis. Computing technology has made staggering leaps forward in power, miniaturisation and sophistication. High speed international data networks are part of modern, everyday life in what we call the Internet . Our peculiarly human desire for entertainment and fun has pushed the fusion and evolution of both computing and networking technologies. Today, computer games are sold to an increasingly significant market whose annual revenues already exceed that of the Hollywood movie industry. Multi-player games are making greater use of the Internet and the driving demand for better than dial-up access services in the consumer space. Yet many networking engineers are unfamiliar with the games that utilise their networks, as game designers are often unsure of how the Internet really behaves. Regardless of whether you are a network engineer, technical expert, game developer, or student with interests across these fields, this book will be a valuable addition to your library. We bring together knowledge and insights into the ways multi-party/multiplayer games utilise the Internet and influence traffic patterns on the Internet. Multi-player games impose loads on Internet Service Providers (ISPs) quite unlike the loads generated by email, web surfing or streaming content. People s demand for realistic interactivity creates somewhat unique demands at the network level for highly reliable and timely exchange of data across the Internet something the Internet rarely offers because of its origins as a best effort service. Game designers have developed fascinating techniques to maintain a game s illusion of shared experiences even when the underlying network is losing data and generally misbehaving. For those with a background in data networking, we begin with two chapters by Mark Claypool, Early Online and Multi-player Games and Recent Online and Multi-player Games , covering the history of computer games and the various ways in which game- related technology has branched out. From the earliest single-player electronic games, through multi-user dungeons and first-person shooters, to today s emerging augmented- reality games and simulation systems, we have come a long way in 40 years. We cover the definition of multi-player networked games and discuss the meaning of peer-to-peer and client server communication models in the context of game systems. For those readers with a background in game design and development, our next chapter, Basic Internet Architecture , provides a refresher and short introduction to the basics of Internet Protocol Networking and Online Games: Understanding and Engineering Multiplayer Internet Games Grenville Armitage, Mark Claypool, Philip Branch . 2006 John Wiley & Sons, Ltd
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
Setting Up Online FPS Game Servers If you are already connected to the Internet and logged in as root, simply execute: % pkg_add -r linux_base-8 All the necessary files will be automatically retrieved over the Internet to install a compatibility environment based on Red Hat Linux 8.0. This package will also support the WET dedicated Linux server. So, if you have a FreeBSD server available it is entirely reasonable to host Linux-based dedicated game servers on this machine. 12.4.2 Ensuring the Kernel Ticks Fast Enough Most operating systems have some form of internal software clock ticking along at a fixed rate, used by programs that wish to regularly wake up and do something . This is true of Windows, Linux and FreeBSD. (This tick rate is not to be confused with a game server s own internal tick rate, discussed earlier in the book. The two tick rates can be entirely different.) At least up until FreeBSD 5.4, the kernel s own tick timer defaulted to 100 ticks per second. Given the way dedicated game servers are written, this tick rate is way too low. Fortunately, the FreeBSD tick rate can be adjusted without recompiling the kernel. Simply add the following line to the file /boot/loader.conf and reboot the machine. kern.hz=”1000″ Once rebooted the kernel will be ticking 1000 times a second, a much better rate when hosting game servers. (You could even set it faster the limit really depends on how much CPU load your machine can tolerate. There is a small, fixed amount of processing overhead incurred for each tick of the kernel s clock, regardless of what all the applications are doing.) You can check or confirm your kernel s current tick rate with the following command: sysctl kern.clockrate Increasing the kernel s own tick rate is important for any system hosting an online dedicated game server, whether it be Linux, FreeBSD or Windows. The simple fact is that a game server s own activities are generally limited by the kernel s own tick timer. For example, an HL2MP dedicated server on a standard FreeBSD 5.4 host is limited to sending at most (kern.clockrate/2) snapshots per second to each client, regardless of the game server s own tickrate (which defaults to 66). Given a default kernel tick rate of 100, your HL2MP server would be unable to send more than 50 snapshots per second to each client. The game server s own default sv maxupdaterate setting of 60, and default tick rate of 66, are rendered meaningless. Running a FreeBSD server host at, for example, 150 ticks per second would limit the HL2MP server to 75 snapshots per second to each client. Setting the kernel s tick rate to 1000 ensures that sv maxupdaterate, cl updaterate and the HL2MP game server s own tickrate become the proper limiting factors. In summary: the maximum snapshots per second rate to each client is the smaller of sv maxupdaterate, the game server s tickrate, and half the underlying operating system s software tick rate. It is essential to reconfigure your FreeBSD s default 100 ticks per second to something more like 1000 ticks per second.
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
206 Networking and Online Games: Understanding and Engineering Multiplayer Internet Games Once all files have been downloaded, you can launch the dedicated server in a similar fashion to the Linux server. For example, to launch HL2MP with map dm overwatch, LAN-only and rcon password of mypass , use this line: c:hl2serversrcds.exe -game hl2mp -console +map dm_overwatch +sv_lan 1 +rcon_password mypass You may find it useful to create a short batch file that loops forever, automatically restarting the server if it crashes for some reason. 12.3.9 Further Reading It is not really within the scope of this book to provide a tutorial on tweaking server configuration options, as most of them relate to HL2MP game-play, in-game physics, and the VAC system. There are numerous sites around the Internet with suggestions on how to tweak game-play and add mods (modifications). A good place to start would be Valve s own Steam Forums at http://steampowered.com. 12.4 Configuring FreeBSD s Linux-compatibility Mode FreeBSD is popular in many server configurations. With its Linux-compatibility mode FreeBSD makes a good platform for hosting dedicated game servers. In this section, we will discuss two key steps that must be performed before running a dedicated Linux game server under FreeBSD. The first is to ensure the correct Linux-compatibility libraries are installed. The second is to ensure the FreeBSD kernel is ticking fast enough. 12.4.1 Installing the Correct Linux-compatibility Libraries Details of FreeBSD s Linux binary compatibility are described in Chapter 10 of the online FreeBSD documentation [FBLINUX] and will not be repeated here. FreeBSD 5.4 was current at the time of writing, and a number of Linux-compatibility options exist. Linux binary compatibility means that a Linux application (an executable binary file previously compiled under Linux) runs natively on a FreeBSD host. There is no processor emulation occurring compatibility is implemented within the FreeBSD kernel s loader function. When a Linux application is launched, the FreeBSD kernel will re-write sections of the application s internal executable code before starting the program. (The Linux application s calls into the Linux kernel for things like disk access, network access and memory management are replaced with equivalent calls into the FreeBSD kernel.) After the re-writes are complete, the application begins execution as though nothing has happened. Many standard Linux libraries are installed under /compat/linux on the FreeBSD host, enabling dynamically linked applications to operate properly. The main point to recognise is that Linux compatibility is easily configured by installing a Port or Package onto your existing FreeBSD system. A number of different compatibility environments are available, reflecting some different Linux distributions. If you want to run Half-Life 2 dedicated server you will need the libraries based on Red Hat Linux 8.0, rather than the default (as of FreeBSD 5.4) based on Red Hat Linux 7.x.
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
Setting Up Online FPS Game Servers Table 12.4 Server-side settings controlling network traffic Variable Role Default sv minrate Lower bound on rate (the maximum 0 snapshot rate in bytes/second requested by the client) sv maxrate Upper bound on rate (the maximum 0 (unlimited) snapshot rate in bytes/second requested by the client) sv minupdaterate Lower bound on cl updaterate (the 10 client-side requested snapshot rate). Server will send at this rate if cl updaterate is too low sv maxupdaterate Upper bound on cl updaterate (the 60 client-side requested snapshot rate) -tickrate Sets the server s internal tick rate (in ticks 66 per second). Can only be set on the command line Table 12.5 Client-side settings controlling network traffic Variable Role Default rate Maximum data rate (in bytes per second) (depends on client the client wishes to receive snapshot data network setting) from the server cl cmdrate Rate (in packets per second) at which client 30 will send command packets to the server cl updaterate Rate (in packets per second) at which client 20 wishes to receive snapshots from server server on a Windows machine, you should download the Windows equivalent of the dedicated Linux server described in this chapter. Most of the differences exist only in the name of the executable used to launch the server, and the syntax of filenames and pathnames. Valve provides an automatic update tool called hldsupdatetool.exe, located at http:// www. steampowered.com/download/hldsupdatetool.exe. Download this tool and launch it without any options. It will update itself, and is then ready to be used to pull down the server itself. You will be prompted by hldsupdatetool.exe to specify a directory into which you would like to store your dedicated server. Two obvious choices would be C:srcds or C:hl2mp it is up to you. Once the tool has updated itself, launch it again with the same options as for the Linux updater, e.g.: hldsupdatetool.exe -command update -game hl2mp -dir c:hl2server (The primary difference is how we locate and specify directories.)
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Mac Web Hosting services
204 Networking and Online Games: Understanding and Engineering Multiplayer Internet Games Figure 12.9 Using Rcon from within Half-Life 2 client console to access a server at 192.168.10.1: 27015 (client logged in from 192.168.10.99) an error message because the server requires an rcon password. So you set the rcon password with rcon password mypass , and then repeat the rcon status command. Now you receive the server s console output back (seeing that there s one person, the author, on this LAN-only server). You can issue other commands too, such as rcon sv lan to report the status of the LAN-only flag. You only need to enter the rconpassword line once, then use multiple rcon commands as necessary. HL2 s rcon service runs over TCP to the server s game-play port (27015, unless -port was specified when the server started up). Unfortunately, the rcon mechanism has an important weakness. Every time an rcon command is executed, the client sends the rconpassword in clear-text over the Internet along with the requested server-side command. Anyone sniffing the IP network between your client and your server will easily be able to extract your rcon password and begin remotely interfering with your server. For this reason, rcon should only be used from client machines that have direct IP connectivity to the server (or at least have connectivity over a path that can be trusted). At the time of writing XQF [XQF05] did not support rcon to HL2MP servers, although this may well have been added subsequently. 12.3.7 Network Performance Configuration Table 12.4 lists a number of server-side variables and settings affecting the network traffic generated by your server. Server-side variables can be set on the command line or in server.cfg file (except for -tickrate , which must be set on the command line). Table 12.5 lists a number of client-side variables and settings affecting the network traffic generated by your server. The settings in Table 12.4 on the server side can override settings in Table 12.5 requested at the client side. Chapter 10 provides a discussion of the underlying principles. 12.3.8 Running a Windows Server In principle, you can start a listen server from within a Half-Life 2 client on a Windows machine. However, this is really only suitable for private, local games. To host a public
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Adult Web Hosting services
Setting Up Online FPS Game Servers be repeated here. Although HL2MP and Steam use a number of ports, only the game- play port ( -port NNNN ) must be visible to the outside world. For the reasons described earlier, you will need to install a special rule into your NAT-enabled router to ensure unsolicited server-discovery probes from the wider Internet are properly routed to your HL2MP server. If you plan to remotely manage your server with rcon , you will need to put in the same rule for both UDP and TCP traffic. 12.3.6 Monitoring and Administration When started from the command line the game server prints information to the screen and accepts keyboard input in real time, allowing you to monitor server state and modify server configuration parameters. For example, you could type status to find out the names of all clients currently connected, along with their current ping time, IP address and port number. However, you ll usually want to start the game server and then leave returning only occasionally to monitor activities and perhaps modify parameters. For this you need to enable logging and rcon (remote console). To set up logging from your server, the following commands should be in your server.cfg file: log on sv_logsdir “” sv_logfile 1 sv_logecho 1 sv_logdetail 3 sv_logmessages 1 The logdirectoryname. parameter is the name of a directory within which you wish to store your logfiles. If provided as a relative pathname, it is interpreted relative to the hl2mp game directory. For example, when using the hl2 user account described above, sv logsdir logs/todayslogs would result in logfiles being created inside the directory /home/hl2/hl2mp/logs/todayslogs/ . The actual logfiles will be created inside this directory with names Lmmddxxx.log , where mm is the month, dd is the day, and xxx in an integer number starting at 000 and incrementing with every map change. Each logfile will contain date and time stamps of events such as players joining and leaving, their playernames, Steam IDs and the IP address:port from which the client connected. Remote control of your game server is possible through the rcon facility. Rcon is a client-side console command that passes text to the server, and prints the server s output back onto the client s console window. Rcon access to a server is enabled by setting an rcon password with the +rcon password password option when starting your server. For example, to start a LAN-only server with the rcon password of mypass you could use: /home/hl2/hl2mp/% ./srcds_run -game hl2mp -console +map dm_overwatch +sv_lan 1 +rcon_password mypass Figure 12.9 shows how you would then access the server from the console of an HL2 game client already connected to the server. The first use of rcon status resulted in
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Adult Web Hosting services
202 Networking and Online Games: Understanding and Engineering Multiplayer Internet Games srcds run updates the HL2MP server immediately prior to starting. (Internet connectivity is required for autoupdate to work. This option will not be very helpful if you are running aLAN-onlyserveronanisolatednetwork.) 12.3.3 Starting a LAN-only Server Adding the +sv lan 1 option prevents your server from registering as a public server. For example: /home/hl2/hl2mp/% ./srcds_run -game hl2mp -console +map dm_overwatch +sv_lan 1 Your server will still contact the Steam master servers, but will not register as a public server, and will not use Steam to authenticate clients and will not use Valve Anti-Cheat (VAC) to protect the server. The server may be located by players on your local LAN using the LAN game option in their Steam clients. Clients discover servers on their local LAN by broadcasting server-discovery probes (UDP packets sent to IP address 255.255.255.255 with the ASCII text TSource Engine Query in their payloads). Each time a player presses their refresh button in the Steam client s LAN server locator window, six UDP broadcast probes are sent one each to ports 27015, 27016, 27017, 27018, 27019 and 27020 in that order. This normally triggers a response from any of the dedicated servers on the local LAN who are listening on one of these six common HL2MP server ports. A server using, for example, port 27085 would not be visible to the Steam client s LAN search function. A prospective player would need to explicitly name the server by IP address and port number in order to connect. As with WET (discussed earlier in this chapter) if you run a LAN-only game using +sv lan1. and also specify the game server s local IP address with -ip w.x.y.z the server appears to ignore the server-discovery queries being sent to 255.255.255.255. In this case, each client will need to manually specify the server s IP address (w.x.y.z) and port number in order to connect. 12.3.4 Ports You Need Open on Firewalls It is entirely possible you have a firewall between your server and the outside world. If so, you must ensure that the server can send packets outbound to a range of ports. HL2MP seems to need quite a few ports open for clients and servers to operate freely. A dedicated public server has been seen to talk to remote Steam-related servers on ports 27011 (UDP), 27014 (UDP) and 27030 (TCP). UDP port 27020 is required open for Half-Life TV. Inbound access is obviously required to the server s actual game-play port (UDP to 27015, or whatever was set with -port NNN ). If remote administrative access is required (using the rcon function, discussed later) you will also need to enable inbound TCP access to the game-play port. 12.3.5 Dealing with Network Address Translation Running an HL2MP server behind a NAT-enabled router introduces a number of issues. These have largely been discussed earlier in this chapter in relation to WET, and will not
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Adult Web Hosting services
Setting Up Online FPS Game Servers depend largely on your motives for running a server. Detailed descriptions of how to set up various game types are outside the scope of this book.) By default, an HL2MP server will bind itself to UDP port 27015 on the local server host. However, you can explicitly specify an alternative port if another process on the server host is already using port 27015 (for example, another HL2MP server). Player slots should be limited based on your available network capacity and processor speed. Use the discussion in Chapter 10 to estimate your per-player network bandwidth requirements. From within the hl2mp subdirectory, the usual way to start a dedicated server is to execute srcds run with a number of command line options. For example: /home/hl2/hl2mp/% ./srcds_run -game hl2mp -console +map dm_overwatch This particular set of options instructs the server to run the hl2mp game on the default UDP port 27015 and start map dm overwatch . (If no map is specified the server initialises, but does not start operation.) Because of how srcds run is written you must run this command from within the directory in which you installed the HL2MP server. By default, the server will look for a configuration file named server.cfg under ./hl2mp/cfg (relative to the directory in which srcds run is located, which in our example would be at /home/hl2/hl2mp/hl2mp/cfg/server.cfg ). Almost everything that can be configured about the HL2MP server s operation can be specified or overridden in server.cfg. By default, the server will start with two player slots. Adding the +maxplayers N option tells the server to create N player slots. If you are running on a host with multiple IP interfaces, you may wish to explicitly identify which IP interface should be advertised by the HL2MP server. For example, the following command line specifies that the server advertises itself (and only exists on) IP address 192.168.1.50: /home/hl2/hl2mp/% ./srcds_run -game hl2mp -console +map dm_overwatch -ip 192.168.1.50 To run your server on a non-standard UDP port, and bind to a particular IP interface on your local server host, use both the -ip and -port options. For example, to use port 27085 as the port for in-game traffic in a game for 16 players: /home/hl2/hl2mp/% ./srcds_run -game hl2mp -console +map dm_overwatch -ip 192.168.1.50 -port 27085 +maxplayers 16 By default, your server will register with Steam and become available to other players around the Internet. If you happen to be sniffing the network connected to your server, you will see server-discovery probe traffic coming in within minutes (or sometimes only seconds) of starting your server. (You may also see server-discovery probes from the Internet for some period of time after you shut down your public server. It takes time for knowledge of your server s IP and port number to disappear from all the places it was stored when you first registered as a public server.) If you copy the ./steam executable (used to install and update HL2MP) into the same directory as srcds run , you can use the -autoupdate command line option to request that
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Adult Web Hosting services
200 Networking and Online Games: Understanding and Engineering Multiplayer Internet Games /home/hl2% ./steam -command update -game hl2mp -dir hl2mp [..steam downloads roughly 671MByte of hl2 and hl2mp material..] /home/hl2% ls -al hl2mp total 562 drwxr-xr-x 5 hl2 hl2 512 Oct 24 21:50 . drwxr-xr-x 5 hl2 hl2 512 Oct 24 21:50 .. -rw-r–r–1 hl2 hl2 1381 Oct 24 21:52 InstallRecord.blob drwxr-x—2 hl2 hl2 1024 Oct 23 23:36 bin drwxr-x—7 hl2 hl2 512 Oct 23 23:36 hl2 drwxr-x—11 hl2 hl2 512 Oct 23 23:24 hl2mp -rwxr-xr–1 hl2 hl2 183825 Oct 23 23:36 srcds_amd -rwxr-xr–1 hl2 hl2 183793 Oct 23 23:36 srcds_i486 -rwxr-xr–1 hl2 hl2 183793 Oct 23 23:36 srcds_i686 -rwxr-xr–1 hl2 hl2 10164 Oct 23 23:36 srcds_run /home/hl2% Figure 12.7 Using the Steam installer to install a Half-Life 2 multiplayer server /home/hl2% ./steam -command update -game hl2mp -dir hl2mp Checking bootstrapper version … Updating Installation Checking/Installing Half-Life 2 Deathmatch version 11 Checking/Installing Base Source Shared Materials version 7 Checking/Installing Base Source Shared Models version 3 Checking/Installing Base Source Shared Sounds version 3 Checking/Installing Source Dedicated Server Linux version 47 HLDS installation up to date /home/hl2% Figure 12.8 Updating a current hl2mp installation If you want to install Counter-Strike:Source instead (or in addition to), then replace -game hl2mp with -game Counter-Strike Source in the examples above. You must also specify an alternative directory location with the -dir option (otherwise the Counter- Strike:Source software components will likely overwrite some of your hl2mp software components). Because the Steam installer uses a text-based interface you may also do this installation process while remotely logged into the server host from elsewhere (for example, over an ssh connection [SSH2005]). This is most convenient when your server host is already mounted in remote rackspace without a dedicated keyboard and monitor. 12.3.2 Starting the Server for Public Use A couple of technical decisions need to be made before starting your dedicated server. What UDP port will it run on? Is this for local LAN play, or available for anyone on the Internet? What is the maximum number of supportable players? (There are also some game-specific questions you need to consider, such as what game type and map rotation do I want? . In part, these are subjective decisions that
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Adult Web Hosting services