MKWii Network Protocol/EVENT

From Custom Mario Kart
Jump to: navigation, search

This pages is related to MKWii Network Protocol and describes the record type EVENT.

Record structure of a complete racing packet
Size Count Type Description
0x08 0–1 SLOT Only used for redirected data via a proxy. The record identifies the original client by its slot number.
0x10 1 HEADER A header for a race packet.
0x28 1 RACEHEADER_1 Basic race data, 1 record per client.
0x28 0-1 RACEHEADER_2 Basic race data, 1 record per client. Not present in live view.
0x40 1–2 RACEDATA Race data (with positions) for each player of a client.
0xc0 0–1 USER A USER record containing mii data and friendcode(s).
0x08 1–2 ITEM Item in the box for each player of a client incl. handshaking to limit some items.
>= 0x18 1 EVENT A list with 24 byte entries. If a value is not 0x10, it declares an EVENTDATA field is following. After that list, up to 24 EVENTDATA records follow.

The record EVENT transmits events. Events are:

  • Activating an item.
  • Lose an item.
  • Pick up an item.

A new event is placed in the first free slot of EVENT. The data of all events are stored after the slot list. This announcement is active for 200/60 seconds and the data is not modified during this time. This means that each Wii calculates the item routes and the interaction by its own.

Event Types

The byte describing an event type is split up into two parts: a 3 bit action type followed by a 5 bit object number for the item involved.

Action Types
Id Name Description
0 NONE The neutral value for unused slots. Always paired with object id 0x10
1 USED Using an item, such as Lightning or a Mushroom.
2 SHOT Throwing an item, either forwards or backwards, such as a Green Shell or Banana.
3 HIT-DRAGGED Hitting the dragged item of a player (can be yourself), either with your vehicle or an item.
4 HIT-FREE Hitting any item that isn't being dragged, either with your vehicle or an item.
5 LOSE? Used when a Thunder Cloud is lost, either from its timer running out or from passing it to another player
6  ? Unknown
7 DROP Dropping an item when hit (including ones that disappear on landing)

Event Data Structure

The data structure depends on the data types defined by the slot list of EVENT. The data is not aligned. To find the DATA for a specific slot, the slots must be iterated to skip the previous data. The data size for a single event differs from 3 to 21 bytes, depending on the action type:

Event Data Sizes by Action Type
Id Size (bytes)
1 3
2 Varies by item
3 20
4 5
5 5
6 4
7 20

Every event data starts with a 2 byte time stamp, a copy of the timer of record RACEHEADER_1.