Monday, November 19, 2012

Fun with Procedural Lock and Key Puzzles



Hi!

Something I've been experimenting with recently for Jungle.com is throwing in some procedurally generated lock and key puzzles. Since I've played around with these before, mostly in the context of my research, and Jungle.com already has both locks and keys for other purposes, I figured they might add a nice bit of spice to the generated levels.

The basic idea with generating locked doors is pretty simple and fits nicely on top of the existing level generator. For context, this is what the generator did prior to adding locks:

  1. Generate the complete arrangement of objects for the level (I might post about this process separately) 
  2. Randomly choose rooms for the start and end of the level (sufficiently far apart to keep things interesting).
  3. Pick a semi-arbitrary path between the start and end of the level. This will be the "guaranteed path" for completing the level, although other paths are highly likely to exist. 
  4. Forcibly carve openings between rooms on the "guaranteed path". 

Now to add locked door puzzles, I just add a few extra steps to this process:

  1. Choose how many locks to add to the level based on a "lock density" parameter that I can control for each level. 
  2. For each lock to generate, choose a random node on the guaranteed path (that hasn't yet been chosen) to generate the lock. Place a bunch of immovable walls and locked doors in between the chosen node and the next node on the path to add the locks. 
  3. For each lock generated, spawn a new key somewhere on the guaranteed path before the locked node. 
  4. I don't do this yet, but it might also be fun to generate locked doors between rooms that don't lie on the guaranteed path, just to see what happens. 


And we're done! With locked doors active, you might end up with rooms that look kind of like this:
The walls and locked doors are placeholder art right now


Now, since almost everything can be destroyed in Jungle.com, keys included, you might wonder what I do to prevent the player from blowing everything up and getting kinda stuck. The answer is, well, "not much."

Even the code says "too bad"


The design philosophy for Jungle.com so far has been "Offer enough solutions so the player would have to work pretty hard to get completely stuck". It's seemed to work pretty well so far, so hopefully it works okay here as well. I'll be relying on ample play-testing to make sure there aren't any serious snafus.

Anyways, after implementing all this junk I tried playing a few levels set to 100% lock density (so every room on the guaranteed path is separated by a locked door). It seemed pretty interesting. I definitely had to plan my motion through the levels a little bit more, but I could also see it getting kind of annoying if I make locks too frequent. Also, what's this...


Darn you acid spider enemy! How dare you destroy my carefully generated lock and key puzzles! Haha, the fun thing is that getting past that spider unharmed might actually be more of a hassle than just finding a key and unlocking one of the other doors.

Of course I'm leaving that in.

Okay Bye!

Sunday, November 18, 2012

Hello

Hi! My name is Alec Thomson, I'm trying to become a game designer and this is my new blog.

I've made a bunch of games in the past, sometimes as a student and sometimes as a researcher at the former Singapore-MIT GAMBIT Game Lab (now known as the MIT Game Lab), which can all be found at my website.

Most recently, I've released a free puzzle game for iOS called Conway's Inferno. Conway's Inferno is a game about goofing around with a cellular automata to cause the extinction of a species. It's totally available here, so feel free to download it and (hopefully) have some fun.

One of the later levels of Conway's Inferno

Meanwhile, the game I'm currently working on is a procedurally generated stealthy puzzle game called Jungle.com. Jungle.com is a game about robbing a major online retailer by ordering tools from that same retailer to help you out. It's still in development, so check out this gameplay video for an idea of how it plays.



At my day job, I'm a Masters student at MIT in the Computer Science department. My research is on developing designer targeted tools for creating procedurally generated puzzles. Right now, I'm creating tools the look kind of like this.

The Puzzledice puzzle editor


Anyways, this is actually the third time I've tried to start up a regular blog (don't look for the others), so hopefully I can keep it going this time. I'm going to try to keep posts short but frequent and mostly about my projects or other things I think are cool.

Okay bye!