ea's spore released on 7th september 2008
So, what exactly is Spore? It comes from the terrifyingly clever mind of Will Wright and his team at Maxis (the same company behind the phenomenally popular 'Sims' franchise), now a subsidiary of Electronic Arts. It is also a game which has proven difficult to explain, although the best explanation I have heard so far is “it is Sim Everything”. You start out as a small organism and, much like the real world, it's survival of the fittest. Progress through the game is rewarded with upgrades, where you can spend DNA points on upgrading your lil' fella. As the game progresses, you move from simple organism to pond life, to a land animal, and from there to founding society, then civilisations, and onto becoming the dominant species of your world. But that is not all – from there, the game folds out allowing intergalactic travel to other worlds, where the local monsters have been populated from a huge database of other people's creations.
I toyed with the 'creature creator' a few weeks ago. It's a small part of the game that EA released early, so we could get a taster of what is to come. The creator is fantastic fun – I made a crocodile with a huge head for instance, and I laughed at it for probably fifteen minutes straight. The bright and colourful models together with the very cutesy animations your creation performs (my crocodile almost shat itself in excitement when I gave it an extra set of eyes, for example) not only entertained me, but roped my non-gamer girlfriend in too. It was interesting to see what monsters she came up with. Inevitably, the first one looked very sappy and cute, some sort of hug-monster. I have a sneaking suspicion come this Friday, I may have competition trying to get on my PC!
So what is this blog about? The pitfalls, really. I don't mean to be cynical but I'm British, and it's in my genes. I really want this game to succeed, I really do. A few things worry me, however. First off, great, it's a game where you can 'level' your monster up (reminds me of E.V.O. on the Super Nintendo, if anybody remembers that game), which is great. I'm familiar with that concept, and together with the creation mode, it sounds like a game I'd have a lot of fun with. What about the other areas of gameplay? If you watch the trailer, it shifts from top-down munch-em-up to a third-person action game, then to an RTS, then to a space-faring sim. The variety looks great and I applaud it, but I hope it doesn't feel like I'm just playing a set of mini-games with a tentative link between them all (the link being your creation, as it will be constant throughout, although you can 'upgrade' it). It's that sort of detached feeling that made Wii Sports a decent game and not a great game, in my eyes.
The second is the fact that content comes from other people. If this thing gets as big as 'The Sims' did, which lets face it is likely, there will be a hell of a lot of content within Spore. Somebody has already mentioned: what happens when the Star Wars, Pokémon and Futurama creations start appearing? Are they protected from take-down notices? Will EA have to screen all the content? If you're new to the whole concept of Spore, or gaming in general, you may not be familiar with the one core concept rooted deep within our kind. If you give a gamer (especially a male one) a sandbox environment where you can build or model things, they will. make. a penis. I haven't got the statistics to hand, but apparently there have been thousands of cock-monsters uploaded already and the game isn't even out yet. Spore has an ESRB rating of E10+. Would you want your ten year old daughter and her interstellar pal 'Mr. Cuddles', the green snuggle-monster to suddenly arrive on a planet filled with huge pulsating penis-monsters, wriggling around and oozing god knows what? I'm not so sure either.
I hope it lives up to the huge weight being placed upon its digital shoulders by the Internet. I'm sure it will pull me away from reading and programming in the evenings for a while, at least. The game has to be admired, just for the sheer scale, the ingenuity (you can give a creature a billion legs and it just works out how to walk), and the love that has gone into designing something this complex. At five or so years in the making… let's see if can match the hype.
nested sets (again) with group_concat()
If you haven't used them before, sub-queries are a very handy addition to your developer's tool kit. Traditionally, they are used to grab parts of data where the grouping in the main SQL query makes it difficult, or for getting similar result sets to outer joins. Going back to our nested set model, if you look at the examples for the adjacency set you can see that when they are getting the path to a node, the result set is one row containing several fields.
So, what do we want to do? We could do it programatically with a loop, and use two queries. I am always incredibly weary about placing queries in loops and I decided against this. All we really need to do is concatenate all the node names together into a string. Makes sense? So as we traverse the path, PORTABLE ELECTRONICS is appended to ELECTRONICS, and then MP3 PLAYERS is appended to the previous string, and finally FLASH is appended to this string.
Unfortunately, this method doesn't work either. Your 'node' and 'parent' elements will concatenate together, but again they will overwrite the previous concatenation. The only way around this is to use an aggregate function that is present in MySQL 4.1 called GROUP_CONCAT(). This will concatenate a field together based upon a GROUP BY clause. If we run the query:
So there you have it. GROUP_CONCAT()… I feel stupid that I never knew about it before. I use it every now and then in queries like this to produce a CSV from a dataset and use WHERE IN() or just return the string and 'explode' the list with PHP. Hopefully my little adventure with the nested set model and this MySQL string function proved useful to you. If you have any further ideas for making the query more efficient, or you can rewrite this without a sub-query, please: leave a comment!