Jump to content
  • Advertisement
Sign in to follow this  
fooman_69

config file

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

Advertisement
do you mean a config file like many games use them?

if(yourAnswer == YES)
{
those files are used to store data even when the program is closed so that certain settings dont need to be made every time you rin your program. those setting could be screenresolution, texture quality, player name etc.
}
else
{
sorry i understood you wrong

}



greets DeviceLost

Share this post


Link to post
Share on other sites
A config file is useful for providing a layer of abstraction between the game and the game code. Instead of hard-coding settings, they are stored in a text file which can be loaded at run-time. This eliminates the need to rebuild the game just to make a few tweaks to the settings.

It's not that important to have one for small, hobbyist projects like Pong or Tic-Tac-Toe, but for something as massive as an FPS, it's almost critical, as building the game's code-base can become a matter of hours.

As far as making one goes, you pretty much have to write your own parser. There is a somewhat-standard data-storage format known as XML, and I'm sure Googling for XML parsers will yield something useful.

Share this post


Link to post
Share on other sites
If you're using windows there is some API functions for parsing .ini files. Maybe have a lookinto them. I think they called Get/SetProfileItem

Share this post


Link to post
Share on other sites
Quote:
Original post by chad_420
If you're using windows there is some API functions for parsing .ini files. Maybe have a lookinto them. I think they called Get/SetProfileItem


GetPrivateProfileString/WritePrivateProfileString ;-)
It's just a matter of having the Win32 help standing by or Google MSDN for the words :-)

A scripting language like Lua or Python can also be used. Both have code for parsing and manipulating scripts, and a typical Lua config script can look like this (that eliminates the sections of an ini, but can contain tables if wanted to give some sort of a class hierarchy, like the code shown below):

screen.width = 1024
screen.height = 768


Then you can go further and use Lua scripting for your entire game, but that's another subject.

Share this post


Link to post
Share on other sites

What Dev IDE and Language are you using. As siad about in Windows there are some api functions that you can use to interact with ini files, but in .Net there are managed functions that will allow you to interact with Application Configuration Files. Also using the newer .Net 2.0 Framework you no longer have to access the registtory to store user daya as you can read and write from the app.config files using the new User Settings Sections.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mykre

What Dev IDE and Language are you using. As siad about in Windows there are some api functions that you can use to interact with ini files, but in .Net there are managed functions that will allow you to interact with Application Configuration Files. Also using the newer .Net 2.0 Framework you no longer have to access the registtory to store user daya as you can read and write from the app.config files using the new User Settings Sections.


Or you could just use .NET's amazing XML support, which I think would be the way to go because of the flexibility. And it's just so easy to do with C#.

Share this post


Link to post
Share on other sites
Thanks for response!
I'm writing my app in C++ in .NET
is an .ini file just a text file with that extension?

Share this post


Link to post
Share on other sites
Quote:
Original post by fooman_69
is an .ini file just a text file with that extension?


Yep. As with all extensions, they really have no set meaning (its a windows thing). Linux doesn't usually use them as you may notice. Name the file whatever you want, but .ini is usually the standard way to go for initialization settings.

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!