…and writing about it too

It Begins

So over the last couple of days I’ve somewhat started on the game itself, hooray! Not that I’ve had much time to work on it, but so far it’s a blank OpenGL window with a configuration file that you can modify to set the resolution. Well gotta start somewhere I guess. A lot of the time has been spent simply grabbing code from previous projects and formatting it to be consistent. That’s one thing I tend to be anal about, and it ends up different each project too 😛 Do I use capital letters for .cpp file filenames? What do my function header comments look like? What should I put as the source file header? I probably take way too long to decide on this stuff, and tend to somewhat ignore general coding conventions. At least some of them.

There are a bunch of basic classes I’ve written over the years which I use in pretty much all of my projects. I’ve just gotten so used to them that even if a library I’m using in the project provides the same (usually better) functionality I’ll still use my own implementation. Like, say, my string tokenizer. In case you didn’t know what that is, a string tokenizer basically breaks up a string into tokens (heh, guess the name is quite literal hey). So “Hi there how are you” would be broken up into 5 tokens: “Hi”, “there”, “how”, “are”, and “you”. This kind of thing I have many uses for, such as parsing the text based configuration file. At the moment the cvar section contains 4 lines. Screen width, height, bitdepth and fullscreen. Now the tokenizer comes in handy for reading this. I can get it to read a token, check if the token is “vid_width”, and if it is, read in the next token as an integer variable and set the screen width cvar to whatever that is. So “vid_width 640” would set the screen width cvar to 640. Oh, and it can also skip c-style comments (// or /* */).

This brings me to another collection of classes I use all the time, my (well not quite ‘my’) CVar classes. Basically these are global variables with some extra features. I can get a list of all of them, read/write them from/to a file, specify wether a particular CVar should be written to the configuration file or not, etc etc. As I mention in the source, these classes very much based on ZDoom’s CVar classes 😛 Well hey, they use some kinda advanced c++ that I’d rather not have to write myself since it’s been done already, hehe. Anyway not sure why I bothered writing about these, not like anyone is interested. Oh well 😛

So, the first thing I want to get up and running for the project is a basic console. Unfortunately this isn’t as simple as it sounds. Before I can get it to display I need to implement OpenGL texture loading and some kind of font support, yay. I’m still undecided on how I’m going to implement image loading, in the past I’ve either used FreeImage or the wxWidgets image loaders. The problem with FreeImage is it does way more than I really need it to for this project, which, I’ve decided, is to deal with the PNG format only. FreeImage deals with a crapload of different formats, and can do a whole bunch of other things like flip, stretch, recolour, etc. All stuff I really don’t need, it’s more suited to an image editor really. And of course I can’t use the wxWidgets ones since I’m not using wxWidgets for this in the first place. So, one thing I’ve looked into is simply using libpng/zlib, but as far as I can tell it’s quite complicated to use. We’ll see how it goes though.

Hopefully soon I’ll be able to setup an SVN for the project. Using my usb stick to transfer updated source between my pc (windows) and laptop (linux) can get pretty tedious. Well that’s pretty much all for now I guess.