Sunday, June 21, 2009

Porting Ren'Py to iPhone project

Ren'Py is a visual novel framework written in C and Python which conveniently compiles Win32, OS X and Linux targets for you. For those of you old enough to remember "Choose Your Own Adventure" books, visual novels are basically the same idea.

One platform Ren'Py does not support is iPhone, likely due to these factors:

  1. The Ren'Py developer community's doubts about the viability of the iPhone app economy (commercial visual novels cost more than most iPhone apps) compounded by recent dustups concerning App Store authors not being paid in a timely fashion
  2. Apple's public stance against App Store apps with code interpreters. Under the terms of clause 3.3.2 of the iPhone 3.0 SDK, it would seem to be impossible to develop any kind of software with a code interpreter that uses its own frameworks. And yet this is being debated endlessly across forums ever since the 3.0 SDK came out. I suspect the more hardline Apple tries to be on this point, the harder developers will push to create better toolchains of their own, leaving Apple in the unenviable position of trying to add EULA language prohibiting you the end user from choosing what kind of software you want to run on a device you outright own (they had the choice not to port the iPhone to the iPod Touch).
Despite these obstacles, we have to remember that the iPhone platform was designed for a very specific purpose: to waste as much time as humanly possible. And to this end, visual novels are IMO a killer pocket app.
Just to make it all fun, I have zero experience with Python or XCode and limited experience with C-based languages -- but then, most of my learning new stuff has been to build real-world projects.
So, let's enumerate what has to be done to accomplish this particular project:

Goalposts:

  • Learn Ren'Py/Python
  • Learn SDL framework
  • Learn enough Objective-C/C++
  • Learn enough iPhone dev process/XCode/alternate toolchains

Ren'Py main dependencies:

  • PyGame
    • Python (found, available from Cydia)
    • libsdl (found)
    • ffmpeg (proven, on Cydia)
    • libogg (proven, on Cydia)

Possible final product distribution:

  1. unjailbroken app distributed via ad hoc (ad hoc is limited to 100 users)
  2. jailbroken app distributed via Cydia
  3. self-distributed manually installed .ipa package (potential path, not enjoyable yet for end users)

Possible packaging:

  1. Standalone package (possibly a compile option for Ren'Py main)
  2. Shell app to be fed game files from existing games (i.e. jailbroken app)

Issues/obstacles:

  • Licensing for Python / SDL incompatible with AppStore (irrelevant) and not necessarily free for commercial products
  • This suggests a shell app feature which can load Ren'Py /game
  • Performance hits from multiple software abstraction layers and interpreters (could be serious)

Recently discovered resource:

haXe for iPhone (iPhone port takes care of SDL wrapper, among other things)

6.28: found libsdl for iPhone
6.29: iPhone 3.0 SDK installed
6.30: Looking into open source toolchains to bypass iPhone 3.0 SDK licensing issues

1 comment:

simpleDvorak said...

To be honest, I thought it was about time someone went ahead and did this, as I've been working on a Ren'Py doujin Visual Novel for some time now and have always considered portable platforms (with a reasonable degree of capability of course) to be ideal for this genre of games/literature/what-have-you.

I must, however, ask for clarification on a few things regarding the project:

Is this a port of the entire Ren'Py kit? Just the engine so that Ren'Py-made games will run on an iPod (i.e. like a virtual machine)? A wrapper, so that a finished Ren'Py product can be converted into an iPhone runnable app? Some other incarnation?

Which leads more into to my specific interests:
What does this project, if and when completed, mean for someone wanting to port a game already made in Ren'Py, to the iPhone/iPod touch?

Lastly, will you be developing this for the iPhone 3.0 firmware, or the 2.2.1? I ask this because most of the people I know who own an iPhone in fact own a 1Gen or 2Gen iPod Touch, who like me having paid $10 for the 2.2 update are less-than-inclined to give Apple another $10 for an update which includes features that should have been included out-of-the-box.

Signed,
SimpleDvorak; intrigued game developer / CompSci undergrad.

P.S. Visual Novels are indeed an awesome time-waster. [geek] I have clocked just over two weeks (that's 24hx14d) of total play-time on Fate/Stay Night. [/geek]

If there's anything a CS Undergrad could possibly due to help, let me known.
tcoolala34 (at) gmail (dot) com.

[/me hits the Subscribe button.]