Just trying out Crayon

Just trying out a new code highlighter. It is called Crayon. Pretty impressive, and very easy to use. If you want to know more about the n-Queens program, check out this shizzle.

Premature complexity

Here is another trait of mine I could do without. Whenever I embark on a new project, I have a tenancy to make it really complicated, really quickly. I have a recent example of this. Last night I was sketching out the range of actions a rogue can take each turn. I immediately made it far too complicated. I had three levels of movement (sneak, walk, run) each with a different noise modifier. I had a separate ‘detect traps’ action. I was making it pretty tough for myself. In the end, I simplified things down to the following 5 actions:

  • Sneak – For one action point, a rogue can sneak one tile in any direction. This includes diagonal movement. When sneaking, a rogue has a medium chance of detecting traps.
  • Move – For one action point, a rogue can move two tiles in any direction. This includes diagonal movement. A walk action can combine directions (e.g. up and then left). When walking, a rogue has a low chance of detecting traps
  • Melee attack – For one action point, the rogue can melee attack a guard in the 8 tiles around him. Melee attacks made by the rogue have a high chance of hitting the target. A melee attack that hits will always kill the target.
  • Ranged attack – For one action point, the rogue can attack any guard within 5 tiles (in any direction). Ranged attacks made by the rogue have a variable chance of hitting the target (the further away the target, the lower the chance it will hit). A ranged attack that hits will always kill the target.
  • Steal – For one action point, the rogue can steal any treasure in the 8 tiles around him. There is no limit to the amount of treasure a rogue can carry. The reassure is assumed to be light and portable.

This should be a lot easier to implement. Some of the other stuff I thought about (‘fog of war’ type vision, effect of noise on environment etc.) can be introduced later, when I get the basic stuff working.  It’s a clear case of KISS with maybe some YAGNI thrown in for good measure.

Anyway, the next thing I am going to do is get set up for Python development. I thought it might be a good idea to use Rogue Code as an opportunity to work in another language. So I need to download the latest Python release and a good editor. I have picked PyCharm Community Edition from Jet Brains. They are the guys who make ReSharper and IntelliJ, so they should know what they are doing.


This is the problem I have with new projects. I start work on them, and then all of a sudden I want to make some massive change, take a completely different direction, re-boot the whole thing. This has just happened to me with Rogue Code. I was making some coffee in the kitchen when I heard the sound of a police siren in the distance. Whenever this happens to me, I immediately flash back to various zombie films I have seen (i.e. suburban setting suddenly disrupted by cop sirens, gun shots, screams etc.). Anyway,  while I was in this zombie frame of mind, I started thinking:

What if Rogue Code was about zombies instead of dungeons?

And then I was away, away in fantasy land. I was planning the URL I needed to buy (www.zombie-code.com is available), I was puzzling out the basic mechanics of the game etc. Note that I am doing this BEFORE I have written one line of code for the original dungeon-based concept. This is actually pretty typical of me. Sometimes I start a personal project, change the specification several times in quick succession, then move on to something else without achieving anything. I guess this is the challenge with personal projects, as opposed to the projects I am handed at work. When you are implementing your own specification, you are just as likely to encounter requirements drift as when you working on someone else’s.  I am going go do some more work on the players guide, while I think about this.

Bitmap map map

OK, after a few false starts, I have created an image using Tiled to illustrate the type of thing I am talking about. It is very simple, but hopefully it paints a picture. A rogue enters a torch-lit dungeon. In the smoky light, he makes out a treasure chest and a dozing guard. Can he nab the treasure and slip away? Will the guard wake up or sleep right through? Just another day at the rogue office, right?


OK, so let’s get down to brass tasks. How is programmatic dungeon crawling going to work exactly? This is a good question. Well, I have started a new page called Players Guide that tries to answer it.

The best part of a project

The best part of a project is always the beginning. The first few days or weeks of a new undertaking are full of possibility. Of course, it tends to bog down after that,  but right now I am happy, because I have an idea. This is not a commercial idea. I am not trying to make money. It is not an original idea. I am sure that someone, somewhere has already done it. But it is a fun idea, or at least, it seems like fun to me.

What I want to do is take all the programming goodness you can find in Robocode, and throw it at the noble art of subterranean adventuring / tomb raiding. Think about it! You program the adventurer, then drop them into a procedurally generated, semi-random dungeon. You study the results. You improve the code. You change your strategies. Your adventurer evolves. Fun!

Anyway, it is all going to be very simple to begin with. In my mind I am seeing a small grid of tiles that represent a dungeon. Then we insert a sprite representing the rogue, a treasure chest, a few enemies and an exit. Add some very simple rules for turn based action and you are ready to go! It’s easier to explain this stuff using images, so my first research task involves finding a good map/dungeon editor. I have found a few links to something called Tiled, so that is where I am going to start.