Oh no! Now, of all times - that's what we were thinking a few days ago, when a local newspaper published an article about text adventure games and emphasized that they are currently become 'in' again. Why, do you ask? Well, we are planning to create text adventures since a while. There is still a lot of work to do, and right now the newspaper is telling everybody to create text adventures! Hopefully we won't be too late....

The blog entry you're currently reading was written by Tobias. It is my task to implement a game editor where our writers could easily create and manage a story for a text adventure game. I got some descriptions what to do and approximately how to do it. We planned to use SQLite (https://sqlite.org/) as database for the game story. We did not want to use the Entity Framework (https://msdn.microsoft.com/en-us/data/ef.aspx) because of its size. This framework would automatically implement the 'transformation' from the given source code to the necessary SQL scripts. As a consequence we have to do it 'by hand'. A few years ago I've learned how to do this, so it was time to get my notes and reread the steps how to go from a list of features over an entity relationship model (http://en.wikipedia.org/wiki/Entity%E2%80%93relationship_model) up to a schema in SQL.

I was looking for an example code how to use SQLite via C# and made some tests. You can read more about this on these pages (https://www.sqlite.org/lang.html, http://www.codeproject.com/Articles/22165/Using-SQLite-in-your-C-Application). I've tried to setup the schema and the SQL scripts to read and write from the database. With the help of a short test text-adventure it was a long work of trial and error, but the error messages from SQLite (it throws nice exceptions) are very useful and with their help it was easy to find the corresponding peace of code. Another helpful tool was the Firefox-Addon named SQLite Manager (https://addons.mozilla.org/de/firefox/addon/sqlite-manager/). It will open a separate window out of Firefox where you can choose the sqlite-file and watch the structure and make queries for tests. At the moment we are able to create a database for a game with some hard-coded statements and read from it. This enables us to work on the editor and on the game app in parallel.

Lessons learned

  • - You can draw a very nice-looking diagram for the ER schema for you database which looks perfect and finalized, but during the implementation you will find some new problems you didn't take into account before. It is thus important to discuss necessary changes on the database model with your team on the go.
  • - You need to clearly define the task of the database: We want to use it only as a data source, this means there is no game logic implemented in the models and the database. In our case, the game application checks whether conditions are fulfilled and takes care of the current status of the user (how much life points, how much cold coins, etc.) and the dealing of load and save of game sessions.