Thursday, November 29, 2007

My New Programming Language - "Harry".

Being a programmer who has no fear of programming a disaster, I've decided to write my own programming language.

"Madman!" I hear you cry, but no, seriously. And on the face of it, it's not that difficult. On the face of it, it's just a case of reading a text file and turning that into "symbols", which your interpreter/compiler converts into something existing, whether it's Bytecodes or good old machine code.

My language is called "Harry", and is similar to Lisp, since everyone seems to rave about it, and I've been quite impressed with it. However, there are a few (minor) problems with Lisp, which no doubt people will take me to task for. Here's my : it's not standard enough (there seem to be lots of variants), and it's not very practical (in order to do something like graphics or databases, you need to find libraries).

I've written the interpreter in Java for platform-independence. It's still in the development stage, so no download yet. The current problem I've got is functions and the variables contained within. What happens if a function names a variable with the same name as a global variable? And scope is a problem, i.e. "unsetting" the variable once the function has finished, so the global var becomes available. But what if the function calls another function? And recursion? And what about if a parameter to the function has the same name as a variable?

Anyway, to whet your appetite, here's an example of the code (which should be self-explanatory):

; Add, eq, print
(print (eq 2 (+ 1 1))) ; returns 1

; Set
(set lst (quote 1 2 3))

;quote, contains, if, return
(print (if (contains 2 lst)(ret true)(ret false))) ; prints "True";

Monday, November 19, 2007

Why Are Named Parameters Rare?

One of the things that seems common to most languages, even the supposedly better new ones, is the lack of "named parameters". Surely it must have come to the attention of most language designers that having a line like the following is ridiculous:-

// Do some stuff
int x = MyFunction(true, false, true, true);

Okay, it's probably bad programming practise to have something like this, but even a simpler line with just one boolean would be bad. What on earth does each parameter mean? The only way of finding out is to query the underlying function's code, but that defeats the object of having well named functions. I'm still surprised that having named parameters isn't in most modern languages. How much better is the next line:=

int x = MyFunction(foo:true, bar:false);

Here you can see, without having to browse the underlying function, what each parameter means. Okay, this is nothing earth-shattering that will lead to perfect code, but it has to be a step in the right direction.

Thursday, November 15, 2007

Eclipse and Subversion (Subclipse)

I've blogged before about using Subversion and Eclipse - if you haven't installed Subclipse then don't do it! However, I've discovered another problem and solution to Subclipse...

Even when Subclipse is installed, if you have seperate src and bin directories, the bin directory can confuse Subclipse, since Eclipse likes to effectively delete it and recreate it with each build. The solution to this (apart from adding the bin directory to your ignore list) is to not "Scrub output Folder when cleaning projects".

Wednesday, November 14, 2007

New Game - Chain Reaction

And this time it's original! I knocked it up in Java over about a day (though most of that was trying to work out how to turn "bouncing balls into each other" into something resembling a game).


It's called Chain Reaction. Basically, you have to bounce a certain number of balls into each other. The page (just like all my other applets) keeps track of your scores in a global high-score table, which I think greatly improves the competitiveness. And it's pretty addicitve (and hard) to boot!

Tuesday, November 13, 2007

I Bought a Domain!

I've finally bitten the bullet and bought a domain - http://www.onlinegameplanner.co.uk/. My original "default" domain was "ng.game-host.org", which doesn't really roll off the tongue quite as well, and bears no meaning to the content of the website.

Thursday, November 08, 2007

New Project

It's called Survival (at the moment).


[Added 19/11/07] A few other details since the original post was so sparse: it's written in Java and uses jMonkeyEngine to do the 3D.

Tuesday, November 06, 2007

BBC & Microsoft

(This blog is getting a bit political, I know). What happens when an ex-Microsoft employee starts working for the BBC? They develop a Windows-only iPlayer and claim that only 400-600 Linux users visit the BBC site, before hastily correcting themselves after getting it 16,000% wrong.

Wednesday, October 31, 2007

Software Exams! Grr!!

One thing that annoys me a lot are "software exams", where you can become a certified drone of the particular software company, typically Sage or Microsoft. They are a two-pronged attack by the software company on free software, gaining them money (because you have to pay to take their exam) and locks you into their software, since you are more likely to stay with software that you have spent money and time learning.

But they also have ridiculous questions! One of the Sage exams has the question "What is the maximum number of lines you can have on an invoice?" What?? So Sage has decided (either due to their inability to write software that allows as many invoice lines as possible, or their marketing dept. decided that it looked good in a brochure) that you can only have 99 lines on an invoice. And people have to memorise this (and a myriad of other completely pointless facts) in order to pass an exam.

Excuse me if I'm not impressed with anyone who's been stupid enough to take this exam.

