Hacker News new | ask | show | jobs
by inclemnet 3328 days ago
> Like how they were (didn't check if they still are) using pygame to interface with SDL to do rendering a lot of other things.

Kivy only ever used Pygame for SDL's backend management, drawing has always used OpenGL. We actually no longer use Pygame by default, having moved instead to SDL2. There are also alternative backends for almost everything, e.g. a direct X11 window backend on Linux, or the rpi window backend that does not require X.

> I've seen other projects that used pygame on mobile devices that were able to do it without all of the extra complexity that Kivy layers on

Do you have any examples? I'm aware of almost none, or any active build tools for Pygame. I've been wondering if the best way to use Pygame on Android would be via pygame_sdl2 using Renpy or python-for-android, but it would be nice to find an alternative.

> all of the extra complexity that Kivy layers on. Pygame isn't that hard to use, so if I know how to use it, why would I use Kivy?

I'm not sure what is meant by 'extra complexity' unless you're referring to Kivy itself being an extra module to install. Kivy isn't a Pygame wrapper, but its own toolkit with a very different, OpenGL based drawing API. It's probably also more performant, especially when optimised (e.g. KivEnt http://kivent.org/). Even ignoring performance etc., you'd want to use Kivy if you just prefer how it works (but you don't have to feel that way).

Beyond this, Kivy doesn't just have the graphics API but an entire widget toolkit. It also directly supports both Android and iOS, although as above perhaps I'm not aware of current Pygame efforts.

2 comments

>a direct X11 window backend on Linux

That one took several attempts to read correctly :P

>Kivy only ever used Pygame for SDL's backend management, drawing has always used OpenGL. We actually no longer use Pygame by default, having moved instead to SDL2. There are also alternative backends for almost everything, e.g. a direct X11 window backend on Linux, or the rpi window backend that does not require X.

Ahh, OK. I'll have to check that again. It's been more than a few years since I last looked at it. I guess though I did find the idea of using pygame just for SDL to be kind of... blunt. Though there weren't very many other good python to SDL wrappers (which is like, not all of what pygame is used for).

>> I've seen other projects that used pygame on mobile devices that were able to do it without all of the extra complexity that Kivy layers on

>Do you have any examples? I'm aware of almost none, or any active build tools for Pygame. I've been wondering if the best way to use Pygame on Android would be via pygame_sdl2 using Renpy or python-for-android, but it would be nice to find an alternative.

I was actually thinking of Renpy or python-for-android. Again, my initial impressions about this are several years old, and I didn't actually get that far past the initial evaluation of it for what I was thinking of using it for before moving on to other projects.

> I'm not sure what is meant by 'extra complexity' unless you're referring to Kivy itself being an extra module to install. Kivy isn't a Pygame wrapper, but its own toolkit with a very different, OpenGL based drawing API. It's probably also more performant, especially when optimised (e.g. KivEnt http://kivent.org/). Even ignoring performance etc., you'd want to use Kivy if you just prefer how it works (but you don't have to feel that way).

I think I didn't at the time, because I already felt kind of comfortable with how SDL/pygame did things. But I should look into that again.

>Beyond this, Kivy doesn't just have the graphics API but an entire widget toolkit. It also directly supports both Android and iOS, although as above perhaps I'm not aware of current Pygame efforts.

Yeah, I didn't need the widgets at the time either, and mobile was only a secondary concern. I should look at Kivy again one of these days...

> I guess though I did find the idea of using pygame just for SDL to be kind of... blunt

Yeah, I think this was a pragmatic choice (it was before I was involved at all), but it was never that great. SDL2 has solved a lot of problems and is much easier to support.

> I was actually thinking of Renpy or python-for-android.

python-for-android is Kivy's own Android build tool, which nowadays is a separate project. It supports multiple backends, but doesn't really support pygame except as a Kivy backend (which is not maintained much any more). It does support SDL2, so you can use e.g. PySDL2 to make Android apps.

I think Renpy also moved to SDL2, probably also due to issues supporting Pygame, although last I checked they use a fork of Kivy's older python-for-android toolchain.