# Netrek

Netrek is an Internet game for up to 16 players, written almost entirely in cross-platform open-source code. It combines features of multi-directional shooters and team-based real-time strategy games. Players attempt to disable or destroy their opponents' ships in real-time combat, while taking over enemy planets by bombing them and dropping off armies they pick up on friendly planets. The goal of the game is to capture all the opposing team's planets.
Developed as a successor to 1986's Xtrek, Netrek was first played in 1988. It was the third Internet game, the first Internet team game, and as of 2022 is the oldest Internet game still actively played. It pioneered many technologies used in later games and has been cited as prior art in patent disputes. Xtrek and Netrek are the oldest games of what is now called the MOBA (multiplayer online battle arena) genre.

## Description

The following describes Bronco Netrek, also known as Vanilla Netrek. Other variations of the game exist, such as Hockey Netrek in which players use tractor beams to manipulate a hockey puck. Paradise Netrek, which originated as a re-implementation of Netrek at Utah State University, has radically different gameplay, including a far larger number of planets, transwarp speed, new ship types, and an additional rank structure. However, Bronco is the most prevalent form.
Netrek is essentially a greatly expanded version of Empire, a multi-user space combat game that ran on the PLATO. Empire, in turn, is essentially a multi-user version of the seminal Spacewar!, the earliest computer video game. Like those games, in Netrek each player takes command of a starship, which they pilot about a 2D map of the game galaxy, as seen from above. The game combines both tactical combat and strategic goals.

### Planets and facilities

The game galaxy consists of 40 planets distributed about the map. The map is further divided into 4 sectors of 10 planets each. Netrek divided the players into one of four teams, loosely based on the Star Trek universe; the Federation, Romulans, Klingons, and Orions (or "feds", "roms", "klis", and "oris", respectively). Each team is assigned to a single sector when the map is reset.
The planets differ from each other in terms of military or agricultural development; at the start of a game each team has several planets under their control one of which is their homeworld, usually named after an actual planet in the Star Trek Universe (such as Earth for feds, Romulus for roms, Orion for oris, Klingus for klis). Some worlds, however, have special facilities that help any friendly units in orbit of them. Repair facilities, represented by a wrench, speed up repairs to the player's hull and shields, which take damage while battling enemies. Fuel depots, represented by a fuel can, speed up the fuel recharge rate of any ships in orbit of the planet. Some worlds may have both these while others have one or none. As well as fuel and repair facilities, some planets generate armies at a faster rate than other planets; these planets are known as agricultural planets, or "agris". A team's home planet always offers fuel and repair facilities, but is never an agricultural planet. Of the nine other starting planets, two are agricultural and others are assigned fuel depots or repair facilities. Planets slowly generate armies (and at a faster rate if agricultural), which may be beamed up by players, and then beamed back down onto enemy planets to capture them. Planets can be bombed to kill off armies, but only to a point; dropping armies is always required.
Planets will fire upon enemy ships in orbit, even to the point of captured homeworlds firing upon ships from the homeworld's starting faction as they appear over the planet.

### Combat

Unlike Spacewar! or Empire, Netrek includes many different ship types with their own strengths and weaknesses. Some, like the scout, are faster and are useful for long range hit-and-run attacks. Others, like the battleship, are extremely powerful but slow, useful primarily for point defense.
A player obtains "kills" either by killing an enemy ship or by bombing enemy armies. The number of kills decides how many armies a player's ship can carry. The player's kill count resets back to zero each time their ship is destroyed, requiring them to obtain more kills before they can carry armies and capture planets. Consequently, people with two or more kills are often targeted for "ogging" (a kind of kamikaze attack) just to remove the threat of them carrying armies.
Enemy ships can be destroyed using two main weapons systems: phasers and photon torpedoes. Phasers are instantaneous beam weapons which cannot be dodged, while torpedoes take time to travel to the target and thus can be dodged. Other shipboard combat systems include shields, and tractor and pressor beams. When a ship is destroyed, the player chooses a new ship and reappears next to their team's homeworld.
In addition, ships also sustain damage if they are too close to an explosion, such as those created by another ship being destroyed, and ships take damage from hostile planets they are close to.

## Game play

