We are re back in action! Happy New Year one and all. After a nice relaxing, drunken, over-fed Christmas and New Year, its time to brush the dust off the little grey cells and try and get my head back into coding and writing about it again!
I figured just before Christmas that if Project Blast! is going to get anywhere it needed to be coded in C++. Regular readers will be very aware of my irrational dislike of the VC++ compiler and my very rusty skill set when using it. I’ve tried to make life a bit easier for myself by using the Blitz3D library so a lot of the functions are familiar to me, which is a great help. At this stage I would like to apologise in advance, as this issue is going to be quite “techy” in some areas!
What I’ve found (albeit very early on in the process) is that the porting process is tremendously time consuming more than anything else. For example – with the Blitz 3D dev environment variables are defined by a symbol, so a float would be “myvariable#” an int “myvariable” and a string “myvariable$”. C++ of course doesn’t work like that – so ALL references to my variables need to be changed to specifically state “float myvariable;” or “int myvariable;”. Whilst I’m currently wading through my header file it has taken quite a bit of time to get right and working correctly.
Also with Blitz you don’t have to prototype functions, you can just start a new one whenever you like and Blitz happily accepts it. With C++ I need to ensure that all my functions used within the game are prototyped in the header file too (point of note – that’s not technically correct as if my functions are defined prior to being called – but prototyping is actually a good way to ensure that I don’t miss anything!). Not that I have an enormous amount of functions, but it’s just another pitfall area for me to watch out for.
Nevertheless I think I’m beginning to grow to like C++. It imposes order in my chaotic world and simply refuses to work with the rubbish I usually feed in! Blitz is VERY forgiving – it holds your hand and lets you get away with things that C++ just laughs at. Whilst it can be insanely frustrating at times, it is equally VERY rewarding when something finally works. When pressing the “build” button for the first time and getting over 150 compiler errors it can be a bit disheartening, until you realise that 145 errors relate to you declaring a variable incorrectly and the compiler throwing up an error every time it encounters the said variable!
Another area where I’ve been forced to do things properly is by ensuring that I don’t instantiate any variables in the header file (other than some constants). This has actually taken a lot of my time too – as previously I had all my variables being declared and instantiated within my Blitz header. Whilst, again technically, I can instantiate my variables in the header file, I’m trying to embed some good practise within what I do!
I am also finding that the compiler (whilst VERY complicated in certain areas) actually speeds up the development process too. Little things like when pointing the mouse curser at variables within the code, the compiler will tell you what kind of variable it is, or, if it’s a function, the arguments required (which has proven invaluable). I’m sure that as time progresses I will discover more of these little quirks and grow to love them!
The great thing about doing this port for me personally is its increasing not only my confidence in C++, but also my understanding exponentially. Before I started I was quite nervous about using C++, now I’m less so. I am understanding more of the basic principals and also am beginning to understand how using certain features of the language might actually benefit me. Things like Classes, Overloading (functions and operators), templates etc. may all mean that I can reduce the code used within Blast! to make the game run much smoother, although I think I will focus on getting the game ported over “as is” to ensure it works ok, and then look at refactoring to make the code more efficient.
All this time spent porting (and of course time to be spent porting) has meant that actual progressive development of the game has stopped temporarily. I have no idea how long this port will take me, however what I am confident in is that once its done we will be on a much better footing to get things moving at a much faster and more professional pace. I’m also hoping that by using C++ I can introduce other libraries into the game which will improve the overall feel and quality of Project Blast!
I’m actually also in the process of changing my kid’s old small bedroom into my study. I’ve set up my old dual monitor (ideal for debugging) PC in there, hooked it up to my network hard drive so I have no excuse for not doing more work on the game at home now. Trying to code on a laptop whilst the Mrs is watching telly is nigh on impossible! Especially when she likes to provide a running commentary!
As ever I’ll try and keep posting updates on our forums at www.adarakion.co.uk.