MapMan (made in Pythonista) Available NOW in the App Store
Last post on this, I promise!
MapMan is now available for download in the App Store!
MapMan is free to download and offers an optional in-app purchase (the fist Pythonista App to do this - as far as I know!).
It you are on twitter we are @mapmangame and any retweets would be really appreciated.
Thanks again to the Pythonista Forum for all the help over the last year, this is a really great community!
Thansk finally to @omz for creating a truly remarkable app and opening up the possibility of developing real iPhone Apps on an iPhone! It's been fun!
How did you manage to implement in-app purchases? Would be truly awesome if you could explain it :)
No problem, I will put something together. Maybe a blog or something spelling it out. I’m catching up with a few things after getting the MapMan release out, so it might be a few days.
In the mean time the outline answer is that I added objective-c code to the template to handle the purchases and then used objects_util calls within my python script to call out the the objective-c code. As the Apple store kit is asynchronous I defined a callback interface within the template which I implemented in the python code. So I could continue to code my app within Pythonista I used dependency injection to switch between the real purchase class (used when my game was launched from the template)
and dummy purchase class (used when launching within Pythonista). I guess the template could be extended with the code I wrote (it would need a little cleaning up as I have a very poor grasp of objective-c).
The resorted to the above as I could not get in-App working with just objc_util calls within Pythonista. I think this is down to Apple’s security around in-App purchases which forces them to original from the main thread (but I’m guessing).
Quick update after two days in the App Store we’ve had 9342 downloads, not bad for a game written on a phone!
You can see the sales chart here https://m.facebook.com/mapmangame/
@mapmangame Hi, thank you for sharing it, it is interesting. I'm not a player with phones/pc but I was curious to see how an app developed entirely with Pythonista works .
Obviously feel free to answer my questions (just curious):
- did you developed your app using mainly your idevice with Pythonista or using a computer with other tools? I mean to test/debug your source codes during development.
- still need a mac to develop applications for iphone/idevices and still need to pay Apple to develop, upload to App Store (or similar) and download an app from it in own idevice that user has already paid for? I mean, is there a way to test own apps created with Pythonista downloading them in idevice from a sort of alternative but official Apple store only for testing without desire to sell anything (a sort of GitHub for idevices test apps created with Pythonista)?
- your app works very well in my idevice, but it consumes about 165 MB as app plus about 100 MB as Documents and data, for a total of about 265 MB. Is it ok? About it, how much memory could occupy a simple application that writes "Hello World" in a window that appears for 5 seconds, as a very very simple example? From the compilation tests you did to create your application, do you know something about empirical/rational math formula that estimates the memory consumption of a full app written with Pythonista starting from the memory consumption of its source code without comments?
- for your application how much (%) of pure python and how much of compiled code (about)?
Thank you if you want to share these infos.
Sure, he goes:
The entire game engine was written, tested and debugged in Pythonista on my iPhone. I combined this code with the Pythonista App Template (https://github.com/omz/PythonistaAppTemplate). The app template contains a version of Pythonista as a library which run your python code within Xcode. I had to do a small amount of debugging in Xcode to cope with some small differences between the version of pythonista in the template (which seems a little old) and the latest version of pythonista. I also extended the template a little to accommodate in-app purchases.
Yes you definitely need a mac to upload to the App store. There is no way round this as this is the way apple have designed it. There are ways to distribute python code to other pythonista users by making your code open source. An example is stash (shell for pythonista) see https://github.com/ywangd/stash. Stash is installed by cutting and pasting some simple commands into pythonista.
Pythonista apps are probably always going to be a little bit on the big side. The pythonistakit library itself is 50mb. There is also a feature of the pythonista template which copies your code and files to a writable directory (in case you code needs to change them). This has the effect of roughly doubling the size of your app (this is the documents and data that you allude to). In my case most of the 100Mb is music files as MapMan has about 40minutes of original music, the rest is images and a very small amount is the actual source code. I think a bare bones pythonista yellow world app would be about 50-60mb. The pythonista template itself contains a hello world example.
I think my pure python code is very small i.e. well under 1Mb. The compile pythonistakit is around 50Mb. There are also various python modules that are bundled as standard in the template, but these can be deleted if your app doesn't use them.
Note also there are a few pitfalls with the template owing to Apple's submission policy, I would in particular flag this discussion on the forum: https://forum.omz-software.com/topic/3744/xcode-template-for-pythonista/25?page=2. I got it working, but it did take a bit of fiddling.
Is MapMan written in Python 2 or Python 3?
It would be a great help to this community if you would be willing to submit your changes in 1. as a pull request to the original repo.
@ccc I believe it’s written in Python 2.7, because the XCode template for Pythonista only supports Python 2 code.
@ccc I'm up for that. I'm pretty weak on objective-c so my code is a little scratchy. I would benefit from someone giving it the once over.
Do you think I should fork it, or create a branch and merge back in?
@mapmangame Thank you very much for reply, and congratulations for your application developed on an iphone! I'm quite impressed on it, although I'm slightly disappointed about how much space is needed for an ios app created with Pythonista that prints "Hello World" in the iphone screen for x seconds (as example).