Friday, September 26, 2014

My Video Game's Leaderboard

So, for the last for days I've been working hard on my game and generally ignoring blog related activities. This has resulted in two things. The first is that there's been no blog posts but the second is that I can finally see the light at the end of the project. The game I'm writing is nearing completion and this make me happy.

I decided to stop working on the blog when I started working on the global leaderboard for my game. The idea is that instead of having a top ten list only for the local machine you have one giant one for the entire world.. Consequently it has to have more than ten entries in it. I figure the world must contain several dozen people so I should use a database for that sucker (I'm not actually sure of the world's population since I don't go outside anymore :(   ).

The problem with databases is that I've spent most of my time as a professional developers trying to avoid SQL. I don't like SQL, It reeks too much of command lines and the 1970s. My internal conceptually associations go something like silly hair, the colours orange and brown, tiny tennis rackets and SQL. SQL is an injection attack just waiting to happen. Seriously. You need to escape stuff properly or use an API with prepared statements. Otherwise the teenage equivalent of me is going to turns the database into a playground.

In order to hook up the leaderboard to my application I also needed to use Apache and PHP. I chose these two things because my ISP chose these things and was nice enough to let me use them.

In order to write my code without affecting production I needed to create a test environment. This proved to be extremely difficult partly because I'm on Windows and this is considered weird by the UNIX crowd who make all this stuff (also 1970s, BTW). But mostly because I was trying to match all the version numbers with the ones my ISP had installed. It's generally a good idea to test on the same software as you deploy on because it has a better chance of working. In this case that would probably require time travel as the ISP hasn't updated its software since dinosaurs roamed the earth.

Space: The go-to place for all good video games

In any case, I eventually got a decent test setup using fairly up-to-date versions of everything but it took just about a week to do. Normally I wouldn't mind too much since I'm being paid to do it, however in this case I was fully aware I was wasting my own time and could probably build my own server software quicker at this point (it never works out this way but it feels like it should).

Anyway, the general upshot is that my game now has a global (as well as local) leaderboard. Hopefully gamers will like that and compete for higher rankings. If they don't I just wasted a huge chunk of time.

No comments: