Network Protocol
This page describes the network protocol used by Mario Kart Wii. It is very incomplete at this moment.
Introduction
The analysis of the data is done with the tool mkw-ana. So the naming of mkw-ana for objects (records, stages, ...) is used here. Because of the very early phase of the analysis, names and structures may completely change.
You can discuss this topic at mariokartwii.com.
Terms and definition
General description
The Mario Kart Wii traffic starts with some name resolutions. Then it will use only UDP packets.
First it connects Nintendos servers (N-server). In a room or while racing, all Wiis communicate directly to each other. In a race, only some alive records are send to a N-server.
Connecting Nintendo servers
If entering the Mario Kart WFC, the Wii started with DNS queries to find out the IP addresses of the following servers:
- gpcm.gs.nintendowifi.net
- gpsp.gs.nintendowifi.net
- gamestats.gs.nintendowifi.net
- gamestats2.gs.nintendowifi.net
- mariokartwii.available.gs.nintendowifi.net
- mariokartwii.natneg1.gs.nintendowifi.net
- mariokartwii.natneg2.gs.nintendowifi.net
- mariokartwii.natneg3.gs.nintendowifi.net
- mariokartwii.master.gs.nintendowifi.net
- mariokartwii.gamestats.gs.nintendowifi.net
- mariokartwii.gamestats2.gs.nintendowifi.net
- mariokartwii.ms19.gs.nintendowifi.net
Then it starts the comminication with nintendos servers and the first packet goes to mariokartwii.available.gs.nintendowifi.net.
Point to point communication
The Wii use a frequency of 59.94Hz (based on NTSC, about 1/60s) as time base. All clients send every second pulse (~1/30s) a status packet to one of the other clients. If there for example 3 clients A, B and C, then A sends first a packet to B and then, 1/30s later, a packet to C, and again 1/30s later, the next packet to B. this means, that the individual status update is done only every 1/15s. This update time is reduced to 11/30s (~1/3s), if 12 clients are playing. And that's the reason for the many lagging effects if playing with many players.
The average packet length is about 220 bytes, so the the total traffic is about 6.6 KB/s (52.8 KBit/s) in both directions, independent of the number of clients.
Records
Each UDP packet can be split in records. Records are logical units. The following table shows:
- A name used by mkw-ana.
- Value of the first 4-6 bytes (Record ID, big endian, hex).
- Length of the record.
- Description.
Name | Record ID | Length | Description |
---|---|---|---|
CHECKSUM | 0000.0000 | 0x08 | A checksum record used for the most data records. |
USER | 0000.000x | 0xc0 | A user information including a FC and 2 Miis for both users of the client. x is 1 for 1 player or 3 for 2 players. |
ANNOUNCE | 1000.0000.0000 | 0x08 | Announce a new user by sending it's FC4. This record is send by a Nintendo Server to the host and the new guest. After receiving an announce, both clients start with a little handshake. |
unknown | 1000.0000.00c0 | 0xc8 | ? |
unknown | 1000.0000.xxxx | ? | ? |
ROOM | 1000.0004 | 0x0c | A ROOM record is always placed before an USER record. The byte at offset 8 decides the sub type:
Room records are only sent in room events. There is a prefix record "GLOBAL" for non-room-events. |
SELECT | 1000.0038 | 0x40 | This record is send while selecting driver and track. It is always placed before an USER record. The byte at offset 0x3d decides the phase:
|
RACE RACEDATA ITEM EVENTHEAD EVENTDATA |
1028.2800 | 0x58 +U*0x40 +U*0x08 +0x18 +N |
Record send during race and battle. The content of race and battle records are different.
The record is followed by 1 or 2 extensions (RACEDATA, each 0x40 bytes) for 1 or 2 users of the client. After the user extensions a list with items and events is appended. |
SLOT | 46fc.570x | 0x08 | The following message is related to client slot x (default: for the sender). This is mainly used in combination with ANNOUNCE and USER to tie information to specific client slots.
If a client has bandwidth problem, it can use another client as proxy to reduce its own traffic during the race. Such indirect packets are also prefixed by a SLOT record. |
STATUS | bb49.cc4d | 0x14+N | A status record with 5 different extensions. Byte 9 describes the extension length N and is 0, 4, 8, or 16. One task is to select and advice client slots to clients. |
HANDSHAKE | fdfc.1e66 | 0x14+N | Different handshake records with different length. At the moment an announce of Nintendo (with ip+port) and a little handshake between host and guest are known. |