3D / Physics support?
I'd like to start off by saying that I'm so glad that Pythonista now has a community forum. I've been using this app and Codea for a while now. My best language is Python, and I don't really know Lua, so I prefer this app. Until this 1.2 update though, Codea has had the distinct advantage of having a community forum. Now we get one too!
Onto my real question now. This is more of a feature request actually.
3D support: I would love to see support for 3D drawing with Pythonista. Codea has this feature, and it works well there with good frame-rate for moderate examples.
A physics engine: One other major obstacle in the way of creating great games with Pythonista is the lack of a physics engine. A python wrapper around something like Box2D or similar would be great.
Thank you so much for putting all of your time and effort into Pythonista. I look forward for what the future holds for this app.
Those are interesting ideas, thanks for your input.
I'm not sure if I want to go in the 3D direction... For one thing, 3D code is an order of magnitude more complex – and while it may be possible to do some cool demos, I doubt that it would be very useful in the typical case, because even if you keep things as simple as possible, you need a whole lot more code to do anything at all when working with 3D... And to be honest, I'm also not really an expert in that area (to put it mildly).
As for a (2D) physics engine, I've been thinking about that. There are some technical difficulties, but it's definitely a possibility and could be fun to play with – don't expect anything like that short-term though, even if it's "just" a port/wrapper of an existing library, it would take a significant amount of work to make this happen.
I want to make one other, more general point: I'm not trying to make a Codea clone. Codea is a great app and has contributed a lot to the whole category of "coding on iOS". I'm thankful for that and I can honestly say that Codea has pushed me to make Pythonista more ambitious than it would have been otherwise (though I started the project quite some time before Codea was released).
But while Pythonista and Codea may be in a similar category, I think both have their strengths and weaknesses – and that's a good thing! Lua is traditionally very strong in the gaming area and I think Codea's focus is a bit more on that side, while Pythonista is developing more in a "utility/tool" direction, especially with the last two updates.
How about pygame? One of the things I like about pythonista (in contrast to Codea, which I do love) is the traditional procedural architecture; you're not forced into an event loop, which makes certain types of programming (I'm looking at the http server example, which makes me very happy) much easier. Python has pygame, it's very popular, and I suspect a nice chunk of code would be able to come over unmodified.
Not sure if that's possible, haven't looked into it in enough detail... The problem with a lot of libraries that aren't "pure python" (i.e. use native code for performance-critical stuff) is that they often rely on linking dynamic libraries. While technically possible, iOS apps aren't allowed by Apple to include dynamic libraries, which makes porting these things pretty difficult.
So, yes, PyGame is an interesting option and I think I'll look into that at some point, but I wouldn't be surprised if porting it turns out to be quite difficult or maybe impossible.
I can see what you're saying about 3D being too complex for an interpreted language to reasonably use large-scale.
PyGame relies on SDL, and I believe that SDL is ported to iOS. So long as all of the libraries are compiled statically (.a files instead of .dylib), the final executable will be just one standalone file and therefore allowed by Apple. The only problems that I forsee with porting PyGame are getting it to display on an iOS screen and making it understand touch events. Porting it to ARM shouldn't be too dificult as I'd imagine that it has already been ported to arm.
In any case, good luck with the app. In case I gave the wrong impression, I don't want this to turn into Codea but using Python instead of Lua. It's just that Codea has some nice features included with it that Pythonista doesn't have, but the opposite is true as well.
The big thing with converting PyGame will be converting NumPy, and if I remember right, NumPy hooks into a C code block.
Oh, I forgot that pygame uses numpy. I actually tried porting numpy about a month ago but didnt get very far. I don't have a Mac though, so I do all of my development on my iPad. I may try again later.
Maybe Box2D and its pure python wrapper PyBox2D would work? I know that Box2D works on iOS, though the Python wrapper might need to be tweaked somewhat.
Yes, numpy would be very difficult to port, I've experimented with it a little, but didn't get very far (for one thing, it seems to require a Fortran compiler...). I'm not sure if PyGame really requires numpy, from what I've read, it seems to be optional, but again, haven't looked into it in much detail yet.
Yeah, fortran is the part that stopped me, as the iPad doesn't have a fortran compiler. I've never used pygame before, so I don't know for sure whether it requires numpy or not.
I didn't try it, but according to the scipy/numpy docs, only scipy needs fortran. Numpy only needs a C compiler. So numpy alone might be doable after all.
Now that NumPy is supported, would that open the gates for porting PyGame?
Or is the new Scene module equivalent to it in functionality?
@nascif - there had been recent discussion about this again. You can find some of it by searching for kivy in the forum. This other project has SDL/Pygame working on IOS. However, the rest of the info in this thread remains true. You still have to make everything link into one big static library in an IOS App and this is a lot of work and then ongoing maintainence.
I looked at kivy recently and found that they don't have an IDE that runs on IOS - only on desktop OS's. This is where Pythonista really shines and keeps getting better and better.
Since you mention Numpy, I would love to read an article from omz on what his experience was getting this port done.