[Solved]-Django website, basic 2d python game

6👍

As browsers (everything except Grail) do not run python code it is fairly difficult to build the game you want in python. In theory you could mix some client side Javascript with some python code running on the server side, but that would not be a very goog idea, since the browser would have to communicate with the server for “every move in the game”. You can also have server side python rendering html, but that wouldn’t make a very good game.

You could try to make a gaming site for Grail users, but I suppose there aren’t many 🙂

More seriously:

You can also take a look at pyjs. And theres even a game example. You can find the source code for the asteroid game here. I can imagine that pyjs is pretty much all you have got to make it work.

Similar question to yours has been asked before, you should check the answers.

👤root

2👍

I think this article is what your looking for: How to Build a Python Bot That Can Play Web Games . But if it is not, try to implement pygame – it is the most popular library to make 2d games in python. If you can, search and download this: “Making Games with Python & Pygame”.

But like the answers above, I believe that the most easy way to build and implement a 2d game in the web is using html5 canvas with javascript on the client side. “HTML5 Canvas Core” is the best book to start learning it. I hope that this was helpful to you. Good luck.

1👍

The game will most probably have to run on the client side. You should take a look into Javascript and AJAX.

👤zmbq

Leave a comment