Monday, October 29, 2007

Off Lisp

I don't see why Lisp is so great. I wrote a "random movie star selector", and it came up with Tom Cruise.

Thursday, October 25, 2007

Shadowfire Remake

Shadowfire is a classic Spectrum game from 1985, and I'm always surprised that no-one has remade this, since it seems perfect to me. The original game had some great ideas, plot and gameplay, but was limited by the platform. Some modern graphics would enhance it no end.

So I've taken it upon myself to do the remake, which is located here.

Screenshot

I've given it an RTS-style interface. It's still unfinished; at the moment you can walk around, teleport your team in, and shoot the enemies. It currently uses sprites from the original game, which weren't designed to be used in a top-down game, so if anyone could provide me with new sprites that would be good. I've got the code to rotate them to all 8 directions, so you only need to draw one copy of each!

Tuesday, October 23, 2007

Java Threads

Unfortunately, one of the (few :) ) drawbacks of Java applets is that in order to have a consistent game loop, you need to run the main game code in another thread. (I may be wrong here; please let me know if I am). I've blogged before about why threads in any language are a pain as they exponentially complicate a program, not least because variables can change mid-line.

Another problem that I always forget, is that in Java, threads don't access another threads data directly (unless you use the volatile keyword). Forgetting this caused me several hours of frustration and I even wrote my own ArrayList class to try and fix it. Basically, the code in my thread's run() function was accessing the class-level arraylist. But completely failing to affect it! It was calling "arraylist.remove(13)" (say), but after it had run, that object still existed in the list! What was going wrong?!?

Well, I've already said the answer. It was accessing a copy of the arraylist, not the list itself. As soon as I discovered and fixed this, all was well and I could go back to enjoying writing applets again.

Wednesday, October 10, 2007

An RTS that I intend to be a 2D version of World in Conflict

I mentioned this a while back, and against my own advice I've come back to it. Actually, I've already written most of the difficult framework stuff of selecting units, moving them around, A* pathfinding stuff etc.., and just have the fun of adding a proper "game" and features (- classic assumption by programmers that the final stuff is fun/easy). The screenshot is below, and the game itself is here (or it will be by this evening).

I've nicked the graphics from Advance Wars, and although I've never played World in Conflict, I always think it's a good idea to try and copy a game, as it gives you (me) inspiration and something to aspire to. And if I do anything differently, then great, it makes my game slightly more original!

I used to do this a lot back in my Spectrum BASIC programming days - I've written versions of Carrier Command and Populous, among other games, in BASIC using UDG's (remember those?). It used to be pretty easy. Looked awful, mind.

Tuesday, October 09, 2007

Games Blamed for Society's Problems (again)

People have really got it in for games today!

