Data files

As I’m fairly busy last few months game development has almost frozen. So to heat things up I will
make a simple post regarding the file format we use in our games and engine.

We had the following demands:

  • Easy to read for a human
  • Easy to read for a computer
  • Easy to extend
  • Nesting

So with this in mind we looked at some existing file formats:

  • Ini: Easy to read for a computer and a human, but no nesting support.
  • XML: Easy to read for a computer, but not for a human.
  • Binary: Very easy to read for a computer, not for a human.

So we cam up with our own format: Data Files.
It’s basically a combination of an ini file with the nesting of XML defined as follows:

{Node1
    Key=Value
    {Node2
        Key=Value1
        Key=@(path)Value2
    }
}

We have nodes. Nodes can contain new nodes and key-value pairs. Key-value pairs don’t have a
primary key and can only be one liner. Basic design that’s pretty good readable for a human and a computer!
We also have a special variable defined. The “@(…)”. This defines that there’s a value that contains
a variable value. For example the “@(path)” contains the path the file is located in.
This is very useful for fetching a file in the same directory: Texture=@(path)MyTexture.jpg.

2 thoughts on “Data files

Leave a Reply

Your email address will not be published. Required fields are marked *