Introducing Delta Lite

For the past few weeks, I’ve been working on a brand new project I’m happy to share with you all: Delta Lite. Delta Lite is a Swift Playground that allows you to play any NES game in the Swift Playgrounds app on your iPad. Despite being a playground, Delta Lite is essentially a complete iOS app, and it supports standard emulation features such as save states and cheat codes, as well as Delta’s unique Sustain Button functionality.

How does it work?

You may be asking, what is Swift Playgrounds? Swift Playgrounds is an iPad app that allows you to write (typically small) Swift programs. Primarily focused on teaching Swift fundamentals, it includes several “Learn to Code” lessons provided by Apple, but you are also able to download additional playgrounds that usually teach specific Swift or iOS development lessons. For more information, I’d recommend checking out Apple’s website.

Delta Lite is also a swift playground, but it is far more complex than the ones provided by Apple. Because Delta has been written in Swift, Delta Lite uses the same codebase internally, which means that the program that runs when you open the playground on your iPad is almost identical to the app version of Delta.

Why only NES?

Swift Playgrounds only supports programs written in Swift. Unfortunately, the vast majority of emulators are written in C++, which means they cannot be used as-is. To work around this, I came up with a somewhat convoluted solution. I took the Nestopia emulator codebase, and then using Emscripten I compiled the codebase to JavaScript. I included this JavaScript file in Delta Lite, and then I use a hidden web view to run this JavaScript in the background, piping data to and from the web view as needed.

This process was somewhat tricky, so for now I limited it to just NES. There’s no reason I couldn’t add more systems in the future, but I think everyone would be happier if I spent that time finishing Delta itself :-) But yes, this does mean Delta will launch with NES support as well!

Download Instructions

Download Swift Playgrounds on your iPad from the App Store. Tap this link on your iPad, which will launch Swift Playgrounds. Tap “Subscribe” on the alert that appears. Tap “Get” on the Delta Lite playground in the new “Delta” section. Open up the Delta Lite playground, and start playing NES games!