30 August 2013
Tomb Breaker: How do those super cool mystical doors work? (Guest Piece)
Kurt Bieg is the founder of Simple Machine, a one-man indie game studio. From coming up with unique game mechanics to coding to writing the music, Kurt runs the show with the goal of bringing unique experiences to unexpected audiences.
Kurt’s recent Tomb Breaker game was recognized as New and Noteworthy by Apple and was selected as a Corona App of the Week in May 2013. In his piece, Kurt shares how he created the mystical doors seen in Tomb Breaker.
Before explaining how the doors work technically, I have to explain the design philosophy of Tomb Breaker so that you can get an idea of why they are there.
Tomb Breaker started with an idea. Make a fully immersive puzzle game, from top to bottom. Everything in the game is there for a reason, from the setting, to the powerups, to the actual puzzle. Everything exists as it would if you actually walked into the tomb. This meant designing UI elements that actually existed in the tomb. For instance, the highscore list is kept in Aria’s journal, the purchasable powerups are emitted from the gem in the tomb door, as if they were mystical blessings the tomb offers Aria, before entering, and even the puzzle game itself is designed as a lock that Aria must solve to gain access to the riches kept in the tomb. This is where I’ll let you in on a secret. Tomb Breaker was never meant as just a blitz. It has a rich narrative that was planned out from the beginning. The upcoming updates will have Aria traveling around to different tombs collecting relics all in an effort to capture a rare and powerful relic.
Ahem. What was I saying again?
Oh, right! As I started to map out the game and do research on other games, I realized that this type of design doesn’t exist in match games. Generally match games have a theme of some genre of “stuff” like candy, or gems, or animals, or what have you (head nod to Puzzle Quest and any others that have added more to the mix). Arguably these games function well enough with out such immersive themes and narrative due to the insane popularity that goes along with the match 3 mechanic. But I love to find new and challenging areas to innovate in, and making a match game with a particular design focus was something I wanted to create. I also developed a totally new mechanic for a match game, so that prompted me to build a story around this unique mechanic. It’s also important to note that I was working with an unbelievably talented artist, Vic Soto, whose unique style and dedication made for an unbelievable combination.
When we first started Tomb Breaker, we had just a door that had menu buttons on it. When you tapped play, the doors slid open much like they do now, of course, without the mysterious tomb and the super cool Aria Brite character. I had wanted to make the tomb room with a zoom into the door for a while, but put it off because I imagined it to be quite an undertaking. However, as I’ve learned using Corona SDK and the exceptional Lua language that Corona is built on, sweeping changes are hardly more complicated than writing 10+ lines of code.
When I finally sat down to give it a go, the doors sliding open and the zoom into the puzzle were actually super simple to implement in half an hour (mostly spent tweaking x and y coordinates). If any of you have used Corona’s Storyboard library you probably understand that it has a huge potential to pull off some seemingly impossible visual effects all without waiting for loading time. If you haven’t, you really should check it out.
Anyway, as I started to learn about the Storyboard Library I found that the basic elements of sliding scenes were really great, but to do the doors and the zoom I needed to do more with it. I didn’t want to just pan over to a scene, I wanted to have two scenes coexisting together at the same time, this way I could have the game menu scene overlaid on top of the puzzle scene. When the player presses play on the menu, the game zooms in, the doors slide open, and the puzzle swiping madness begins.
There are two basic “tricks” I used to make it work. Ok, they’re not tricks at all, just things that took me some heavy research to find.
First, did you know that when you’re in a storyboard scene you can call any file you have as an overlay and it will run the scene on top of the current scene?
I didn’t know this at first, but as I pushed more and more to make the tomb come alive, I realized that this would be the only way to keep the puzzle loaded in the background while showing menus like the highscore list and power ups, all without skipping a beat. I just call the following line in the puzzle game scene after a match ends and the doors close:
And then when the player presses play in the menu, I call this line from the menu scene:
Very useful, but that wasn’t the only thing I needed. See, the tomb is actually similar to an open face sandwich. No really, I’m 100% serious about this. In Corona, you can actually separate the layers you are working with, so the storyboard can be on one layer, but you can add other layers below it or above it. It works just like any other display layer in that you can add images, groups, etc. In my main.lua file, I just do something like this:
Then I add the background image to the _G.background layer. Now here comes the curve ball, that image is actually the image with the stone walls and the floor that you see in the game, it just so happens that everything else like the tomb doors, the torches, Aria, the notebook, are all on the storyboard.stage layer. This allows me to access and zoom into the background image (the walls and floor) when the tomb doors slide open to give the game the feeling that you are actually walking up to it.
Pretty cool right? And I know what you’re thinking, “Yeah, Kurt’s right, that very much is the definition of an open faced sandwich!” Ok, maybe without the exclamation point, but still.
Those are the two things I used to make the special sauce. From there it was simply making most of the moving objects global so that the menu or the puzzle game scene can move them.
All in all, Tomb Breaker is far from complete. As I mentioned, I plan to expand on the story and introduce new puzzles, but the groundwork is set.