The Witness iOS

The Witness is a first-person puzzle game from Thekla released in January 2016 for Windows PCs and PS4 and in September 2016 for XBox One. It was designed mostly by Jonathan Blow, known for Braid. The game is set on a colorful island covered in vegetation, beautiful if slightly ominous. The game has a very specific look and uses a number of advanced techniques to achieve it: the game engine is a custom multi-platform one. I joined the team on a contract basis to create an iOS port of the game, which released in autumn 2017. The game is also available on Mac OS and NVidia Shield.

My main task early on was to handle shader translation. The shaders were written in a subset of HLSL, as is generally the case with games released on Windows plus consoles. Mac OS and iOS use either OpenGL or Apple's proprietary Metal API, so some kind of translator was needed. There was already a parser and a syntax tree-builder available: the bulk of my work ended up being code generation, handling edge cases and API quirks, as well as fixing the shaders to be more translator-friendly. The translator is open-source and available on GitHub.

As I was neck-deep in the shader system, I ended up hunting two iOS shader compiler bugs that took significant time and effort to nail down. One of them made the vegetation black in seemingly random locations. That's fine, it's not like the game has plants everywhere, right?

I also handled platform-specific issues. The first big decision was to use Metal rather than OpenGL: it was definitely the better option on iOS, on Mac OS it can be hard to tell which is easier to use. I rewrote the iCloud saving code to better comply with Apple's recommendations, and the audio notification handling to integrate with the OS. I documented a number of XCode tips and other gotchas that saved significant time for the rest of the team, and updated export scripts so updating dev builds was trivial.

Working with Thekla was a pleasure, and I'm very glad I got to contribute to a game which means a lot to me for its use of colors and the flow of its spaces.