Monday, June 17, 2013

Part 1 - Why use SimpleIni aka why config files are awesome

In order to keep you interested while I'm working on the game in some shape, I'm gonna take some time and explain the code libraries that I'm gonna use for the game. I'll start of with SimpleIni

What is SimpleIni

SimpleIni is a C/C++ open-source software that is used to read, change and save settings on .ini files. It can read both integer values, floating point values, string values and booleans.

Why SimpleIni

Initially, I used it because I was assigned to find a solution that could read settings from .ini files, but I liked it so much that I continued to use it. One reason for it is because it is so simple to use, all you need to include is one header files and from there on, it is really simple to use, maintain and debug.

Disadvantages?

By the way I've been using SimpleIni, there are a few disadvantages with it
  • Only support for the integer variable long (which is equal to an int, a 4-byte integer), but you can cast it to lower integer values. For grater values, you read it as a string and then convert that to an integer
  • Only support for the floating-point variable double (which used 8 bytes), if you want to use float (which uses 4 bytes), you have to cast it to a float when reading the value

Why have config files

Because it saves time!
The way the project and VS is set-up for me right now, if I change something in the renderer class, it takes ~4 seconds to compile. That may not sound much, but when you are in a phase where you are doing nothing but changing variables to make the game balanced, that adds up quickly. So by having numbers in a config files, you just need to change the variables and save the file in order to make the change happend. And that saves lots of work in the long run.

So if you don't already have a config files for your game, get one now!

No comments:

Post a Comment