A renewed effort for iOS support!

Hi everyone! I’m excited to be participating in the Google Summer of Code over these next few months, and am even more excited about the project: an iOS port!

David Rose had implemented the beginnings of supporting the iPhone back in 2012, but it was soon discovered that Apple’s policy on interpreted languages would prevent apps utilizing Python from being submitted to the app store. This led to the languishing of the project, and no progress has been made for the last several years. Thankfully, Apple has loosened its restrictions since then, so it is now feasible for Panda games made completely in Python to be submitted to the App Store.

The full proposal can be found here, which details the goals of the project along with a timeline for completion.

For this first week, I will be getting the cross-compilation toolchain up and running for Panda’s thirdparty libraries, based off of @rdb’s panda3d-thirdparty CMake script. I’d also like to get a CI pipeline for this repository up and running at some point.

I will be posting updates here frequently, so stay tuned!


Testing the port

The port is now in a usable enough state for other people to begin testing their applications with it.

What does not work:

  • Shader generator; this is not iOS specific, since we do not have a working generator for GLSL.
  • Device sensors such as gyro and accelerometer.
  • 3D touch; this should be easy to add with the coming multitouch changes.

The wheel containing everything needed for iOS development can be found here.

There is a new setuptools command called makexcodeproj that will create an Xcode project for testing. It is very unfinished and will not work with many configurations, but should work fine for simple stuff. There is no documentation yet, review the source code for more information.

9 Likes

Hello again!

With the second week of work wrapping up, I believe an update is in order. I have successfully gotten both the thirdparty tools and Panda itself to compile for both iOS devices and the simulator. It was a bit of a slog getting this to work, to be honest, since it’s mainly a loop of trial and error trying to get things to fit together correctly. The following libraries are now ready for inclusion on iOS:

  • ARToolkit
  • Bullet
  • Eigen
  • FFMpeg
  • Freetype
  • Harfbuzz
  • JPEG
  • ODE
  • OpenSSL
  • Opus
  • PNG
  • Python
  • Squish
  • TIFF
  • Vorbis
  • ZLib

This leaves only a few libraries that aren’t working (and are probably impractical for iOS anyways, like VRPN). I’m quite happy with this, because although I was able to get Panda itself to compile several months ago, this is the first time I have done it with almost all of the thirdparty libraries included. It has been quite a struggle wrangling with the often strange ways Apple does things, but I believe this thorough preparation I’ve performed will be worth it down the road.

This post comes at an odd time, admittedly, since these next two weeks are where the real meat of the work is going to start. But, posts are required every two weeks, so here it is. Hopefully the work going forward will be a bit more exciting for people to read about, and won’t involve me waiting for rebuilds for nearly as long :wink:

3 Likes

Hello!

Welcome to my third weekly check-in. I got a lot done over the past week, so let’s talk about it.

During the first part of the week, I spent a large amount of my time attempting to wrangle the Python interpreter into actually running inside an iOS app. During the build process, Python generates a sysconfig file that contains variables that were used during the build that may be useful to Python later on. Unfortunately, this generation cannot happen on iOS easily, since it requires an arm64 device to actually run on. The solution to this ended up being to generate this sysconfig file in the Simulator, and make some changes to it manually for the Device version. This works well enough, and I haven’t run into any issues with it yet, but we’ll see.

The second half of this week, I turned towards brainstorming about how to adapt Panda’s startup process to the iOS app lifecycle. Up until this point, Panda has been a game engine that runs exclusively on desktops, and as such, it is used to having complete control over the application lifecycle. Things work a bit differently on iOS (and Android!), however, which will require me to make some changes with how Panda handles it. Coming up with a formal design for this will be one of my primary tasks for this coming week.

Along with this, I am going to try and come up with a way to get Panda along with the Python interpreter to run in a separate thread entirely from the main UI thread. This will make it so I will have to make fewer changes to Panda in order for the UI thread to get the time it needs.

A more detailed write-up on how I plan on accomplishing this is available here.

That’s all I have for this week. See you next time!

3 Likes

Hi!

This past week was very productive. I got many of the Panda samples running inside an iOS app. Here’s one of them:

This app allows you to go back and forth between all of the samples included with the Panda3D game engine. Since the samples cover a wide range of features, it’s great for testing. It was (and still is) quite a challenge to get Panda and iOS melding properly, but I’m glad I’m finally getting some visible results. For this next week I’m going to see if I can get baseline version of the iOS display backend up for other people to try. See you all then!

5 Likes

Looks great! I developed a panda3d application I always wanted to put on the App Store, so this is very exciting!

Hi everyone!

Time for another update. These past two weeks I’ve been trying to clean up how I’ve been implementing things, since a lot of my code thus far has been pretty prototypey. I have the backend at a point where I can start to turn to other features, like multitouch. This past week I implemented some basic mouse emulation, which you can take a look at here:

See you next week!

6 Likes

I’ve updated the OP with information about testing the port. I will have more information about my multitouch work in the coming days.

1 Like

Is multi touch supported in this state? I have an app that can zoom in or out, and I think it will be cool if I can zoom in or out with two fingers on an iPad.

The .whl I have in the post does not have my multitouch changes in yet. Once I get pointer events working and adjust the default trackball controls to work with touch, I will update the wheel and post here once again.

1 Like

Thank you Panda3d developers! But it’s been quite a while since you made an announcement. It’s December 2020 more than a year since you made announcements. Is everything going well?

And the sample was looking great👍 keep working

Hi there, work has been slow these past few months, but this hasn’t been abandoned. Since I’ve been the only one working on it, the speed of progress really depends on my schedule IRL. Contributions are always welcome!

2 Likes

Could this project mean something like Toontown Rewritten could run on iOS?
(And give an alternate app for M1 Macs)

Toontown is a proprietary product of Disney and no one here has anything to do with it. I seriously doubt that what you’re asking will ever happen. If you want an answer, the only way to get that is by getting in contact with whoever is responsible for it at Disney.

I would like to help out, if you could point me in the right direction what needs to be done, I’m happy to contribute to this effort.

Hi, The given link is broken, Is this still being worked on?

This is quite an intriguing project! I would love to contribute, as I’ve been getting more into IOS development, and I’ve been working on a Panda3D IOS port, if you would like any help, feel free to reach out to me in the Panda3D discord!

Do you still have the .whl available? Or the source code? I would love to take a look and maybe contribute as well.