July 2008

You are currently browsing the monthly archive for July 2008.

So I did some work on a timer. There’s actually some timer stuff in SDL which I’ve read about and decided not to go for and there is also a timer object in the SDL_gfx lib I’ve been thinking about using, but in the end I thought it would be best if I did what I wanted regardless of everyone’s experience in the matter. How glad I am that I did!

Actually, I’ll probably abandon my timer when it proves to be as shit as I suspect, but I’ll forge along and try it in the game anyway because;

A. it actually does what I intended it to, and
B. the alternative in SDL_gfx is actually fairly straightforward to implement and I think its important to see why mine is a bad idea before abandoning it first.

Why do I think I did a bad job? Well, what I understand of timing is after all the game logic is called, you call the timer, this takes the framerate you desire, works out the fractions of a second this splits into then halts the loop till it hits the next interval this corresponds to.

Looking back, I guess that’s fine, people use this method for a reason and its not like games are a new technology that’s full of unproven concepts, but without a clear understanding of what it was all about, it seemed a waste of computing power. Instead, I came up with this fantastic idea where the computer just runs the game as fast as is possible, and only updates when that fractional timing trigger is fired. This I was sure was the winner and so I set off to implement it. And in fairness, it works exactly as I intended, except obviously its using awe inspiring quantities of cpu time.

I’m in the process of turning my prototype into a class which I can use, one of the nice things about it is that I’ll be able to have multiple timers with different framerates within the code without any real complexity, I’m not sure if there’s any benefit to that at all, its why I’m going to carry on and see what a real-world implementation does.

One thing it did teach me, which makes the whole exercise worthwhile, is how timing in C++ and game programming works, this more than any tutorial I could find was very useful.

I’ve written something about myself in the “About” page in the links at the top of the blog, feel free to have a read if your interested.

So I’ve not finished Atoms yet, there’s a few things i need to work out for that and frankly I’m having a pretty shit time at the moment and i just don’t fancy that right now.  Instead I’ve decided to look into solving the two major conceptual difficulties I’m having with games programming, timing and sprite classes.

These are important to games, but haven’t been show stoppers for Atoms, so I’ve been able to use work-arounds for the moment, but really, I’d rather just get them sorted and do it properly.  The Atoms codebase is too crowded for me to be introducing fairly major and completely new code concepts at this point, so I’m starting with a blank editor and beginning with line 1, why not make it the basis for the start of the AstroLiger project?

I’ve created a second googlecode project for my SVN repo, but nothing else just yet, I’d like to get something compiling before i setup a page for it here, but as with Atoms, it will be free and Open Source and cross-platform.

When i make progress, I’ll update here as usual.

I really fancy the idea of adding online gaming to Atoms, of course, i’ve never done any network code before and i’m unsure how to persue this.

A friend (Goldbuick,) advised enet, i’ll certainly take a look, but does anyone know of a really basic networking lib for C++ thats not going to bloat my game and make my head explode?  Good tutorials or examples would be a must.

Thanks :)

Code Update

My last article generated some traffic and attracted some interest in my remake of Atoms, i got my first link from another site as well!  So now this is being read by more than me and my mum, I’ll update with what i have been up to more frequently.

I spent some time last night looking at adding a user interface, i added a class for handling the front-end, developer splash and other user interface gubbins and the first thing i tried to implement was a straightforward pause mechanism.  Turns out i needed keyboard input code for that, and after a failed attempt at adding one as a new class, i realised i had to merge it into my mouse class and make a generic input object instead.  Seeing as I’d gotten a little better with C++ since i originally wrote the mouse input, i took the time to rewrite the whole class and make it more consistent, all i need to do for it now is add joypad support for future projects, but I’ll do that when the time comes.

After adding the new control code, i got the pause mechanism working, this pleased me, and so i committed what i had to my codebase and went to bed.

I should point out if i haven’t already, I’m a firm believer that when working on something, you should commit it to your code repository as soon as you have it working, then, if you toss it up later, you can come back to it later, and not have to also re-write a bunch of other stuff you didn’t commit till you had to.

I’ve learned this the hard way, its not much fun.

Later tonight I’m going to do some more work on adding the mechanisms for a front-end and a splash screen, my goal is to get a functional menu system up and running.

Seeing as i’m getting some visitors now, i’m working through tidying up the site.

I’ve updated the “Atoms” page in the links above; over the next few days, i hope to make a few more improvements around here, if you look to the right of the news, you’ll now see i’ve got my links sorted out! :D

This is part of an ongoing series of articles originally written for the TIGSource forums

Part 4 - “Oh my god.”

Sitting down to write this article I’m blown away by the passage of time since the last one.  October 7th, 2007 was the date and I’m slightly embarrassed because I left my last article at the point where I was to actually get on and make my game, or at least a prototype.  So much has changed since then, not least my opinion and attitude towards game programming.

Read the rest of this entry »

New Additions

You may have noticed a 3 post fart below, I’ve written a few forum posts about starting out with game development and they provoked a lot of opinions when first published on the TIGSource forums, but i kind of  didn’t do anymore.

Well, i’ve posted them here, and i’m going to start them up again, continuing the articles here and on the TIGS forums where they originally appeared.

This is part of an ongoing series of articles originally written for the TIGSource forums

Originally Posted: September 20, 2007

Part 1 - “Choosing a language, additional libraries and development environments.”

Hi, my name is Leigh.  I’ve already posted a hello on ‘The Obligatory Introduce Yourself Thread‘ - Its a riveting read and contains a spiffy picture of me as well!  At the bottom of the post i talk about wanting to be a game programmer and starting to write my own game so for no other reason than to punish you all, I’ve decided to document this effort and make it available for all to read. Read the rest of this entry »

This is part of an ongoing series of articles originally written for the TIGSource forums

Originally Posted: October 07, 2007

Part 3 - “Design and distillation.”

So moving on from my previous posts which were more instructive, I’m starting to find myself in unfamiliar territory.  While firmly entrenched in the drudgery of basic C++ tutorials, ‘if’ this and ‘while’ that etc, I find my mind wanders to more conceptual subjects of design and structure and I start to think about my game and how exactly it’ll work. Read the rest of this entry »

This is part of an ongoing series of articles originally written for the TIGSource forums

Originally Posted: September 29, 2007

Part 2 - “The Wall.”

So this is the difficult second post.  Last time I talked about choosing a language, APIs, IDEs and version control software, this time as I sit and type I’ve had to make a choice about how to progress this article.

See, the problem is, I’m not a game programmer.  I’m not even a c++ programmer, I have experience in other languages,  but not enough to provide a tutorial on C++ or game making.  I cant provide a newcomers approach to C++ as I already know a fair chunk of the core concepts, I know nothing of game making theory.

So what use could this article be? Read the rest of this entry »

I’m close to a release, very close, but theres still so much to do!

I wont give a date, i’ve tried that and it doesn’t work, so i’ll adopt the famous mantra “When its done” and see you next decade!

lol, i’ll have a more interesting post when i’ve finished the bit i’m working on at the moment.