Oculus VR, Inc.

 Introduction

Manual Last Updated 11/19/2012. See readme.txt for the current version number.

RakNet is a high-performance network API designed for games or other high-performance network applications. RakNet is intended to provide most to all features modern games need, such as a master server, autopatcher, voice chat, and cross-platform capabilities. RakNet currently supports Windows, PlayStation 3, XBOX 360, PlayStation Vita, Linux, Mac, the iPhone, Android, and Windows Phone 8.

 Quick Start

Components of a multiplayer game
System Overview
Detailed Implementation
Tutorial
Compiler Setup (Visual Studio)
Compiler Setup (XCode)
Optional 3rd party dependencies
HowTo

 Training Videos

Introduction:Major Features
Tutorial 1: RPC3
Tutorial 2: ReplicaManager3
Tutorial 3: Autopatcher
Tutorial 4: A complete sample covering object replication, teams, player hosted rooms and lobbies, NAT traversal, and host migration

 Feature Videos

Networked logging with SQLiteClientLoggerPlugin

The Basics

Startup
- Starting up RakPeerInterface, and the thread sleep timer explained

Connecting
- How to find and connect to other systems, and what to do if there are problems

Creating Packets
- How to create custom packets using structures and bitstreams, and how to encode timestamps.

Sending Packets
- How to send packets already prepared, and what parameters to use.

Receiving Packets
- How to converting raw data back to a packet you can read via a structure or bitstream.

SystemAddress
- Describes the purpose and use of the SystemAddress structure used in packets and in some function parameters.

Bitstreams
- An overview of RakNet's bitstream class, used throughout the API.

Reliability types
- Covers parameters you can use to control how data gets sent.

Network Messages
- Gives an overview of the messages the API will send to the user. This is also listed in MessageIdentifiers.h.

Timestamping your packets
- Covers the purpose of timestamps.

NetworkIDObject
- A Utility class to give each class instance a unique identifier that all systems can share.

Statistics
- The statistics that RakNet provides.

Secure connections
- How to activate and use secure connections.

Master server
- Our hosted master server service, to find other games on the internet.

Cloud hosting
- Setting up RakNet with cloud-hosted services

Rackspace interface
- C++ interface to Rackspace, allowing you to programatically create, delete, reboot, image, and perform other operations on servers.

NAT traversal architecture
- How to use combine UPNP, NAT type detection, NAT punchthrough, and Router2 so P2P connections complete quickly and efficiently.

Preprocessor Directives
- Enables you to rebuild the library with different code settings.

Custom Memory Management
- For consoles, memory tracking, etc.

IPV6 support
- The next-generation IP address format.

Marmalade integration
- Integration with the Marmalade SDK for the IOS and Android platforms.

 Plugins
Plugin Interface 2
- The base class of all plugins

Autopatcher
- Overview of the autopatcher included with RakNet.

RPC3
- Call C and C++ functions with native parameter lists, using Boost for additional functionality.

RPC4
- Call C functions, no external dependencies.

Connection Graph
- A plugin-in that maintains a graph of the entire network.

Directory Delta Transfer
- Send changed or missing files between directories. In essence, a simple autopatcher that can be used for transmitting levels, skins, etc.

File List Transfer
- Plugin to send a list of files, encoded in the FileList structure

Fully Connected Mesh 2
- A plug-in for peer to peer games, for host determination and verified connectivity to the mesh.

Lobby2Client - PC
- PostgreSQL backed database for game data, including users, friends, clans, messages

Lobby2Client - Steam
- Steamworks powered backend, using the Lobby2 interface.

Lobby2Client - PS3
- PS3 NP backend, using the Lobby2 interface.

Lobby2Client - XBOX 360
- LIVE backend and voice chat support, using the Lobby2 interface with support for RakVoiceXBOX360Plugin and FullyConnectedMesh2

Lobby2Client - Games for Windows Live
- Same as XBOX 360 backend but runs on Windows

Message Filter
- Prevent unwanted network messages based on sender for added security.

NAT type detection
- Find out what kind of NAT you are behind to keep users that will probably not be able to connect separate