The ultimate goal of the game is to capture all of the enemy's planets. Game play is normally between only two teams, the other two quarters of the galaxy being known as "third space", referring to the third-party nature of the non-playing teams. When two teams each have at least four players, the server enters "Tournament Mode", or "T-Mode", in which planets can be bombed and captured. Once one team has only two planets remaining, a twenty-minute count down timer for their automatic surrender begins. Capturing a third planet will freeze the counter, while a fourth will remove the threat of automatic surrender.
If one or both teams have less than four players, the game enters "Pre-T Mode", in which a team wins by simply having 4 more planets than their opponents. In this mode, stats are not saved, and the Pre-T galaxy is erased when "T-Mode" exists. On some servers, "Pre-T Robots" fill in empty player spots to create a 4 vs. 4 game, but get replaced by players as the players log on.
Players join and leave the game as they wish. Pickup games can be as short as ten or fifteen minutes, but are normally much longer. "Clue Games" are games between experienced players, which are usually timed for an hour with a half-hour of overtime, and a scoring system is used to determine victory.

## History

Netrek is largely derived from Empire, written for the PLATO mainframe system beginning in 1973. It shares many characteristics of that game; key differences include a different planet layout and a much different pace of play, as well as evolutionary factors such as the use of mice instead of keyboard commands, TCP/IP networking, and the inclusion of color and sound.
In 1982, UC Berkeley student David Davis began writing a UNIX game called trek82, based on what he remembered of Empire when he used the PLATO system while at the University of Hawaii. This version emerged as trek82, using character graphics for display and a shared file to exchange data. Chris Guthrie joined Davis, and introduced him to Jef Poskanzer and Craig Leres, who were working on a more strategic offshoot of Empire called Conquest. They produced an updated version known as trek83.
In 1986, Guthrie began porting trek83 to the newly released X Window System, producing Xtrek. Further development took place at the XCF, with the help of Ed James. In the spring of 1988, Xtrek II was written by Scott Silvey and K. Smith, moving from a model which used X as a transport to the game having its own client–server protocol. This was key in allowing the game to be ported to other platforms, which may or may not support X. This version was later developed into Netrek by Scott Silvey, Kevin Smith and Terence Chang.
In 1989, the source code was posted to Usenet. In the fall of 1990, UCB alumnus Terence Chang set up a public Netrek server at Carnegie Mellon University where he was attending graduate school. In spring 1991, the first inter-scholastic game was played between UCB and CMU, and in January 1992, the "International Netrek League" (INL) was formed, so that teams could form and compete with one another (as opposed to pick-up play, in which games are played by whoever connects to a server, and players enter and leave as they wish during the course of the game). Netrek was very popular in the Carnegie Mellon computer clusters for a number of years in the early 1990s.
In 1993, Heiko Wengler at the Technical University of Dortmund added Short Packets, an improved network protocol that reduced traffic by 40–75% and enabled competitive play via low-bandwidth connections.
Netrek play peaked in the middle to late 1990s, with several leagues existing for different forms of the game as well as for different regions, and several pickup games always active, 24 hours per day, seven days per week. Between 2002 and 2006 there was a steady decline in play. As of early 2007, Netrek has seen a moderate increase in playerbase coupled with a mild renaissance in development. In late 2006 Mactrek, a new client for the Macintosh, was released, and substantial changes are being made to the Windows clients as well as various server enhancements. In 2019, an open source Netrek client was implemented in the Swift programming language and made available in the MacOS App Store. Currently there is a move from 10 frame/s to 50 frame/s, and the addition of voice chat is being considered.

## Technological innovations

Netrek pioneered the use of many technologies and design features that later found their way into commercial network games, including:
* The efficient use of fast but unreliable UDP packets as well as reliable but slower TCP streams. It was probably the first game to use both types of Internet Protocol packets.
* A robust client–server model that reduces the data exchange to "need to know" information, limiting both the required bandwidth and the opportunities for players to cheat by obtaining more knowledge of the game world than their opponents.
* Persistent account information where players can create a "character", and log in and gain ranks over multiple games.
* Game mechanics designed to reduce the ability of assisted or robot player aimbots (referred to as borgs) to gain a significant advantage over a human player.
* An anti-cheating mechanism using an RSA-based public key cryptography authentication system that also attempts (with limited success) to detect and prevent man-in-the-middle attacks.
* Multiple game variants played by the same client, with the server telling the client what game features are supported.
* The use of metaservers, servers designed to help clients locate available game servers.
* Netrek Nexus, a web site about playing and programming Netrek launched in January 1994, originally hosted by the University of Arizona and maintained by Jeff Nelson, was the 779th web site submitted to the World Wide Web Worm, an early search engine.