Client side version progress: PyPy.js

In my last post about producing a version of Fleshcult that runs locally in the browser rather than on a server, I was wrestling with the need to translate all the Python code into Javascript.

I think I’ve found a way around it. PyPy.js translates Python into Javascript on the fly, right inside your browser. It’s a just-in-time compiler to asm.js rather than an interpreter, so it’s surprisingly efficient.

Watching a browser download and execute Python will never stop looking weird

The sticking point with this approach is that there are no Javascript functions for my Nunjucks templates to call into. While PyPy.js lets you call Python functions, it’s an async call and can only handle primitive data types, so it’s not suited to fine-grained access. If I’d been more hygienic about keeping logic out of the templates, the Python would hand off a tidy bundle of data and there would be no issue. It’s going to need a clean-up.

Currently my proof of concept can load and render simple pages, but it’ll be a fair amount of work cleaning up all the rest of the page templates. Luckily I can do it in advance of the big fork.

My estimate of the port work remaining: 8 weeks, down from 3 months. As I mentioned before, I’ll be working on it in parallel with new content.

2 thoughts on “Client side version progress: PyPy.js

  1. Alexis says:

    Great to hear!

  2. Fox says:

    im so glad to see you back on this project. from the first moment i saw it i new there was great potential behind it. i was very sad when i had noticed the lack of updates and the news of the other game you where developing. i hope that everything goes well with this. continue the good work!

Comments are closed.