Sponsored By

Experimenting with movement in squishy physics climb-em-up Klifur

"Physics-based character controllers are fun because they always have these emergent properties."

Chris Kerr, News Editor

July 5, 2022

8 Min Read

Klifur is an exuberant morsel of a game from Torfi Asgeirsson -- one of the minds behind NUTS and A Firm Handshake -- that aims to explore physics and character movement by getting players to put a plucky climber through their paces.

The project was inspired by turn-based fighting game Toribash, which lets players devise their own moves by choosing which muscles to contract or relax before each turn in a blend of turn-based and realtime combat.

Intrigued by that mechanic, Asgeirsson wanted to dig deeper into physics-laded limb management and started tinkering in Unity with a view to creating, well, something vaguely playable. The result is Klifur (that's Icelandic for "climbing," by the way), which combines a handful of mechanics -- such as a stamina bar and a variety of holds -- with tight puzzle design to deliver a bite-sized experience that's surprisingly dynamic.

After tucking into Klifur during a recent lunch break, I reached out to Asgeirsson to hear more about the technical workings and design inspirations behind his little spoonful of digital joy. Oh, and if you're keen to take Klifur for a spin before reading on, it's currently playable over on Itch.

Game Developer: You've mentioned that you often think about games that attempt to explore one new or interesting idea, so I'm curious to know what intrigued you about character movement?

Torfi: So, the character setup is very simple. The torso is a dynamic rigidbody and the hands and feet are kinematic rigidbodies while they are on holds, otherwise they are dynamic, and they are attached to the torso via a distance joint. There is no force on those joints, they just keep the hands and feet within a certain radius from the shoulders and hips respectively. 

The knee and elbow joints don't exist in the physics simulation at all, they are purely visual. I used Unity's built-in 2D Inverse Kinematics package to set that up. BUT when you combine all that and start moving the hands and feet, you get this fantastic illusion that the arms and legs are helping to move the body. It just immediately looked really dynamic and surprisingly lifelike while also being really simple to control and that is what I really look for in a good physics-based controller of any kind.

Here you can maybe see more clearly the joint setup. The dotted lines are the IK joints, the solid lines with the bars on them are the actual physics joints.

Why did you choose to explore that concept through the lens of a climb-em-up?

I'm actually not really a climber, I've only done it a few times, but my friend and collaborator Joon is and we had a conversation about bouldering at some point which is a form of climbing where people do these short routes that are a bit puzzle-like, they are even called 'bouldering problems'. Ever since we had that conversation, it would occasionally pop into my mind as something that might be fun to build a game around. 

I like games with really compact but expressive levels and it felt like there was some fertile ground there. I had a very different idea at first, it was a turn-based game where each turn is one move and you spend stamina based on how hard the move is. I thought there might be something interesting in the combination of navigation plus resource management but as I started to try designing it more concretely I quickly realized it would be really complicated to make. But as I thought about that idea, the physics character setup I described above occurred to me and it seemed like it could also be promising.

How did you conceptualize, implement, and iterate on your core climbing mechanic, thinking about elements such as momentum, physics, and limb maneuverability?

Honestly a lot of that just emerged naturally from the character controller setup. I've made a lot of physics-based character controllers by now so I have some intuition for the right mix of simulation and control but I definitely felt like I got lucky with that first attempt. I could immediately feel that it had some interesting properties. Like you could stretch your right hand onto a hold while your foot was hooked onto one to the left and when you released the foot the body would swing to the right and you could use that momentum to get your leg up onto some other hold. I had to do a tiny bit of tweaking things like gravity and drag to get it to behave the way I wanted but way less than I usually do.

Could you explain how and why you added constraints such as a stamina bar and force variables that depend on a player's current hold?

I wanted to constrain how far you could reach based on how many holds you are touching both because it looks more natural but also because it enables much more interesting level design. Then you don't just have to think about the distances between the holds but how they are arranged and where you can place limbs to "push" you toward the hold you want to get to.

I spent a lot of time thinking about how to apply force to the limb you are dragging. The classic way to implement something like that is to have an invisible kinematic rigidbody that follows the mouse and then attach that to the physics object with a spring and that's what I tried first. The problem with that is that the spring applies more force the further apart the bodies are so you could just drag the cursor really far away and still get a lot of movement even with low force on the spring. I noticed that Unity has these "Relative Joints" that I had never used before but behave kind of like a spring except you set a max force that can be applied to try to reach the target. So then it was just a matter of setting that max force based on how many hands or feet are touching holds. There is also a little bit of consideration for whether the direction you are dragging in is "in-line" with your legs or not, so you get more force when your legs are pushing you than when you are hanging by them.

Even with the force applied being limited, though, you could still sort of swing back and forth and build up enough momentum to get onto some holds that I didn't want you to be able to reach so I added the stamina wheel mainly to prevent that. But it also creates an interesting dynamic where you still can perform some of those unlikely moves with precarious holds if you are quick enough. I tried to design the levels so that you never have to do one of those, there are always 'safe' positions available, but I like that you can go for risky moves to lower your move score.

Did the more emergent aspects of movement take you by surprise or is that something you anticipated? What do you feel they brought to the experience?

Physics-based character controllers are fun because they always have these emergent properties and I love the process of discovering those and slowly shaping them. There was definitely a lot of small things I didn't expect and the process of tweaking the character and making the levels really felt like exploration more than invention. There's a bit in Getting Over It with Bennett Foddy where he talks about when designing the mountain in that game, he would come up with some section and when he tested it, if it was too hard, it felt like that was a failure of him as a player rather than as a designer. 

I felt a bit like that when making levels for Klifur. The edges of the constraints are fuzzy enough that you're often not quite sure if something is impossible or just really hard and I found myself discovering techniques that I could never have intentionally designed into the character controller or the level. I think that level of expressiveness int the character is really what makes this game interesting.

This a move that I think looks cool. It's really satisfying to get that three-point setup on the right side before reaching over to the green hold and then swinging further right. It also highlights something how adding the eyes that track the active limb did a lot to create that illusion of more complicated movement.

Finally, given you created Klifur to explore movement, I'm keen to know what you learned from the experience?

Like a lot of game devs, I start way more projects than I finish. I think Klifur was a good exercise in executing on a simple idea to the point where the idea is sufficiently expressed and just calling that good enough. It was very tempting to add more stuff, I had ideas for different characters with different body shapes, different types of holds, a level editor, etc. But none of those things would have helped express this core idea of this character and how it moves. Most of the game came together over a three-day weekend and then I spent a few more weekends iterating on levels and adding some polish. Every week I would say "I'll release it next weekend" but then find something else I wanted to add or fix. Then finally last weekend I had a wedding to go to so I knew I had to either just pull the trigger or it would be another week and so even though I still really wanted to add a menu and fix some of the remaining jank, I just threw it out there and I'm really glad I did.

About the Author(s)

Chris Kerr

News Editor, GameDeveloper.com

Game Developer news editor Chris Kerr is an award-winning journalist and reporter with over a decade of experience in the game industry. His byline has appeared in notable print and digital publications including Edge, Stuff, Wireframe, International Business Times, and PocketGamer.biz. Throughout his career, Chris has covered major industry events including GDC, PAX Australia, Gamescom, Paris Games Week, and Develop Brighton. He has featured on the judging panel at The Develop Star Awards on multiple occasions and appeared on BBC Radio 5 Live to discuss breaking news.

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like