I believe some standardisation would be useful on that point.
Project | Format |
---|---|
SpockBot | python dictionary |
minecraft-data (used by node-minecraft-protocol) | json defined by a json schema |
hematite | rust macro |
darkbot | xml |
pymcprotocol | python dictionary |
steven | go structures |
hansihe's elixir mc server | domain specific language |
However representing the protocol in a simple data structure is not possible for some projects who chose to use the syntax of their language to represent that, for example :
- MCProtocolLib using classes in many files
- the vanilla client
It might however be possible to generate code files from a standard file like ProtocolGen now does using minecraft-data protocol.json
- what is needed for a format to represent the whole minecraft protocol ?
- what would be the best way for all of these project to use a single data source for the mc proto ?
- how to sync that information easily with http://wiki.vg/Protocol ? (some idea )
- as wiki.vg/Protocol is a wiki and wikis are turning to wikidata for information storage and in general the knowledge bases are gaining popularity, would it be possible to somehow represent the protocol in such a way to store it in that kind of knowledge base and link it back to the wiki somehow ?
As can be seen from the list, many formats are possible. The problem is most of these format are language specific, for example python dictionaries can only be used in python and go structures can only be used in go. Using a format like xml or json make it possible to read the protocol file in most languages easily : you will find json and xml parsers in basically every language.
So I believe if a format is going to have any chance to being used in several projects, it has to be in a language independant format like json or xml.
Choosing a formatting language for the protocol file is only the first step though. It is still needed to choose how data can be represented in that format. For that task, json schema or xsd propose to standardise the representation of the data.
One way to make the link between a standard file and wiki.vg/Protocol would be to generate wiki.vg/Protocol from that file.
The problem is putting all the description and explanation with text formatting in the protocol file would get messy. One way to go around that is putting description in a separate file written in markdown (or an other formatting language like wikitext) and then generating wiki.vg/Protocol from both the protocol file and the description file. The short field notes could go into the protocol file. The mapping could be done with packet names or packet ids.
Here on the right is a (very simple) proof of concept for that idea using node-minecraft-protocol's protocol.json.
Interesting I did a Google search just now and by coincidence turned up this document.