TheoGB.com
 

I Have Written an HTML Game Called 'Perilous Wood'

Sat 30th Aug 2014

Posted under:DevelopmentWebsites
Over the last year I've been creating a game using just PHP, MySQL and HTML. The inspiration came from reading the Eloquent Javascript site at EloquentJavascript.net, which contains at least one game in its examples, leading me to wonder what sort of game you could make within an HTML construct. Clearly purely HTML would have been a fairly limited series of yes/no questions, so I reasoned PHP and MySQL would widen the scope a little.

My first thought was to produce something akin to the tile-based game Mystic Wood, a simple RPG exploration game where you lay a series of tiles out, face down, in a grid and flip them over as you get to them. At the same time, I was remembering Rogue on PC, which used simple ASCII graphics to represent everything. After a bit of fiddling I ended up with this: game_tester.php
original_version-25.jpg


This quickly proved to be a bad idea. ASCII isn't very web friendly at the best of times and the result looked like something had gone badly wrong. Instead I decided to use a fixed table with graphic backgrounds defined in CSS, and I took those graphics from Google Earth snippets of beaches with trees that I mashed a little to try to make them blend. I also gave the interface a slicker look and put in a health counter so you'd be dead after moving around a bit. None of this was using anything more than session variables.
game_version_0.11.jpg


My notion was to enhance from here to introduce a marker for the player, creatures, objects to pick up and use, and combat. Development to add these took a long time, mainly due to doing so much of it in my spare time, but I also spent a lot of time unsure what sort of game I was making. Did I want a completely random (within defined rules) game, or did I want to create a larger adventure game, where there was a proper plot? This probably meant about 4 months of nothing happening while I failed to really push the development forward.

Once I'd fixed on a properly random map generation and all the rest that involved, I created a system to randomly generate a map for a level and applied that. Shortly after that, I decided to create new graphics for the terrain to give the whole thing a more colourful and cartoony feel.

For combat, the HTML nature meant I didn't want to drag things out, so it is all determined in one go, resulting in a success, run away or death message. All weighting is designed to make the player more likely to run off than die, although death is still possible. The hardest bit has been trying to get the mechanics right. The original Rogue is harsh because it's random and I wasn't against the game being tough, but I didn't want people dying in the early levels too easily. I made several attempts to understand my own system, since I'd programmed it but not really thought through what I was expecting of the creatures the player was against, and eventually got some semblance of logic running behind it.

It's still fairly basic in terms of how it works, with the creatures for higher playing levels highly likely to either be push-overs or wipe the player out. But I've decided to call it version 1.0 and put it live and see what happens. I doubt anyone will play it. If they do then I guess I'll find out from comments how bad it is!

Here it is, anyway: PerilousWood.com