Thursday, August 27, 2009

To Applet or not to Applet?

Some free games require you to download the source code and compile it yourself. Some require you to just download and install. Others are just download, unzip and run. However, by far the easiest are flash/applet web games, where you just point your browser at them and that's it - once the game has loaded you can play it straight away.

However, maybe due to this simplicity, or maybe due to the fact that a lot of web games are simple in themselves, they are not treat with the same level of respect as games that require more work to start up. It seems that the more effort you are prepared to expend to get a game working, the more time you are prepared to spend on it.

(Taking this to the extreme, I find that when I play a lot of old Speccy games, of which I have many fond memories, I give them approximately 10 seconds of my time (since that's pretty much how long it takes to load it up nowadays) whereas in the past, when it took minutes, I'd play them for longer and give them far more of a chance. Actually, I think I've just invented my own axiom: "The time a player will spend playing an average game is directly related to how long it took to them to run it.". You heard it here first!)

Anyway, back to my point. I've got a game called Island Commander, which is an applet, but is increasing in complexity. However, because of the lack of "respect" that web games get, I'm tempted to turn it into a stand-alone game so that people will take it more seriously. In addition, nothing is more galling than seeing comments by people about games written as applets, all saying how much they hate applets.

Is it mercenary to make it harder for people to play the game in the hope that they will spend more time on it? Maybe my whole premise is wrong, and flash/applet games get played far more than stand-alone games. However, out of all the most popular free open-source games out there with large communities, I can't think of any that are web games.

Monday, August 24, 2009

Trawling My Own Archives (Part #2)

There are literally tens of directories in my newfound treasure-trove of old source code, and I'm slowly getting through them. It's taking a bit longer than it should due to my old habit of sharing common (but now missing) libraries of source code between projects and using network drive letters that no longer exist.

However, here are 3 more to whet your appetite for the good old days when games were simpler (so simple in fact, that even the author is struggling to find the point).

The first game is one I originally called Floater, in an amusing play on the gameplay of Thrust-type games. There's not a lot to this game at the moment - you float around in an Asteroids/Thrust kind of way and shoot some bullets, not that there are any baddies to shoot at yet. If memory serves, I planned to make this a network version of Thrust or something, a bit like Gravity Force.



The next looks like some kind of puzzle game, though again I can't seem to work out what the actual game is supposed to be. It's almost fun though, as you bounce a ball around lots of other balls, and kinetic energy is passed between them. I think I wrote this on the assumption that some kind of game idea would magically appear once the mechanics are in place. I'm still waiting...



I've saved the best until last - this one is actually quite good and almost complete, and has a point! In a nutshell its a top-down shooter, a bit like GTA 1 but without the cars. The "missions" (if they can be called that) are randomly selected, and range from killing a Terminator-like robot to killing a group of rioting vegans (I always like to include a bit of social commentary in my games). I might actually release this one since it looks like I spent a fair bit of time on it.

Friday, August 21, 2009

Cheating AI

While writing Island Commander, the temptation has always been to allow the AI to cheat, as this would make it so much easier to write.

A programmer has only two options when writing an AI if they want to make a challenging game: allow it to cheat, or to analyse the game so much that they can break down the "secret" of winning into something like a flowchart, where every situation is covered and has an appropriate response.

Needless to say, this is no easy option for anything above the simplest of games (can you imagine something like this for chess?). In addition, every time a change is made to the game, or a feature added, the whole "flowchart" (and thus the AI code) needs to be changed.

However, this is the only option, since if any situation is not covered, the human players will quickly identify it and take advantage of it, and from that point on, the AI is no competition. Something I have been told several times!

Tuesday, August 18, 2009

Trawling My Own Archives

I came across a directory in the depths of my computer's filesystem the other day, which had old programs that I wrote when I was first learning Java. It was a nostalgic experience, but needless to say, none of the programs lived up to their epic names, and most were good examples of brevity of code; there were utilities like "MailingList", which was a one-class Java program that read a text file and emailed it to a hard-coded list of addresses. Also "AutoRunSQL" would basically run a hard-coded line of SQL at regular intervals (why you would want to do this is left for the reader to guess). There was also something called "CommerceNet", which preceeded Ebay and was intended to be a protocol for buying and selling, which would have changed the world if anyone else had known about it.

However the programs were mostly games, which should come as no surprise. The first I came across is called "Mr Do". It shows how long ago I wrote it because I'd even forgotton there was an old game called Mr Do, and this is a simple but quite playable copy of it:-



There was also another arcade clone, this time Bombjack. It looks like I lost interest in this before I'd ripped all the sprites I was needed, so the player and the enemies are all squares. However, the game seems to be all there, even down to "vibrating" bombs.



Finally, what looks like a homage to old ZX Spectrum games from the early 80's, is something called "Roadster" which I have no recollection of, but that's hardly surprising since it looks like I spent a grand total of 8 minutes writing it. I've no idea what's even going on.



However, strangely, this game has given me some insperation for my next project, which will be based around laying down train lines. Nothing so complicated as Railroad Tycoon, but more of a casual puzzle game.

Look out for more programming gems coming soon! And if anyone actually wants any source code, let me know.

Thursday, August 13, 2009

Blindingly Obvious Programming Tips #3

I've not implemented this tip myself yet, since I've only just had the idea, but I thought I'd commit it to screen before it disappears from my head.

One of my peeves about programming are function calls with long lists of esoteric parameters. Stuff like "sprite.draw(10, 12, true, true, false, true);". Unless you can memorised the order and meaning of each of the parameters, you have no idea what that function call is going to do exactly. Multiply that by the number of functions in a typical program, and you realise that a solution is needed.

Some languages can get round this and have named parameters. I don't believe Java has those yet; the closest we have is javadoc annotations. However, my solution is pretty simple: create "constants" (or as close as Java will allow) with meaningful names that are simple booleans. Then the above function call can be re-written as

sprite.draw(10, 12, B_COLLIDES, B_FOREGROUND, B_HAS_HALO, B_FLICKER_SLIGHTLY);

Much more understandable.

Tuesday, August 11, 2009

Some programmers shoot us all in the foot

I really like Linux, and use it whenever I can for work and home systems. However, every so often something happens which makes you wonder which side the programmers of Linux software are on.

The latest problem is to do with Remote Desktop in Ubuntu 9.04 - Jaunty Jackalope. I've been using Remote Desktop quite happily for a few years on earlier versions of Ubuntu, but now I've upgraded, it seems to have a problem - the "Advanced" tab is missing. This means I can't choose the port number, along with various other settings.

A quick Google later, I discover this gem:
And yes, I've removed the 'advanced' tab. 'Advanced' users know to how use gconf-editor to tunning applications. The advanced tab was a mistake I made. Blame me.

What? "'Advanced' users know to how use gconf-editor"? I like to consider myself an advanced user, but I've only used gconf once, and I always have to remind myself how to get to it. But how am I supposed to know that I even need to use gconf? And where in gconf (which is the equivalent of RegEdit) are the settings I need?

And how on earth can regular users be recommended to use Ubuntu with arrogance like this? It's like we want to build a wall between us and the kind of people we need to bring on board if Linux is ever to get into the mainstream.

Wednesday, August 05, 2009

Java/Ubuntu Graphics Problem

I do most of my development on a Windows box (even though I dislike Windows and much prefer Ubuntu) so I've not noticed this problem before, but it seems that Java software that uses non-OpenGL graphics runs like a dog on versions >= 8.04 of Ubuntu.

One thing I like about Java is that it generally runs identically on most platforms, but sometimes something comes along which stops that "feature" dead in its tracks. The KeyPressed/KeyReleased bug was one of these, meaning I had to write special code get around it. If you don't test software on all the platforms, you won't know about these issues (as I am finding).

I've only got two Ubuntu boxes to test on, and one of these is a VM (which can add its own set of problems), so I'd be interested if anyone else experiences this. And I'd really like to hear from anyone who has a solution!

Monday, August 03, 2009

Metal Glove Solid Update

Now I've improved the performance of Metal Glove Solid, I've turned my attention to the average graphics. This thread on the Freegamer forums (about another stalled Gauntlet-remake) contains some useful walls. I've grabbed these and stuck them in MGS, and this is the result:-


Pretty basic, huh? True, but it's the first version, and I'm combining the change in graphics with a new map generator, rather than rely on designing my own maps. Here we see two rooms joined by a corridor. Procedurally generated content is the future; this is it in it's most basic form, but even this can provide a million different styles of dungeon, so no two games will be the same.

Friday, July 31, 2009

I've been Freegamer'd!

Fame and fortune comes with its downside, as I can now testify (well, for fame anyway - fortune may have provided a solution). I, up until a few hours ago, hosted most of my web pages and all my download files on my home server, which suited me well since I had direct access to it and don't need to faff around to make files available.

Unfortunately, the only option my crappy ISP (aren't they all?) has for unlimited upload/download allowance is countered by a maximum speed of 0.5mbps. This never used to be a major issue, until I got Freegamer'd. The interview on Freegamer, with it's myriad of links to all my games (most stored on my server) has caused a bit of a bottleneck, much to some people's (and my own) understandable annoyance.

However, I've now fixed it. I'm hosting the larger files on HyperFileShare, which seems pretty good. I've not fixed all the links across all my pages, but in the meantime here are the best download links:-

Xenogeddon | Laser Tactics | HoloRacer

Thursday, July 30, 2009

Revisiting My Old Projects

Going back to an old unfinished game project can usually end up one of two ways - you're quite impressed with the way the game is, or you're imagination has been playing tricks on you and you wonder what on earth you were doing when programming it, since you weren't concentrating on the game. I had both these feelings the other day:

I went back to a couple of my old games, in order to remind me of them for my Freegamer Interview. The first was DangerMan, a platformer with weapons. And I was (IMHO) quite impressed - the gameplay was solid, there were no glaring bugs, and it moved at a reasonable speed.

Then I took a look at Metal Glove Solid, my Gauntlet remake (which will have additional features later). Oh dear, it wasn't very good. It was dog-slow and the collision detection left a lot to be desired. How come I don't remember it being like that? It's time for some emergency programming!

The problem seemed to be my method for storing sprites. Gauntlet is famous for having a lot of sprites on the screen at once, and I needed an efficient way of keeping track of them for processing and collision detection. Usually in my games I just store them in a long list, but this can be quite slow.



My method was to have two two-dimensional arrays - one for storing each sprite at it's mapsquare co-ordinate (so drawing would be efficient as I could easily identify which sprites needed to be drawn, based on the area of map that was being shown on-screen), and one storing each sprite at each mapsquare co-ordinate that the sprite was covering - this would improve collision detection since I could easily identify all the sprites that shared the same mapsquare with the sprite I was testing for collisions.

Both of these methods seem sound, but the drawback is that every time a sprite moves, it needs removing and re-adding it to both arrays. This is what takes a long time. My not-so-difficult solution was to get rid of the first array and simply store the sprites in a tried-and-tested list. Performance is much improved, and the latest version (1.1) can be downloaded here.

Tuesday, July 28, 2009

New Forums

Thanks to Charles at Freegamer, I now have my own Forum at FreeGameDev. Please feel free to use them (or the comments section of this blog) to inform me of how my games could be improved.

Thursday, July 23, 2009

IC: Tweaking the AI and Game Mechanics

As well as improving the graphics of Island Commander, most of my time has been spent tweaking the AI. This involves playing the game and employing one of 3 basic tactics: build mines and wait for the AI to attack me; rushing the AI; and thirdly something between the two (build quite a few mines and then attack).

After playing it a few times, you begin to notice pitfalls that the AI falls into. For example, it doesn't keep any "reserve" cash, so when it gets attacked, it takes it longer to raise enough money for a defence. This has now been implemented. Also, it never builds any defences before it is actually attacked. I've still yet to add this.

There's also a few tricks that it can use that a human player would; for example, units are far more effective in pairs (or more) since they can get twice as much firepower out, destroying targets much faster. I've now implemented this.

I've also tweaked the balance a bit by adjusting various unit's stats; in particular, mines were a bit weak, meaning that the first player to attack usually managed to decimate the opponents buildings (causing the slippery slope effect). I've also reduced the amount of money that mines give, meaning that if a side does have less mines, they're not necessarily losing out on much more money than their opponent.

Thanks to all who have contacted me with problems and suggestions. It has made my job a lot easier!

Monday, July 20, 2009

Island Commander: New Graphics!

Yeah so I'm like "woah!", and everyone else is like "yeah, whatever", and I'm like "okay, I'll redo the graphics then." Praise the lord for GPL and other great licences that let people like me have decent graphics in their game with no legal hang-ups. Here's a screenshot of Island Commander with its new look:-


At a distance it's quite blurry and doesn't look that different; you'll probably have to click on the picture to see the new graphics (or even just [Ultimate] play the game). For those who are curious, the new units are taken from Bos Wars and FreeOrion, which both have great graphics and permissive licences.

I've also taken the opportunity to tweak the AI. However, this change in graphics is just the first stage of a new aspect of "IC": factions. The player will be able to choose from various armies, each of which will have special unique skills and abilities. This will increase the AI complicatedness factor to about a million percent and also undo all the good work in balancing that I have done, but I think it's necessary to keep the game interesting. Suggestions for funky faction names are more than welcome - and full credit will of course be given!

Tuesday, July 14, 2009

Island Commander AI

I've received a total of zero emails asking me about how I implemented the AI in Island Commander, but screw you lot, I'm going to talk about it anyway.

This is all probably exceedingly simple to anyone's who written any kind of strategy game AI, but the enemy works in this way: every so often, it scans the map for the players units. It then gives each square a threat point value, based on the unit type (the meaner the unit, the higher the points) and how far away the square is. It then totals up all the points for each square, and then finally takes the square with the highest points of which the AI owns. This square is where the AI will build its next attacking unit (if there is actually any threat to that square).

Of course, this may not be the case. There may be no threat whatsoever, and in fact there may be some juicy enemy mines to destroy. If this is the case, the AI does the same thing as above, except instead of looking for threats, it looks for targets. If there are within range, it will launch an attack on them.

Incidentally, you can see this in action by pressing T (to see the "threat map") or Y (to see the "target map") when playing the game. There are a few other nuances, like the fact then if the AI is attacking, it will sometimes build 2 or more units since they have more chance of surviving. It will also choose certain units for certain roles, like defending or attacking. But in a nutshell, that's it.

The next step is to implement different "personalities" of AI, one of which is chosen at random at the start - a defensive one, an aggressive one, and maybe a mad one that does random things. I may even get them to shout sarcastic remarks at the player via the console.

Friday, July 10, 2009

Island Commander Released!





How I imagined the game in my head



This is NOT what the game looks like,
but may do if I have enough time

One thing I remember reading on Joel Spolsky's blog something about "don't alienate your audience by releasing buggy software too early" (or something along those lines). I've always been curious how this works with the open-source mantra of "release early, release often", but I'll save that discussion for another day.

Anyway, with that in mind, I'm using the Google trick of making it beta, so if there are any bugs I can easily explain them away. I haven't actually found any, and the last fews days has been spent balancing the game and improving the AI, which plays a mean game.

Talking about the AI, I'd appreciate if someone else could give me feedback. I think it's getting easier to beat, but that might be because I am so awesome (and have had lots of practise since I've played it about a gazillion times).

So anyway, the Island Commander can be played! Point your browser to http://onlinegameplanner.no-ip.org/games/islandcommander.cls and strap yourself down. All feedback welcome, of course.

Wednesday, July 08, 2009

RTS Theory?

I've reached that stage in my new RTS game where all the main programming is done (apart from all the boring bits like a start and end, and changing the UI so someone other than myself knows what to do) and it's now down to tweaking the mechanics.

I used to look forward to this bit, but with something like my (albeit very simple) RTS, there are so many variables that I feel like a need some read some kind of book on RTS theory. There are (only!) 4 different kinds of unit. Each one has a cost, movement speed, a view range (how far they can spot enemy units), a shot range, a shot power, a "health" rating (how much damage they can widthstand), and finally a threat rating (for the AI). And I'm sure this is very simple compared to most RTS's. Then there are other factors, like how much to increment the players cash based on how many mines they have.

Most people hold up Starcraft as a prefectly balanced games, and I want to know how they did it. With all these hundreds of variables, did they just play the game several trillion times, each time tweaking it like "that unit is a but powerful, let's reduce its firepower". Or do you increase the other unit's firepower to compensate?

Questions questions questions. The main problem at the moment is that Island Commander is an "arms race" game, except instead of arms, it's mines. If you don't build as many mines as possible as quickly as possible, the enemy will soon overrun you. How does Starcraft (or any other RTS) avoid this problem?

Tuesday, July 07, 2009

New Project: Island Commander

I always like to give my projects a name that reminds me what the hell my original idea was that I started with, since it's easy for them to transmogrify into something else, I lose the initial inspiration, get bored and go onto something else. This happens a lot. My new game is called "Island Commander" for this reason, and should serve to remind me what my original vision was.

I was browsing t'interweb and came across a page for Carrier Command, a game I haven't played for years, and is long due for one of my legendary "remakes". It also reminded me of another Amiga game called Archipelago, which I've never played but always admired the screenshots for their simple 3D graphics.

I can't remember the exact thought processes I went through to get to where I am today, but I always wanted to write a strategy/wargame thingie that involved units being controlled by AI, so you were more of a commander rather than directly controlling every unit. The result is this simple RTS, where you simply choose where to start the units (whether it's a mine for the obligatory resource gathering or a jet fighter) and then the unit goes of and does what it thinks is best.



No prizes for guessing where the sprites came from. And you'll notice it's not 3D, but that will come, maybe. And I've not implemeted "islands" yet. I'm still tweaking the opponents AI, but rest assured, if I manage to finish it, this will be the new Starcraft! Most importantly, I actually enjoy playing it so this one could run...

Friday, June 26, 2009

Another "Almost" Game

I had another idea for a game which I've started and now stopped for the usual reason. Originally, I was going to write a 3D FPS that doesn't use models, since it is a massive ball-ache trying to find appropriate models on t'internet. Instead, I thought about just using basic shapes or something, but because they are basic I can make them more animated: moving platforms, floors that go up and down, walkways that extends and then retract, you get the idea. Actually, writing about it now makes it seem like a great idea, so maybe I'll come back to this one. I'm thinking something like Mirrors Edge with a constantly changing environment.

Anyway, the idea then transmogrified - the kind of games that already use this "simple shape" theory are all the old classics - Breakout, Pac-Man, Tetris. Their graphics were nothing special but they were good games. So how about a game set inside another game? Maybe this screenshot will give a better idea of what I mean:



Those blocks are supposed to be the blocks in a game of Breakout. I intend to have a bouncing ball and maybe the puck. The player would walk around in an FPS-stylee, and maybe shoot all the blocks while avoiding the puck or something.

I even got as far as starting a Pac Man level:



I think it was this level that started eroding my enthusiasm. I realised that this game is going to take a lot of time to create all the 3D models for each level/game. Then there's the AI for all the unique enemies, the level design etc etc...

So I decided to (maybe temporarily) abandon it in favour of another game idea; an idea that uses simple graphics, no advanced AI, and is incredibly addictive. As soon as I have this idea, I'll let you know. Meanwhile, it's back to the Spectrum Arcade for inpiration.

Tuesday, June 23, 2009

Someone has used one of my ideas!

It was surely only a matter of time, since I have so many great ideas. However, to quote from this very blog from July 19th 2006, where I described a time-travel game device: "To give you a more concrete example, imagine Command and Conquor with time travel".

Lo and below, fast forward to 2009 and what has happened? Achron: "a real-time strategy game where players and units can jump to and play at different times simultaneously and independently".

I assume the cheque is on the post.

Monday, June 22, 2009

New Game! "Xenogeddon"

It's been a bit quiet on this blog lately. I got a bit bored of writing games that no-one wants to play. However, I've got a new burst of niavity and/or optimism, so I've knocked up something new in the vain hope that someone else might find it interesting.

Todays effort is an FPS by the name of Xenogeddon. It's basically Space Hulk by another name. You walk around an "abandoned" (read: not completely abandoned) and shoot stuff that looks like it might want to kill you.

True to form, it's not actually finished, but is certainly playable.