Difference between revisions of "Network Protocol/EVENT"

From Custom Mario Kart
Jump to navigation Jump to search
(Fixed link)
(Spelling, grammar, and other small changes for consistency)
Line 1: Line 1:
This pages is related to [[MKWii Network Protocol]] and describes the record type '''EVENT'''.
+
This page is related to [[MKWii Network Protocol]] and describes the record type '''EVENT'''.
  
 
{{MKWii Network Protocol RACE}}
 
{{MKWii Network Protocol RACE}}
  
 
The record '''EVENT''' transmits events. Events are:
 
The record '''EVENT''' transmits events. Events are:
* Activating an item.
+
* Activating an item
* Lose an item.
+
* Losing an item
* Pick up 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 by its own.
+
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 ==
 
== Event Types ==
  
The byte describing an event type is split up into two parts: a 3 bit action type followed by a 5 bit [[List_of_Identifiers#Items|object number]] for the item involved.  
+
The byte describing an event type is split up into two parts: a 3-bit action type followed by a 5-bit [[List_of_Identifiers#Items|object number]] for the item involved.  
  
 
{| class="textbox grid sortable alt"
 
{| class="textbox grid sortable alt"
Line 19: Line 19:
 
| align=center | 0
 
| align=center | 0
 
| align=center | NONE
 
| align=center | NONE
| The neutral value for unused slots. Always paired with object id 0x10
+
| The neutral value for unused slots (always paired with object ID 0x10)
 
|-
 
|-
 
| align=center | 1
 
| align=center | 1
 
| align=center | USED
 
| align=center | USED
| Using an item, such as Lightning or a Mushroom.
+
| Using an item, such as Lightning or a Mushroom
 
|-
 
|-
 
| align=center | 2
 
| align=center | 2
 
| align=center | SHOT
 
| align=center | SHOT
| Throwing an item, either forwards or backwards, such as a Green Shell or Banana.
+
| Throwing an item, either forwards or backwards, such as a Green Shell or Banana
 
|-
 
|-
 
| align=center | 3
 
| align=center | 3
 
| align=center | HIT-DRAGGED
 
| align=center | HIT-DRAGGED
| Hitting the dragged item of a player (can be yourself), either with your vehicle or an item.
+
| Hitting the dragged item of a player (can be yourself), either with your vehicle or an item
 
|-
 
|-
 
| align=center | 4
 
| align=center | 4
 
| align=center | HIT-FREE
 
| align=center | HIT-FREE
| Hitting any item that isn't being dragged, either with your vehicle or an item.
+
| Hitting any item that isn't being dragged, either with your vehicle or an item
 
|-
 
|-
 
| align=center | 5
 
| align=center | 5
Line 80: Line 80:
 
|}
 
|}
  
Every event data starts with a 2 byte time stamp, a copy of the timer of record [[MKWii Network Protocol/RACEHEADER_1|RACEHEADER_1]].
+
All event data starts with a 2-byte timestamp: a copy of the timer of record [[MKWii Network Protocol/RACEHEADER_1|RACEHEADER_1]].
  
 
{{MKWii Network Protocol}}
 
{{MKWii Network Protocol}}
 
[[category: Network Protocol|R]]
 
[[category: Network Protocol|R]]

Revision as of 18:07, 30 May 2021

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