Hosting a game

I have developed an interactive maths game which I wrote in python. To get it played I think the best idea is to put it in a website and people can interact with it via the web. What is the best way to do this? Apple apps take your idea for themselves… Android seems to require a big rewrite. I'm thinking of trying to use pythonanywhere to host it. How do I make the game playable on the web?

That's a big question and it depends very much on the game. If it's a game that can fit into the request/response model of the web, then you could create a web site that acts as the game, but if it's more like a traditional real-time game (think Tetris) then you either need to provide a download or rewrite it in Javascript.

Thanks Glenn: The game is interactive but is a strategy game more like draughts so doesn't need to be 'real-time'. (There are some colour alternations to signify a selected line). I don't quite understand... a web site that acts as the game...can you elucidate. Would Javascript be easier to implement? There is a 3D rotation at the start .. can I do maths functions etc easily in JavaScript? Appreciate your comments.

If your game was a quiz of some sort, then you can implement it as a web app that show the question and then process the response when the user answers. A board game is probably also a good candidate. If you've got things like 3D rotations you'll have to do those in Javascript and you'd probably have to write most of the interaction logic in Javascript and then use the Python you have to update the page.

If you don't have experience doing 3D graphics in JavaScript, let me highly recommend Three.js. It's awesome and (relatively) easy to learn.

Giles: Thanks...some awesome graphics. Glen: Is there an example to show how that sort of integration works. It sounds like it might be the way to go. Presumably I would do it using the pythonanywhere platform. Are there some pythonanywhere websites to model?


@cubixathon -- just jumping in while Glenn's away -- I think you're answering an almost impossible question, it all depends so much on what your game is like!

I would recommend running through one of the web frameworks' tutorials, like flask or django's, to get an idea of how the standard web app model works -- HTTP requests + responses, GET and POST, sessions, databases, and so on. That will give you an idea of what's possible on the server-side, and what you might be able to use for your game.

Then check out some front-end stuff, like HTML5 and what's possible in javascript... A couple of random pointers:

Is this project open source?

It has taken oodles of hours to develop - would it be a sin to make a return on the investment? Ideally open but no not yet... will try django. But had trouble using github would you adam and eve it.

what do you need in order to make a small video game

what do you need in order to make a small video game, if anybody no please let me no thanks toly rhoads

have a look at "pygame zero"? It won't work on pythonanywhere, but it's a good place to get started building games with python on your own computer...