Grapple Hook Game

Game screenshot with title card visible: GRAPPLE HOOK GAME

This is a small game I wrote during my early years of University, for fun and to learn C programming.

To this end, and as an arbitrary artistic constraint, I avoided using any complicated libraries, aside from SDL for the windowing and graphics.

I am always fascinated by physics engines, so I started with a tiny 2d physics solver (without rotation), and went from there.

The most interesting part is that, despite the simplicity of all the shapes, I implemented collision with arbitrary convex polygons via the separating axis theorem. Put simply, for each pair of shapes it loops through all the faces of the first and projects the two shapes onto it, if for any face the two shapes don’t overlap in the 1D projection, then the shapes are not overlapping. This is neat because when they are overlapping it gives you a vector to move them out of collision (the amount they are overlapping, in the direction of the face).

Of course, this algorithm isn’t very efficient, and worse, requires very small time-steps for it to look “stable”. I even run the physics in a dedicated thread to help speed it up.

The levels and colours are fully procedural, though not very interesting. The colours are a simple hue rotation and the levels are a random walk with a random increase in height for the ceiling and floor.

Everything is drawn with simple lines and rects.

I did cave and use a font for the text in the game, since I didn’t feel like designing a pixel font in a C header, although that would better match the aesthetic.

Despite this simplicity, a few people have played it and really enjoyed it, so I count it a great success.

I poke around with the game occasionally, but having not really touched it for 1–3 years now, I think I can call it finished and leave it as is.