Wednesday, May 30, 2007

Unreliable XBox 360's

It looks like Micro$oft is doing an Apple, and completely denying that there's a serious problem of XBox 360's lasting approx 12-18 months before crashing and burning. No doubt it will only be when the mainstream media get hold of it that they will acknowledge that there's a problem. However, at the moment there's profit to be made from charging people ~£80 to repair something that shouldn't have broken in the first place.

Will I ever need to power-down my PC that quickly?

Who's idea was it to incorporate a power-off button onto keyboards? What is the point? And especially, why put it next to another commonly used key? On my Genuisnet.com keyboard it is just below the Delete key. I've lost count of how many times I've knocked it, and all my applications have suddenly closed right in the middle of programming. Aaarggh!! If I want to turn my PC off, I'll press the power button that sits on the case approximately two feet away! Why do I need it on the keyboard?!?!

Tuesday, May 22, 2007

Latest Releases

I thought I might as well mention the new releases of my games, in case anyone's interested!

Nuclear Graveyard - The biggest complaint about this game was all the keys. I've now added a new menu system, so all the functions can be accessed from this. You can now also click on a units stats to select them, and click on the map in the top-right corner to change the view mode.

Passenger - I changed this so that it now uses floats for the angle, rather than integers. This has led to much smoother turning. I still need some decent animated 3D models though!

DangerMan - I changed the targetting on this so that the mouse pointer is a crosshairs (just like Abuse). I think this improves the playability. I also changed it so that the sprite coords are floats rather than integers. I thought this might slow things down, but it seems okay. I need to work on the maps now.

HoloRacer - This now compiles some of the OpenGL shapes for improved performance, and I also widened the track. I also got it to remember which level the player reaches, so if they restart the game, then can jump straight to the latest level. I've managed to get to Level 5 - beat that!

Thursday, May 10, 2007

When to Check Collision Detection?

This post is not going to cover the actual detection of collisions between sprites; I think there's already more than enough of that on the net for a lifetimes reading. I'm talking about "when" we check for collisions...

I previously used to process all my game objects sequentially, and check for collisions against every other object. However, the problem with this is that the program will be checking for collisions between object A and object B, and then checking object B for collisions with object A. This is time wasted, as presumably if object A hasn't hit object B, then object B hasn't hit object A. (This assumes that all object movement has been carried out already)

What I now do is loop through each object, and only check for collisions against all the objects placed after the current object in the game's "list of objects". So object A is checked against object B and C, and object B now checks only against object C, whereas previously it would also have checked against object A as well.

So if my game had 100 objects, it was checking for collisions 9,900 times in each game loop (100 objects x 99 other objects). However it now only checks 4,950 (I think) times!

Watch Out for Eclipse and Subversion

If you're using Eclipse and Subversion at the same time, beware. When compiling, Eclipse copies the src directory over the bin directory. Presumably this is perfectly okay for most people. However, if you're using Subversion, this means that it will also copy the .svn directory that is inside src. The upshot is that Subversion now thinks that your bin directory is your src directory: it will think all the source files are missing, and try and update them.

