Friday, 26 July 2013

Adventures in MySQL

About a year ago, I wrote a particularly geeky post about an experiment I did using MySQL for something for which a database was probably never intended. As it happens, I was reminded today about a similar abuse of MySQL I and a colleague tried several years earlier just to see if it were possible. Having re-discovered it, and having not written a blog post for a long time, I thought I would share it with a wider audience. Who knows? Someone may even take it and make it into something useful.

The plan this time was to write a text adventure game in MySQL and, as with the Mandelbrot Set generator, I wanted it to be a genuine use of the database rather than just an exercise in translating algorithms that could just as easily be written in any other language. Ideally, I wanted the commands that the players uses to be standard MySQL commands but that became too complicated so everything is done using stored procedures. However all data, state and information governing the interaction with the computer controlled character are stored in the tables and it should be possible to replace all of this and get a completely new game. Well, that is the theory.

Anyway, the source code to the text adventure as well as the Mandelbrot set are now on github for anyone to fork and do with as they wish.

What else can be forced into a database? Chess?

1 comment:

  1. Hi Joseph,

    I couldn't imagine that there would be much of a problem doing anything with a database. Though admittedly I've not tried this.

    Any object that can be part of a non-fuzzy set (and hence the algebra of sets/set theory applies) can, I assume, translate into a DB structure, given relational algebra is a derivative after all. Programs are ordered sequences of commands (based on sets) and this I assume it just simply becomes a transactional script maybe? What do you think?