Source Control Chaos Handled

Today I finally got my act together with version control.  This is something I had put off for way too long, and with my venture into PC ports, I think it was finally time to learn what branching and tagging are.

In a nutshell, branches and tags are like copies of the project that don’t take up extra space like they would in a normal file system.  They’re useful for storing release versions and for testing new features.  They’re like the save games of the world of coding–you want to create a new one before a boss fight.

For those of you who don’t use version control, get Subversion and learn the best practices.  Need a host?  Code Spaces has done me well.

With that handled, I got to put in a bit more time on porting Soulcaster II to PC.  I uninstalled Visual Studio and XNA Game Studio on one of my desktop computers so it could act as a testbed for end user machines.  Still have to work out some bugs but things are set up well for it now.

Squish Detection in Platformers

Top: Direct hit, kill. Bottom: Gentle nudge out of the way.

I’m amped.  I started writing a post on game production and teamwork versus working solo, but it’s just not something I can do tonight–draft saved.  Right now I just have to celebrate the squashing of an ancient, pernicious demon bug from hell in the Escape Goat code.  Could it even be called a bug?  It never even revealed itself in that mortal form.  It stayed for weeks, months even, as the Feature that Wouldn’t Be.

It was creature squish detection.

Here’s the situation in a nutshell:  If a block falls on you, or you get mashed between two moving walls, you get squished and have to restart the room.  Makes sense.  And detecting this is easy enough: if after resolving all collisions (clipping creatures to the edges of walls) a creature is still intersecting with a wall, you’ve got a squish happening.  That means one wall clipped the creature into another wall and it can’t be pushed away.

There was a problem with this.

Getting squished by a single pixel of falling block was annoying.  So was getting crushed when you were only barely inside a moving wall.  Come on, that should just nudge you out of the way… it’s barely grazing the goat’s tail!  You can’t make me restart this whole puzzle for that.

But… I also can’t take out squishing.  What if you get crushed by a block, do you just get to clip through the top of the block?  Or through the floor below?  That’s no good.  Squishing machines are a great hazard device in this game.  I’m not giving that up.  There has to be a balance… you need to be able to tolerate a few pixels of squishing and “nudge” the player out of the way in those situations.

I tried about 5 different methods of handling this.  And just a couple hours ago, after intense frustration and perseverance, I found the solution:

  1. Do all clipping of creatures to walls and world obstacles
  2. If any creatures are still intersecting with walls, start a crush timer on that creature, which lasts for 5 frames
  3. If the crush timer reaches 0, kill the creature.  (It took too many frames to resolve it to a safe position.)
  4. If the creature is not intersecting, store its position as a “safe position”
  5. If the creature is no longer intersecting, reset the crush timer, and compare its new position to the safe position that was stored before.  If the distance is greater than the squish tolerance (I set it to 5 pixels in either axis), kill the creature.

Essentially, give the game 5 frames to resolve a safe position for the creature after being crushed.  If this new position is too far from the start position, well, I can only be so forgiving.

Top: Direct hit, kill. Bottom: Gentle nudge out of the way.

When you face a feature from hell, stick with it, draw pictures, and try solving it from a variety of angles.  You’ll get it eventually and it’ll feel great.

Ira Glass on Storytelling: How it Applies to Game Design

I’ve only had an iPhone for a few months, and I didn’t realize until last weekend’s road trip that it can be used as an endless YouTube jukebox, provided you’ve got the reception for it.  My wife, Mary, played DJ on most of the drive home.  One of her selections was Ira Glass on Storytelling, available in four parts on YouTube.

Ira was really talking about game design, even though he thought has was talking about broadcasting.  I realized this and have pieced it together a bit below.

Let’s recap the four main pillars he touched on.  I’ll paraphrase:

Part 1: The Two Essential Building Blocks for Storytelling

  1. The Anecdote.  There is something powerful about a sequence of actions, where you feel like you’re on a train that has a destination.  A good anecdote is constantly raising questions, then answering them.
  2. The Moment of Reflection.  Before the listener can ask, “Why am I listening to this story?” Answer this question for them. What is the greater purpose to the story, and how does it relate to things beyond the story itself?

A common tragedy he describes is when you have one but not the other: a great anecdote that ultimately means nothing, or a boring anecdote that relates to a profound concept.  A good story requires both parts.

How do these two building blocks apply to games?

The anecdote is the ongoing, second-by-second interactions of the player.  Running, jumping, collecting coins, killing bad guys, assaulting prostitutes, matching three colors.  Be sure to constantly raise questions:  What’s on the other side of that door?  What does the bomb do?  What happens when the timer runs out?  Then answer those questions.

