Difference between revisions of "Network Protocol/EVENT"

From Custom Mario Kart
Jump to navigation Jump to search
m (Typos)
(Updated based on some code analysis and in-game testing)
Line 11: Line 11:
 
== Event Types ==
 
== Event Types ==
  
There are 256 (0x100) possible event codes and many of them are used. After a first analysis, it seems that the lower 4 bits defines the item type (other than [[MKWii_Network_Protocol/ITEM#item-code|these item codes]]) and the 4 upper bits the action code. The value 0x10 declares an unused slot.
+
The byte describing an event type is split up into two parts: a 3 bit action type followed by a 5 bit [http://wiki.tockdom.com/wiki/List_of_Identifiers#Items object number] for the item involved.  
  
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
<!-- DON'T EDIT THIS TABLE, BECAUSE IT IS GENERATED BY SCRIPT. -->
 
<!-- Tell me (Wiimm) info on the discussion page.              -->
 
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
 
{| class="textbox grid sortable alt"
 
{| class="textbox grid sortable alt"
|+ Item codes for record EVENTHEAD
+
|+ Action Types
! Code !! Data<br/>Size !! Data<br/>Type !! Description
+
! Id!! Name !! Description
 
|-
 
|-
| align=center | 0x10
+
| align=center | 0
| align=center | —
+
| align=center | NONE
| align=center |
+
| The neutral value for unused slots. Always paired with object id 0x10
| The neutral value for unused slots.
 
 
|-
 
|-
| align=center | 0x23
+
| align=center | 1
| align=center | 0x03
 
 
| align=center | USED
 
| align=center | USED
| Mushroom used
+
| Using an item, such as Lightning or a Mushroom.
 
|-
 
|-
| align=center | 0x24
+
| align=center | 2
| align=center | 0x03
 
| align=center | USED
 
| Star activated
 
|-
 
| align=center | 0x26
 
| align=center | 0x03
 
| align=center | USED
 
| Lightning activated
 
|-
 
| align=center | 0x28
 
| align=center | 0x03
 
| align=center | USED
 
| Mega Mushroom activated
 
|-
 
| align=center | 0x2a
 
| align=center | 0x03
 
| align=center | USED
 
| Blooper activated
 
|-
 
| align=center | 0x2b
 
| align=center | 0x03
 
| align=center | USED
 
| ? POW Block activated
 
|-
 
| align=center | 0x2c
 
| align=center | 0x03
 
| align=center | USED
 
| Golden Mushroom finished or lost
 
|-
 
| align=center | 0x2e
 
| align=center | 0x03
 
| align=center | USED
 
| Thundercloud found and activated
 
|-
 
| align=center | 0x40
 
| align=center | 0x14
 
| align=center | SHOT
 
| Green Shell shot
 
|-
 
| align=center | 0x41
 
| align=center | 0x15
 
| align=center | SHOT
 
| Red Shell shot forward
 
|-
 
| align=center | 0x42
 
| align=center | 0x14
 
| align=center | SHOT
 
| ? Banana thrown forward
 
|-
 
| align=center | 0x45
 
| align=center | 0x15
 
| align=center | SHOT
 
| Spiny Shell shot
 
|-
 
| align=center | 0x47
 
| align=center | 0x14
 
| align=center | SHOT
 
| ? Fake Item Box thrown
 
|-
 
| align=center | 0x49
 
| align=center | 0x15
 
 
| align=center | SHOT
 
| align=center | SHOT
| Bob-omb thrown
+
| Throwing an item, either forwards or backwards, such as a Green Shell or Banana.
|-
 
| align=center | 0x60
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x61
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x62
 
| align=center | 0x14
 
| align=center | ?
 
| ? Item at tail lost
 
|-
 
| align=center | 0x63
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x64
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x65
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x66
 
| align=center | 0x14
 
| align=center | ?
 
| ? Mushroom lost
 
|-
 
| align=center | 0x67
 
| align=center | 0x14
 
| align=center | ?
 
| Fake Item Box hit
 
|-
 
| align=center | 0x68
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x69
 
| align=center | 0x14
 
| align=center | ?
 
| Bob-omb touched (tail of rival)
 
|-
 
| align=center | 0x6a
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x6b
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x6c
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x6d
 
| align=center | 0x14
 
| align=center | ?
 
| ?
 
|-
 
| align=center | 0x80
 
| align=center | 0x05
 
| align=center | MISC
 
| looping, wheely, hop, ...
 
|-
 
| align=center | 0x81
 
| align=center | 0x05
 
| align=center | MISC
 
| Red Shell disintegrated (not only hit)
 
|-
 
| align=center | 0x82
 
| align=center | 0x05
 
| align=center | MISC
 
| Banana touched
 
|-
 
| align=center | 0x83
 
| align=center | 0x05
 
| align=center | MISC
 
| Mushroom picked up and activated
 
|-
 
| align=center | 0x84
 
| align=center | 0x05
 
| align=center | MISC
 
| Star picked up and activated
 
|-
 
| align=center | 0x85
 
| align=center | 0x05
 
| align=center | MISC
 
| ?
 
|-
 
| align=center | 0x87
 
| align=center | 0x05
 
| align=center | MISC
 
| ?
 
 
|-
 
|-
| align=center | 0x89
+
| align=center | 3
| align=center | 0x05
+
| align=center | HIT-DRAGGED
| align=center | MISC
+
| Hitting the dragged item of a player (can be yourself), either with your vehicle or an item.
| ? Bob-omb exploded
 
 
|-
 
|-
| align=center | 0x8e
+
| align=center | 4
| align=center | 0x05
+
| align=center | HIT-FREE
| align=center | MISC
+
| Hitting any item that isn't being dragged, either with your vehicle or an item.
| Thundercloud lost (Respawn)
 
 
|-
 
|-
| align=center | 0xa1
+
| align=center | 5
| align=center | 0x05
+
| align=center | LOSE?
| align=center | MISC
+
| Used when a Thunder Cloud is lost, either from its timer running out or from passing it to another player
| ? miscellaneous
 
 
|-
 
|-
| align=center | 0xae
+
| align=center | 6
| align=center | 0x05
 
| align=center | MISC
 
| Thundercloud caught
 
|-
 
| align=center | 0xc1
 
| align=center | 0x04
 
 
| align=center | ?
 
| align=center | ?
| ?
+
| Unknown
 
|-
 
|-
| align=center | 0xe0
+
| align=center | 7
| align=center | 0x14
 
 
| align=center | DROP
 
| align=center | DROP
| ?
+
| Dropping an item when hit (including ones that disappear on landing)
|-
+
|}
| align=center | 0xe1
+
 
| align=center | 0x14
+
== Event Data Structure ==
| align=center | DROP
+
 
| Red Shell dropped
+
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:
|-
+
 
| align=center | 0xe2
+
{| class="textbox grid sortable alt"
| align=center | 0x14
+
|+ Event Data Sizes by Action Type
| align=center | DROP
+
! Id!! Size (bytes)
| Banana dropped
 
|-
 
| align=center | 0xe3
 
| align=center | 0x14
 
| align=center | DROP
 
| Mushroom dropped
 
|-
 
| align=center | 0xe4
 
| align=center | 0x14
 
| align=center | DROP
 
| Star dropped
 
|-
 
| align=center | 0xe5
 
| align=center | 0x14
 
| align=center | DROP
 
| ?
 
|-
 
| align=center | 0xe6
 
| align=center | 0x14
 
| align=center | DROP
 
| ?
 
 
|-
 
|-
| align=center | 0xe7
+
| align=center | 1
| align=center | 0x14
+
| align=center | 3
| align=center | DROP
 
| ?
 
 
|-
 
|-
| align=center | 0xe8
+
| align=center | 2
| align=center | 0x14
+
| align=center | Varies by item
| align=center | DROP
 
| ?
 
 
|-
 
|-
| align=center | 0xe9
+
| align=center | 3
| align=center | 0x14
+
| align=center | 20
| align=center | DROP
 
| ?
 
 
|-
 
|-
| align=center | 0xea
+
| align=center | 4
| align=center | 0x14
+
| align=center | 5
| align=center | DROP
 
| ?
 
 
|-
 
|-
| align=center | 0xeb
+
| align=center | 5
| align=center | 0x14
+
| align=center | 5
| align=center | DROP
 
| ?
 
 
|-
 
|-
| align=center | 0xec
+
| align=center | 6
| align=center | 0x14
+
| align=center | 4
| align=center | DROP
 
| ?
 
 
|-
 
|-
| align=center | 0xed
+
| align=center | 7
| align=center | 0x14
+
| align=center | 20
| align=center | DROP
 
| ?
 
 
|}
 
|}
  
<br/>
+
Every event data starts with a 2 byte time stamp, a copy of the timer of record [[MKWii Network Protocol/RACEHEADER_1|RACEHEADER_1]].
 
 
To find the DATA for a specific slot, the slots must be iterated to skip the previous data.
 
 
 
== Event Data Structure ==
 
 
 
The data structure depends on the data types defined by the slot list of EVENT. A data size for a single event differs from 3 to 21 bytes. The data is not aligned. It seems, that each event data starts with a 2 byte time stamp, a copy of the timer of record [[MKWii Network Protocol/RACE|RACE]] at offset 0x02.
 
 
 
=== Type USED ===
 
 
 
An event of type "USED" is sent when you use an item, i. e. a Mushroom, a Blooper or a Lightning. It's sent when using an item which won't land on the road.
 
 
 
=== Type SHOT ===
 
 
 
An event of type "SHOT" is sent when you throw a Green Shell, Red Shell or Spiny Shell, or throw (not drop) a Banana, a Bob-omb or a Fake Item Box.
 
 
 
=== Type DROP ===
 
 
 
An event of type "DROP" is sent when you drop/put an item. Either by putting it on the road or by getting hit by a Lightning/POW Block.
 
 
 
=== Type MISC ===
 
 
 
Type misc is used for different things. All records have 5 byte, the first two being the time stamp, the last three being a sub-ID indicating the actual event.  
 
  
 
{{MKWii Network Protocol}}
 
{{MKWii Network Protocol}}
 
[[category: Network Protocol|R]]
 
[[category: Network Protocol|R]]

Revision as of 20:52, 9 July 2020

This pages 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.
  • 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.

Template:MKWii Network Protocol