Jump to content
  • Advertisement
Sign in to follow this  
all_names_taken

Using windows registry or ini files?

This topic is 4341 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

I've been told that the windows registry could be more efficient to use than ini files for settings for a game. 1. How do I store and read info in the registry for a WinAPI game? For a MFC game? 2. If registry isn't the way to go, what's the simplest way to read ini files? I suppose there must be a standardized way of coding it (sample code) so I don't have to reinvent the wheel (not that I mind, but I'm trying to make an engine which will take a year or so anyway so I'll use completed code and components as much as I can).

Share this post


Link to post
Share on other sites
Advertisement
Hi,

You could also have a look at wxWidgets as they have platform independent code for reading/writing ini-like settings files - same API can also access registry so its easy to try both out! There may be other cross-platform features in there that you could use too (e.g. logging, sockets, timer, threads or XML).

If you statically link you will not bloat your applications with the stuff they do not use.

Cheers,
dhm

Share this post


Link to post
Share on other sites
what exactly are the benefits of XML? Isn't it a bit tricky to implement an XML parser compared to just registry and ini file accesses? All I want is just a simple way of storing integers, strings, and maybe a few floats, nothing else really.

Share this post


Link to post
Share on other sites
If you use an existing XML library, reading and storing data in XML format is easy enough. Whether it's the best format to use is debatable, but it's not hard to do, at least.

Anyway, I agree with the above, please, stay out of my registry.
No application ever cleans up after itself, and you have virtually no way of finding out *where* it left entries in the registry.

Share this post


Link to post
Share on other sites
I've always thought using XML is a bit overkill for a configuration file. Since you mentioned registry, you must be using a Windows system, so just use these. Ignore the ones that deal with the registry and only use the PrivateProfile functions.

Share this post


Link to post
Share on other sites
Microsoft has changed the way it wants you to store information about your program . Back years ago the registry was the way to go. The problem with this method is the registry gets very bloated and slows the whole machine down. Who would have though we would ever have hundred of programs on a single box? So now Microsoft says to store program information in ini files that are local to the program or that are stored in Document and Settings area for each user. The resistry is now only to be used for storing class information, data type, extention information and other critical program information that is used by the SYSTEM. Anything that is just program use should be stored in the ini files.

There are a few ways to do your ini files depending on how complicated they will be. You can create a ini class and serilize it and just stream it in and out of the file. You can create your own ini file system and just read and write the file directly. Or you can us XML. XML is great for accesses very large ini files . Creating your own ini class is really nice for smaller ini files that you don't mind storing all the information in memory.

Well there you go.

theTroll

Share this post


Link to post
Share on other sites
Quote:
Original post by TheTroll
Microsoft has changed the way it wants you to store information about your program . Back years ago the registry was the way to go. The problem with this method is the registry gets very bloated and slows the whole machine down. Who would have though we would ever have hundred of programs on a single box? So now Microsoft says to store program information in ini files that are local to the program or that are stored in Document and Settings area for each user. The resistry is now only to be used for storing class information, data type, extention information and other critical program information that is used by the SYSTEM. Anything that is just program use should be stored in the ini files.


Where does anyone say this? I find this very difficult to believe considering that the standard INI functions all say

Quote:

This function is provided only for compatibility with 16-bit Windows-based applications. Applications should store initialization information in the registry.


Anyway, a reference to functions for both the registry and INI files can be found here.

Share this post


Link to post
Share on other sites
The registry was a solution devised for software that share configs and so on.

Many ms products do this, it is also usefull for storing sensitive encrypted data.

Using an ini or registry both have their differences, if you want cross-compatible use inis 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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!