Jump to content
  • Advertisement
Sign in to follow this  
garyfletcher

config file layout.

This topic is 4841 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone know of any decent articles regarding a general format for a config file. I'm using tinyXML to load and parse my file. But I feel the whole design of the data is a little hapazard which has lead to the design of the parser being a little messy. Basically I'd just like to get a general, generic layout that I can then write a decent, compact parser.

Share this post


Link to post
Share on other sites
Advertisement
Write down what you want the configuration file to do. From that, you can design a compact script and parser.

For instance, in the config scripts that I use, I decided that all I really need to do is assign values to variables, and to execute other configuration scripts, so only two commands are required, "set" and "exec". From that, a simple script can be constructed like so:

set <variable> <value>
exec <other config script>

etc...

From that I managed to write a really small parser, and it works wonderfully for what I require.

So, to recap:
Write down what you want the configuration file to do. From that, you can design a compact script and parser.

Share this post


Link to post
Share on other sites
Speaking of INI files, they are really easy to work with, not to mention simle. DaRookie showed me a quick and easy INI file parser and congifuration loader that I used for quick data driven features in my current project. They are here(.cpp) and here(.h). It is not 'final' per se, but it uses a lot of interesting things that can give you ideas of what functionality to add to your parser. Very very useful though!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!