And don't make the mistake that I did, before I discovered the above problem: I svn-deleted the source files from the bin directory, assuming they shouldn't be there (which technically they shouldn't). However, when I then update my src directory, it deleted all the source files from there as well! It did this because when I deleted them from the bin directory, Subversion thought it was the src directory!

I'm now trying Subclipse...

Friday, March 23, 2007

Self-Indulgence

Sometimes, in a very self-indulgent way, I like to search for my games on the internet and see if anyone else has mentioned them. I think this is one of the main reasons why I write games - for fame! (Not fortune, as they are fully open source, though donations are welcome). Sometimes I strike gold, and sometimes I don't. 90% of the links that are to my game are just agregators for Sourceforge, but here are a few mentions I've got:-

Nuclear Graveyard:
A mini review - though someone has replied complaining that it's multiplayer only, which it definitely isn't. (The review even mentions the AI!)

Holoracer
"Holoracer 3 announced!". What? They make me sound like a proper software company that does press releases! I don't remember "announcing it". I unleash it! (Sometimes via a magazine, it seems)

Friday, March 16, 2007

The Quality of Open-Source Software...

..is too high, especially where graphics in games are concerned. My own projects pale in comparison, and it's got me wondering whether it's worth starting a new project unless you've got an excellent graphic designer on board.

Unfortunately, graphics to play a large part in the popularity of a game, whether it's getting people to play it, or getting them to enjoy it. Back in the day, when I wrote my games for the Spectrum, it wasn't a problem as all games looked awful. But now it's different, and with games like Tremulous setting the standard, what hope have we got?

Sunday, February 11, 2007

Apache2 and PHP5

[For ref - to be updated]

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
AddHandler php5-script php
AddType text/html php
#
# Cause the PHP interpreter handle files with a .php extension.
#

SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 9524288


AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

Wednesday, January 31, 2007

Java "Interval" Class

One of the most useful classes I've ever written is this Interval class. Games always have a main game loop, which gets run every game cycle. However, often you don't need something to be done every cycle, such as the AI re-examining it's environment. For this reason I wrote a simple Java class which is used in the following way:-

Interval check_env = new Interval(1000); // Millisecs

while (game_looping) {
...
if (check_env.hitInterval()) {
// Do slightly more involved stuff.
}
...
}


It's not the worlds best class ever, but I find myself using it all the time. Here it is:-

public class Interval {

private long last_check_time, duration;

public Interval(long dur) {
super();
this.duration = dur;
this.last_check_time = System.currentTimeMillis();
}

public boolean hitInterval() {
if (System.currentTimeMillis() - duration > this.last_check_time) {
this.last_check_time = System.currentTimeMillis();
return true;
}
return false;
}

}

Wednesday, January 24, 2007

GTA Autopsy

I was getting a bit worried that my latest game Passenger was starting to turn into another GTA clone. Which it is. But it's my GTA-clone, and I can claim I wrote it! However, it also gave me reasons to think about the flaws in GTA that I can hopefully improve upon, and there are a few. Off the top of my head:-

* The camera - They slowly improved this from GTA3 - 5, but it's still a pain. Try running down the road, stop, turn 180, and then run back. You can't see where you're running! What's the point in that? It ruins the immersion as you realise you are playing a game and must think about how to get the camera to spin round.

* Targetting - I prefer direct control over my targetting, old-skool shoot'em-up style. Simply pressing the "target" button and letting the computer target for you takes all the fun out of it. Where's the skill?

* Character movement - This is actually quite cludgy. I've played San Andreas all the way through, and I think the last mission is probably the most frustrating, which is a combination of probably all these points but mainly this one. If you compare the slick control of, say, a Mario game (sorry), you can see that there is no fine-grain control. It's just a case of move, spin round, press target, shoot someone, hope they don't kill you first, and repeat.

* Frustrating missions - I realised a long time ago that most of the missions, IMHO, aren't that much fun at all. They are more frustrating than anything, and the only incentive (and it is a strong incentive) to complete them to continue the story. And I have nighmares about the missions that involve radio-controlled vehicles.

Needless to say, GTA is an amazing game, but the most fun I have out of it is by playing simple "antagonise the police" games. Anyway, I won't let Passenger end up with the same criticisms.

Friday, January 05, 2007

Multi-Player On-Line GTA Variant

That snappy name is the unofficial title of my latest programming adventure called Passenger. It was originally intended to be a remake of Turbo Esprit (a Spectrum game from about 1984), but after developing it, I discovered that due to the type of game Turbo Esprit is, if you write an updated version, you pretty much end up with GTA.

I'm trying to avoid copying GTA, but it's hard trying to think of any new gameplay aspects that they haven't included. Still, it's pretty rewarding to write a free multi-player GTA, even if it's not quite as good (yet).

Anyway, feel free to give it a whirl and let me know what you think.

Wednesday, December 06, 2006

Downtime

One of the hazards of hosting games on a server that also doubles as the family computer was demonstrated today when my wife accidentally knocked the chair into the power switch! I was at work, and only noticed when I got home. Oh well. I don't think anyone was affected.

Tuesday, December 05, 2006

A Mention!

In my quest for publicity (to get people to play the game) I have managed to garner a mention for Nuclear Graveyard on the excellent Freegamer blog. Okay, it's only small, but it might snowball?

Wednesday, November 08, 2006

Publicity

I'm now facing the greatest challenge of all game development - getting people to play it. For some reason, people will go out and pay for games in their thousands, but then a game which is just as good yet completely free (not my game, BTW) will remain obscure. Where's the logic in that? Where are the magazines dedicated to free games that people can play straight away?

My current pet project, Nuclear Graveyard, is proving obscure and hidden to the public. I've created the obligatory website, some forums, this blog, and even posted some news items on Sourceforge in the hope of bumbing up its rank. However, on average only one person is connecting per day (even though it's being downloaded about 3 times a day on average(?)). What's a programmer to do? Pay people to play it??

