Can NoSQL databases help Mobile Games ?
I’m back!,
It’s great to be writing for iDevBlogADay again!, I’ve been very busy since the last time I wrote, mostly because I’m in the process of starting my Informatics Engineering Student Thesis, which I’ll begin as soon as I get myself to France, which should happen by July 31. I’ve been working quite hard the last couple of months, exploring new technologies and trying to figure out how they could fit in the Mobile Games world. One of the technologies that I had heard about in the past was the NoSQL databases.
A NoSQL database attempts to solve many problems that you can face with a typical SQL database on a broad set of applications. They don’t require fixed table schemas, they try to eliminate join operations and in most cases scale horizontally. This article aims to talk a bit about some database implementations that solve some interesting issues that are experienced in the realm of mobile games.
I have to admit that I’m a quite biased in favor of NoSQL databases for most of the mobile games that I see in the App Store, but I must concede that you can come up with some games that would require a regular database engine to solve different sorts of issues, but I think that at least for general purposes, a NoSQL database could be a better choice. I must also admit that I’m in no way an expert in this technology, and so far I’ve made only basic experiments.
Flexibility to model data
The problem that I see for many kind of games is that the requirements can change extremely fast, and I think that relational databases can be a bit of a drawback when this issues happen, for example, let’s say I’m prototyping and polishing for fun in a 2d Beat’em Up Game ( a la Castle Crashers ), right now I have a database to reflect several item types.
Image we have this in a relational database, I’m iterating with a designer in order to try out different item types, which is something I tend to do a lot… , so let’s say that designer says “Hey, we should try a Magical Sharp Knife!, I think that would be awesome!”, well of course I would shrug and reply, “Ok, but I’ll have to modify the DB schema to make the data fit”. That would cost me a bit of time, etc. The idea of a NoSQL database such as CoachDB or MongoDB is that they are schema free, that means that I don’t have to make my data fit a “fixed” schema and I can just model my data the way I want it to be. Of course there’s the argument that Schema Free can be a disaster if not managed correctly, but I think the same is true ( and even worse ) for a typical relational database.
| 1 2 3 4 5 6 7 8 9 |
|
How the schema can be more flexible in a Schemaless DB (pseudo code but you get the idea, if you don’t maybe you can take a look at this MongoDB article, the syntax resembles that a bit)
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
As you can notice, I didn’t have to add some “row” in order to support my Piercing Magic Knife of Burn, so I can support my old Knife and the new one without big changes in the DB. For me, this represents an advantage, but it’s not the biggest advantage, specially if we’re talking about Mobile Games.
Mobile Application Data Synchronization
This feature is implementation dependent, but MongoDB and CouchDB seem to offer it. Since Couchbase has iOS support, it should be ready to go, although the iOS implementation of Couchbase is still Beta, and for now adds significant weight to your App Binary (they are targeting 5 MB for their first round of optimizations, and they state it might get even better in the long term). Trivial synchronization of data between mobile peers is becoming a reality, and this can prove very useful for Mobile Games. Sharing a simple context for a multi-player game (real time or turn based) can be a huge benefit and this is the single thing that excites me the most, of course you could also share a player Game State between his Mac, iPad, iOS in a no-brainer manner.
The NoSQL database concept is not new, Carlo Strozzi came up with it on 1998 for databases which didin’t expose an SQL interface. However a lot of the implementations that are appearing these days, are quite new and already show a lot of promise. Their data modeling flexibility, synchronization facilities and low latency, makes them attractive for Game Development. I would be very interested to know how do you think that this new generation of databases could impact Game Development, and in particular, the Mobile Component.





Add Yours
YOU