Squish Detection in Platformers
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:
- Do all clipping of creatures to walls and world obstacles
- If any creatures are still intersecting with walls, start a crush timer on that creature, which lasts for 5 frames
- If the crush timer reaches 0, kill the creature. (It took too many frames to resolve it to a safe position.)
- If the creature is not intersecting, store its position as a “safe position”
- 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.
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
- 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.
- 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.

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
- 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.
- 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.
How To Pick the Right Music Style For Your Game
Last Throes of Scope Creep
The bulk of the remaining work on Escape Goat is level design. Here are the goals:
- Player needs to get the first two items within five minutes, making the first region about 3 minutes total.
- Player needs to learn the play mechanics for both the goat and the mouse.
- There are 18 gadget types. They all need to be featured in puzzles, but they need to be demonstrated to the player beforehand. I’m hoping to avoid using text unless there is really no alternative.
- Rooms need to provide a range of difficulty, so you don’t have a string of consecutive easy or hard rooms.
- Rooms need to provide challenges for both platforming and puzzling. Platforming levels feature precise timing, and puzzling levels are more low-key and can be slower paced.
The current state of the game is a random collection of rooms that need to be placed in order. I added a cut-and-paste feature in my editor, so it’s easy to move rooms around, even from one level to another.
A couple days ago I came up with new gadget ideas. I allowed myself an hour this morning to program the first one: a floating bubble that keeps inertia and gets pushed to the edge of the wall. I figured it could be used to make Sokoban-style puzzles where you have to pick the right order and direction of blocks to push.
I got it working, then put together a level featuring the new gadget, and then decided it’s best to scrap it. The game doesn’t need more gadgets. A new feature means something else I have to train the player on. And with 18 working gadgets already, there are endless combinations I can use.
I’m glad I took the time to explore it, because maybe it would have been groundbreaking and awesome–you never know with these things. And it was only an hour. I’m also glad I’m willing to let it go. And after this exercise, I really know now that nothing more needs to be added.
New Theme
Welcome to MagicalTimeBean featuring the Standard Theme. I had never really been happy with any of the free WordPress themes, so every so often I go on a hunt for a premium theme. About two weeks ago I was on such a search, digging through the WP theme marketplace online, when my wife Mary pointed out that the theme wasn’t the problem, it was that I never update my site. She put it in a much more diplomatic way of course, and I launched a personal challenge to post once per day for 15 consecutive days. Then I would earn my precious new theme. Well, last night was the last one, and I have to say I’m proud that I’ve been able to keep it going. And so far I’m enjoying the Standard. It’s still kind of bare bones around here, but I’ll get the graphics back as soon as I can.
This morning I managed to clean up the Soulcaster and Soulcaster II pages. They have much more comprehensive links to reviews and other related stuff online, a new bio, and some other general tweaks.







