LAN versus WAN

Networking for games can be broken down into two broad categories: Local Area Network (LAN) games, which are played on computers connected directly to each other, and Wide Area Network (WAN) games, which are generally played over the Internet.

The issues involved with each are fairly different. In general, though, LAN games are much simpler to design and implement than WAN games; therefore, we will focus on LAN games in this chapter. The big ways LAN and WAN games differ are in the latencies they are required to handle and the ways in which computers are connected to them.

Latencies

Networked data is communicated using packets, which are small discrete chunks of data. Latency is the time it takes a packet of data to travel from the originating machine to the machine or machines by which it is being received. If you think of a network as a hose and a packet of data as a cup of water poured into the hose, the latency is the time it takes the water to come out the other end. The longer the hose, the higher the latency (see Figure 7.1).

On the Internet, packet latencies can get quite large and must be dealt with in a way that does not destroy the user experience. Luckily, in a LAN environment the latencies are small enough that they can be safely ignored.

image from book
Figure 7.1: The latency of water traveling through a hose is determined by the hose length.

Bandwidth

Whereas latency is the time it takes a packet to get from one end of a net connection to another, bandwidth is the number of bytes that can be transferred in a single unit of time. It is typically measured in bytes/second. (The measurement used to be kilobytes; these days it’s more likely to be megabytes.)

Looking at the hose analogy, the width of the hose is the bandwidth. Making it wider means it can deliver more water per second, but it still takes a given water molecule the same amount of time to get from the beginning to the end of the hose (see Figure 7.2).

image from book
Figure 7.2: The bandwidth of water traveling through a hose is determined by the hose’s width.

The bandwidth of the player’s connection to the Internet is often a critical factor in designing WAN games. Again, on the LAN we generally have so much bandwidth available as to make it a non-issue in your code design.

Connection Types

Computers can connect to the Internet in a variety of ways. Today, these include remote connections such as analog (56-K) modems, DSL modems, cable modems, and more direct connections like T1 and T3 lines. Each of these connection types has its own unique properties. In particular, most of the remote methods add unique challenges in terms of latencies and bandwidth.

Desktop computers connected to a LAN are all connected through either an Ethernet port or a wireless Ethernet connection (80211.b or 80211.g). Both of these connections add trivial latencies and support bandwidths much wider than games require.



Practical Java Game Programming
Practical Java Game Programming (Charles River Media Game Development)
ISBN: 1584503262
EAN: 2147483647
Year: 2003
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net