PS - If you do play it, please please email me and let me know - even if it's to tell me why it's the worst game you've ever played (since my last one).

Saturday, October 21, 2006

Latency

What a pain this is! For my FPS, I originally planned to have all control processed on the server to keep things simple: if the user pressed a key on the client, that would get sent to the server, the server would process it and send back a command to the client to say "the unit you control has moved forwards".

In practise, even though the delay was a fraction of a second, it seemed like a lifetime, and movement was incredibly sluggish, as most people who've tried to write an FPS can probably attest to. Instead now, I've had to give the client details of all the map and all the other objects it could collide into, and get it to do the movement processing itself.

Now, when the player presses a key, the client checks for collisions before sending a command back to the server saying "this object has now moved forwards - tell all the other clients please". It works a lot better and movement is now brisk, but it's a lot more complex and involved since I have to do collision detection on the server AND the clients, and make sure they are all in sync.

Tuesday, October 17, 2006

N-Grave Up and Running

Nuclear Graveyard (or N-Grave as I like to call it) has now been up and running for several days, after my project was accepted by SOurceforge (actually, I'd be curious to know if there were any projects they didn't accept. But I digress). I've got two servers up and running and waiting. All I need now are some players! And to get those, I need publicity.

So far, I've created the obligatory web page, and even set up some forums. I guess I just need Google to trawl through it and add it to their directory?

Friday, October 13, 2006

Threads!

Every time I use threads I wish I hadn't! IMHO they exponentially multiply any problems you might have in code and often far outweight their benefit.

My latest bugbear (which I've come across before but not learnt my lesson) is "accidentally" using different threads to read incoming bytes from a scoket. Obviously this is a big mistake as the ordering of bytes is critical, so if you've got two threads reading the bytes, god-knows which thread is going to read which btye.

My first mistake was to create a new form which read some bytes; I temporarily forgot that forms run in their own thread, so my comms broke down until I spotted this.

My next mistake was to forget how quick computers are. Instead of the form using its own thread, the main thread waits until the form disappears and then reads the bytes after that. However, a split second before that my main game loop is started, which also reads incoming bytes. In the 100th of a second between the form being closed and the main thread realising that the form has been closed, my main game loop starts reading in bytes itself and causing chaos.

I know I should have a single sycnhronized method to do this, but there's loads of code to change. Suggestions welcome.

Tuesday, October 10, 2006

Nuclear Graveyard

After playing the excellent game Tremulous, I was inspired to fork Laser Squad 3D and turn it into something better. I'd been thinking of turning it into a fully on-line game for ages, but I couldn't quite see how to do it. After all, it's not your basic Quake variant; you control whole squads of people.

Anyway, Nuclear Graveyward is the result. If I get asked, I'll post about how I came up with the name (but it's not that interesting). I haven't actually released this game yet as I'm still tweaking it. (The problem with fully on-line games is that you can't afford to have any bugs in there without disillusioning loads of people in one go). If anyone fancies being a playtester or writing some instructions for it, just email me and I'll send you the game.

If you've played Laser Squad 3D you'll know the basics of how the game works. However, now it's fully on-line, it's slightly different. Players can join at any time and select any unit on their side (assuming it's not already being controlled by someone). So that means you can have several people playing against several people; you can have a squad of different human players playing against the computer. Strategy and communication between players is the key.

Sunday, September 10, 2006

Quality Free Games Blog

One problem with free games is that there is so many of them, and the good ones get lost in the quagmire of the dross (I count my games in the latter mainly I'm afraid). People rave about the latest commercial games, and magazines only review games that you have to pay for. I find this really frustrating and annoying. Why do people ignore all the stuff that's free?

What was needed was somewhere where they are reviewed and rated, and I've finally come across it - the Freegamer blog. Now people have got no excuse for not playing quality free games like Tremulous.

My New Game - HoloRacer

I've finally got round to writing a new game. I thought I'd go for something simple that I could hopefully finish before I got bored with it. It's a simple 3D racing game called HoloRacer. It's designed to be as simple and as fast as possible, and it does get pretty fast (assuming you have a good graphics card). It's still in it's mid stages, and is fully playable and good for 5 mins. I'm just trying to think of features'n'things to add to it now. Let me know what you think.