Network Protocol/EVENT

From Custom Mario Kart
< Network Protocol
Revision as of 18:07, 30 May 2021 by Nightcat (talk | contribs) (Spelling, grammar, and other small changes for consistency)
Jump to navigation Jump to search

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

Template:MKWii Network Protocol RACE

The record EVENT transmits events. Events are:

  • Activating an item
  • Losing an item
  • Picking 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 on 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

All event data starts with a 2-byte timestamp: a copy of the timer of record RACEHEADER_1.

Template:MKWii Network Protocol