Unseen Data Format

Leave notes for other devs

Moderator: Karl G.

Unseen Data Format

Postby Karl G. » Wed Apr 19, 2006 8:44 pm

I've been working on a kick-bum scripting language to allow us to easily specify any kind of data we could imagine. Just to jump into things, I'll give you a basic file:

Code: Select all
template Mesh <template id> {

    // The file from which to load this mesh
    STRING File;
};

// An object specifies an instance of a mesh
template Object <template id> {

    // The mesh that this object uses
    STRING MeshName;

    // The object's position
    FLOAT x, y, z;
};


This is a very basic template file that defines a "Mesh" type, which specifies a 3d model file, and an "Object" type that can be used to put the mesh in the world at a specific location. the "<template id>" is something called a global unique identifier (or GUID) and is used by programs to give something a number that will probabalistically be unused by any similar object.

For those of you who aren't coders, FLOAT is a data type that represents a decmial number, such as "14.23". The "//" means that anything that comes after it on that line is a comment, and doesn't mean anything to the interpreter.

Now, let's look at a (very basic) use of these templates:

Code: Select all
Mesh treeMesh {
    "tree04.x";
};

Object treeNumber5 {
    "treeMesh";
    0; 0; 0;
};


This code would load the file "tree04.x" and call it "treeMesh". Then, an object named "treeNumber5" would be created and placed at the center of the world--coordinates (0,0,0).

There are much more complex things that can be done with this definition language. It's very powerful. I will be changing how Born to Rule is currently laid out (just moving some code around) so that we can support plugins and maps. Entire maps can be created using this language--just think about everything you can specify with such a flexible format! Here is a full list of "native" data types for your viewing pleasure:

Code: Select all
word - 2-byte unsigned (only positive) integer
dword - 4-byte unsigned (only positive) integer
float - 4-byte decimal number
double - 8-byte decimal number
char - single character, such as 'Q'
byte - 1-byte unsigned (only positive) integer
short - 2-byte integer
long - 4-byte integer
string - string of up to 1024 characters, such as "Hello, I really like your purple jeep!"
guid - 128-bit integer



Aaaaand, for those of you who care, a short feature list:
  • Recursive block-comments (/* ... /* ... */ ... */ is a single comment--it doesn't just stop on the first */)
  • C++ style line comments
  • Supports multidimensional arrays, including arrays that reference other fields in the template for their sizes
  • Ability to reference previously created objects to fill in data positions
User avatar
Karl G.
Lesser Spirit
 
Posts: 2453
Joined: Sat Mar 04, 2006 10:26 am

Postby Joe M. » Wed Apr 19, 2006 11:44 pm

looks useful. like c++, without all the hard bits :P
User avatar
Joe M.
Developer
Developer
 
Posts: 996
Joined: Sat Mar 04, 2006 10:14 am
Location: Texas


Return to Dev Chat (private)



Who is online

Users browsing this forum: No registered users and 1 guest