Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use python to create flash like browser games?

is it possible to use python to create flash like browser games? (Actually I want to use it for an economic simulation, but it amounts to the same as a browser game)

Davoud

like image 237
Davoud Taghawi-Nejad Avatar asked May 24 '10 20:05

Davoud Taghawi-Nejad


People also ask

Can I make browser games with Python?

There is no way to build your entire browser game using Python as web browsers use HTML to render web pages and its various elements. Therefore, you can use Python for the backend logic of your game and render it as pure HTML on browsers.

Can you make a game with Python code?

Now that you know Python is working correctly, you need to install PyGame in order to write a game using Python. PyGame is a Python library that makes writing games a lot easier! It provides functionality such as image handling and sound playback that you can easily incorporate into your game.

Can Python be used to make mobile games?

YES! You can develop an Android application using Python. But, it is not the best choice if we compare to other programming languages to develop the Android app. There are lot many things you can do with the Python, but developing a solid Android game does not come in Python bucket.


Video Answer


5 Answers

The answer would be yes, assuming you consider this a good example of what you want to do:

http://pyjs.org/examples/Space.html

This browser-based version of Asteroids was created using Pyjamas, which enables you to write the code in python in one place, and have it run either on the browser, or on the desktop:

http://pyjs.org/

Having recently found Pyjamas, and also preferring to consolidate my code in one language (Python!) and location (instead of having some code server-side, and some browser/client-side, in different languages), it's definitely an exciting technology. Its authors have ported the Google Web Toolkit to Python, a really impressive feat, retaining the expressive power of Python (something like 80,000 lines of Java was shrunk to 8,000 lines of Python). More Pythonistas should know about it. :)

like image 63
limist Avatar answered Sep 30 '22 07:09

limist


You could use Python to do client side scripting using Silverlight + IronPython. Of course, this requires all your users install Silverlight.

I think you're talking about using Python on the back end, in which case running something on the server side with Python (in which case this Django vs other Python web frameworks SO question is a good general list and may have what you're looking for.

like image 30
RyanWilcox Avatar answered Sep 29 '22 07:09

RyanWilcox


You need to use something that the current browsers support, this means you're stuck with Flash, Java applets or Javascript+HTML if you want your game displayed in a browser.

You can use python on the backend and display pure HTML, if that is enough for your needs.

like image 41
Mad Scientist Avatar answered Oct 02 '22 07:10

Mad Scientist


Yes, but there a a number of ways to get there.

Flash is the client side rendering. You could use Python to generate Flash, or you could use Python to generate some dynamic HTML with Javascript, etc. that was interactive in a similar way.

But the Python will be running on the server. The Flash, ActionScript, HTML, JavaScript, etc. will all be running on the client.

So while the answer to the question is yes, I am going to suggest you might need to do more research and ask a better question.

like image 35
Jim McKeeth Avatar answered Sep 29 '22 07:09

Jim McKeeth


You could have Python CGI code as a backend and send input in to it through AJAX. Its probably better just use something on the client side for this, though.

like image 43
alternative Avatar answered Sep 29 '22 07:09

alternative