Author: Manuel Moos

DEFINE(Armagetron Advanced, Armagetron)

Introduction | Layer One | Layer Two | Layer Three

# Armagetron: network code documentation

Warning: These document are basically obsolete. The demo programs don't work currently and the docs for Layer 1 have not been updated for the recent refactoring. However, Layer 2 and 3 still are mainly intact and give the basic ideas about the system.

This document is not designed to explain every detail of the network subsystem; it is intended as a sort of user's manual for people who want to integrate Armagetron's networking into other GPL'd games and don't know much more about networking than the average Quake fan. You will not read anything about the "equal ping" technology here; I didn't know that before I started writing this either :-) "equal ping" is not part of any of the three network layers, it's in the way the game timer is handled and how client control messages are interpreted by the server.

## General structure

Just like most other network games, Armagetron uses a client/server architecture. The server has full control over the game, to minimise the possibility of cheating: the clients send only their players' input to the server (and of course, don't wait for the server's response to interpret it), the server executes the commands and sends all clients the updated game information.

As you probably expected, Armagetron's network code is organised in layers, where the lower layers deal with the details of network communication and the upper layers use the functionality provided by the preceeding layer to implement more complex tasks. In detail:

- Layer 1 (Network protocol abstraction):
- Layer 2 (Network messages):
- Layer 3 (Network objects):

The game itself uses the login/logout functions of layer two, and of course a lot of layer three. The layers two and three are a little interconnected: some stuff that should be happening in layer two already is postponed to layer three (i.e. cleaning up after a client quit from the server), so it's not possible to compile a program just with layers one and two. Sorry about that...

### Common data types

`string` (declared in `smartstring.h`): this is a better substitute for the normal `char *` with several enhancements (you can simply append characters to it...).

`REAL` (declared in `stuff.h`): just a basic `float`.

### Common global objects

`con` (declared in `console.h`): this is the console and used just like `cout` or any other stream. Messages written to `con` are displayed on the screen or written to standard output.

This Page was created by Manuel Moos(
).

Introduction | Layer One | Layer Two | Layer Three