Friday, 8 February 2008

Pointless Quest what I've decided to call my little ajax/webservice multiplayer hack'n'slash rpg thingy. I'm pretty chuffed with how far it's come in a week, and as an engine it's pretty much "finished", bar ironing out some bugs.

The game itself turned out to be pretty simple. Your only stats are Level, Hitpoints and XP. You attack mobs simply by moving to an adjacent square and clicking frantically on their avatar. There's a lot going on under the hood though, and I'm going to go into that a bit here.

I took a bite out of WoW's book and implemented a simple "aggro" table for each mob. When a player attacks a mob, that player is added to the mob's aggro table, along with a tally of how much damage is done. The mob will always attack the player with the highest amount of damage done, assuming that player is in an adjacent square. If not, the player with the next highest amount of damage will be attacked, and so on.

When the mob dies, XP is split up by damage done amongst all the players in the mob's aggro table at the time of death. This means that all characters that helped attack the mob will get a share of XP.

The mob loses all aggro 5 seconds after it was last attacked. This means that if all attacking players run away, the mob will no longer attack and all damage counters will be reset. The mob will then regenerate health, just as the players do.

Combat itself is a simple hitroll/damroll mechanism. Players and mobs both adhere to the same rules. Chance to hit is initially 90%, and reduces by 10% for each level difference between player and mob. Damroll is some wierd calculation I made up on the spot, but it basically increases level by level and seems to work for the most part.

So that's it really. There's a heck of a lot more to the game, including some neat javascript tricks clientside to help detect clicking on the game area. I implemented a Yell function, which allows players in the same map (but not neccessarily on the same screen) to chat. I made use of the keyboard: Cursors for movement, space to set focus to the Say box, and Y to set focus to the Yell box. All combat is point and click, however.

Oh yes, of course. Death. I toyed with the idea of having a respawn after death with reduced stats ala WoW, but then decided to go all out and make my game harsh. When you die, it's game over. All your stats are reset to level 1, and you'll respawn back at the start. So that this makes some kind of sense, there are two high score tables: one for Current Lives and one for Past Lives. Current lives lists all the characters that are still alive and kicking. Players on this table are still gaining XP.

The Past Lives table is your traditional "high score" table, which is updated when a player dies. This immortalises a player's furthest progress and gives them something to beat in the next life.

The next step is to build an editor for the game. It's going to be a windows app that I can edit the maps with, which currently has to be done by hand by editing a textfile. I imagine I'll still edit mobs and exits by hand, but at least the hardest part of area creation will be dealt with. Once the editor is usable, I'll be keeping the current area in as a "Newbie" area, and opening a portal to the main world where the real adventure will begin...

No comments: