Is there a place for web-based games in PyWeek?

I've told my story here before, but briefly: PyWeek is how I got into game programming, and I would love to write games in Python. However, it's not worth it if it means it's hard for people to play them, and I gave up after a couple of years of looking for an easy way to share games. Now, with the exception of PyWeek, I write games in JavaScript.


I was very excited to see mauve's entry this time, which uses a JavaScript frontend with a Python backend. I thought maybe we can get to where a Python game is finally available in the browser. But then I read this comment that mauve received:

it would be nice if the whole code could be python. Just... it's pyweek you know, not "make a game that use part python, and 40%-50% other languages".

And so I want to ask a question that I have wondered for a very long time: is there any way we can make PyWeek welcoming of browser-based games?

I'm open to any and all possibilities here, but one thing I imagine is a JavaScript rendering and input library that allows easy communication with a Python backend, and minimal code to be written in JavaScript. If that was explicitly allowed by PyWeek rules, I would be certainly be willing to contribute to that project.

(log in to comment)

Comments

Use of other languages is explicitly allowed in the rules:

This is a Python programming challenge, but that doesn't preclude the use of supporting languages (eg. C or C++ libraries, Javascript in HTML web pages, and so on).

You raise good points though.

Python on the web is in rather a poor state. As the PyPy.js author noted there are a number of boxes to tick and no project is ticking all of them:

  • Being "of the web" ie. giving a first class experience for access to browser APIs, running completely in the browser etc
  • Being 100% Python compatible
  • Being fast

To which I would add:

  • Being Python 3

(which, sadly, PyPy.js doesn't meet.) And various other projects are only meeting some of these.

I think the input/rendering works a bit (as in my game), but I don't know if I could see it generalising to something more like a web-based Pygame.

Meanwhile I think distribution of Python applications is getting gradually better eg. with PyInstaller. It just needs more people to attempt it and build the knowledge and the tooling to make it easier.

I've done some Godot games and since the language is close to Python (and there's a Python script version) it seemed to me that there might be a path where you could convert a Pygame based game to Godot and use Godot's publishing to get it on the web.


I'm not sure its actually better than just using Godot though!