HuskyGames Dev Diary 006

Ah, SQL: the greatest language in the world. It is so amazingly good that I am going to educate you all in this blog post by writing the remainder of it in SQL.

Select ‘So, this week I set about building the database for our new game.’
From WhatHuskyGamesDidThisWeek

Select ‘I can not be bothered doing this for the whole post, so blog over.’
From ConsequencesOfBadIdeas

SQL is a lovely technology for manipulating data. iOS and Android both have SQLite technology built in and the Corona SDK provides nifty API access to it. It was the obvious choice for the new game’s database, and given my recent experience working with SQL I was very comfortable with it.

The Mac App Store is a brilliant thing and from it I downloaded a piece of software called SQLite Manager. It lets you quickly build a database – tables, views, indexes, stored SQL scripts and the like – all saved as one SQLite file. The file can then be dropped into the main development folder for the game. With a few lines of code data is soon appearing all over the screen, giving the appearance that a game is actually being built.

Which, of course, it is.

Once I had the database then a lot of the game’s functionality became easy to implement. What starts as high level concepts – training players, for example – is reduced to SQL code:

Update Player
Set Speed = Speed + NewValue
From Player src
Where src.PlayerID = playerID

Update Team
Set Cash = Cash – TrainingCost
From Team src
Where src.TeamID = teamID

Argh, my eyes, my eyes! This is not beautiful like Killzone 3, I hear you proclaim. And that’s true. It’s not. But, once Nofi has finished up with the special graphical loveliness, the functionality above – and more like it – will be wrapped up in such a shimmering vision of wow, that you’ll forget all about my equally sexy SQL. Hmph.

Despite the database and the kickstart to development it’s brought, there is still a lot to do. There are many areas of team management to include in the game; training, scouting, transfers, contracts, picking the team and tactics and so on. It’s a modular design though, so each area is separate from the other meaning it’s easy to develop one at a time. The only point when everything will collide is in the “match engine”, i.e. the code that effectively plays out a match between two teams. This is definitely the most complex part of the game and the piece of development that I am most looking forward to starting.

Which, if all goes well this week, I’ll be starting to design and code next week. And, if that goes well, in another week or two the game may well be fully playable, awaiting just a coat of awesome from Nofi’s paintbrush.

Once again, I’d like to thank the team at Ansca Mobile for their support, and also the great Corona community over at Ansca for its help and advice.



  1. I love SQL, one of my favourite languages after Ancient Greek and Binary. And I’m not even joking … seriously

    • Although binary isn’t really a language, I suppose.

      • I nearly listed a few languages that SQL is better than. But then I didn’t. My bad.

      • There are only 10 types of people in the world…. those who understand Binary, and those who don’t. ;)

      • wow, I can’t believe you actually went there……

  2. “training, scouting, transfers, contracts, picking the team and tactics” tis now sounds like Football Manager, got me hyped up to 11. Good luck HuskyGames!

    • i’d like a speedball type game.

      • Yes, well. Er. Good! I think we all want that. Really. We do, don’t we?

        Our game was originally inspired by Speedball about 20 years ago. The new game is, well, we’ll see how it turns out!

    • It is like Football Manager. It’s not football though. Nor is it like those super complex footy management games around these days. It’s just like good old Football Manager back in the day. Sort of. Yes.

  3. I use SQL a bit at work, unfortunately this site is blocked at work, wonder if I can use the article as a business case for them to unblock it for me!

    • Tell them there’s a really important tutorial about, erm, using SQL to model real world entities. Yes, tell them that’s coming up next week and you need to read it.

      • If that doesn’t work, you’ll have to remove the word ‘Game’ from the site for me.

  4. SQL eh? As a database administratior I can share your sympathy with the language.

Comments are now closed for this post.