I was wondering if it is possible to implement a web based game in python. I have searched the internet and cannot seem to find any tutorial or document pointing to this. Any advice will be appreciated..
-
The clarification you gave in the comments below you should mention up here in the original question.jhocking– jhocking2011年04月05日 21:20:39 +00:00Commented Apr 5, 2011 at 21:20
5 Answers 5
Your question is a bit vague but from what I understand you are trying to create a web based game with Python.
As python is a serverside language you could implement the website/server with it but for the client and the game itself you will need a browser based client-side technology. Like Flash, Silverlight, WEBGL or Even Javascript and HTML5. But this will all depend on how you would like to structure your game.
You could create a Server that pushes information to the clients with a library with say Twisted. The other option you could choose is to create a website that the clients will poll for information or use Comet for Push.
Comments
These are the only ways I know to "directly" code in python for the web :
Pyjamas which is a python to pyjamas compiler. See this asteroid example (buggy on Chrome). I made one myself and simple stuffs are working well but you can't display text on the canvas at the moment. And i guess It would be much slower than pure javascript.
Panda3D and its plugin, so you'll have to ask the players to download that plugin.
Comments
Of course it is. But without more information on what type of game it is impossible to provide further guidance.
2 Comments
Python is a serverside language. For the "web" in web-based you still need HTML und JS (or Flash). Using Python for the serverside is possible. Here is a list of Python web frameworks (my personal favorite is Django).
Comments
Python can be used in a variety of ways for developing web games. In particular, it can be very useful for doing the back-end of a multiplayer game. For the front-end you will probably need to use a client-side technology like Flash, but there have been turn-based games that simply use static HTML as the front-end (for example, Urban Dead) and that could be implemented in Python alone without a separate client-side technology.