Multiplayer Framework: Introduction

PreviousNext

Overview

This page serves as an introduction into the Multiplayer Framework. It gives a short overview of the various concepts and shows how they play together. We recommend that you first read the introduction and after you have an overview of how things play together, you may read the more detailed explanations of the key concepts where you'll find several tips and usage hints and learn how to use other concepts to increase multiplayer performance.

Layers of the Framework

The framework is based on the following set of abstraction layers:

The first layer is the User Datagram Protocol. Even though it has some major drawbacks compared with TCP, it has one big advantage which makes it the favourite protocol for network games: Shortest possible latency. A lost packet does not affect other transmitted packets. This is crucial for low latency, which is the main problem of games that are played over the Internet.
The second layer is the concept of serialization which we use to synchronize objects over the network. This layer is not dynamic in its nature itself, this means that you cannot simply add and remove objects using this layer only. In other words: The objects you want to synchronize must already exist on 'both' sides. You can hardcode them, or you can use the dynamic object creation and destruction mechanism.
The third layer, which builds on top of the object synchronisation mechanism, is the event delivery system. It uses a an event broker object, which is present on all peers by default, to publish events over the network and deliver them to the subscribers. This system enables a programmer the usage of the famous publish/subscribe pattern over the network.
The forth layer enhances the event system with guaranteed delivery of events. A feature we would have inherited automatically if we had used TCP. Events that are either received by all remote peers or not at all are called two phase commit events (EM_NET_2PC_EVENT_OBJECT).
The fifth layer builds an object creation and destruction mechanism using the secured delivery of events.

Classes

The framework is built around a few core classes which play a very important role:

Network structure

The standard architecture of the framework is client/server based. The following illustration serves as an abstract overview.