Fun with GLSL Shaders

Posted in Game Developement, Metagine with tags , , , , , , , on March 14, 2010 by James

I haven’t updated my blog for a while so I thought I’d do a quick update to demonstrate the progress I’ve made recently. The latest addition to Metagine (and therefore Able in Space) is support for shaders. What this means for the end-user is hopefully some nifty post-processing effects that make the game look nicer. The downside of this is increased hardware requirements in terms of graphics hardware. In order to remain compatible with older hardware I’ll do a quick check when the game is launched to determine whether their hardware is compatible with shaders and enable/disable them accordingly.

Here’s a quick image to demonstrate the sort of thing that can be achieved with shaders. I’ve literally only just got this up and running. This is for proof-of-concept purposes, it isn’t really a useful effect for the game in the long run. The shader renders the game in greyscale in real-time. I hope to post some sexier pictures in the near future, stay tuned!

Able in Space running in greyscale mode.

Able in Space (Screenshots)

Posted in Game Developement, Metagine with tags , , , , , , , , , , , on March 6, 2010 by James

I decided to call my little Space Invaders style game “Able in Space”. It is a bit silly really – since I decided that the main character is a monkey I did some quick Google research and discovered that people have a habit of launching poor monkeys into space. Able is the name of the first living being ever to successfully return from a trip into space – this game is a little explanation of what he got up to while he was out there!

I’ve completely upgraded the renderer in Metagine from SDL to OpenGL. The upgrade path is quite convenient as it is easy to work with SDL’s surface format and OpenGL. The only thing left to do is fix the font rendering, I haven’t decided exactly where I’m going with that. I’m pleased that the engine performs much more smoothly as a result of the changes.

In order to whet your appetite I’ve taken some screenshots that show an early preview of the game’s concept. There is still much work to be done but I’m quite confident I should be able to finish it by the end of March before moving onto a new game concept. I hope to be able to finish 3-4 games by the end of the Summer if at all possible.

Once the game is completed I will upload it to my blog and portfolio and try and get some feedback. I’ve only had the chance to run Metagine on my own computer so this will be a test to see whether it can be successfully deployed on various hardware configurations. Time will tell!

Space Invaders Clone (Metagine)

Posted in Game Developement, Games, Metagine with tags , , , , , , , , , , , , , , , , on March 4, 2010 by James

I took a break from my MSc research (which has become a little tedious) in order to work on a quick game prototype. I wasn’t looking to develop anything original, just a semi-functioning game in order to expose bugs and test the performance of Metagine. I spent a few hours making a quick Space Invaders clone using some free art from the Assemblee Part 1 competition.

The process was worthwhile for a number of reasons. I discovered and fixed several silly bugs in the game engine and got to really test the performance of the collision detection algorithm I’m using. With a large number of entities on screen, the pixel-perfect collision detection is proving to be a performance bottleneck despite the screen partitioning optimisation I implemented the other day. However, I’m still doing a lot of redundant checks between objects that aren’t likely to collide. I intend to perform some more pre-checks using Separating Axis Theorem which is something I studied at university last year.

The other performance bottleneck involves the method in which I’m using to render objects to the screen. The SDL library I’m using is very convenient but unfortunately is quite slow. As a result I’m upgrading the renderer to use OpenGL (and therefore hardware acceleration) which if done correctly should eliminate the performance overhead for now.

The game is pretty simple right now but I do have some ideas to improve it. It is just a prototype at the minute, you can’t even die yet. Your character is going to be an intelligent monkey who holds the fate of Earth in his hands (or something equally is serious!). Can you stop the alien invaders before its too late!?

(The video appears slower than life due to the screen-capture program I’m using and unfortunately you can’t view the whole right side because this blog theme is too narrow!).

Screen Partitioning / Collision Detection in Metagine (Video)

Posted in Game Developement, Metagine with tags , , , , , , , , , on March 3, 2010 by James

Time for another amazing Metagine video! This one might be a little difficult to see, apologies if it causes you to squint at your screen. This video demonstrates how I reduce the number of collision detection calculations per-frame by subdividing the screen into 4 partitions (imagine folding a piece of paper into 4 pieces!). Collision detection is only performed between entities that exist within the specific partition that it belongs to. The alternative to this approach would be to simply perform collision detection on all entities that are on the screen but this would be extremely inefficient with large numbers of entities present.

The theory is that entities will not be able to interact (and therefore collide) with other entities that are far away from it within a single game frame. This is actually not quite true – if the entity has an extremely large velocity it may travel the distance of the screen in a single frame but its not a problem I’m likely to encounter at this stage.

It is important to note that one entity may belong in more than one screen partition at once. This is because the entity may overlap a partition boundary. Infact, it is quite possible for an entity to belong to all 4 screen partitions simultaneously if the entity straddles the boundaries of all of the partitions – in this case that would be the center of the screen. I have tried to highlight this in the video.

(Just like last time I recommend full-screen viewing if you want to read any of the text!)

Complexities of Parallel Programming (and Yet More Metagine)

Posted in Game Developement, Metagine, Research with tags , , , , , , , , , , , , on March 2, 2010 by James

This week has been quite difficult as the stress of being involved with multiple projects has started to take its toll and to top things off I caught a nasty cold. On the brighter side of life I have ordered a new shiny laptop and made progress with both my MSc work and Metagine.

My MSc work currently involves porting someone’s existing work on the QuakeWorld server and updating it to use a new parallel paradigm (child-processes/forking vs. threading). I actually completely under-estimated the amount of time this would take (which is entirely my fault) but fortunately I have factored in plenty of backup ‘rescue’ time into my work-plan. It is an incredibly complex task to ensure that global data is not modified by multiple threads, in addition to re-synchronisation of shared data at the end of a game frame. This wouldn’t be as difficult if starting from the ground-up, but unfortunately I’m working from a fairly large codebase written over 10 years ago when C was the main game development language. I am however pleased to announce that I will be able to share the source-code after-all as I’m now working with entirely open-source code, success!

My work on Metagine has been quite slow but I’ve still managed to make some fairly significant progress. I’ve made some fairly large structural/architectural changes to the code that were causing me a bit of grief due to the way the project had suddenly inflated in terms of volume of code. The changes were quite time consuming (and frustrating, to say the least) but worth it in the long run. On top of this I have implemented sound playback using the FMOD API. The only thing left in the audio department is music and streaming large sound files from disk (vs. storing them entirely in memory – bad!) – I need to have a think about how I’m going to integrate them into my audio queue.

This marks the end of the fundamental programming work on the engine – there is still much to do but I will be doing most of this ‘on demand’ as I begin to develop a game. I’ve also had some discussions on this with my housemate (who will most likely be helping out with the art) and we’ve come up with a unique style for the game that doesn’t necessarily result in more complexity. I hope to have some concept art up within the month.

Stay tuned.