I’ve always loved the “fantasy maps” that you find at the beginning of all fantasy novels (LOTR, Game of Thrones, etc.). There’s something exciting about seeing the map, with all sorts of interesting looking places just begging to be explored. I thought it would be fun to make a turn-based strategy tactics wargame based on this visual style.
I’m creating my game in HTML5 using jquery, because something like this doesn’t need 3d rendering performance, and because it is very easy to turn the game into a mobile (android, ios and ouya) app using phonegap. I started by first drawing some typical fantasy map icons using marker on paper:
After scanning in the images and creating a spritesheet, I wrote a simple random map grid creation class. It uses deterministic random procedurally-generated terrain (a seeded mersenne twister PRNG) so that a complex map can be recalled with a single integer seed value (no need to save a huge array to disk/cookie/localstorage). I then add extra water tiles around the edges by varying the shoreline randomly. Finally, I scatter hamlets, towns, cities, forts and castles in non-blocked tiles and give them random location names by combining two syllables from an array of three-letter strings. This results in a fantasy book-style map with scattered forests, mountains, hills, swamps, and deserts that hold a plethora of interesting-sounding locations.
Finally, I implemented an A-Star pathfinding algorithm that can navigate a character around obstacles to get to any waypoint on the map (the green and red blocks: green is how far you will move in a single turn before running out of “energy”). I also coded a line-of-sight (LOS) algorithm for use in the combat, which means that eventually projectiles and magic spells could be cast in a straight line but would be blocked by mountains or towns. The light beige blocks are tiles that you are able to attack.
There’s no actual gameplay yet – no enemies or win conditions – but at least you can move around the map.
The game jam is half over: so far so good! Wish me luck on this grand adventure: my quest is to make something that is fun enough to provide some replay value and will hopefully serve as an ideal proof-of-concept for a larger and more polished project over the next few months. I love Ludum Dare (and Orcajam – this weekend’s local game jam gathering).