This Week's Sponsor:

Kolide

Ensures that if a device isn’t secure it can’t access your apps.  It’s Device Trust for Okta.


Building Games for Playdate in Swift

Panic’s Playdate has been in the news again recently. The company has caught up with pre-orders, so anyone can order one, and it will ship within 2-3 days. Also, Lucas Pope, the creator of beloved games like Papers, Please and Return of the Obra Dinn just released Mars After Midnight, a game I plan to dig into this weekend. The Playdate catalog is also running its first-ever sale, but there’s just one day left, so check it out today.

Most recently, I saw Panic’s Cabel Sasser link on Threads to a post by Rauhul Varma on the Swift.org blog. The Playdate’s developer SDK supports Lua and C, and as Varma explains, “the typical Swift application and runtime exceed the device’s tight resource constraints.”

However, Varma, who is an engineer in Apple’s Advanced Prototyping in the Platform Architecture group, had an idea for building Playdate games that would fit on the device:

Recently, the Swift project began developing a new embedded language mode to support highly constrained platforms. This mode utilizes generic specialization, inlining, and dead code stripping to produce tiny binaries, while retaining the core features of Swift…

These defining characteristics make the embedded language mode a great solution for shrinking Swift to fit the Playdate’s constraints.

To demonstrate the approach, Varma shares two games built in Swift: Conway’s Game of Life, which is a sample included in the Playdate SDK, and a Breakout-like game called Swift-Break. For developers who are interested in building games for the Playdate using Swift, Varma’s post includes a detailed explanation of the process, and the code and documentation are available on GitHub.

I love this project because it lowers the barrier to getting started for Swift developers who may not be as comfortable or familiar with Lua or C. I hope this leads to even more great releases for Panic’s awesome little handheld game platform.