The point is to keep the player occupied with short-term tasks that logically string together and generally make sense in relation to one another.

But every few minutes or so, you might have to take a Moment of Reflection.  A lot of games do this exactly the way Ira describes it in broadcasting: a cut scene or dialog sequence.  This is what I did with Soulcaster.  Every few levels, the characters would chat about where they’ve been and where they’re going, revealing a bit more about the plot each time.

In Shadow of the Colossus, you see the sleeping girl between every battle, just as a small reminder of why you’re fighting and exploring.

In Resident Evil 4, every so often you’ll get a call from someone reminding you about Ashley and your mission to rescue her.

Part 2: Finding a Decent Story

The amount of time it takes to find a decent story is often equal to or greater than the time it takes to fully produce that story.  Half your time or more can be spent trying things out, then killing them when they don’t work.  Good stories exist because of how ruthlessly the creators cut the crap parts out.

During the process, you should be failing repeatedly, going through this process of experimenting and cutting.  If you’re not failing all the time, you’re not putting yourself in a position where you can get really lucky.  And it is luck.  Cover as much ground as possible to increase your chances of stumbling on that great story.

 The Killing Process and Game Design

I got really lucky when I made Soulcaster.  My first guess at a fun concept, dungeon crawling blended with tower defense, turned out to be pretty fun.  So while I didn’t spend a lot of time chasing lots of concepts looking for the right one, I did spend a lot of time building, testing, and killing lots of things within that core concept.  To get the 22 levels that ended up in Soulcaster, I probably made close to 40 total.  And in Soulcaster II, I probably made over 60 levels to get to the 30 that ended up in the game.

This is one of the first tileset tests I did for Soulcaster II. How many problems can you count?

When I got to the stage where I nailed down my mechanics, that’s when the design challenge really took place.  Way, way too few games take this aspect seriously enough.  There is just no way your first ten levels will be any good at all.  Make twice as many as you need, and throw the bad ones away.

 Part 3: Before Your Skills Match Your Standards

Whether it’s TV, radio, or writing, you got into this because you love the medium.  So you’ve got good taste.  For the first couple years, your skill won’t be able to produce material that’s up to your taste.  Don’t get discouraged, you have to stick it out.

The real, only solution is to produce a volume of work.  Churn out material continually, set a schedule, put yourself in a position where you have to be working constantly.  Over time, your skill will catch up to your standards and you’ll have bridged the gap.

My Experience with this Phenomenon

Even though I’m normally ruthless with myself, I’m proud to say I haven’t really fallen into this trap much.  I think two things have helped me in this regard.  First, I come from a background in computer music, which I learned from scratch, so this is not uncharted territory.  I already survived that learning process and the volume of work it took for me to be really happy with what I was creating.  Second, I chose an 8-bit aesthetic, which is both a) to my taste and b) within my grasp.

There is still the large body of work to create within the project itself (see above, all the unused Soulcaster levels).  Parts 2 & 3 seem closely related.

Part 4: Two Common Mistakes for Beginners

  1. Trying to sound like the medium.  Don’t try to sound like Ted Koppel, when there already is a Ted Koppel on the same TV.  The more you are your own self, the better off you are.
  2. If you appear in the story, make sure you give the right balance of time between yourself and other characters.  Show yourself, but also show others reacting to you, or you reacting to others.  Drama occurs when characters interact.

Applicability to Games

I think there’s a real value in copying the look and feel of a game you like, as a beginner, because of how much you can learn from this process.  But don’t miss opportunities to leave your personal mark.  Figure out how others tell their story, then see how you can use these methods to tell your story.

I need to watch out for #2 more than #1.  I’ve been able to give my games a distinctive look and feel, even though they are heavily inspired by lots of other games.  It’s the drama and personal touch I need to deliver a bit more on.  I’ve got some ideas for how I can do this with the story in Escape Goat.

I Need Your Help

Game designers of all levels of experience, help me fill in the blanks here.  I think there are a lot more parallels between the two disciplines than I could come up with in one sitting.

Infirmed For A Day

Take this guy’s advice and do proper stretching.  There must be something seriously wrong with my new home office setup because I had to take a full day off work due to paralyzing upper back pain.  I think my monitor is too low to the desk which makes me lean forward a bit too much.  (Actually the real reason is that I didn’t take enough breaks working at the computer.)  When I get back after this weekend, I’m going to be doing some ergonomics measurements around here.