Difference between revisions of "Registry of Message Ids"

From Space Engineers Wiki
Jump to: navigation, search
m
m (Added additional suggestion to validate message in paragraph 3)
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
 
much more often than people think.
 
much more often than people think.
  
To avoid this issue, when creating a mod that uses network messages, please add your message ids to this page. Avoid reusing already selected ids.
+
To avoid this issue, when creating a mod that uses network messages, please add your message ids to this page. Avoid reusing already selected ids. Additionally, consider a method to validate messages such as encoding the name of your mod in the message.
  
 
Also if you are writing a mod, be aware that you may be receiving messages that do not match your format!
 
Also if you are writing a mod, be aware that you may be receiving messages that do not match your format!
Line 21: Line 21:
 
|-
 
|-
 
|1002 || VoteRelay || Plugin Client-Server Communications
 
|1002 || VoteRelay || Plugin Client-Server Communications
 +
|-
 +
|29345 || MessagePlay2 || Plugin Client-Server Communications
 
|-
 
|-
 
|59619 || HoverRail || Setting Update
 
|59619 || HoverRail || Setting Update

Latest revision as of 00:21, 1 July 2017

When calling RegisterMessageHandler or SendMessage in the mod API, a "message id" must be provided. This number is of type "ushort", meaning there are 65536 possible values. However, if everybody picks a value at random, then you will get a 50% chance of a collision after only 300 random picks. That is not a lot!

This is a case of the birthday paradox, where random selection leads to collisions much more often than people think.

To avoid this issue, when creating a mod that uses network messages, please add your message ids to this page. Avoid reusing already selected ids. Additionally, consider a method to validate messages such as encoding the name of your mod in the message.

Also if you are writing a mod, be aware that you may be receiving messages that do not match your format!

Humans are bad at random numbers. To create a random id, you can use random.org.

Please keep entries sorted numerically.

Table of Ids in Use
Id Mod Name Message Type
1001 MessagePlay Plugin Client-Server Communications
1002 VoteRelay Plugin Client-Server Communications
29345 MessagePlay2 Plugin Client-Server Communications
59619 HoverRail Setting Update
54599 CameraControl Setting Update