Storing Map Data

Started by
2 comments, last by Morley 12 years, 2 months ago
So I'm working on my own engine. I have all the rendering going fairly well so now I'm working on a basic world editor.

To create maps using the editor, I would like to save the coordinates of each object in to a file so that I might be able to redundantly use the 3D objects to lower the overall size of the game and to provide a better way for my rendering system to work (through prefabs)

Here's the problem: I don't know how to effectively store the data in a readable format at run time and load time. Should I use XML or try and figure how to make my own file type?

Opinions and discussion? Well aware that parsers are no fun in writing, but I expect this to be the most effective way. (Unless you has an alternative :) )

Any links to resources (specifically for this application) would be appreciated!

Morley
Morley

Aspiring programmer, modeler and game designer.
Advertisement
Do whatever's easiest -- all that matters is that you can read and write it. There's no real magic in defining a file format.

Generally you'll want to have a format that is optimized or at least convenient for how your engine loads data. If XML is easy for you, then use XML. the primary strike against XML in general is that it more or less assumes that the data is hierarchical, that it can be very verbose, and that its usually several times, perhaps an order of magnitude, less space-efficient than binary formats. JSON and YML are some other structured markup languages that are easy, well-supported by libraries, and less verbose than XML. The advantage of these formats is that they can easily be read and edited with text-processing tools (including Diff and source control), while binary formats usually require specialized tools.

You could also adopt another standard format by importing it directly (say .fbx for 3D scenes) -- but the difficulty there is that some of these formats are poorly documented, if at all, designed for editing (rather than being specialized for "final" assets, as you may want), and you often can't really extend them if you want to be able to use all the normal tools.

throw table_exception("(? ???)? ? ???");

I have been very satisfied using JSON (I use jsoncpp) to store entity / prefab data.
I am not very interested in YAML for the time being. XML is a future option but I don't think it will buy me anything short term.

I store geometry data in binary only.
Everything is planned to ship in binary. I am having consistent difficulties in adopting well known formats, they often come with some rough corners.

Previously "Krohm"

Thanks for the input guys!

I believe I'll have to be baking to .obj(or other natively supported format) for storing the actual models, but I suppose I'll be looking in to JSON and YAML for storing Map Data.
Morley

Aspiring programmer, modeler and game designer.

This topic is closed to new replies.

Advertisement