• ### Popular Now

• 14
• 12
• 9
• 10
• 9

#### Archived

This topic is now archived and is closed to further replies.

# GAME: Where to put registry stuff

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

## Recommended Posts

Hi, I''m not a big registry fan, and i like to keep stuff, like settings, in a file the user can save, if he uninstall the game, but i reckon registry will be necessary somewhere... So, where should we put our gamestuff in the registry? under which levels?

[Hugo Ferreira][Positronic Dreams][]
"Research is what I''m doing when I don''t know what I''m doing."
- Wernher Von Braun (1912-1977)

##### Share on other sites
Most of time people do it like this:

HKEY_CURRENT_USER\Software\CompanyName\GameOrAppName\

For example, Half-Life stores its settings here:

HKEY_CURRENT_USER\Software\Valve\Half-Life\

##### Share on other sites
OK, I''m comming from the Unix world, so please forgive this stupid question, but...

Why do Windows games always need to put their config stuff into the registry ? Why can''t they just create a little ini or cfg (or .config ) file in their current directory, and load that one at startup ? This way, games would be 100% relocable. I hate this: Try to copy a game that you installed on D:\blah to E:\blah because you need the space on D for something else. Game doesn''t run anymore. WHY do Windows games need to store direct references on drive letters ? Some even store drive-bound paths into registry entries !! WHY ?

Don''t get it...

##### Share on other sites
I have to agree, stop playing with the registry! Mine is already over 32MB big(!!)

Give me a .ini (or whatever file) in the GAME DIRECTORY anytime over the stupid use of the registry.

And if you must use the registry, then don''t put directory paths, or anything else that can mess up a game just by moving the folder from one drive to another.

##### Share on other sites
Using the registry is an easy way to allow per-user settings. You can also store binary data directly.

I still prefer config files for games and stuff though.

----------------
Blaster
Computer game programmer and part time human being
Strategy First - http://www.strategyfirst.com
BlasterSoft - http://www.blastersoft.com

##### Share on other sites
quote:
Original post by Anonymous Poster
Why do Windows games always need to put their config stuff into the registry ? Why can''t they just create a little ini or cfg (or .config ) file in their current directory, and load that one at startup ?

What about allowing settings for different users? Under UNIX you get a different home directory for each person so this is trivial, Windows doesn''t do that.

quote:
This way, games would be 100% relocable. I hate this: Try to copy a game that you installed on D:\blah to E:\blah because you need the space on D for something else.

If you could move games around that easily, how would Windows how to uninstall it?

(Of course, this can be answered with: "why not teach the users how to delete a directory for themselves, instead of using a convoluted Add/Remove mechanism".)

[ MSVC Fixes | STL | SDL | Game AI | Sockets | C++ Faq Lite | Boost ]

##### Share on other sites
quote:

What about allowing settings for different users? Under UNIX you get a different home directory for each person so this is trivial, Windows doesn''t do that.

Hmm, yes. Good point.

But, although I don''t know the Win-API very well, I''m sure that there is a function to query the username of the currently logged in user. So you could just create a CFG for each user: user1.config, user2.config, etc.. Perhaps encrypted with a user defined password.

That way, each user could just do what he wants with his config file, copy it onto his notebook (to keep playing at work ), backup it, or even access his personal configs (or savegames) over a network, or... Oops, probably I''m thinking too much Unix here...

##### Share on other sites
Thanx for all the inputs...

[Hugo Ferreira][Positronic Dreams][]
"Research is what I''m doing when I don''t know what I''m doing."
- Wernher Von Braun (1912-1977)

##### Share on other sites
Since nobody mentioned it, you can still create .ini files. In fact, you can give the user the choice of using the registry or an .ini file (so the power user has more control), but default to one for the type of user who always clicks "Default Installation."

Happy Hacking!

[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!

##### Share on other sites
The registry is cool, because it begins to provide type-safe storage.. it''s certainly not perfect though. Personally I find text parsing a pain, and a waste of time that could be spent doing something else, so I tend to use the registry early on in development because it''s a little quicker to use.

As for username''s, etc.. Win9x doesn''t really have that concept. NT/2000/XP does though. NT also has the concept of a ''home'' directory which you can get the path for, using Win32 APIs. Max Payne (for PC) will query for your user folder and store your save games there (and maybe other user specific stuff). I think there was an article on MSDN that describes this as "the right way to store savegames/etc under Windows"..

-Brannon