Adarakion Developer Diary: Issue 9

Planning. A word I am somewhat unfamiliar with, being better friends with its arch enemy, Chaos. Thoroughly planning a project and subsequently implementing it is much better than chaotically coding away and realising that you have to change the entire structure of your program to accommodate a new feature, as I have discovered on several occasions lately. It can be quite frustrating to “nail” a bit of code and then realise a few minutes later that whilst it works now, it probably won’t once I implemented feature “X”.

Take for example, the coding of the ships systems such as weaponry, nano-tech etc. All a relatively simple process in terms of, you pick your ship (a), weapon (b) and nano-tech (c) and away you go, however with the reasonably complicated profile system I am hoping to integrate, along with how these weapons will actually operate a little bit of forward planning goes a long way! I have allowed more than ample space for all the weapons/tech we want to cram into the game and made the code flexible so it will be very easy to add more in either before release or MAYBE as DLC at some point in the future.

But the actual implementation of these various systems “in game” could be a bit of a headache without me at least giving some cursory thought to planning. Does each weapon run from its own function? Do I have a global weapons function which accepts the weapon being fired as an argument? Neither will affect how the game plays, but may well affect how easy the code is to follow once there is a lot of it! I’m thinking separate functions for each of the weapons at the moment, maybe within a separate weapons “header” file. That way I can very quickly look at each weapons code and adjust as required, rather than having to search through a bunch of code to find the weapon I need.

Turning to other matters, I had a lot of screenshot requests last week and this is still very much in the forefront of my mind. There will be screenshots and other nice things to look at soon, I promise, but I need to do some more work on the fight engine first so that you can understand what you are looking at – so bear with me for a few weeks till I get onto that. I just have to finish my work on the ship selection system (which other than the required “polish” is pretty much finished), then I can go hell for leather with the fight engine and screenshots will follow left right and centre… yeah, that’s right, Ill post 3!!!

A common theme amongst these diaries is my continuing war on bugs (I feel like a real life Tommy Lee Jones here), so therefore I felt it appropriate to list the Adarakion Top 10 bug list, so here goes pop pickers (cue cheesy 70’s countdown music):

10. Bad filenames. Is this an mp3, wav, jpg, png ??!? I always guess wrong!

9. Split screen x/y coordinates. Damn you. I always ALWAYS forget to offset the second players’ coordinates!

8. Operator precedence. Grr. No matter how many times I think I have cracked it, I STILL get the order wrong!

7. Running the wrong program – yeah it sounds daft, but trying to “run” the header file isn’t always going to give you the result you expected, and its easily done!

6. Syntax Error. Gah, you have a lot to answer for Commodore 64. I’m sure you made that phrase up

5. Variable Scope. SO easy to lose a variable you thought was global in a local function! Globalise all of ’em I tell ya! Actually that leads me onto..

4. Globalising local variables. Ok, so this is tied to number 5, but still relevant. DON’T make local variables global unless you are prepared to reset them after the function in which they are called. Actually, just don’t do it, its bad practice anyway! (Makes a note to self!)

3. Getting sums wrong. Simple, basic algebra and maths will only work if YOU get the sums right – sure, the computer is clever, but not THAT clever!

2. Getting the draw order wrong. Right, so first I need my background, then graphics then text. It’s amazing how many times I draw the text, THEN the background and spend a long time trying to figure out why I can’t see my text when I have just plonked the background over it!

1… and at number 1 its mis-spelt variables! Gah. Ugh. They are the worst sort of bug. Spending hours going over and over code dry running it, realising it WILL work so why isn’t it. 2 hours pass, ugh. WTF is wrong. It’s the compiler. Its faulty, it doesn’t wor…. Oh.. Hold on a minute. Let me put the “e” in “number”. Ahh. Works fine now!

Right, I best be off, got lots to do and not enough time – as ever, any questions feel free to ask them here, or over on our forums at www.adarakion.co.uk.