Saturday, 11 December 2010

All the settings

An important part of being a programmer at a game development company, is creating things in such a way that game designers can do their job. They get to fiddle around with the gameplay, while programmers build the technology. At Ronimo Games we have built a whole suite of tools for designers to work with, and I personally think the settings system is the most important. The nice part is that it was also the easiest to build.

At its core, this is a very simple thing. We have a text file with lots of values that our designers can tweak. For example, for each unit, the designers can set the health, price, walking speed, weapon's range, and a lot more. In Swords & Soldiers, we have some 600 gameplay settings like that.

A programmer creates these settings, and then a designer experiments with them to choose the right value for each of them. To do that, the designer needs to see the results of his changes quickly. Now I would like our designers to work with that as fluently as possible, so I built the feature that by pressing F5 in the middle of the game, they can reload all the settings. So they can constantly switch between settings and game using alt+tab, and use F5 to reload on the fly. Usually there is no need to restart the game all the time.

Technically, this is very simple to do. The key aspect is to use a struct for the settings and keep pointing to that. Never copy a value from the struct, because the copy won't change if the struct does. Thus when F5 changes the values in the struct, all the gameplay immediately uses the new values.

Depending on your needs, lots of variations to such a settings system can be chosen. In Proun I don't have the F5 mechanism, but I do have the possibility to change all the settings per level. So in the third track, I could easily make boosts last twice as long as in the other tracks, which happened to fit the track design better.

One of my first implementations of this system was De Blob. There we even implemented sliders in the game to allow designers to quickly modify properties, but we learned that as the number of settings explodes, these sliders didn't work that well. Since they were also a lot of work to build, we have simply used Notepad to modify settings ever since.

I would like to also talk about Ronimo's Secret New Game here now, since we have a much more advanced settings system for that, but that will be for another day. After all, the game is still Secret (tm) right now.

A settings system like this is so simple to build, that I think you should even create something like it for the smallest student games. It is also something that you can build once and then reuse in all your games after that. In my opinion, fast gameplay tweaking options are an absolute requirement for good game design.