1. Introduction

NEX consists of the NEX P2P library, which implements peer-to-peer communication features, and the NEX Server Services library, which implements matchmaking, ranking, NAT traversal features, and other server communications features. This programming manual explains NetZ, which is included in the NEX P2P library. Also, VSocket is introduced as an appendix.

NEX NetZ is a game network engine used to develop multiplayer games. NetZ addresses the needs of multiplayer game developers: time to market, reliability, efficient use of bandwidth, and cross-platform compatibility.

The NetZ duplicated object (DO) philosophy is different from traditional message-based networking solutions. When using duplicated objects, the developer does not need to worry about having the application pass messages from station to station because NetZ automatically duplicates game objects (such as characters, bullets, and enemies) to all stations on the network. One station has the duplication master (the controlling instance) of an object, while all other stations hold a duplica (an exact copy) of the same object. When a master object is updated, the change is then pushed out to all the duplica stations. Because of the way data is propagated across the network, complicated features, such as fault tolerance (the malfunction recovery feature), dead reckoning (an interpolation feature that considers latency), and object migration (load, bandwidth distribution, privilege transfer, and latency management), become very easy to work with.

The remote method call (the so-called remote procedure call) and direct streaming (the byte series sending and receiving functionality), which were generally used with traditional P2P libraries, are available.

Positioned in a layer lower than NetZ, the NEX VSocket is a socket-like library that provides simple packet sending and receiving functionality without performing P2P session management. VSocket can connect to all NEX server services including NAT traversal features, and is appropriate for integrating any existing P2P libraries and NEX.

By combining with PiaLocal, which is a module of the Pia library that is provided separately, you can use the NEX P2P library features even with local communications. (The two modules required for this use are PiaCommon and PiaLocal. ) For more information, see the Pia library documentation.

NetZ and VSocket are designed to connect using NEX matchmaking features. This documentation is structured under the assumption that NEX matchmaking will be used. Contact Nintendo if you plan to implement your own matchmaking feature on an independent server and use it with NetZ or VSocket.

1.1. Selecting Features to Use

There are several communication methods in the NEX P2P library. Use the following table to select an optimal implementation method based on the differences among the communication methods. The NetZ communication methods can be used concurrently.

Table 1.1 NEX P2P Library Communication Methods
Libraries Communication Method Description
NetZ Data sharing with duplicated objects Use when features such as fault tolerance, dead reckoning, or object migration are used in addition to P2P session management.
NetZ Remote method call Use when serializing data (for sending and receiving and message dispatch processing) and P2P session management are entrusted to the library.
NetZ Direct streaming Use when P2P session management is entrusted to the library, but processing related to sending and receiving data is performed on the application side. Use when transitioning from DWC (the communication library for DS or Wii), when using application-specific serialization processing, or when sending a large volume of data.
VSocket Communication is similar to UDP Socket Use when you already have another P2P library and you want to integrate it with NEX.

1.2. About the Manuals and How to Use This Manual

This Programming Manual describes how to use and take full advantage of the NetZ architecture. The purpose of the guide is to provide general implementation information, in addition to detailed background information when it is appropriate. If you want to know how to use a specific feature—such as dead reckoning—look it up in this Programming Manual. On the other hand, if you want to know a particular member function's structure, parameters, return values, sample implementation, and so on, refer to the API Reference Manual or the sample demos.

This manual is written for programmers who want to use NetZ as the network engine for their game. A good background in C++ and object oriented programming is assumed.

1.2.1. Conventions Used in This Manual

The following table shows the conventions used throughout this manual.

Table 1.2 Conventions Used in This Manual
Convention Description
Class and method names The name of each class and method begins with an uppercase letter. All compound names use uppercase to begin each individual embedded word.
_T In the sample program code, wide characters strings are represented by wrapping the string in a T function (for example, T("foo")).

CONFIDENTIAL