Saving and loading the different maps to and from external files

Started by
3 comments, last by Surgura 12 years, 1 month ago
Hey all,

After designing a global structure for my program, I am now trying to figure out which resourses I will need.
The program's static core will be written in C++.

I want to save different maps in external files, for obvious reasons. A map file should not only contain the coordinates of, for example, a door, but also a link to a function call in a Lua file, when a specific trigger is caused. An example map with only one object:

Object: Door
Position_x: 2345
Position_y: 3345
OnOpen: door7654.lua->OnOpen()
OnClose: door7654.lua->OnClose()

Every object in a map will have it's own Lua file with it's own functions. This way it will be easy to create a map maker. The Lua function will handle the trigger.

The question I have is:
Is there a file type that is suitable for this?

I find it an ugly idea to just take a .txt file and type in text like this, and then create my own reader for it. I am sure there are many file types ready for me.

Thanks in advance,

Aart Stuurman
Advertisement

The question I have is:
Is there a file type that is suitable for this?

Lua itself makes a very reasonable data description language.
The question I have is: Is there a file type that is suitable for this?
Maybe JSON. Or YAML. Or XML. Or perhaps lua itself like edd notes.
But I still don't understand what's the real deal with those text files. I'd just write everything in binary. Last time I had looked at the text description of a level script it was like 5000 lines long.

Previously "Krohm"

Okay thanks. I will try some of those and look into some articles on binary maps.

-Aart
For anyone who is interested; I am goin to you Boost's Serialize to create a map maker and loader and use Boost's stream options to let Serialize create a binary file.

http://www.boost.org/doc/libs/1_49_0/libs/serialization/doc/index.html

-Aart

This topic is closed to new replies.

Advertisement