GroupFight: My old PHP-based game

Tags:

First an announcement: During 2008, CodeUtopia had about 120 000 visitors! I think that’s amazing, and I want to thank everyone who has been reading the blog. I’m going to try and keep posting interesting things for you to read this year too. :D

Now, to the post: Back in 2003 I wrote a game called GroupFight. The idea started as a joke, so don’t expect anything very amazing ;)

In the game you are a fighter, who fights against monsters and gains experience, levels up and so on. Let’s look at it a bit more after the jump

The game

I don’t remember the specifics of why and how the game came to be, but I wrote it for The Group, which is a finnish non-profit organization, mainly involved in organizing LAN-parties and other computer-related events.

As mentioned, the basic premise of the game is fighting monsters. Each monster has a picture and some attributes like health and strength, and so does your fighter with the exception of the picture. But what makes the game unique (I think) is how it’s played: by hitting the refresh button.

Each time you hit the refresh button, the game generates a new monster, and simulates a fight between your fighter and the monster, and displays the result of the fight to you. If your fighter beats the monster, he/she gains experience and with enough experience, a level. When a fighter levels up, they gain more health and randomly increase one of their other attributes.

Since I wrote it in 2003, it contains some gems, like a variable in the constructor, which gets set to 1 after the constructor has finished. By default its value is 0. I guess I wanted to be sure the constructor ran, even though the variable isn’t used anywhere else in the code…

It’s also pretty much a mumble of “OOP” – basically procedural code but functions are inside classes – and mixed output and processing – some functions do processing but also output values with echos, which isn’t exactly a good idea.

The game also has a Top 10 list which is supposed to list 10 highest leveled fighters. Well, it shows more than 10, and it doesn’t show them ordered by the level. I don’t know if this ever worked right, or if it just broke up at some point due to code-rot or something.

A legacy

While the game isn’t so amazing, it’s interesting in how it’s become a part of history of The Group. Back in 2003, the organization was smaller and involved in much smaller circles, and consisted of almost completely different people than right now – I’m one of the only early members left. The pictures of the monsters in the game are actually some old members of The Group, or other images related to other Group-related things. The organization has a lot of inside jokes and other things, and GroupFight is a part of that “legacy”, possibly the oldest joke that’s still current in any way.

Play it

You can play the game here! Just try not to break it, okay? ;)

The game requires an account, but it won’t need you to register it with an email or anything.