* Manhunt 2 has been banned (for the second time). (Notice that despite the headline and parent's insistence, police said there was no evidence his killer was inspired by the first game). The Government has decreed that I can watch films like Saw and Hostel, but I am not allowed to play Manhunt 2.

* A Games violence study is launched. Despite the fact that there are far more violent films, books, comics etc., it seems that games are the favourite target for blaming as the cause of crimes and bad behaviour. Didn't we have crime before games started getting "realistic"?

Monday, October 08, 2007

Ignoring my own Advice

After deciding to stop writing overly complex games that take up too much of my time and I end up abandoning before I finish them, I suddenly found myself writing an RTS that I intended to be a 2D version of World in Conflict! Arrg! Note to self: Stop!!

To compensate, I decided to write my own version of the highly addictive game Gimme Some Friction. It took me about two hours, and the results are playable here straight away thanks to applet-technology.

Phew! A finished game that's fun! Whatever next? An original game? We'll see...

Thursday, September 27, 2007

Tremulous Hulk

In my effort to single-handidly save Applets from obscurity, I have just finished the first working version of my new RTS applet, called Tremulous Hulk (because I intend it to become like a 2D Tremulous, but have ripped Space Hulk sprites).


It's very basic at the moment, but in true open-source fashion, I have big plans, culminating in something that will take on World of Warcraft for player-base size.

Tuesday, September 25, 2007

Online Game Scheduler

As an exercise in seeing if I could do it, I decided to write a web server several months ago. HTTP seems pretty straight forward in principle, but programming it can get bogged down if you accidentally send too many CR's and/or LF's. Also, closing connections is a problem, since clients like IE and FF often don't bother.

However, it now seems to be working, and I can officially announce what I think is a website with an original idea!

I've called it NewGame, and it's an "online game scheduling service". Basically, users select which online games they play. Then, when one user schedules an online game, all the other users who have selected that game will automatically receive an email telling them to date, time, and server.

I thought of this because a common problem with online games, especially new ones and the less well known ones, is that they are often bare of human players. Online games are brought alive by other players being there at the same time, and hopefully my solution will help this to occur.

As well as that, in order to give the site more content, it also has the latest gaming news headlines courtesy of a randomly selected news site. There are also forums for each game, and in a nod to free games, they are highlighted as such, so players can download and play them straight away. And finally, it's going to be the platform for my latest foray into bringing applets back from the brink of extinction!

Monday, September 24, 2007

Game Instructions Please?

I don't spend all of what little spare time I have on programming. Sometimes I even get to play some games. With this thought in mind, I decided to look through the Ubuntu games repository and see what strategy games were there.

I came across Boson, which I'd given a few seconds of my time to before. After installing it (which, thanks to Synaptec, is so easy anyone can do it blindfold) I started the game.

This is where the problems hit, and this is why I only gave it a few seconds last time. Visually, the game is great; I could only dream of one of my games looking this good. But how do you play it? My first (and probably only) port of call was the website.

Unfortunately, on the website:-
  • There is no link that give the smallest clue that it might lead to some instructions.
  • The link to the FAQ doesn't work.
  • There is a wiki, but that looks like it's purely for the development team. Nothing to do with actually playing the game.
  • Under "Contact us", there are only links to forums and mailing lists and an IRC channel. Sorry, but I haven't got time for any of those. I either want an answer now (or an emailed reply), or I'm just going to play another game, and there are plenty out there. I was going to email them to tell them that the FAQ link doesn't work.
It's a pity really. Like I said, it looks like a really good game, but they are shooting themselves in the foot by not telling anyone how to play it.

Applets Update

An addendum to my previous post: there is one drawback to applets, and it is that no-one takes them seriously, even when they are good.

Even the forums of the excellent Freegamer blog lumps them in the category "Proprietary & Web Games" (with the subtitle "Just in case you really have to talk about them... "!?).
Maybe the problem is that there's so many rubbish games out there? Do a simple search, and you'll probably come across a million versions of Sudoku, and applets that were written back in 1995. However, there are plenty of good games out there.

Maybe what the genre needs is something like Freegamer, but dedicated to online games, to sort the wheat from the chaff. Hmmm...

Friday, September 21, 2007

Applets Are Dead! (again)

Every time the subject of applets comes up, people insist they are dead. Why don't people like them? In one of Joel's latest postings, he mentions applets being dead because they are slow (despite the fact that the thrust of his post - that you shouldn't bother to optimise, but rather wait for technology to catch up - contradicts this).

I think people misunderstand applets. They were not designed to provide banner ads or simple flashy icons. We've got Flash for that (which is why I have FlashBlock installed). Applets are designed for full applications and games that are comparable to any shrink-wrapped software. And if you do compare them to "normal" software, they come out favourably.

The beauty of applets is that you don't need to install anything, but you've got a feature-rich application, or in-depth game, sat there straight away ready for use. And applets are far from dead - there are tons of them out there, and for the time being it's going to be my platform of choice.

Thursday, September 13, 2007

Revelation And/Or Epiphany

I feel like I've had an epiphany. I was at a low, and now I've seen the light.

I'd spent an hour or so on one of my games (Passenger) trying to optimise the map so that if there were (say) four mapsquares next to each other, all of the same type, it just drew one big square. For various reasons it was taking far longer than I expected. (This is always bad news - one thing I've found guaranteed to get me annoyed is when a task takes much longer than anticipated. That's why I now always assume everything is going to take ages).

Anyway, I suddenly thought: "Why am I spending my time doing this? Writing open-source games? I'm not actually enjoying it, I don't get paid, and (to be brutally honest with myself) I don't even play my own games myself, and I don't think anyone else does."

Basically I'd just become fed up with fiddling around with games, trying to fix bugs, optimise graphics etc. etc. The best part of writing a game is before you start, when you have a blank canvas in front of you, and an image in your mind of how amazing the game is going to be. Once reality sets it, it all comes crashing down after you've spent several hours (or days, or weeks) of your time. Even if a game is finished, then what? There are a million games out there all vying for attention. Why should players spend any time on mine, when it's obvious to anyone that there are better games out there?

Anyway, after a few days of thinking about it, I have come to a solution - Casual Gaming(tm)! Casual Games are much easier to write, and also it means I can play against my colleagues at work, and gain instance gratification to know that the game has brightened up their lives.

My first casual game was (another) version of Tower Defence (yes, not very original). It only took about 3 hours to write, and being a Java applet, it means it's very accessible. In fact, you can play it here. (You do need to log into the website I'm afraid though, but I may change that).

Programming "casual games" means that I can spend far more time designed and tweaking the games and far less time on boilerplate programming and sorting out bugs. And get back to enjoying writing games.