Human: Fall Flat is a physics based puzzle platformer published by 505 Games where you run, jump, lift, climb and fall your way through a ton of fun levels. We at Codeglue were tasked to bring this game to more players around the world by porting it to mobile phones. In a previous blogpost we went over the challenges we faced with implementing touch controls for this PC title. In this blog post we dive deeper in how we made this performance heavy game run on mobile phones.
With the playable levels becoming more and more intricate the further you progress, we had to make sure the performance would stay optimal for a fun experience. Physics calculations are expensive and when paired with big open level scenery, low frame rate becomes a valid concern. We’d like to take you through a few of the steps we took to make this game run buttery smooth on even some low-end mobile phones.
The player character consists of many physics driven body parts which are – often in hilarious fashion – constantly colliding with the level and other objects. How the player character reacts when he falls and flops against the terrain gets determined in complex physics calculations. In order to save some much needed processing power, we had to make these calculations both easier and less frequent.
Many of the level’s objects had their colliders altered. A collider is the shape that the ‘physics world’ sees the object in, regardless of the visual shape the player sees. This means that the physics interactions can be calculated for a much simpler representation of the object’s actual shape. Great! That happens to be exactly what will make the physics calculations a lot easier for the hard-working mobile phones. A small golf club composed of a grip, shaft and head gets represented by something less complicated – a stick. A bigger golf club? A bigger stick! The big golf club has an added box at the end to more closely represent the club head, but these primitive shapes are still much more performant in calculations than its complex visual shape. On top of that we decreased the amount of times these calculations get performed from 60 times per second to 45 times per second. Less calculations, means more juice to do other demanding tasks such as the visuals!
We didn’t want the visual appeal of the game to suffer noticeably with the change from desktops to mobile phones. However, changes needed to be made to certain aspects of the visuals to let the tiny computers keep up. A very performance-intensive issue we needed to tackle first was lighting. Lighting is what breathes life into a scene, but doing so during runtime is also one of the most taxing processes.
Dynamic lighting will process all the sources of light in a level and display their effect on their surrounding every frame. This results in lights blending together, combining colors, and making shadows warp perspective as you make your way past different scenes in the level. Sadly, this was just too demanding for the poor phones. We tried to approach the lighting found in the original PC version of the game, by baking most of the lights onto the geometry. This means that those light sources calculate their purpose during the build process of the game, rather than during gameplay, which then gets saved into the level. Playing through the level you will still see all the lights cast their shadows on the level geometry itself, but the moveable objects such as player characters and other interactable objects cast a more simplistic, directional shadow.
Besides lighting we also applied slightly more restrictive LODs on many objects. LOD is the abbreviation of ‘Levels Of Detail’, they are used to simplify the quality of an object’s visuals when the camera gets far away. This is incredibly helpful in reducing the power it takes to render complex objects. A beautiful mine cart should obviously look like mine cart up close, but when its size on the screen isn’t bigger than the head of a pin, we can simply represent it with a gray box instead. You won’t even notice the difference.
We’re proud of this product we’re delivering. With every new, increasingly complex level that gets added to the mobile version of Human: Fall Flat, we keep facing new challenges we must conquer in order to give the players a smooth experience. We love it, and we hope you can get the most enjoyment out of all of the released and upcoming additions to the game.
Would you like to stay up to date and follow our development updates, please check out Codeglue on your platform of choice!