« | Main | »

Saving byte-code in NBT format (Named Binary Tag)

By Jewe | February 28, 2016

Starting with JewelScript 1.4, the binary format for saving and loading byte-code will change to NBT format.

I’m currently working on a standard C implementation of Markus Persson’s NBT format. It already works, but it’s still in it’s infancy and there’s still some stuff missing.

NBT stands for “Named Binary Tag” and is a “document object model” format similar to JSON or XML, only that it is in binary format, and thus very quick to save and load. The format has been invented by Notch himself as a file format for Minecraft saves. And now JewelScript will use it too.

The benefits using this format in JewelScript?

First of all, the format is platform independent: The byte-order of the machine JewelScript runs on no longer matters (little / big endian) when loading compiled programs.

Secondly, the format is extensible. Meaning, you can add, modify and delete properties in the file at will – just like with JSON or XML documents. This would allow a compiled JewelScript program to load it’s own NBT file and access it’s properties – or even add new ones.

Lastly: There are already tools to load, view and manipulate NBT files, such as NBT Explorer, most of which of course have been written for Minecraft, but can now be used for JewelScript as well. Here’s an example file, created by the current test-build of JewelScript.

JewelScript NBT loaded in NBT Explorer


Topics: docs, news | Comments Off on Saving byte-code in NBT format (Named Binary Tag)

Comments are closed.