My Biggest Regret With Fleshcult 1

My biggest regret is that Fleshcult is a server based game. You click a button, it sends a request to the server, and all the processing happens there in Python code.

There are several disadvantages:

  • It doesn’t run offline. If the server goes down, nobody can play.
  • There’s no easy way to keep multiple versions of the game live. I was always careful to keep saved games backward compatible because I know players can’t just fire up an older version, so my ability to make drastic changes was limited.
  • Modding is completely impossible.
  • I haven’t been able to do a totally unrestrained promotional push, because I know the server can only take so much before it lags out horribly or starts spitting errors. Server administration isn’t my forte.

This is all my own stupid fault.

Web browsers can’t run Python without some kind of translation layer, so fixing this is daunting. I’ve been looking for Python to Javascript translation tools and I’ve finally found something that looks doable but it still requires 3 months of work. This isn’t exactly good for Patreon momentum.

The Plan

Here’s how I’d do it gradually, instead making everybody eat all their veggies before dessert:

  • Add content to the server version for a couple of months, all the while doing prep and fixing up code that translates poorly.
  • Fork the code into a server version and a Javascript version. I’d split my time between programming the Javascript version and writing text for the server version. Text is easy to merge when I need to bring the Javascript version up to date with all the latest stuff.
  • Announce a final push and spend a month 100% focused on programming the Javascript version.
  • After making it public and doing a bunch of bugfixes, call that initial Javascript version “Fleshcult Classic” and archive it off.
  • Start work on Fleshcult 2 from the same codebase. Then can I start making really big changes.

What do you guys think? Technical details below the fold.

Technical Details

I plan to use:

  • Nunjucks: It’s a Javascript implementation of the Jinja2 HTML template language I use. This means I can port over the presentation layer intact. Just need to rewrite all the links to turn it into a Single Page Application.
  • Transcrypt: It compiles Python 3 into ugly looking but serviceable Javascript.

I also looked into Brython (seriously impressive, but way too slow), PyPy.js (poor start up time, unmaintained), and Rusthon/PythonJS (total cack).

I’ve converted a little bit of the game as a proof of concept. The lion’s share of the work will be cleaning up Transcrypt’s output. The cruft isn’t as bad as it first appears – it cranks out gunk to emulate Python’s class-based inheritance which I can mostly get rid of because prototype inheritance is a better fit for Fleshcult.

I think I can get a lot done in the prep stage: turning code into data as much as possible (Javascript and Python are equally happy reading stuff out of a JSON file) and dumbing down any Python constructs that don’t turn into sensible JS.

9 thoughts on “My Biggest Regret With Fleshcult 1

  1. DrPill says:

    While you’re at it, look at Tome of Thorns? Still says (incomplete) when picking it up and contains nothing afterwards.

    • jackoekaki says:

      I’m guessing you mean the Tome of Infestation? It’s high on my list. The Tome of Thorns gives you the flesh-woven cloak and the retractable claws.

  2. ruduki2 says:

    This seems like a solid plan.

    If it was a little more developed, BeeWare’s Batavia (CPython bytecode interpreter written in JavaScript) might be a faster port, but as is it’s a little clunky.

    It’s been one of my concerns in writing games in Python (the browser makes it super easy for people to archive, share, and play the games…), so I’ve mostly stuck with Twine & JavaScript despite using Python for my day job.

    • jackoekaki says:

      Batavia sounds interesting, I’ll give it a go and see how it compares. If I could find a fast enough interpreter that would be a good short term solution.

      Cheers!

      • jackoekaki says:

        Oof, Batavia is slow! 800x slower than CPython on my machine. It’s a shame, their approach has promise.

  3. art926 says:

    It sounds like a really good plan and very time-wise realistic (in contrast of most nsfw games on Patreon which developing never ends)!

  4. Anon says:

    Why not just make a standalone Python executable? Why does it have to run in browser?

    • jackoekaki says:

      I’d much prefer it run in the browser so new players can try it out easily.

      I did poke around for a little while looking at Python equivalents to Electron; something that’d give me a browser front end so I could keep the presentation layer, but other than a very unfinished thing called Cocoon I didn’t find much.

      I thought about making a Python server serve on domain sockets so people wouldn’t have a real webserver running on their machine, but then I figured screw it, this approach is a complete mess.

  5. jackoekaki says:

    I retrospect I think I was too quick to dismiss PyPy.js. It benchmarked well enough on string handling workloads (the bulk of Fleshcult) that I think it’d be fast enough.

    It’d be great to have a client side version to handle the spike during a patreon launch. Gotta invest some time into making their weird async API work though.

Comments are closed.