Safegame

September 29, 2008 @ 23:43

I am a big fat liar once again. I *WILL* make a new theme, I will keep updating this blog, I will do all the things I keep saying I’ll do, honest.
Anyway, back to now.
I’ve started a project (If you want to place bets on how long it will last I’ll put £5 on… 2 weeks). The principle is a savegame server and client api.

Before I go into detail about what I would like it to do I think I should explain (quickly) why I decided to do this.
We have a module at university this year, “Games Tool Programming” which will involve us designing a programming language of sorts, and making a compiler for it. We will be using a 10 year old version of yacc (well, I will be using the latest build of bison) and lex (for me, flex)
Anyway, I was busy working on the first week’s lab sheet, editing a simple calculator, when I realised I was very bored with it and started looking for something more interesting to do.
I don’t know how to do any network programming. That might be fun(!) So I set about looking for tutorials on network programming. I came across Beej’s Guide to Network Programming which I found great and recommend it to anyone wanting to have a look at sockets. I realise that this isn’t the highest level and easiest way of doing things, but I figured, if I can do sockets, then any networking I would be asked to do in future could only be easier… right?

games.jpgAnyway, I worked my way through that and had a look at this guide for the simple client/server code in one chunk which I set upon pulling apart and playing around with.
Next thing was a repository. I used to have an old Compaq 600MHz PC sitting as my router but the HDD died and I’m back to a linksys, so I have no sort of version control I can access and I set about looking for something. Unfortunately everything I could find (for free at least) was only for projects (see Sourceforge, Google Code etc) so I tried to think of an obscure project I would enjoy working on that I wouldn’t be bugged, at least to begin with, as I am still just learning. I would hate to have some more knowledgable person come and rewrite all my code (and improve it) when the main reason I started this was to experiment myself.
Anyway, enough rambling. I came up with safegame as I thought it might be useful to me in the future, and other people might find it useful too at some point, who knows. I also stuck it on [url=”http://www.tuxfamily.org]tuxfamily[/url] as I had never heard of it before, so maybe noone will find it until I’m ready to show people.

So, what is safegame (…going to be…)?
Basically, it’s a set of functions that can be easily added to your game to connect to a savegame server. The server will have multiple user accounts, each with a repository of save games stored, possibly allowing for multiple games on the one server. The server can then return the savegame to the player at a later date.

Why?
You can easily use multiple computers to play the same single player game without having to fiddle around copying files around. Also, it would be possible for the server to poll the repositories and create a web based leaderboard.

How?
After initial handshake and username exchange, the client will send any data it has to the server, using memcpy into a buffer where it will be output to a binary file at the server, including a server generated header containing username and any important information (score etc). The username and password will initially be transfered in plain text but when I get the rest working, I will implement an encryption method for at least these, if not the game data also. The usernames and information on what savegames are currently stored will be in a separate database. I don’t know whether I will write this myself or find something that does what I want. Server configuration is being done with xml files, using TinyXML which is published under the ZLib license. I’ve used this before and am fairly confident in using it.

When?
Haven’t a clue.
I hope to keep working on it. The guys at Tuxfamily seem cool (although I’ve not talked to anyone personally, but still) so I would hate them to ban me or something because I’m not working on my project. As I said, I chose something that interests me in the hope I keep going. When I’ve done a bit myself and am confident how I want things to work, I might make it slightly more public. Hopefully that will be soon.

Currently I have little more than a folder structure for my code and empty classes, with declarations of what classes are members etc. That and a couple of diagrams in my notebook. However, I did only start looking at sockets a couple of days ago, and my git repository application was accepted yesterday, so I don’t think I’m doing too badly…
When I have something to show I will make the repository public and post a link here if anyone wants a look.

If anyone has any questions, please let me know, I have 2 comments on my site, one from me… so I’d like to know what you think :)

Image: An Ode to Gaming by paperghost - unfortunately I don’t have all these consoles (yet!)