Winter Development

posted 06 Jan 2012

Over my 3 weeks Winter holiday from University I’ve managed to get a fair amount of development done for my game, MazeOtaur. It’s still quite a way off from being published or even in a playable state, but it’s getting to a playable point and I should be able to put it up for testing in the next month or so.

A few of the things I’ve been working on are rooms, braided mazes and torches. These are some of the important defining characterists of my game, to make it somewhat unique.

Rooms weren’t too much trouble to implement. I simply generated a few sqaures on the map, then let the maze algorithm connect them together. I made this hard for myself because I wanted a limited number of entrances to a room. Eventually I gave up on this, but my braided maze code saved the day for getting this to work.

Braided Maze with Rooms

Braided mazes are mazes which have no dead-ends. This means there are plenty of loops throughout the maze, which makes the stealth aspect of my game more interesting, as before there was only one path. My braid implementation isn’t perfect, there are still a few dead-ends, but it does look and play much better as there are multiple paths. My braided maze algorithm works by simply giving a weight to every, that states how many corridor tiles are adjacent to it. Using this and Primm’s algorithm I can check the weight of each tile, and if it’s small enough I can connect to it and possibly make a loop.

That method was the simplest to implement but other methods like finding dead ends and just knocking out a wall would also work, and would give you a fully braided maze, unlike my partially braided maze.

The last thing I’ve implemented over the past few weeks is torches. These have been the main element I wanted to play with since I came up with the idea for the game. I basically wanted the player to only see parts of the maze, making the maze much more difficult and more interesting. As without torches the game simply becomes Pac Man without the Cherries.

Initially I thought lighting would be a difficult thing to implement, but the approach I took was very simple and worked quite well. I simply gave every cell a lightLevel value of 0, and when there were torches, I would simply increment that level. To get a nice spread of light I used a limited depth first search to find all the cells adjacent to the first, torch node. This worked quite well as you can see from the main picture on this post.

Breadcrumbs are a small feature I added to try and make the maze easier. A friend suggested this, but he also suggested making the Minotaurs eat the breadcrumbs as they walked along their patrols. Which is an interesting idea, but would be horrible. Perhaps if I have a hard mode I can introduce this. Breadcrumbs took 10 minutes to implement so I’m not going to talk about them.

You’ll probably notice from the images that not all my features are in all the pictures. This is because I’m trying to learn how to use git properly, by branching all my implemented features, then merging them into a development branch. After some bug fixes in development, I can then merge into master.

This idea was working well, until I started putting bug fixes in random branches, rather than making a seperate branch with the fix then merging it to all my development branches. This was fairly annoying as one of my bug fixes was to ensure the display actually displayed things, as sometimes it set it’s height to 0, which was very annoying.

Another thing I was playing with was Sonar which is a static code analyser. It’s been very useful, but was horrible to set up.

Next time I’ll probably talk about Sonar or my git setup, but I’m sure my git setup is horrible and could do with improving.