Jump to content

  • Log In with Google      Sign In   
  • Create Account


Saving and loading the different maps to and from external files


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Aart   Members   -  Reputation: 201

Like
0Likes
Like

Posted 21 March 2012 - 02:24 PM

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

Sponsor:

#2 e‍dd   Members   -  Reputation: 2105

Like
0Likes
Like

Posted 21 March 2012 - 05:41 PM

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

Lua itself makes a very reasonable data description language.

#3 Krohm   Crossbones+   -  Reputation: 2952

Like
0Likes
Like

Posted 22 March 2012 - 01:20 AM

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.

#4 Aart   Members   -  Reputation: 201

Like
0Likes
Like

Posted 22 March 2012 - 07:24 AM

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

-Aart

#5 Aart   Members   -  Reputation: 201

Like
0Likes
Like

Posted 22 March 2012 - 09:03 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS