Sign in to follow this  
bigbang89

python for android.. possible?

Recommended Posts

I just made .py game using python 3.1... However, I would like it to run on android devices. however, I found a Pygame Subset for Android but I am indeed confused. the site says I must "Download and install PGS4A, Python 2.7, the Java Development Kit, and Android USB Drivers." if that's the case, should I just uninstall python 3.1 in my pc and retype all the codes for my game in python 2.7 OR is there a way to convert python 3.1 codes so that it may be compantible with python 2.7 I appreciate any helpful replies.

Share this post


Link to post
Share on other sites

You would need to manually port the code to python 2.7. You cant put python games on the play store either, infact the end user would need to go through the process of installing python onto their device themselves and then manually loading their game into it.

If you want to write an app on android then just use java, C or C++. Python on android seems to be more useful for light programming on the go (it makes an excellent calculator for example).

Share this post


Link to post
Share on other sites

Android runs on ARM right?  Pretty sure you might be able to use {this newish JIT compiler}.

No clue, but if I'm not mistaken, and I probably am, what you're looking for is the ability to compile or interpret the language and libraries on a specific CPU type which is likely ARM, which probably supports openGL ES, and odds are your game supports regular openGL.

Its potentially doable, as far as I can tell from my knowledge of how this stuff works.  Good luck.

Share this post


Link to post
Share on other sites

[quote name='MyNameIs' timestamp='1356277796' post='5013686']
Android runs on ARM right?  Pretty sure you might be able to use {this newish JIT compiler}.

No clue, but if I'm not mistaken, and I probably am, what you're looking for is the ability to compile or interpret the language and libraries on a specific CPU type which is likely ARM, which probably supports openGL ES, and odds are your game supports regular openGL.

Its potentially doable, as far as I can tell from my knowledge of how this stuff works.  Good luck.
[/quote]That is just another python interpreter. Your kinda on the wrong track there. As it is the default python interpreter runs on arm already. What he is after is running his .py file within the actual android environment (which is actually available on mips and x86 aswell as arm). Its doable with SL4A but that isn't practical for end users, the only way I know of the actually get a python app on the play store or in a neat .apk file would involve a lot of kludging around with java and NDK and by the time its working you would have been better off writing your app in java in the first place.

Share this post


Link to post
Share on other sites

Java doesn't have the practicality of typeless python, but I wouldn't say Java is less productive, I would say python is nice for short programs that have limited code design complexity and limited size (< to 1000 lines I found to be manageable). But I'm going on a troll line here.

Anyway, if his python game is now working well and would be too long to adapt into python 2.7 (I doubt much has to be redone, there are not THAT many differences),

he still has the option to make an interpreter program for python 3 himself. There must be some python library for java somewhere. there is boost::python that can interpret python for C++. And I'm pretty sure many python interpreters are open source. But take the time to make all of that compile and run, if his game is not too big, a rewrite in 2.7 would be over long ago.

Share this post


Link to post
Share on other sites
Its doable with SL4A but that isn't practical for end users, the only way I know of the actually get a python app on the play store or in a neat .apk file would involve a lot of kludging around with java and NDK and by the time its working you would have been better off writing your app in java in the first place.
This.

Just because you CAN do something does not make it a good idea.

I CAN make a tool that will emit my own executables, but then I would have spent my time writing a new compiler rather than writing a game.

It looks like you are on a similar path: You are creating a tool chain, you are not creating a game.

Currently the most direct route to creating a game is either to use Java or to use an existing engine. While you might find a way to do it with PyGame, it won't be the easiest or most direct route.

Share this post


Link to post
Share on other sites

Ofcourse, if you're a brand new programmer entirely, then the best way to learn is to make things for the computer you are currently on, instead of making things for devices like Android and iPhone or game consoles. Python is an excellent choice, Java is another excellent one. There's no need to toss "Trying to get things working on Android"  into the mix if you are already burdened with "Trying to learn how to program in general". Sometimes trying to kill two birds with one stone makes you miss both birds.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this