Introduction
Novelty is built on top of a graphics engine that relies heavily on XML. XML is a tag-based markup language for describing objects and structure. NoveltyML is an XML-based language, which means it follows the same syntactical rules.
However, there is no need for alarm if you've never written XML before. It's easier than it sounds. This article will teach you the basic syntax of NoveltyML. Once you know the basics there should be no problem for a novice to explore and appreciate the language.
Note: NoveltyML is case-sensitive.
Tags
XML, and in-turn NoveltyML, is a tag-based language. Assets are represented by tags. A basic tag looks like this:
The first thing you should notice is that the tag begins with an open angle bracked (<) and ends with a forward slash and a closed angle bracked (/>). These characters specify the beginning and the end of a tag. The forward slash at the end specifies that this tag is closed, but we'll get to that later.
The name of the tag is Texture which in NoveltyML means that we're defining a new Texture asset.
Attributes
Most tags are useless unless we add some attributes to them. Here's is one example of an attribute:
Here we've added a name-attribute to the Texture asset. The syntax is always the attribute's name followed by an equals sign (=) and the value inside quotation marks(").
Note: Attribute names are always lower case.
Value types
Every tag has different attributes and their values are expected to match to a value type. In the example above the name-attribute expects a string value, i.e. text. Other attributes may expect a different value type. For instance the size-attribute is a Vector2, or two decimal numbers separated by a comma (,). The first value is the width and the second is the height.
For a list of all the value types, click here.
Creating an image
Consider the following NoveltyML:
The first tag, of which you should be familiar with by now, defines a new Texture resource. It only has two attributes, one being the resource name, the other is the location of the texture file.
The second tag defines a new Image asset. It also has a name-attribute, but instead of referring to a file source the texture-attribute references the Texture asset by name. You only need to define the Texture resource once and you can then use it over and over in Images and other objects.
Note: All assets must have a name so it can be handled by Novelty.
Creating an image inside an image
Another important property of tags is that they can have a parent-child relationship to eachother. This is useful for a multitude of things. In this example we're going to put one Image inside another. The second image will be a child of the first and every transform (position, size, rotation) will automatically affect the other.
What we need to do first is to change the tag from a closed tag to an open one:
Here we've removed the forward-slash (remember, it specified a closed tag). Instead we close the tag on a new row. The syntax for closing a tag is an open angle bracket followed by a forward slash (</), then the tag name and a closed angle bracket (>).
We can now put other tags inbetween:
...in this case another Image. Note that this new Image doesn't have any children and is thus closed (/>). Also note that we don't specify any name for this image. Only the parent tag needs to have a name.
Summary
By now you should have grasped the basics of NoveltyML. You've learned how to define a texture resource and then use it in an Image object. There are of course many more resource and object types that you can use. Don't forget that there is a separate tool for writing NoveltyML called the NoveltyML Designer.
See also: Using NoveltyML Designer, NoveltyML language reference