Most Efficient way to read a Settings Configuration File

Aidan Knight
  • Most Efficient way to read a Settings Configuration File Aidan Knight

    I have been working on a game for quite a while, and I am using Ogre3D for the rendering engine. It is getting to the point I need to move adjustable settings to a configuration file such as video settings/options, player keybindings, etc.

    I am using RapidXML for parsing and loading my scenes, but I am not sure this is the best way to go about doing configurations. As a long time fan of Valve games, I know there's are just a long list of settings, basically no grouping, just a list. Where as UT games do something like

    [VideoOptions] ... ...

    [GameSettings] ... ...

    Anyways, I am just wondering what the best way to go about this is.

  • This probably isn't the optimal solution, but I'm currently using Ogre's ConfigFile class (here is the API ref for it) for simple gfx/control/whatever config settings. Not a terribly robust solution, but it's worked fine for simple stuff.

    Its format is similar to the UT example you gave, for instance:

    Resolution=1024 x 768

  • You may also be interested in Boost.PropertyTree. It let's you access properties in a hierarchical manner, e.g. settings.get<int>("Graphics.Resolution.Width"). The are parsers/loaders available for XML, JSON, and more.

  • Another option is to embed a simple language like Lua and expose the configuration values you want to Lua. Then your configuration file becomes a series of assignments, and can be as complex or as simple as you like. I probably wouldn't do this just for loading configuration files, but scripting languages do come in very handy for many aspects of game development so it's worth considering.

game-design c++
Related questions and answers
  • of this then why would I be here asking this question? The reason is as shocked as I am about this. I don't like to lose. I have my own queries on how appealing this project would be to someone looking... up with any conclusive results on whether this project is the right way to go. There is no finite answer to this question, just any experienced advice on what route to pick and what resources to go... with c++. C++ was just the medium for learning. My opinion on the language? C++ is an amazingly diverse one size fits all language and its no surprise its around this long. My skills in it are basic

  • I have a very simple effect file shown below. I am using this to draw 2D lines, however it is not behaving how I expected and I can't seem to get my head round why. If I draw a line that goes from 0,0 to 100, 100 for example, I would expect it to draw a line from one corner of the screen to a little way in. I would expect it to treat these numbers as screen coordinates. Instead, the line is huge! A line of about 2 long fills the whole screen. Why is this? How can I modify my shader to 'think' in screen coordinates? // a struct for the vertex shader return value struct VSOut { float4 Col

  • I was recently listen to a talk that Jonathan Blow gave, you can find it here. In the talk, he was talking about what data structures he (and he seemed to imply many others) use, and why. Which... critical place in the code. He gave the example of loading data from a wad file in doom, which while fast, still took that naive approach (at least according to the talk, I haven't looked at the source code since I have not a clue to where I should begin). The reason he gave for this was because while it may be slightly slower to do things the naive way, it's not much, and in many cases

  • I am trying to get more experienced with Ogre 3D and I am following the basic tutorials on the website. All the code samples compile just fine. The first time I encountered an "error" was in Basic... this line but it shows an ugly red line beneath it and on mouse hover it says #define OGRE_NEW new (__FILE__, __LINE__, __FUNCTION__) Error: no instance of overloaded 'operator new' matches the argument list" or if I mouse hover over Ogre::TerrainGlobalOptions() it says "Error: expected a type specifier I searched on Google but couldn't find my answer. I got about a year C++ experience

  • that I have generated. I handle the threads by using turn-based concurrency. My problem is I worry about lag of the input events when there are fast moving objects, and I am curious to see... think about adding a bulk of data on the generic object creation, but there might be a lag between the creation and the actual event - on Java, I have to go through JNI and the generic object is always...Currently in my project, the way I handle user input events is through the OS Framework, then create a generic object - basically combines all types of input: keyboard, mouse, touch, trackball, etc

  • I'm considering using micropather to help me with pathfinding. I'm not using a discrete map : I'm working in 2d with sectors and portales. However, I'm just wondering what is the best way to compute costs with this library in this context. Just to be more clear about geometrical shapes I'm using : sectors are basically convex polygons, and portals are segments that lies on sector's edge... implementation give me results, i.e I'm able to find a path in my map, but I'm not sure I'm using an optimal solution. For the AdjacentCost method : I just take the distance between sector's centers

  • Since building a game is not about 2D anymore, I just want to build a list of the (not necessarily best, but good enough) open source software available to make games. I prefer to put emphasis on libraries that insist on specializing on one part of what makes a game (like Ogre does for graphics, and OpenSteer does for steering), rather than engines/libraries that try to feature a lot... (plugin for Ogre3d) Bullet Feel free to update this list and/or add categories.

  • I am just curious as to how in many games (namely games like arkham asylum/city, manhunt, hitman) do they make it so that your character can "grab" a character in front of you and do stuff to them. I... you come up behind some person and put your hand over there mouth while they struggle and slowly go to the floor where you lay them down. I am confused as to whether it was animated to use two models... together. I am not an animator so i assume most of what i just said is not right but i hope that some one can understand what i mean and provide an answer. PS) I am a programmer and I am

  • ++ I've tried building SDL 1.3 and following this tutorial. This ended up being a pretty big pain and I gave up amid a stream of compile errors - I'd prefer to not go this route if possible. I know also that GLEW/GLEE or some do-it-yourself extension function pointers will be required. So basically: is it possible? If so, what is the best/easiest way to make it happen? Thanks! ...I've been using SDL 1.2.14 for awhile without using many of the features from newer OpenGL versions. I'm now interested working only with the 3.3 API (not using the deprecated functions, etc

Data information