I usually spend much more time thinking than coding, but this week was even more so, and that paid off handsomely. A week's delay is a small price for getting the foundations right in Dungeon Romp.
So, what's the big news?
- Color! Glorious color! Yes, I finally figured out how to do it. Even better, now the display is framed correctly in all browsers, regardless of default font size.
- A complete melee combat system. Took me a while, but pretty much everything works now — weapons, armor and damage-per-second. Healing causes hunger, which gives penalties, but now you can eat to recover. Simple, yet effective. Credit for the concept goes to the RogueBasin article on hunger.
- Basic inventory management — a precondition for the above point.
Of course, the upcoming tasks are yet bigger:
- One more level for starters, with its own generator. Which in turn means new mobs, and better AI... and a way to get away from too strong an attacker that keeps coming at you instead of wandering off.
- Moving between levels (duh!) and gaining experience from that.
- A lighting system, as part of the game will take place underground.
- Potions and wands... or rather what passes for them in my setting.
- Ranged combat. Preferably designed to be useful.
Last but not least, there is something I decided not to do.
As mentioned in the previous update, once you get past a certain line count in JS the language starts showing its limits. But what to do? For a while, I seriously considered rewriting the whole thing in CoffeeScript. But when I tried porting the more sophisticated pieces of the code, it turned out to be just as long, if less verbose. Then I considered applying that silly technique where you wrap all your code in one big function, and return from it just what you need. Was about to get started, too, but a brief review of the code made it clear that I was going to gain half a dozen lines or so, and no extra clarity. So that idea got scrapped at the last moment as well.
Turns out, good old refactoring still gives the best results. I should be more worried about the game wooshing past the 1000-LOC mark with no obvious way to split it into modules. But I'll think of something.