Tuesday, March 27, 2012

Lock and Key

Tonight I put in the first keys and locked doors, along with a primitive run command.  Right now running is bugged so it takes only one step to cross a whole line of squares; this is pretty handy for keeping the monsters off my back, hehehe.

The locked doors worked fine pretty much off the bat; the logic is very simple, after all.  However, it's a good opportunity to start thinking more about how to keep track of where level features (keys, locked doors, stairs, monsters, etc.) are supposed to go.  This information is intimately tied up with the generation of the graph, so it's a bit tricky to conceive of separating those concerns.  Anyway, I got something fairly sensible in place and it seems to work, so I'd say it's a nice step.

Next up will be to parameterize the graph generation so that I can specify what I want in terms of abstract characteristics (number of key/lock pairs, amount of extra rooms beyond core structure, etc.) and get a variety of corresponding levels.  I'll hold off on screenshots for now, because the upcoming ones will look much nicer than my little three-room test with one locked door.


  1. For the lock/key logic are you having the 'key' act as a switch that just unlocks all the matching doors or are you unlocking each door as the character gets to it?

    I guess that first way would be more like having a 'switch' than a key.

  2. Right now keys and doors are one-to-one, matched by color. I need to change that at some point to make sure the colors are at least distinguishable. :)

    Switches are something I also plan to do, and any variations of behavior along these lines is fair game. I want this game to win at fun through controlled combinatoric explosion, so the more interchangeable parts the better.

    A switch can open one door, many doors, many _trap_ doors, many doors with tigers behind them, many doors with princesses behind them, floodgates (thanks Dwarf Fortress), bridges (again DF)... I'll stop now. I've got plans. The list is long, but needs to be longer still, so I'm all eyes and ears for ideas.