NAT punchthrough
- Connect users behind NAT. Required for peer to peer, voice communication, or to allow players to host their own servers.

Packet Logger
- Print network traffic to the screen, file, or elsewhere.

RakVoice
- Overview of RakVoice. Refer to RakVoice.h for full implementation and function details.

Ready Event
- Synchronize when a group of systems are all ready on a common identifier, useful in peer to peer enviroments to start games at the same time, or progress turns in a turn based game.

Replica Manager 3
- A plug-in that provides management for your game objects and players to make serialization, scoping, and object creation and destruction easier.

Router2
- Send network messages to one or more remote systems we are not directly connected to

SQLite3LoggerPlugin
- Create networked log files using SQLite. Based on SQLite3Plugin

SQLite3Plugin
- Execute statements over the network with SQLite (replacement for LightweightDatabase)

TeamManager
- Manages lists of teams and team members. Supports client/server and peer to peer

TwoWayAuthentication
- Implements Two Way Authentication, validating a predesignated password without transmitting the password.

 C# and SWIG

Swig Tutorial
- How to run RakNet from C# using SWIG and possibly Mono.

Unity Integration
- How RakNet is used with Unity, and how to upgrade to version 4.x

 Utilities

Crash Reporter
- Sends mini-dumps when your application crashes, writing to disk and/or sending an email.

Console Server
- Text based backdoor to a server using either secure RakNet or telnet, allowing execution of predesignated commands or arbitrary command strings.

Email Sender
- Used by the crash reporter to send emails via TCP

String Compressor / String Table
- Used to encode strings with less bandwidth and more security.

TCP Interface
- Wrapper class for TCP connections

 3D Demos

Ogre 3D Interpolation Demo
- Use Ogre 3D to show a demo of popping popcorn over a client/server network, using ReplicaManager3

Irrlicht FPS Demo
- Use Irrlicht to show a 3D FPS demo using peer to peer with NAT punchthrough. Also uses ReplicaManager3

 Technical Design Documents
UML Diagram
Potential Bluetooth support
 Data Structures

DS_BinarySearchTree.h - Binary search tree, and an AVL balanced binary search tree.
DS_BPlusTree.h - BPlus tree for fast lookup, delete, and insert.
DS_BytePool.h - Returns data blocks at certain size thresholds to reduce memory fragmentation.
DS_ByteQueue.h - A queue specialized for reading and writing bytes.
DS_Heap.h - Heap data structure, includes both minheap and maxheap.
DS_HuffmanEncodingTree.h - Huffman encoding tree, used to find the minimal bitwise representation given a frequency table.
DS_HuffmanEncodingTreeFactory.h - Creates instances of the Huffman encoding tree.
DS_HuffmanEncodingTreeNode.h - Node in the Huffman encoding tree.
DS_LinkedList.h - Standard linked list.
DS_List.h - Dynamic array (sometimes improperly called a vector). Also doubles as a stack.
DS_Map.h - (Associative array) Ordered list with an per-element sort key.
DS_MemoryPool.h - Allocate and free reused instances of a fixed size structure, used to reduce memory fragmentation.
DS_Multilist_h - (Added 4/8/2009) Combines a list, stack, queue, and ordered list into one class with a common interface.
DS_OrderedChannelHeap.h - Maxheap which returns a node based on the relative weight of the node's associated channel. Used for task scheduling with priorities.
DS_OrderedList.h - List ordered by an arbitrary key via quicksort.
DS_Queue.h - Standard queue implemented with an array
DS_QueueLinkedList.h - Standard queue implemented with a linked list
DS_RangeList.h - Stores a list of numerical values, and when the values are sequential, represents them as a range rather than individual elements. Useful when storing many values that are usually sequential.
DS_Table.h - Table with columns and rows, and operations on that table.
DS_Tree.h - Noncyclic graph
DS_WeightedGraph.h - Graph with weighted edges, used for routing via Dijkstra's algorithm
RakString - String implementation, up to 4.5 times faster than std::string

 Support
FAQ
Debugging Disconnections
Programming Tips
Revision Log